@humain/humain-code 0.4.18 → 0.5.3

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 (519) hide show
  1. package/CHANGELOG.md +284 -1
  2. package/README.md +3 -1
  3. package/dist/agent-monitor/client.d.ts +2 -2
  4. package/dist/agent-monitor/client.d.ts.map +1 -1
  5. package/dist/agent-monitor/client.js +3 -2
  6. package/dist/agent-monitor/client.js.map +1 -1
  7. package/dist/bundle/agent-monitor.js +1 -1
  8. package/dist/bundle/chunks/anthropic-messages-ZP5KUK52.js +67 -0
  9. package/dist/bundle/chunks/anthropic.js +10 -9
  10. package/dist/bundle/chunks/azure-openai-responses-QJFYQ3DF.js +15 -0
  11. package/dist/bundle/chunks/bedrock-converse-stream.js +152 -200
  12. package/dist/bundle/chunks/chunk-2GCMACT4.js +1956 -0
  13. package/dist/bundle/chunks/{chunk-QEF72EIZ.js → chunk-A6B2QMA7.js} +40 -96
  14. package/dist/bundle/chunks/{chunk-YMBXWW36.js → chunk-AO6FF5JL.js} +9 -8
  15. package/dist/bundle/chunks/{chunk-OWLBGSXY.js → chunk-CN3Q5UNB.js} +388 -310
  16. package/dist/bundle/chunks/{chunk-SCIGZFN5.js → chunk-DNGJMRJW.js} +11 -11
  17. package/dist/bundle/chunks/chunk-DU6POZ7E.js +10 -0
  18. package/dist/bundle/chunks/chunk-EY3LZOUP.js +1963 -0
  19. package/dist/bundle/chunks/{chunk-G6ABHCPB.js → chunk-FO2NYB6O.js} +655 -663
  20. package/dist/bundle/chunks/{chunk-RXOCQRBG.js → chunk-GEISZXXH.js} +1 -1
  21. package/dist/bundle/chunks/{chunk-OKALNPTJ.js → chunk-HIZWUSPN.js} +24 -24
  22. package/dist/bundle/chunks/{chunk-MVYV6MJY.js → chunk-HT5YN3LX.js} +1 -1
  23. package/dist/bundle/chunks/chunk-IDU5BNNI.js +15 -0
  24. package/dist/bundle/chunks/{chunk-TIFFHHW6.js → chunk-JCXXRCP6.js} +5 -5
  25. package/dist/bundle/chunks/{chunk-QYCOHSI7.js → chunk-KKCMWB63.js} +8 -7
  26. package/dist/bundle/chunks/{chunk-L5OUCJ7N.js → chunk-L2VKM23Q.js} +87 -13
  27. package/dist/bundle/chunks/{chunk-SCBU5WOP.js → chunk-M74U5X4S.js} +30 -23
  28. package/dist/bundle/chunks/{chunk-AWCJWXGD.js → chunk-MIJHJNNQ.js} +3 -2
  29. package/dist/bundle/chunks/{chunk-Y26OS23T.js → chunk-N7CQ3UV3.js} +4 -4
  30. package/dist/bundle/chunks/{chunk-XQZG5HPT.js → chunk-O4DO5RWS.js} +11 -6
  31. package/dist/bundle/chunks/{chunk-P4UKLIQB.js → chunk-ODJUBJK2.js} +4 -4
  32. package/dist/bundle/chunks/chunk-OR25QDSS.js +365 -0
  33. package/dist/bundle/chunks/{chunk-7PRU6YW3.js → chunk-OZNC2W4B.js} +306 -286
  34. package/dist/bundle/chunks/{chunk-Z33NNMNB.js → chunk-PH7UP57J.js} +1 -1
  35. package/dist/bundle/chunks/{chunk-HPSQKIWK.js → chunk-PS7DGA7B.js} +1 -1
  36. package/dist/bundle/chunks/chunk-QW6PTCAB.js +10 -0
  37. package/dist/bundle/chunks/{chunk-5CDES42D.js → chunk-QWXPGBAG.js} +1 -1
  38. package/dist/bundle/chunks/{chunk-NCQ6WAQK.js → chunk-ROZV2IYD.js} +1 -1
  39. package/dist/bundle/chunks/{chunk-3XDL5ZE4.js → chunk-RTXDU3AA.js} +148 -122
  40. package/dist/bundle/chunks/{chunk-FZUJXM6D.js → chunk-UDB6NI4G.js} +309 -240
  41. package/dist/bundle/chunks/{chunk-3UXBFT4Q.js → chunk-UJLCKIMZ.js} +1906 -1661
  42. package/dist/bundle/chunks/chunk-UTNHGOFS.js +88 -0
  43. package/dist/bundle/chunks/{chunk-H2FY3PEV.js → chunk-V62QBESW.js} +4 -3
  44. package/dist/bundle/chunks/{chunk-NSMMDV3N.js → chunk-XA7CJAYH.js} +4 -3
  45. package/dist/bundle/chunks/chunk-XQX7S3GM.js +7 -0
  46. package/dist/bundle/chunks/{chunk-7VY5IL74.js → chunk-Y3OPKKDR.js} +3 -77
  47. package/dist/bundle/chunks/chunk-YFOLLX5D.js +23 -0
  48. package/dist/bundle/chunks/{chunk-YRCLNWFV.js → chunk-ZI7TK7HM.js} +1 -1
  49. package/dist/bundle/chunks/{chunk-V76YPIMT.js → chunk-ZR4GF4WU.js} +21 -15
  50. package/dist/bundle/chunks/{cli-2NKM2RNJ.js → cli-ENEFJH2B.js} +1 -1
  51. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-T7TPP7SQ.js +4 -0
  52. package/dist/bundle/chunks/codemode-worker.js +27 -27
  53. package/dist/bundle/chunks/compat-CJBWWYHE.js +13 -0
  54. package/dist/bundle/chunks/{dist-XVXV2CL4.js → dist-IBUWEKEE.js} +3 -3
  55. package/dist/bundle/chunks/{dist-ZJIYY3GA.js → dist-RKNCFFGM.js} +452 -448
  56. package/dist/bundle/chunks/dist-YFMJEHPH.js +8 -0
  57. package/dist/bundle/chunks/{dist-cjs-AXBW3N4F.js → dist-cjs-HTASUQXQ.js} +82 -80
  58. package/dist/bundle/chunks/{easter-egg-3d-VGJ77XZQ.js → easter-egg-3d-YOPLCOVW.js} +2 -2
  59. package/dist/bundle/chunks/es-YEFEOGR3.js +1905 -0
  60. package/dist/bundle/chunks/{esm-GIR7QH65.js → esm-R6HJ4QEG.js} +5 -5
  61. package/dist/bundle/chunks/{event-streams-NXFTZDSF.js → event-streams-BR2IL6C5.js} +1 -1
  62. package/dist/bundle/chunks/{execute-ZBEZNJ4E.js → execute-2JXEKQ2X.js} +17 -8
  63. package/dist/bundle/chunks/{extract-RFWEHH6W.js → extract-OTCGZGTL.js} +50 -47
  64. package/dist/bundle/chunks/github-copilot.js +44 -40
  65. package/dist/bundle/chunks/google-generative-ai-HVPCGIZ6.js +21 -0
  66. package/dist/bundle/chunks/google-vertex-UM5MAALA.js +25 -0
  67. package/dist/bundle/chunks/host-ZHEL5XQW.js +2 -0
  68. package/dist/bundle/chunks/{https-proxy-agent-7CAXVAFH.js → https-proxy-agent-JQICCRPH.js} +1 -1
  69. package/dist/bundle/chunks/{llama-cpp-classify-AGCW7HYN.js → llama-cpp-classify-B3G57LVR.js} +5 -5
  70. package/dist/bundle/chunks/{mistral-conversations-G3GN6CMT.js → mistral-conversations-AH72RLXK.js} +11 -11
  71. package/dist/bundle/chunks/{node-A6SZ3T7E.js → node-SJPZTR4K.js} +190 -190
  72. package/dist/bundle/chunks/{node-DZCAT4Q6.js → node-VSA4ZN7D.js} +1 -1
  73. package/dist/bundle/chunks/openai-chatgpt.js +2 -2
  74. package/dist/bundle/chunks/{openai-codex-responses-FJFDAWHI.js → openai-codex-responses-L366637C.js} +48 -47
  75. package/dist/bundle/chunks/openai-codex.js +10 -9
  76. package/dist/bundle/chunks/openai-completions-ZP62QXJX.js +83 -0
  77. package/dist/bundle/chunks/{openai-decisions-HESOHYZB.js → openai-decisions-WOWUC65P.js} +1 -1
  78. package/dist/bundle/chunks/openai-responses-DXUGSUTN.js +26 -0
  79. package/dist/bundle/chunks/openrouter-images-5K47HDAT.js +8 -0
  80. package/dist/bundle/chunks/openrouter.js +10 -9
  81. package/dist/bundle/chunks/{pi-messages-SAOV3JNW.js → pi-messages-MOQQDZBK.js} +5 -4
  82. package/dist/bundle/chunks/radius.js +9 -8
  83. package/dist/bundle/chunks/{runtime-HJEUOD4R.js → runtime-K3F2QDQP.js} +1 -1
  84. package/dist/bundle/chunks/typesafe-system-one-43OCHGKP.js +3 -0
  85. package/dist/bundle/chunks/{undici-4BK3MVJV.js → undici-EK3EUI2E.js} +1 -1
  86. package/dist/bundle/chunks/virtual-modules-5D6QIJPN.js +5 -0
  87. package/dist/bundle/cli-runtime.js +3 -3
  88. package/dist/bundle/flow/package.json +4 -4
  89. package/dist/bundle/index.js +6 -6
  90. package/dist/bundle/rpc-entry.js +3 -3
  91. package/dist/cli/args.d.ts +6 -0
  92. package/dist/cli/args.d.ts.map +1 -1
  93. package/dist/cli/args.js +11 -0
  94. package/dist/cli/args.js.map +1 -1
  95. package/dist/coordination/adapter/tool.d.ts.map +1 -1
  96. package/dist/coordination/adapter/tool.js +3 -1
  97. package/dist/coordination/adapter/tool.js.map +1 -1
  98. package/dist/coordination/broker/broker.d.ts +6 -2
  99. package/dist/coordination/broker/broker.d.ts.map +1 -1
  100. package/dist/coordination/broker/broker.js +20 -8
  101. package/dist/coordination/broker/broker.js.map +1 -1
  102. package/dist/coordination/client/client.d.ts.map +1 -1
  103. package/dist/coordination/client/client.js +4 -2
  104. package/dist/coordination/client/client.js.map +1 -1
  105. package/dist/coordination/transport/discovery.d.ts +10 -3
  106. package/dist/coordination/transport/discovery.d.ts.map +1 -1
  107. package/dist/coordination/transport/discovery.js +18 -5
  108. package/dist/coordination/transport/discovery.js.map +1 -1
  109. package/dist/core/agent-session.d.ts +35 -2
  110. package/dist/core/agent-session.d.ts.map +1 -1
  111. package/dist/core/agent-session.js +163 -40
  112. package/dist/core/agent-session.js.map +1 -1
  113. package/dist/core/anthropic-subscription-usage.d.ts +47 -0
  114. package/dist/core/anthropic-subscription-usage.d.ts.map +1 -0
  115. package/dist/core/anthropic-subscription-usage.js +170 -0
  116. package/dist/core/anthropic-subscription-usage.js.map +1 -0
  117. package/dist/core/bash-executor.d.ts.map +1 -1
  118. package/dist/core/bash-executor.js +7 -1
  119. package/dist/core/bash-executor.js.map +1 -1
  120. package/dist/core/client-identity.d.ts +13 -0
  121. package/dist/core/client-identity.d.ts.map +1 -0
  122. package/dist/core/client-identity.js +25 -0
  123. package/dist/core/client-identity.js.map +1 -0
  124. package/dist/core/codex-usage.d.ts +37 -1
  125. package/dist/core/codex-usage.d.ts.map +1 -1
  126. package/dist/core/codex-usage.js +104 -11
  127. package/dist/core/codex-usage.js.map +1 -1
  128. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  129. package/dist/core/compaction/branch-summarization.js +1 -2
  130. package/dist/core/compaction/branch-summarization.js.map +1 -1
  131. package/dist/core/compaction/compaction.d.ts +2 -2
  132. package/dist/core/compaction/compaction.d.ts.map +1 -1
  133. package/dist/core/compaction/compaction.js +20 -15
  134. package/dist/core/compaction/compaction.js.map +1 -1
  135. package/dist/core/export-html/index.d.ts.map +1 -1
  136. package/dist/core/export-html/index.js +2 -0
  137. package/dist/core/export-html/index.js.map +1 -1
  138. package/dist/core/export-html/template.html +1 -0
  139. package/dist/core/export-html/template.js +2 -1
  140. package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  141. package/dist/core/export-html/vendor/marked.min.js +30 -29
  142. package/dist/core/extensions/loader.d.ts.map +1 -1
  143. package/dist/core/extensions/loader.js +3 -0
  144. package/dist/core/extensions/loader.js.map +1 -1
  145. package/dist/core/extensions/runner.d.ts +14 -0
  146. package/dist/core/extensions/runner.d.ts.map +1 -1
  147. package/dist/core/extensions/runner.js +86 -2
  148. package/dist/core/extensions/runner.js.map +1 -1
  149. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  150. package/dist/core/extensions/virtual-modules.js +3 -0
  151. package/dist/core/extensions/virtual-modules.js.map +1 -1
  152. package/dist/core/model-config.d.ts +920 -0
  153. package/dist/core/model-config.d.ts.map +1 -1
  154. package/dist/core/model-config.js +48 -24
  155. package/dist/core/model-config.js.map +1 -1
  156. package/dist/core/model-registry.d.ts +18 -0
  157. package/dist/core/model-registry.d.ts.map +1 -1
  158. package/dist/core/model-registry.js +20 -0
  159. package/dist/core/model-registry.js.map +1 -1
  160. package/dist/core/model-resolver.d.ts.map +1 -1
  161. package/dist/core/model-resolver.js +33 -7
  162. package/dist/core/model-resolver.js.map +1 -1
  163. package/dist/core/model-runtime.d.ts +9 -0
  164. package/dist/core/model-runtime.d.ts.map +1 -1
  165. package/dist/core/model-runtime.js +123 -14
  166. package/dist/core/model-runtime.js.map +1 -1
  167. package/dist/core/output-guard.d.ts +13 -1
  168. package/dist/core/output-guard.d.ts.map +1 -1
  169. package/dist/core/output-guard.js +101 -11
  170. package/dist/core/output-guard.js.map +1 -1
  171. package/dist/core/provider-composer.d.ts +2 -1
  172. package/dist/core/provider-composer.d.ts.map +1 -1
  173. package/dist/core/provider-composer.js +7 -3
  174. package/dist/core/provider-composer.js.map +1 -1
  175. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  176. package/dist/core/remote-catalog-provider.js +7 -2
  177. package/dist/core/remote-catalog-provider.js.map +1 -1
  178. package/dist/core/safe-credential-error.d.ts +11 -0
  179. package/dist/core/safe-credential-error.d.ts.map +1 -0
  180. package/dist/core/safe-credential-error.js +14 -0
  181. package/dist/core/safe-credential-error.js.map +1 -0
  182. package/dist/core/sdk.d.ts.map +1 -1
  183. package/dist/core/sdk.js +12 -10
  184. package/dist/core/sdk.js.map +1 -1
  185. package/dist/core/session-manager.d.ts +4 -0
  186. package/dist/core/session-manager.d.ts.map +1 -1
  187. package/dist/core/session-manager.js +242 -26
  188. package/dist/core/session-manager.js.map +1 -1
  189. package/dist/core/settings-schema.d.ts +3 -0
  190. package/dist/core/settings-schema.d.ts.map +1 -1
  191. package/dist/core/settings-schema.js +6 -0
  192. package/dist/core/settings-schema.js.map +1 -1
  193. package/dist/core/system-prompt.d.ts +6 -1
  194. package/dist/core/system-prompt.d.ts.map +1 -1
  195. package/dist/core/system-prompt.js +93 -1
  196. package/dist/core/system-prompt.js.map +1 -1
  197. package/dist/core/tools/grep.d.ts.map +1 -1
  198. package/dist/core/tools/grep.js +3 -1
  199. package/dist/core/tools/grep.js.map +1 -1
  200. package/dist/core/tools/ls.d.ts.map +1 -1
  201. package/dist/core/tools/ls.js +37 -12
  202. package/dist/core/tools/ls.js.map +1 -1
  203. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  204. package/dist/extensions/codemode/execute.js +102 -24
  205. package/dist/extensions/codemode/execute.js.map +1 -1
  206. package/dist/extensions/index.d.ts.map +1 -1
  207. package/dist/extensions/index.js +3 -1
  208. package/dist/extensions/index.js.map +1 -1
  209. package/dist/extensions/mcp/config.d.ts.map +1 -1
  210. package/dist/extensions/mcp/config.js +3 -2
  211. package/dist/extensions/mcp/config.js.map +1 -1
  212. package/dist/extensions/usage/index.d.ts +15 -0
  213. package/dist/extensions/usage/index.d.ts.map +1 -0
  214. package/dist/extensions/usage/index.js +110 -0
  215. package/dist/extensions/usage/index.js.map +1 -0
  216. package/dist/extensions/usage/overview.d.ts +90 -0
  217. package/dist/extensions/usage/overview.d.ts.map +1 -0
  218. package/dist/extensions/usage/overview.js +215 -0
  219. package/dist/extensions/usage/overview.js.map +1 -0
  220. package/dist/extensions/usage/popup.d.ts +21 -0
  221. package/dist/extensions/usage/popup.d.ts.map +1 -0
  222. package/dist/extensions/usage/popup.js +98 -0
  223. package/dist/extensions/usage/popup.js.map +1 -0
  224. package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +21 -2
  225. package/dist/humain/bundled-extension-names.d.ts +6 -0
  226. package/dist/humain/bundled-extension-names.d.ts.map +1 -0
  227. package/dist/humain/bundled-extension-names.js +9 -0
  228. package/dist/humain/bundled-extension-names.js.map +1 -0
  229. package/dist/humain/gateway/catalog.d.ts +36 -0
  230. package/dist/humain/gateway/catalog.d.ts.map +1 -0
  231. package/dist/humain/gateway/catalog.js +74 -0
  232. package/dist/humain/gateway/catalog.js.map +1 -0
  233. package/dist/humain/gateway/client.d.ts +58 -0
  234. package/dist/humain/gateway/client.d.ts.map +1 -0
  235. package/dist/humain/gateway/client.js +212 -0
  236. package/dist/humain/gateway/client.js.map +1 -0
  237. package/dist/humain/gateway/constants.d.ts +23 -0
  238. package/dist/humain/gateway/constants.d.ts.map +1 -0
  239. package/dist/humain/gateway/constants.js +32 -0
  240. package/dist/humain/gateway/constants.js.map +1 -0
  241. package/dist/humain/gateway/http.d.ts +18 -0
  242. package/dist/humain/gateway/http.d.ts.map +1 -0
  243. package/dist/humain/gateway/http.js +274 -0
  244. package/dist/humain/gateway/http.js.map +1 -0
  245. package/dist/humain/gateway/login.d.ts +13 -0
  246. package/dist/humain/gateway/login.d.ts.map +1 -0
  247. package/dist/humain/gateway/login.js +121 -0
  248. package/dist/humain/gateway/login.js.map +1 -0
  249. package/dist/humain/gateway/provider.d.ts +34 -0
  250. package/dist/humain/gateway/provider.d.ts.map +1 -0
  251. package/dist/humain/gateway/provider.js +253 -0
  252. package/dist/humain/gateway/provider.js.map +1 -0
  253. package/dist/humain/gateway/secret-store.d.ts +19 -0
  254. package/dist/humain/gateway/secret-store.d.ts.map +1 -0
  255. package/dist/humain/gateway/secret-store.js +252 -0
  256. package/dist/humain/gateway/secret-store.js.map +1 -0
  257. package/dist/humain/gateway/session-store.d.ts +42 -0
  258. package/dist/humain/gateway/session-store.d.ts.map +1 -0
  259. package/dist/humain/gateway/session-store.js +175 -0
  260. package/dist/humain/gateway/session-store.js.map +1 -0
  261. package/dist/humain/index.d.ts +2 -2
  262. package/dist/humain/index.d.ts.map +1 -1
  263. package/dist/humain/index.js +5 -2
  264. package/dist/humain/index.js.map +1 -1
  265. package/dist/humain/login-menu.d.ts +14 -0
  266. package/dist/humain/login-menu.d.ts.map +1 -0
  267. package/dist/humain/login-menu.js +21 -0
  268. package/dist/humain/login-menu.js.map +1 -0
  269. package/dist/humain/node-http.d.ts.map +1 -1
  270. package/dist/humain/node-http.js +6 -31
  271. package/dist/humain/node-http.js.map +1 -1
  272. package/dist/humain/redact-assistant-message.d.ts +4 -0
  273. package/dist/humain/redact-assistant-message.d.ts.map +1 -0
  274. package/dist/humain/redact-assistant-message.js +34 -0
  275. package/dist/humain/redact-assistant-message.js.map +1 -0
  276. package/dist/humain/web-access/vendor/anysearch.d.ts.map +1 -1
  277. package/dist/humain/web-access/vendor/anysearch.js +3 -3
  278. package/dist/humain/web-access/vendor/anysearch.js.map +1 -1
  279. package/dist/humain/web-access/vendor/bocha.d.ts.map +1 -1
  280. package/dist/humain/web-access/vendor/bocha.js +3 -3
  281. package/dist/humain/web-access/vendor/bocha.js.map +1 -1
  282. package/dist/humain/web-access/vendor/brightdata-unlocker.d.ts.map +1 -1
  283. package/dist/humain/web-access/vendor/brightdata-unlocker.js +2 -2
  284. package/dist/humain/web-access/vendor/brightdata-unlocker.js.map +1 -1
  285. package/dist/humain/web-access/vendor/brightdata.d.ts.map +1 -1
  286. package/dist/humain/web-access/vendor/brightdata.js +3 -3
  287. package/dist/humain/web-access/vendor/brightdata.js.map +1 -1
  288. package/dist/humain/web-access/vendor/ceramic.d.ts.map +1 -1
  289. package/dist/humain/web-access/vendor/ceramic.js +2 -2
  290. package/dist/humain/web-access/vendor/ceramic.js.map +1 -1
  291. package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
  292. package/dist/humain/web-access/vendor/curator-page.js +3 -1
  293. package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
  294. package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
  295. package/dist/humain/web-access/vendor/curator-server.js +2 -0
  296. package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
  297. package/dist/humain/web-access/vendor/deepseek.d.ts +11 -1
  298. package/dist/humain/web-access/vendor/deepseek.d.ts.map +1 -1
  299. package/dist/humain/web-access/vendor/deepseek.js +170 -5
  300. package/dist/humain/web-access/vendor/deepseek.js.map +1 -1
  301. package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
  302. package/dist/humain/web-access/vendor/extract.js +63 -6
  303. package/dist/humain/web-access/vendor/extract.js.map +1 -1
  304. package/dist/humain/web-access/vendor/gemini-search.d.ts +5 -3
  305. package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
  306. package/dist/humain/web-access/vendor/gemini-search.js +33 -7
  307. package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
  308. package/dist/humain/web-access/vendor/index.d.ts +1 -0
  309. package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
  310. package/dist/humain/web-access/vendor/index.js +18 -3
  311. package/dist/humain/web-access/vendor/index.js.map +1 -1
  312. package/dist/humain/web-access/vendor/jina-search.d.ts.map +1 -1
  313. package/dist/humain/web-access/vendor/jina-search.js +6 -4
  314. package/dist/humain/web-access/vendor/jina-search.js.map +1 -1
  315. package/dist/humain/web-access/vendor/kagi.d.ts.map +1 -1
  316. package/dist/humain/web-access/vendor/kagi.js +4 -4
  317. package/dist/humain/web-access/vendor/kagi.js.map +1 -1
  318. package/dist/humain/web-access/vendor/keenable.d.ts.map +1 -1
  319. package/dist/humain/web-access/vendor/keenable.js +2 -2
  320. package/dist/humain/web-access/vendor/keenable.js.map +1 -1
  321. package/dist/humain/web-access/vendor/linkup.d.ts +6 -0
  322. package/dist/humain/web-access/vendor/linkup.d.ts.map +1 -0
  323. package/dist/humain/web-access/vendor/linkup.js +167 -0
  324. package/dist/humain/web-access/vendor/linkup.js.map +1 -0
  325. package/dist/humain/web-access/vendor/mistral-search.d.ts.map +1 -1
  326. package/dist/humain/web-access/vendor/mistral-search.js +3 -3
  327. package/dist/humain/web-access/vendor/mistral-search.js.map +1 -1
  328. package/dist/humain/web-access/vendor/ollama.d.ts.map +1 -1
  329. package/dist/humain/web-access/vendor/ollama.js +4 -4
  330. package/dist/humain/web-access/vendor/ollama.js.map +1 -1
  331. package/dist/humain/web-access/vendor/parallel.js +6 -7
  332. package/dist/humain/web-access/vendor/parallel.js.map +1 -1
  333. package/dist/humain/web-access/vendor/perplexity.d.ts.map +1 -1
  334. package/dist/humain/web-access/vendor/perplexity.js +4 -3
  335. package/dist/humain/web-access/vendor/perplexity.js.map +1 -1
  336. package/dist/humain/web-access/vendor/querit.d.ts.map +1 -1
  337. package/dist/humain/web-access/vendor/querit.js +3 -3
  338. package/dist/humain/web-access/vendor/querit.js.map +1 -1
  339. package/dist/humain/web-access/vendor/search1api.d.ts.map +1 -1
  340. package/dist/humain/web-access/vendor/search1api.js +3 -3
  341. package/dist/humain/web-access/vendor/search1api.js.map +1 -1
  342. package/dist/humain/web-access/vendor/searchinfinity.d.ts.map +1 -1
  343. package/dist/humain/web-access/vendor/searchinfinity.js +3 -3
  344. package/dist/humain/web-access/vendor/searchinfinity.js.map +1 -1
  345. package/dist/humain/web-access/vendor/serpapi.d.ts.map +1 -1
  346. package/dist/humain/web-access/vendor/serpapi.js +6 -5
  347. package/dist/humain/web-access/vendor/serpapi.js.map +1 -1
  348. package/dist/humain/web-access/vendor/serpbase.d.ts.map +1 -1
  349. package/dist/humain/web-access/vendor/serpbase.js +4 -4
  350. package/dist/humain/web-access/vendor/serpbase.js.map +1 -1
  351. package/dist/humain/web-access/vendor/serpdive.d.ts.map +1 -1
  352. package/dist/humain/web-access/vendor/serpdive.js +3 -3
  353. package/dist/humain/web-access/vendor/serpdive.js.map +1 -1
  354. package/dist/humain/web-access/vendor/serper.d.ts.map +1 -1
  355. package/dist/humain/web-access/vendor/serper.js +5 -4
  356. package/dist/humain/web-access/vendor/serper.js.map +1 -1
  357. package/dist/humain/web-access/vendor/serply.d.ts.map +1 -1
  358. package/dist/humain/web-access/vendor/serply.js +2 -2
  359. package/dist/humain/web-access/vendor/serply.js.map +1 -1
  360. package/dist/humain/web-access/vendor/utils.d.ts +3 -1
  361. package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
  362. package/dist/humain/web-access/vendor/utils.js +27 -2
  363. package/dist/humain/web-access/vendor/utils.js.map +1 -1
  364. package/dist/humain/web-access/vendor/valyu.d.ts.map +1 -1
  365. package/dist/humain/web-access/vendor/valyu.js +3 -3
  366. package/dist/humain/web-access/vendor/valyu.js.map +1 -1
  367. package/dist/humain/web-access/vendor/web-tool-core.d.ts +2 -0
  368. package/dist/humain/web-access/vendor/web-tool-core.d.ts.map +1 -1
  369. package/dist/humain/web-access/vendor/web-tool-core.js +3 -0
  370. package/dist/humain/web-access/vendor/web-tool-core.js.map +1 -1
  371. package/dist/humain/web-access/vendor/xai-search.d.ts.map +1 -1
  372. package/dist/humain/web-access/vendor/xai-search.js +51 -8
  373. package/dist/humain/web-access/vendor/xai-search.js.map +1 -1
  374. package/dist/humain/web-access/vendor/xcrawl.d.ts.map +1 -1
  375. package/dist/humain/web-access/vendor/xcrawl.js +3 -3
  376. package/dist/humain/web-access/vendor/xcrawl.js.map +1 -1
  377. package/dist/humain/web-access/vendor/you.d.ts.map +1 -1
  378. package/dist/humain/web-access/vendor/you.js +2 -2
  379. package/dist/humain/web-access/vendor/you.js.map +1 -1
  380. package/dist/main.d.ts.map +1 -1
  381. package/dist/main.js +32 -6
  382. package/dist/main.js.map +1 -1
  383. package/dist/modes/interactive/components/assistant-message.d.ts +14 -2
  384. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  385. package/dist/modes/interactive/components/assistant-message.js +62 -7
  386. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  387. package/dist/modes/interactive/components/config-selector.js +1 -1
  388. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  389. package/dist/modes/interactive/components/custom-editor.d.ts +2 -0
  390. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  391. package/dist/modes/interactive/components/custom-editor.js +6 -1
  392. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  393. package/dist/modes/interactive/components/easter-egg-3d.js +1 -1
  394. package/dist/modes/interactive/components/easter-egg-3d.js.map +1 -1
  395. package/dist/modes/interactive/components/footer.d.ts +10 -2
  396. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  397. package/dist/modes/interactive/components/footer.js +141 -66
  398. package/dist/modes/interactive/components/footer.js.map +1 -1
  399. package/dist/modes/interactive/components/login-dialog.d.ts +1 -1
  400. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  401. package/dist/modes/interactive/components/login-dialog.js +3 -2
  402. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  403. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  404. package/dist/modes/interactive/components/mermaid.js +16 -3
  405. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  406. package/dist/modes/interactive/components/model-selector.d.ts +11 -0
  407. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  408. package/dist/modes/interactive/components/model-selector.js +17 -4
  409. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  410. package/dist/modes/interactive/components/radius-login-selector.d.ts +5 -4
  411. package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
  412. package/dist/modes/interactive/components/radius-login-selector.js +11 -9
  413. package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
  414. package/dist/modes/interactive/components/themed-text.d.ts.map +1 -1
  415. package/dist/modes/interactive/components/themed-text.js +3 -2
  416. package/dist/modes/interactive/components/themed-text.js.map +1 -1
  417. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  418. package/dist/modes/interactive/components/tool-execution.js +17 -6
  419. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  420. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  421. package/dist/modes/interactive/components/user-message.js +3 -2
  422. package/dist/modes/interactive/components/user-message.js.map +1 -1
  423. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  424. package/dist/modes/interactive/components/visual-truncate.js +4 -2
  425. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  426. package/dist/modes/interactive/interactive-mode.d.ts +15 -17
  427. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  428. package/dist/modes/interactive/interactive-mode.js +143 -158
  429. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  430. package/dist/modes/print-mode.d.ts.map +1 -1
  431. package/dist/modes/print-mode.js +2 -5
  432. package/dist/modes/print-mode.js.map +1 -1
  433. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  434. package/dist/modes/rpc/rpc-mode.js +2 -3
  435. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  436. package/dist/package-manager-cli.d.ts.map +1 -1
  437. package/dist/package-manager-cli.js +2 -1
  438. package/dist/package-manager-cli.js.map +1 -1
  439. package/dist/utils/child-process.d.ts.map +1 -1
  440. package/dist/utils/child-process.js +3 -2
  441. package/dist/utils/child-process.js.map +1 -1
  442. package/dist/utils/clipboard-command.d.ts.map +1 -1
  443. package/dist/utils/clipboard-command.js +3 -0
  444. package/dist/utils/clipboard-command.js.map +1 -1
  445. package/dist/utils/pi-user-agent.d.ts +1 -0
  446. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  447. package/dist/utils/pi-user-agent.js +3 -2
  448. package/dist/utils/pi-user-agent.js.map +1 -1
  449. package/dist/utils/shell.d.ts.map +1 -1
  450. package/dist/utils/shell.js +45 -13
  451. package/dist/utils/shell.js.map +1 -1
  452. package/dist/utils/sleep.d.ts +1 -1
  453. package/dist/utils/sleep.d.ts.map +1 -1
  454. package/dist/utils/sleep.js +10 -6
  455. package/dist/utils/sleep.js.map +1 -1
  456. package/dist/utils/tools-manager.d.ts.map +1 -1
  457. package/dist/utils/tools-manager.js +4 -3
  458. package/dist/utils/tools-manager.js.map +1 -1
  459. package/docs/codemode.md +2 -2
  460. package/docs/compaction.md +3 -3
  461. package/docs/coordination.md +1 -1
  462. package/docs/custom-provider.md +53 -1
  463. package/docs/docs.json +4 -0
  464. package/docs/environment-variables.md +2 -0
  465. package/docs/extensions.md +133 -10
  466. package/docs/humain-code.md +13 -1
  467. package/docs/index.md +1 -1
  468. package/docs/models-configuration.md +197 -0
  469. package/docs/models.md +24 -6
  470. package/docs/providers.md +58 -2
  471. package/docs/quickstart.md +8 -1
  472. package/docs/settings.md +1 -1
  473. package/docs/slash-commands.md +10 -0
  474. package/docs/tui.md +70 -0
  475. package/docs/windows.md +16 -2
  476. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  477. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  478. package/examples/extensions/gondolin/package-lock.json +2 -2
  479. package/examples/extensions/gondolin/package.json +1 -1
  480. package/examples/extensions/sandbox/package-lock.json +2 -2
  481. package/examples/extensions/sandbox/package.json +2 -2
  482. package/examples/extensions/with-deps/package.json +1 -1
  483. package/examples/plugins/pi-example-plugin/package.json +2 -2
  484. package/npm-shrinkwrap.json +243 -219
  485. package/package.json +21 -20
  486. package/schemas/models.schema.json +84 -30
  487. package/schemas/settings.schema.json +19 -0
  488. package/src/coordination/UPSTREAM.md +36 -3
  489. package/src/coordination/upstream.json +3 -3
  490. package/src/humain/web-access/UPSTREAM.md +72 -1
  491. package/src/humain/web-access/upstream.json +5 -4
  492. package/dist/bundle/chunks/anthropic-messages-TSNY5MWH.js +0 -67
  493. package/dist/bundle/chunks/azure-openai-responses-Z4DCXO2G.js +0 -15
  494. package/dist/bundle/chunks/chunk-26EAEXO5.js +0 -167
  495. package/dist/bundle/chunks/chunk-2ZFUMXOZ.js +0 -1790
  496. package/dist/bundle/chunks/chunk-5K5RFXXO.js +0 -74
  497. package/dist/bundle/chunks/chunk-PY7SOXCA.js +0 -10
  498. package/dist/bundle/chunks/chunk-UGJAAWNC.js +0 -7
  499. package/dist/bundle/chunks/chunk-UGXYG7HN.js +0 -22
  500. package/dist/bundle/chunks/chunk-VEYTRNQC.js +0 -5
  501. package/dist/bundle/chunks/chunk-X3O5MCKJ.js +0 -7
  502. package/dist/bundle/chunks/chunk-YLYOJQQX.js +0 -1951
  503. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MUJQ6LT2.js +0 -4
  504. package/dist/bundle/chunks/compat-VDGEZSVM.js +0 -13
  505. package/dist/bundle/chunks/dist-LKDZAEUQ.js +0 -7
  506. package/dist/bundle/chunks/es-N6YFJOD7.js +0 -1901
  507. package/dist/bundle/chunks/google-generative-ai-4OVYRP24.js +0 -21
  508. package/dist/bundle/chunks/google-vertex-3WQAZJQD.js +0 -25
  509. package/dist/bundle/chunks/host-63SNKK5Y.js +0 -2
  510. package/dist/bundle/chunks/openai-completions-IC7WRLTI.js +0 -82
  511. package/dist/bundle/chunks/openai-responses-XXCYDFSM.js +0 -24
  512. package/dist/bundle/chunks/openrouter-images-DT2HMZNO.js +0 -8
  513. package/dist/bundle/chunks/typesafe-system-one-HCMGHK6A.js +0 -2
  514. package/dist/bundle/chunks/virtual-modules-CFJTDIXL.js +0 -5
  515. package/dist/core/provider-attribution.d.ts +0 -4
  516. package/dist/core/provider-attribution.d.ts.map +0 -1
  517. package/dist/core/provider-attribution.js +0 -85
  518. package/dist/core/provider-attribution.js.map +0 -1
  519. /package/dist/bundle/chunks/{chunk-WZMA7HAJ.js → chunk-XQRYOCHA.js} +0 -0
@@ -1,13 +1,13 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{retryProviderRequest}from"./chunk-Z33NNMNB.js";import{getJsonSchemaToolParameters,resolveJsonSchemaStrictSampling,transformMessages}from"./chunk-TIFFHHW6.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{clampThinkingLevel,collapseSystemMessages,withoutInitialSystemMessage}from"./chunk-5K5RFXXO.js";import{__commonJS,__require,__toESM}from"./chunk-JXWJOIH4.js";var require_retry_operation=__commonJS({"node_modules/p-retry/node_modules/retry/lib/retry_operation.js"(exports,module){function RetryOperation(timeouts,options){typeof options=="boolean"&&(options={forever:options}),this._originalTimeouts=JSON.parse(JSON.stringify(timeouts)),this._timeouts=timeouts,this._options=options||{},this._maxRetryTime=options&&options.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=
3
- null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}module.exports=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(err){if(this._timeout&&clearTimeout(this.
4
- _timeout),!err)return!1;var currentTime=new Date().getTime();if(err&&currentTime-this._operationStart>=this._maxRetryTime)return this._errors.push(err),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(err);var timeout=this._timeouts.shift();if(timeout===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),timeout=this._cachedTimeouts.slice(-1);else return!1;var self2=this;return this._timer=setTimeout(function(){self2._attempts++,self2.
5
- _operationTimeoutCb&&(self2._timeout=setTimeout(function(){self2._operationTimeoutCb(self2._attempts)},self2._operationTimeout),self2._options.unref&&self2._timeout.unref()),self2._fn(self2._attempts)},timeout),this._options.unref&&this._timer.unref(),!0};RetryOperation.prototype.attempt=function(fn,timeoutOps){this._fn=fn,timeoutOps&&(timeoutOps.timeout&&(this._operationTimeout=timeoutOps.timeout),timeoutOps.cb&&(this._operationTimeoutCb=timeoutOps.cb));var self2=this;this._operationTimeoutCb&&
6
- (this._timeout=setTimeout(function(){self2._operationTimeoutCb()},self2._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(fn){console.log("Using RetryOperation.try() is deprecated"),this.attempt(fn)};RetryOperation.prototype.start=function(fn){console.log("Using RetryOperation.start() is deprecated"),this.attempt(fn)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this.
7
- _errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var counts={},mainError=null,mainErrorCount=0,i=0;i<this._errors.length;i++){var error=this._errors[i],message=error.message,count=(counts[message]||0)+1;counts[message]=count,count>=mainErrorCount&&(mainError=error,mainErrorCount=count)}return mainError}}});var require_retry=__commonJS({"node_modules/p-retry/node_modules/retry/lib/retry.js"(exports){var RetryOperation=require_retry_operation();exports.operation=function(options){var timeouts=exports.timeouts(options);return new RetryOperation(timeouts,{forever:options&&(options.forever||options.retries===1/0),unref:options&&options.unref,maxRetryTime:options&&options.maxRetryTime})};exports.timeouts=function(options){if(options instanceof Array)return[].concat(options);var opts={retries:10,factor:2,
8
- minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var key in options)opts[key]=options[key];if(opts.minTimeout>opts.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var timeouts=[],i=0;i<opts.retries;i++)timeouts.push(this.createTimeout(i,opts));return options&&options.forever&&!timeouts.length&&timeouts.push(this.createTimeout(i,opts)),timeouts.sort(function(a,b){return a-b}),timeouts};exports.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+1:
9
- 1,timeout=Math.round(random*Math.max(opts.minTimeout,1)*Math.pow(opts.factor,attempt));return timeout=Math.min(timeout,opts.maxTimeout),timeout};exports.wrap=function(obj,options,methods){if(options instanceof Array&&(methods=options,options=null),!methods){methods=[];for(var key in obj)typeof obj[key]=="function"&&methods.push(key)}for(var i=0;i<methods.length;i++){var method=methods[i],original=obj[method];obj[method]=function(original2){var op=exports.operation(options),args=Array.prototype.slice.
10
- call(arguments,1),callback=args.pop();args.push(function(err){op.retry(err)||(err&&(arguments[0]=op.mainError()),callback.apply(this,arguments))}),op.attempt(function(){original2.apply(obj,args)})}.bind(obj,original),obj[method].options=options}}}});var require_retry2=__commonJS({"node_modules/p-retry/node_modules/retry/index.js"(exports,module){module.exports=require_retry()}});var require_p_retry=__commonJS({"node_modules/p-retry/index.js"(exports,module){"use strict";var retry2=require_retry2(),networkErrorMsgs=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],AbortError=class extends Error{constructor(message){super(),message instanceof Error?(this.originalError=message,{message}=message):(this.originalError=new Error(message),this.originalError.stack=this.stack),this.name=
2
+ import{retryProviderRequest}from"./chunk-PH7UP57J.js";import{getJsonSchemaToolParameters,resolveJsonSchemaStrictSampling,transformMessages}from"./chunk-JCXXRCP6.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{clampThinkingLevel,collapseSystemMessages,withoutInitialSystemMessage}from"./chunk-UTNHGOFS.js";import{__commonJS,__require,__toESM}from"./chunk-JXWJOIH4.js";var require_retry_operation=__commonJS({"node_modules/retry/lib/retry_operation.js"(exports,module){function RetryOperation(timeouts,options){typeof options=="boolean"&&(options={forever:options}),this._originalTimeouts=JSON.parse(JSON.stringify(timeouts)),this._timeouts=timeouts,this._options=options||{},this._maxRetryTime=options&&options.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=
3
+ null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}module.exports=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(err){if(this._timeout&&clearTimeout(this._timeout),!err)return!1;
4
+ var currentTime=new Date().getTime();if(err&&currentTime-this._operationStart>=this._maxRetryTime)return this._errors.push(err),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(err);var timeout=this._timeouts.shift();if(timeout===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),timeout=this._cachedTimeouts.slice(-1);else return!1;var self2=this;return this._timer=setTimeout(function(){self2._attempts++,self2._operationTimeoutCb&&(self2.
5
+ _timeout=setTimeout(function(){self2._operationTimeoutCb(self2._attempts)},self2._operationTimeout),self2._options.unref&&self2._timeout.unref()),self2._fn(self2._attempts)},timeout),this._options.unref&&this._timer.unref(),!0};RetryOperation.prototype.attempt=function(fn,timeoutOps){this._fn=fn,timeoutOps&&(timeoutOps.timeout&&(this._operationTimeout=timeoutOps.timeout),timeoutOps.cb&&(this._operationTimeoutCb=timeoutOps.cb));var self2=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){
6
+ self2._operationTimeoutCb()},self2._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(fn){console.log("Using RetryOperation.try() is deprecated"),this.attempt(fn)};RetryOperation.prototype.start=function(fn){console.log("Using RetryOperation.start() is deprecated"),this.attempt(fn)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.
7
+ attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var counts={},mainError=null,mainErrorCount=0,i=0;i<this._errors.length;i++){var error=this._errors[i],message=error.message,count=(counts[message]||0)+1;counts[message]=count,count>=mainErrorCount&&(mainError=error,mainErrorCount=count)}return mainError}}});var require_retry=__commonJS({"node_modules/retry/lib/retry.js"(exports){var RetryOperation=require_retry_operation();exports.operation=function(options){var timeouts=exports.timeouts(options);return new RetryOperation(timeouts,{forever:options&&(options.forever||options.retries===1/0),unref:options&&options.unref,maxRetryTime:options&&options.maxRetryTime})};exports.timeouts=function(options){if(options instanceof Array)return[].concat(options);var opts={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,
8
+ randomize:!1};for(var key in options)opts[key]=options[key];if(opts.minTimeout>opts.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var timeouts=[],i=0;i<opts.retries;i++)timeouts.push(this.createTimeout(i,opts));return options&&options.forever&&!timeouts.length&&timeouts.push(this.createTimeout(i,opts)),timeouts.sort(function(a,b){return a-b}),timeouts};exports.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+1:1,timeout=Math.round(random*Math.
9
+ max(opts.minTimeout,1)*Math.pow(opts.factor,attempt));return timeout=Math.min(timeout,opts.maxTimeout),timeout};exports.wrap=function(obj,options,methods){if(options instanceof Array&&(methods=options,options=null),!methods){methods=[];for(var key in obj)typeof obj[key]=="function"&&methods.push(key)}for(var i=0;i<methods.length;i++){var method=methods[i],original=obj[method];obj[method]=function(original2){var op=exports.operation(options),args=Array.prototype.slice.call(arguments,1),callback=args.
10
+ pop();args.push(function(err){op.retry(err)||(err&&(arguments[0]=op.mainError()),callback.apply(this,arguments))}),op.attempt(function(){original2.apply(obj,args)})}.bind(obj,original),obj[method].options=options}}}});var require_retry2=__commonJS({"node_modules/retry/index.js"(exports,module){module.exports=require_retry()}});var require_p_retry=__commonJS({"node_modules/p-retry/index.js"(exports,module){"use strict";var retry2=require_retry2(),networkErrorMsgs=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],AbortError=class extends Error{constructor(message){super(),message instanceof Error?(this.originalError=message,{message}=message):(this.originalError=new Error(message),this.originalError.stack=this.stack),this.name=
11
11
  "AbortError",this.message=message}},decorateErrorWithCounts=(error,attemptNumber,options)=>{let retriesLeft=options.retries-(attemptNumber-1);return error.attemptNumber=attemptNumber,error.retriesLeft=retriesLeft,error},isNetworkError=errorMessage=>networkErrorMsgs.includes(errorMessage),pRetry2=(input,options)=>new Promise((resolve,reject)=>{options={onFailedAttempt:()=>{},retries:10,...options};let operation=retry2.operation(options);operation.attempt(async attemptNumber=>{try{resolve(await input(
12
12
  attemptNumber))}catch(error){if(!(error instanceof Error)){reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));return}if(error instanceof AbortError)operation.stop(),reject(error.originalError);else if(error instanceof TypeError&&!isNetworkError(error.message))operation.stop(),reject(error);else{decorateErrorWithCounts(error,attemptNumber,options);try{await options.onFailedAttempt(error)}catch(error2){reject(error2);return}operation.retry(error)||reject(operation.
13
13
  mainError())}}})});module.exports=pRetry2;module.exports.default=pRetry2;module.exports.AbortError=AbortError}});var require_extend=__commonJS({"node_modules/extend/index.js"(exports,module){"use strict";var hasOwn2=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function(arr){return typeof Array.isArray=="function"?Array.isArray(arr):toStr.call(arr)==="[object Array]"},isPlainObject2=function(obj){if(!obj||toStr.call(obj)!=="[object Object]")return!1;var hasOwnConstructor=hasOwn2.call(obj,"constructor"),hasIsPrototypeOf=obj.
@@ -52,7 +52,7 @@ contentType.includes("application/json")){let data=await response.text();try{dat
52
52
  Content-Type: ${partContentType}\r
53
53
  \r
54
54
  `,typeof currentPart.content=="string"?yield currentPart.content:yield*currentPart.content,yield`\r
55
- `}yield finale}static#proxyAgent;static#fetch;static async#getProxyAgent(){return this.#proxyAgent||=(await import("./https-proxy-agent-7CAXVAFH.js")).HttpsProxyAgent,this.#proxyAgent}static async#getFetch(){let hasWindow=typeof window<"u"&&!!window;return this.#fetch||=hasWindow?window.fetch:(await import("./src-6GRQQIOA.js")).default,this.#fetch}static mergeHeaders(base,...append){base=base instanceof Headers?base:new Headers(base);for(let headers of append)(headers instanceof Headers?headers:
55
+ `}yield finale}static#proxyAgent;static#fetch;static async#getProxyAgent(){return this.#proxyAgent||=(await import("./https-proxy-agent-JQICCRPH.js")).HttpsProxyAgent,this.#proxyAgent}static async#getFetch(){let hasWindow=typeof window<"u"&&!!window;return this.#fetch||=hasWindow?window.fetch:(await import("./src-6GRQQIOA.js")).default,this.#fetch}static mergeHeaders(base,...append){base=base instanceof Headers?base:new Headers(base);for(let headers of append)(headers instanceof Headers?headers:
56
56
  new Headers(headers)).forEach((value,key)=>{key==="set-cookie"?base.append(key,value):base.set(key,value)});return base}};exports.Gaxios=Gaxios;_a2=Gaxios}});var require_src=__commonJS({"node_modules/gaxios/build/cjs/src/index.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.__exportStar||
57
57
  function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});exports.instance=exports.Gaxios=exports.GaxiosError=void 0;exports.request=request;var gaxios_js_1=require_gaxios();Object.defineProperty(exports,"Gaxios",{enumerable:!0,get:function(){return gaxios_js_1.Gaxios}});var common_js_1=require_common();Object.defineProperty(exports,"GaxiosError",{enumerable:!0,get:function(){
58
58
  return common_js_1.GaxiosError}});__exportStar(require_interceptor(),exports);exports.instance=new gaxios_js_1.Gaxios;async function request(opts){return exports.instance.request(opts)}}});var require_bignumber=__commonJS({"node_modules/bignumber.js/bignumber.js"(exports,module){(function(globalObject){"use strict";var BigNumber,isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;
@@ -125,22 +125,23 @@ if(ch==="\\"){if(at-1>startAt&&(string2+=text.substring(startAt,at-1)),next(),ch
125
125
  "}"),object2;next(","),white()}}error("Bad object")};return value=function(){switch(white(),ch){case"{":return object();case"[":return array();case'"':return string();case"-":return number();default:return ch>="0"&&ch<="9"?number():word()}},function(source,reviver){var result;return text=source+"",at=0,ch=" ",result=value(),white(),ch&&error("Syntax error"),typeof reviver=="function"?(function walk(holder,key){var k,v,value2=holder[key];return value2&&typeof value2=="object"&&Object.keys(value2).
126
126
  forEach(function(k2){v=walk(value2,k2),v!==void 0?value2[k2]=v:delete value2[k2]}),reviver.call(holder,key,value2)})({"":result},""):result}};module.exports=json_parse}});var require_json_bigint=__commonJS({"node_modules/json-bigint/index.js"(exports,module){var json_stringify=require_stringify().stringify,json_parse=require_parse();module.exports=function(options){return{parse:json_parse(options),stringify:json_stringify}};module.exports.parse=json_parse();module.exports.stringify=json_stringify}});var require_gcp_residency=__commonJS({"node_modules/gcp-metadata/build/src/gcp-residency.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.GCE_LINUX_BIOS_PATHS=void 0;exports.isGoogleCloudServerless=isGoogleCloudServerless;exports.isGoogleComputeEngineLinux=isGoogleComputeEngineLinux;exports.isGoogleComputeEngineMACAddress=isGoogleComputeEngineMACAddress;exports.isGoogleComputeEngine=isGoogleComputeEngine;exports.detectGCPResidency=detectGCPResidency;var fs_1=__require("fs"),
127
127
  os_1=__require("os");exports.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};var GCE_MAC_ADDRESS_REGEX=/^42:01/;function isGoogleCloudServerless(){return!!(process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE)}function isGoogleComputeEngineLinux(){if((0,os_1.platform)()!=="linux")return!1;try{(0,fs_1.statSync)(exports.GCE_LINUX_BIOS_PATHS.BIOS_DATE);let biosVendor=(0,fs_1.readFileSync)(exports.GCE_LINUX_BIOS_PATHS.
128
- BIOS_VENDOR,"utf8");return/Google/.test(biosVendor)}catch{return!1}}function isGoogleComputeEngineMACAddress(){let interfaces=(0,os_1.networkInterfaces)();for(let item of Object.values(interfaces))if(item){for(let{mac}of item)if(GCE_MAC_ADDRESS_REGEX.test(mac))return!0}return!1}function isGoogleComputeEngine(){return isGoogleComputeEngineLinux()||isGoogleComputeEngineMACAddress()}function detectGCPResidency(){return isGoogleCloudServerless()||isGoogleComputeEngine()}}});var require_colours=__commonJS({"node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/colours.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.Colours=void 0;var Colours=class _Colours{static enabled=!1;static reset="";static bright="";static dim="";static red="";static green="";static yellow="";static blue="";static magenta="";static cyan="";static white="";static grey="";static isEnabled(stream){return stream&&stream.isTTY&&(typeof stream.
129
- getColorDepth=="function"?stream.getColorDepth()>2:!0)}static refresh(){_Colours.enabled=_Colours.isEnabled(process?.stderr),this.enabled?(_Colours.reset="\x1B[0m",_Colours.bright="\x1B[1m",_Colours.dim="\x1B[2m",_Colours.red="\x1B[31m",_Colours.green="\x1B[32m",_Colours.yellow="\x1B[33m",_Colours.blue="\x1B[34m",_Colours.magenta="\x1B[35m",_Colours.cyan="\x1B[36m",_Colours.white="\x1B[37m",_Colours.grey="\x1B[90m"):(_Colours.reset="",_Colours.bright="",_Colours.dim="",_Colours.red="",_Colours.green=
130
- "",_Colours.yellow="",_Colours.blue="",_Colours.magenta="",_Colours.cyan="",_Colours.white="",_Colours.grey="")}};exports.Colours=Colours;Colours.refresh()}});var require_types=__commonJS({"node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/types.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.LogSeverity=void 0;var LogSeverity;(function(LogSeverity2){LogSeverity2.DEFAULT="DEFAULT",LogSeverity2.DEBUG="DEBUG",LogSeverity2.INFO="INFO",LogSeverity2.WARNING="WARNING",LogSeverity2.ERROR="ERROR"})(LogSeverity||(exports.LogSeverity=LogSeverity={}))}});var require_logging_utils=__commonJS({"node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/logging-utils.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),
131
- o[k2]=m[k]})),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?(function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}):function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||(function(){var ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(o2){var ar=[];for(var k in o2)Object.prototype.hasOwnProperty.call(o2,k)&&(ar[ar.length]=k);return ar},ownKeys(o)};return function(mod){if(mod&&mod.__esModule)return mod;var result={};
132
- if(mod!=null)for(var k=ownKeys(mod),i=0;i<k.length;i++)k[i]!=="default"&&__createBinding(result,mod,k[i]);return __setModuleDefault(result,mod),result}})();Object.defineProperty(exports,"__esModule",{value:!0});exports.env=exports.DebugLogBackendBase=exports.placeholder=exports.AdhocDebugLogger=void 0;exports.getNodeBackend=getNodeBackend;exports.getDebugBackend=getDebugBackend;exports.getStructuredBackend=getStructuredBackend;exports.setBackend=setBackend;exports.log=log;var events_1=__require("events"),
133
- process2=__importStar(__require("process")),util=__importStar(__require("util")),colours_1=require_colours(),types_1=require_types(),AdhocDebugLogger=class extends events_1.EventEmitter{namespace;upstream;func;constructor(namespace,upstream){super(),this.namespace=namespace,this.upstream=upstream,this.func=Object.assign(this.invoke.bind(this),{instance:this,on:(event,listener)=>this.on(event,listener)}),this.func.debug=(...args)=>this.invokeSeverity(types_1.LogSeverity.DEBUG,...args),this.func.info=
134
- (...args)=>this.invokeSeverity(types_1.LogSeverity.INFO,...args),this.func.warn=(...args)=>this.invokeSeverity(types_1.LogSeverity.WARNING,...args),this.func.error=(...args)=>this.invokeSeverity(types_1.LogSeverity.ERROR,...args),this.func.sublog=namespace2=>log(namespace2,this.func)}invoke(fields,...args){if(this.upstream)try{this.upstream(fields,...args)}catch{}try{this.emit("log",fields,args)}catch{}}invokeSeverity(severity,...args){this.invoke({severity},...args)}};exports.AdhocDebugLogger=AdhocDebugLogger;
135
- exports.placeholder=new AdhocDebugLogger("",()=>{}).func;var DebugLogBackendBase=class{cached=new Map;filters=[];filtersSet=!1;constructor(){let nodeFlag=process2.env[exports.env.nodeEnables]??"*";nodeFlag==="all"&&(nodeFlag="*"),this.filters=nodeFlag.split(",")}log(namespace,fields,...args){try{this.filtersSet||(this.setFilters(),this.filtersSet=!0);let logger=this.cached.get(namespace);logger||(logger=this.makeLogger(namespace),this.cached.set(namespace,logger)),logger(fields,...args)}catch(e){
136
- console.error(e)}}};exports.DebugLogBackendBase=DebugLogBackendBase;var NodeBackend=class extends DebugLogBackendBase{enabledRegexp=/.*/g;isEnabled(namespace){return this.enabledRegexp.test(namespace)}makeLogger(namespace){return this.enabledRegexp.test(namespace)?(fields,...args)=>{let nscolour=`${colours_1.Colours.green}${namespace}${colours_1.Colours.reset}`,pid=`${colours_1.Colours.yellow}${process2.pid}${colours_1.Colours.reset}`,level;switch(fields.severity){case types_1.LogSeverity.ERROR:
137
- level=`${colours_1.Colours.red}${fields.severity}${colours_1.Colours.reset}`;break;case types_1.LogSeverity.INFO:level=`${colours_1.Colours.magenta}${fields.severity}${colours_1.Colours.reset}`;break;case types_1.LogSeverity.WARNING:level=`${colours_1.Colours.yellow}${fields.severity}${colours_1.Colours.reset}`;break;default:level=fields.severity??types_1.LogSeverity.DEFAULT;break}let msg=util.formatWithOptions({colors:colours_1.Colours.enabled},...args),filteredFields=Object.assign({},fields);delete filteredFields.
138
- severity;let fieldsJson=Object.getOwnPropertyNames(filteredFields).length?JSON.stringify(filteredFields):"",fieldsColour=fieldsJson?`${colours_1.Colours.grey}${fieldsJson}${colours_1.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",pid,nscolour,level,msg,fieldsJson?` ${fieldsColour}`:"")}:()=>{}}setFilters(){let regexp=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${regexp}$`,"i")}};function getNodeBackend(){
139
- return new NodeBackend}var DebugBackend=class extends DebugLogBackendBase{debugPkg;constructor(pkg){super(),this.debugPkg=pkg}makeLogger(namespace){let debugLogger=this.debugPkg(namespace);return(fields,...args)=>{debugLogger(args[0],...args.slice(1))}}setFilters(){let existingFilters=process2.env.NODE_DEBUG??"";process2.env.NODE_DEBUG=`${existingFilters}${existingFilters?",":""}${this.filters.join(",")}`}};function getDebugBackend(debugPkg){return new DebugBackend(debugPkg)}var StructuredBackend=class extends DebugLogBackendBase{upstream;constructor(upstream){
140
- super(),this.upstream=upstream??void 0}makeLogger(namespace){let debugLogger=this.upstream?.makeLogger(namespace);return(fields,...args)=>{let severity=fields.severity??types_1.LogSeverity.INFO,json2=Object.assign({severity,message:util.format(...args)},fields),jsonString=JSON.stringify(json2);debugLogger?debugLogger(fields,jsonString):console.log("%s",jsonString)}}setFilters(){this.upstream?.setFilters()}};function getStructuredBackend(upstream){return new StructuredBackend(upstream)}exports.env=
141
- {nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};var loggerCache=new Map,cachedBackend;function setBackend(backend){cachedBackend=backend,loggerCache.clear()}function log(namespace,parent){if(!cachedBackend&&!process2.env[exports.env.nodeEnables]||!namespace)return exports.placeholder;parent&&(namespace=`${parent.instance.namespace}:${namespace}`);let existing=loggerCache.get(namespace);if(existing)return existing.func;if(cachedBackend===null)return exports.placeholder;cachedBackend===void 0&&(cachedBackend=
142
- getNodeBackend());let logger=(()=>{let previousBackend;return new AdhocDebugLogger(namespace,(fields,...args)=>{if(previousBackend!==cachedBackend){if(cachedBackend===null)return;cachedBackend===void 0&&(cachedBackend=getNodeBackend()),previousBackend=cachedBackend}cachedBackend?.log(namespace,fields,...args)})})();return loggerCache.set(namespace,logger),logger.func}}});var require_src2=__commonJS({"node_modules/gcp-metadata/node_modules/google-logging-utils/build/src/index.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&
143
- exports.__exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});__exportStar(require_logging_utils(),exports)}});var require_src3=__commonJS({"node_modules/gcp-metadata/build/src/index.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__setModuleDefault=exports&&exports.
128
+ BIOS_VENDOR,"utf8");return/Google/.test(biosVendor)}catch{return!1}}function isGoogleComputeEngineMACAddress(){let interfaces=(0,os_1.networkInterfaces)();for(let item of Object.values(interfaces))if(item){for(let{mac}of item)if(GCE_MAC_ADDRESS_REGEX.test(mac))return!0}return!1}function isGoogleComputeEngine(){return isGoogleComputeEngineLinux()||isGoogleComputeEngineMACAddress()}function detectGCPResidency(){return isGoogleCloudServerless()||isGoogleComputeEngine()}}});var require_colours=__commonJS({"node_modules/google-logging-utils/build/src/colours.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.Colours=void 0;var Colours=class _Colours{static isEnabled(stream){return stream&&stream.isTTY&&(typeof stream.getColorDepth=="function"?stream.getColorDepth()>2:!0)}static refresh(){_Colours.enabled=_Colours.isEnabled(process==null?void 0:process.stderr),this.enabled?(_Colours.reset="\x1B[0m",_Colours.bright="\x1B[1m",_Colours.
129
+ dim="\x1B[2m",_Colours.red="\x1B[31m",_Colours.green="\x1B[32m",_Colours.yellow="\x1B[33m",_Colours.blue="\x1B[34m",_Colours.magenta="\x1B[35m",_Colours.cyan="\x1B[36m",_Colours.white="\x1B[37m",_Colours.grey="\x1B[90m"):(_Colours.reset="",_Colours.bright="",_Colours.dim="",_Colours.red="",_Colours.green="",_Colours.yellow="",_Colours.blue="",_Colours.magenta="",_Colours.cyan="",_Colours.white="",_Colours.grey="")}};exports.Colours=Colours;Colours.enabled=!1;Colours.reset="";Colours.bright="";Colours.
130
+ dim="";Colours.red="";Colours.green="";Colours.yellow="";Colours.blue="";Colours.magenta="";Colours.cyan="";Colours.white="";Colours.grey="";Colours.refresh()}});var require_logging_utils=__commonJS({"node_modules/google-logging-utils/build/src/logging-utils.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__setModuleDefault=exports&&
131
+ exports.__setModuleDefault||(Object.create?(function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}):function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||(function(){var ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(o2){var ar=[];for(var k in o2)Object.prototype.hasOwnProperty.call(o2,k)&&(ar[ar.length]=k);return ar},ownKeys(o)};return function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k=ownKeys(mod),i=0;i<
132
+ k.length;i++)k[i]!=="default"&&__createBinding(result,mod,k[i]);return __setModuleDefault(result,mod),result}})();Object.defineProperty(exports,"__esModule",{value:!0});exports.env=exports.DebugLogBackendBase=exports.placeholder=exports.AdhocDebugLogger=exports.LogSeverity=void 0;exports.getNodeBackend=getNodeBackend;exports.getDebugBackend=getDebugBackend;exports.getStructuredBackend=getStructuredBackend;exports.setBackend=setBackend;exports.log=log;var events_1=__require("events"),process2=__importStar(
133
+ __require("process")),util=__importStar(__require("util")),colours_1=require_colours(),LogSeverity;(function(LogSeverity2){LogSeverity2.DEFAULT="DEFAULT",LogSeverity2.DEBUG="DEBUG",LogSeverity2.INFO="INFO",LogSeverity2.WARNING="WARNING",LogSeverity2.ERROR="ERROR"})(LogSeverity||(exports.LogSeverity=LogSeverity={}));var AdhocDebugLogger=class extends events_1.EventEmitter{constructor(namespace,upstream){super(),this.namespace=namespace,this.upstream=upstream,this.func=Object.assign(this.invoke.bind(
134
+ this),{instance:this,on:(event,listener)=>this.on(event,listener)}),this.func.debug=(...args)=>this.invokeSeverity(LogSeverity.DEBUG,...args),this.func.info=(...args)=>this.invokeSeverity(LogSeverity.INFO,...args),this.func.warn=(...args)=>this.invokeSeverity(LogSeverity.WARNING,...args),this.func.error=(...args)=>this.invokeSeverity(LogSeverity.ERROR,...args),this.func.sublog=namespace2=>log(namespace2,this.func)}invoke(fields,...args){if(this.upstream)try{this.upstream(fields,...args)}catch{}try{
135
+ this.emit("log",fields,args)}catch{}}invokeSeverity(severity,...args){this.invoke({severity},...args)}};exports.AdhocDebugLogger=AdhocDebugLogger;exports.placeholder=new AdhocDebugLogger("",()=>{}).func;var DebugLogBackendBase=class{constructor(){var _a2;this.cached=new Map,this.filters=[],this.filtersSet=!1;let nodeFlag=(_a2=process2.env[exports.env.nodeEnables])!==null&&_a2!==void 0?_a2:"*";nodeFlag==="all"&&(nodeFlag="*"),this.filters=nodeFlag.split(",")}log(namespace,fields,...args){try{this.
136
+ filtersSet||(this.setFilters(),this.filtersSet=!0);let logger=this.cached.get(namespace);logger||(logger=this.makeLogger(namespace),this.cached.set(namespace,logger)),logger(fields,...args)}catch(e){console.error(e)}}};exports.DebugLogBackendBase=DebugLogBackendBase;var NodeBackend=class extends DebugLogBackendBase{constructor(){super(...arguments),this.enabledRegexp=/.*/g}isEnabled(namespace){return this.enabledRegexp.test(namespace)}makeLogger(namespace){return this.enabledRegexp.test(namespace)?
137
+ (fields,...args)=>{var _a2;let nscolour=`${colours_1.Colours.green}${namespace}${colours_1.Colours.reset}`,pid=`${colours_1.Colours.yellow}${process2.pid}${colours_1.Colours.reset}`,level;switch(fields.severity){case LogSeverity.ERROR:level=`${colours_1.Colours.red}${fields.severity}${colours_1.Colours.reset}`;break;case LogSeverity.INFO:level=`${colours_1.Colours.magenta}${fields.severity}${colours_1.Colours.reset}`;break;case LogSeverity.WARNING:level=`${colours_1.Colours.yellow}${fields.severity}${colours_1.
138
+ Colours.reset}`;break;default:level=(_a2=fields.severity)!==null&&_a2!==void 0?_a2:LogSeverity.DEFAULT;break}let msg=util.formatWithOptions({colors:colours_1.Colours.enabled},...args),filteredFields=Object.assign({},fields);delete filteredFields.severity;let fieldsJson=Object.getOwnPropertyNames(filteredFields).length?JSON.stringify(filteredFields):"",fieldsColour=fieldsJson?`${colours_1.Colours.grey}${fieldsJson}${colours_1.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",pid,nscolour,level,msg,
139
+ fieldsJson?` ${fieldsColour}`:"")}:()=>{}}setFilters(){let regexp=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${regexp}$`,"i")}};function getNodeBackend(){return new NodeBackend}var DebugBackend=class extends DebugLogBackendBase{constructor(pkg){super(),this.debugPkg=pkg}makeLogger(namespace){let debugLogger=this.debugPkg(namespace);return(fields,...args)=>{debugLogger(args[0],...args.slice(1))}}setFilters(){
140
+ var _a2;let existingFilters=(_a2=process2.env.NODE_DEBUG)!==null&&_a2!==void 0?_a2:"";process2.env.NODE_DEBUG=`${existingFilters}${existingFilters?",":""}${this.filters.join(",")}`}};function getDebugBackend(debugPkg){return new DebugBackend(debugPkg)}var StructuredBackend=class extends DebugLogBackendBase{constructor(upstream){var _a2;super(),this.upstream=(_a2=upstream)!==null&&_a2!==void 0?_a2:void 0}makeLogger(namespace){var _a2;let debugLogger=(_a2=this.upstream)===null||_a2===void 0?void 0:
141
+ _a2.makeLogger(namespace);return(fields,...args)=>{var _a3;let severity=(_a3=fields.severity)!==null&&_a3!==void 0?_a3:LogSeverity.INFO,json2=Object.assign({severity,message:util.format(...args)},fields),jsonString=JSON.stringify(json2);debugLogger?debugLogger(fields,jsonString):console.log("%s",jsonString)}}setFilters(){var _a2;(_a2=this.upstream)===null||_a2===void 0||_a2.setFilters()}};function getStructuredBackend(upstream){return new StructuredBackend(upstream)}exports.env={nodeEnables:"GOO\
142
+ GLE_SDK_NODE_LOGGING"};var loggerCache=new Map,cachedBackend;function setBackend(backend){cachedBackend=backend,loggerCache.clear()}function log(namespace,parent){if(!cachedBackend&&!process2.env[exports.env.nodeEnables]||!namespace)return exports.placeholder;parent&&(namespace=`${parent.instance.namespace}:${namespace}`);let existing=loggerCache.get(namespace);if(existing)return existing.func;if(cachedBackend===null)return exports.placeholder;cachedBackend===void 0&&(cachedBackend=getNodeBackend());
143
+ let logger=(()=>{let previousBackend;return new AdhocDebugLogger(namespace,(fields,...args)=>{if(previousBackend!==cachedBackend){if(cachedBackend===null)return;cachedBackend===void 0&&(cachedBackend=getNodeBackend()),previousBackend=cachedBackend}cachedBackend?.log(namespace,fields,...args)})})();return loggerCache.set(namespace,logger),logger.func}}});var require_src2=__commonJS({"node_modules/google-logging-utils/build/src/index.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.
144
+ __exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});__exportStar(require_logging_utils(),exports)}});var require_src3=__commonJS({"node_modules/gcp-metadata/build/src/index.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__setModuleDefault=exports&&exports.
144
145
  __setModuleDefault||(Object.create?(function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}):function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||(function(){var ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(o2){var ar=[];for(var k in o2)Object.prototype.hasOwnProperty.call(o2,k)&&(ar[ar.length]=k);return ar},ownKeys(o)};return function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k=ownKeys(mod),i=0;i<k.length;i++)
145
146
  k[i]!=="default"&&__createBinding(result,mod,k[i]);return __setModuleDefault(result,mod),result}})(),__exportStar=exports&&exports.__exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});exports.gcpResidencyCache=exports.METADATA_SERVER_DETECTION=exports.HEADERS=exports.HEADER_VALUE=exports.HEADER_NAME=exports.SECONDARY_HOST_ADDRESS=exports.HOST_ADDRESS=
146
147
  exports.BASE_PATH=void 0;exports.instance=instance;exports.project=project;exports.universe=universe;exports.bulk=bulk;exports.isAvailable=isAvailable;exports.resetIsAvailableCache=resetIsAvailableCache;exports.getGCPResidency=getGCPResidency;exports.setGCPResidency=setGCPResidency;exports.requestTimeout=requestTimeout;var gaxios_1=require_src(),jsonBigint=require_json_bigint(),gcp_residency_1=require_gcp_residency(),logger=__importStar(require_src2());exports.BASE_PATH="/computeMetadata/v1";exports.
@@ -180,27 +181,11 @@ ENCODED_TAG_INT,dst[offset++]=rLength,rPadding<0?(dst[offset++]=0,offset+=signat
180
181
  path2=__require("path"),WELL_KNOWN_CERTIFICATE_CONFIG_FILE="certificate_config.json",CLOUDSDK_CONFIG_DIRECTORY="gcloud";function snakeToCamel(str){return str.replace(/([_][^_])/g,match2=>match2.slice(1).toUpperCase())}function originalOrCamelOptions(obj){function get(key){let o=obj||{};return o[key]??o[snakeToCamel(key)]}return{get}}var LRUCache=class{capacity;#cache=new Map;maxAge;constructor(options){this.capacity=options.capacity,this.maxAge=options.maxAge}#moveToEnd(key,value){this.#cache.delete(
181
182
  key),this.#cache.set(key,{value,lastAccessed:Date.now()})}set(key,value){this.#moveToEnd(key,value),this.#evict()}get(key){let item=this.#cache.get(key);if(item)return this.#moveToEnd(key,item.value),this.#evict(),item.value}#evict(){let cutoffDate=this.maxAge?Date.now()-this.maxAge:0,oldestItem=this.#cache.entries().next();for(;!oldestItem.done&&(this.#cache.size>this.capacity||oldestItem.value[1].lastAccessed<cutoffDate);)this.#cache.delete(oldestItem.value[0]),oldestItem=this.#cache.entries().
182
183
  next()}};exports.LRUCache=LRUCache;function removeUndefinedValuesInObject(object){return Object.entries(object).forEach(([key,value])=>{(value===void 0||value==="undefined")&&delete object[key]}),object}async function isValidFile(filePath){try{return(await fs2.promises.lstat(filePath)).isFile()}catch{return!1}}function getWellKnownCertificateConfigFileLocation(){let configDir=process.env.CLOUDSDK_CONFIG||(_isWindows()?path2.join(process.env.APPDATA||"",CLOUDSDK_CONFIG_DIRECTORY):path2.join(process.
183
- env.HOME||"",".config",CLOUDSDK_CONFIG_DIRECTORY));return path2.join(configDir,WELL_KNOWN_CERTIFICATE_CONFIG_FILE)}function _isWindows(){return os.platform().startsWith("win")}}});var require_colours2=__commonJS({"node_modules/google-logging-utils/build/src/colours.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.Colours=void 0;var Colours=class _Colours{static isEnabled(stream){return stream&&stream.isTTY&&(typeof stream.getColorDepth=="function"?stream.getColorDepth()>2:!0)}static refresh(){_Colours.enabled=_Colours.isEnabled(process==null?void 0:process.stderr),this.enabled?(_Colours.reset="\x1B[0m",_Colours.bright="\x1B[1m",_Colours.
184
- dim="\x1B[2m",_Colours.red="\x1B[31m",_Colours.green="\x1B[32m",_Colours.yellow="\x1B[33m",_Colours.blue="\x1B[34m",_Colours.magenta="\x1B[35m",_Colours.cyan="\x1B[36m",_Colours.white="\x1B[37m",_Colours.grey="\x1B[90m"):(_Colours.reset="",_Colours.bright="",_Colours.dim="",_Colours.red="",_Colours.green="",_Colours.yellow="",_Colours.blue="",_Colours.magenta="",_Colours.cyan="",_Colours.white="",_Colours.grey="")}};exports.Colours=Colours;Colours.enabled=!1;Colours.reset="";Colours.bright="";Colours.
185
- dim="";Colours.red="";Colours.green="";Colours.yellow="";Colours.blue="";Colours.magenta="";Colours.cyan="";Colours.white="";Colours.grey="";Colours.refresh()}});var require_logging_utils2=__commonJS({"node_modules/google-logging-utils/build/src/logging-utils.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__setModuleDefault=exports&&
186
- exports.__setModuleDefault||(Object.create?(function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}):function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||(function(){var ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(o2){var ar=[];for(var k in o2)Object.prototype.hasOwnProperty.call(o2,k)&&(ar[ar.length]=k);return ar},ownKeys(o)};return function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k=ownKeys(mod),i=0;i<
187
- k.length;i++)k[i]!=="default"&&__createBinding(result,mod,k[i]);return __setModuleDefault(result,mod),result}})();Object.defineProperty(exports,"__esModule",{value:!0});exports.env=exports.DebugLogBackendBase=exports.placeholder=exports.AdhocDebugLogger=exports.LogSeverity=void 0;exports.getNodeBackend=getNodeBackend;exports.getDebugBackend=getDebugBackend;exports.getStructuredBackend=getStructuredBackend;exports.setBackend=setBackend;exports.log=log;var events_1=__require("events"),process2=__importStar(
188
- __require("process")),util=__importStar(__require("util")),colours_1=require_colours2(),LogSeverity;(function(LogSeverity2){LogSeverity2.DEFAULT="DEFAULT",LogSeverity2.DEBUG="DEBUG",LogSeverity2.INFO="INFO",LogSeverity2.WARNING="WARNING",LogSeverity2.ERROR="ERROR"})(LogSeverity||(exports.LogSeverity=LogSeverity={}));var AdhocDebugLogger=class extends events_1.EventEmitter{constructor(namespace,upstream){super(),this.namespace=namespace,this.upstream=upstream,this.func=Object.assign(this.invoke.bind(
189
- this),{instance:this,on:(event,listener)=>this.on(event,listener)}),this.func.debug=(...args)=>this.invokeSeverity(LogSeverity.DEBUG,...args),this.func.info=(...args)=>this.invokeSeverity(LogSeverity.INFO,...args),this.func.warn=(...args)=>this.invokeSeverity(LogSeverity.WARNING,...args),this.func.error=(...args)=>this.invokeSeverity(LogSeverity.ERROR,...args),this.func.sublog=namespace2=>log(namespace2,this.func)}invoke(fields,...args){if(this.upstream)try{this.upstream(fields,...args)}catch{}try{
190
- this.emit("log",fields,args)}catch{}}invokeSeverity(severity,...args){this.invoke({severity},...args)}};exports.AdhocDebugLogger=AdhocDebugLogger;exports.placeholder=new AdhocDebugLogger("",()=>{}).func;var DebugLogBackendBase=class{constructor(){var _a2;this.cached=new Map,this.filters=[],this.filtersSet=!1;let nodeFlag=(_a2=process2.env[exports.env.nodeEnables])!==null&&_a2!==void 0?_a2:"*";nodeFlag==="all"&&(nodeFlag="*"),this.filters=nodeFlag.split(",")}log(namespace,fields,...args){try{this.
191
- filtersSet||(this.setFilters(),this.filtersSet=!0);let logger=this.cached.get(namespace);logger||(logger=this.makeLogger(namespace),this.cached.set(namespace,logger)),logger(fields,...args)}catch(e){console.error(e)}}};exports.DebugLogBackendBase=DebugLogBackendBase;var NodeBackend=class extends DebugLogBackendBase{constructor(){super(...arguments),this.enabledRegexp=/.*/g}isEnabled(namespace){return this.enabledRegexp.test(namespace)}makeLogger(namespace){return this.enabledRegexp.test(namespace)?
192
- (fields,...args)=>{var _a2;let nscolour=`${colours_1.Colours.green}${namespace}${colours_1.Colours.reset}`,pid=`${colours_1.Colours.yellow}${process2.pid}${colours_1.Colours.reset}`,level;switch(fields.severity){case LogSeverity.ERROR:level=`${colours_1.Colours.red}${fields.severity}${colours_1.Colours.reset}`;break;case LogSeverity.INFO:level=`${colours_1.Colours.magenta}${fields.severity}${colours_1.Colours.reset}`;break;case LogSeverity.WARNING:level=`${colours_1.Colours.yellow}${fields.severity}${colours_1.
193
- Colours.reset}`;break;default:level=(_a2=fields.severity)!==null&&_a2!==void 0?_a2:LogSeverity.DEFAULT;break}let msg=util.formatWithOptions({colors:colours_1.Colours.enabled},...args),filteredFields=Object.assign({},fields);delete filteredFields.severity;let fieldsJson=Object.getOwnPropertyNames(filteredFields).length?JSON.stringify(filteredFields):"",fieldsColour=fieldsJson?`${colours_1.Colours.grey}${fieldsJson}${colours_1.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",pid,nscolour,level,msg,
194
- fieldsJson?` ${fieldsColour}`:"")}:()=>{}}setFilters(){let regexp=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=new RegExp(`^${regexp}$`,"i")}};function getNodeBackend(){return new NodeBackend}var DebugBackend=class extends DebugLogBackendBase{constructor(pkg){super(),this.debugPkg=pkg}makeLogger(namespace){let debugLogger=this.debugPkg(namespace);return(fields,...args)=>{debugLogger(args[0],...args.slice(1))}}setFilters(){
195
- var _a2;let existingFilters=(_a2=process2.env.NODE_DEBUG)!==null&&_a2!==void 0?_a2:"";process2.env.NODE_DEBUG=`${existingFilters}${existingFilters?",":""}${this.filters.join(",")}`}};function getDebugBackend(debugPkg){return new DebugBackend(debugPkg)}var StructuredBackend=class extends DebugLogBackendBase{constructor(upstream){var _a2;super(),this.upstream=(_a2=upstream)!==null&&_a2!==void 0?_a2:void 0}makeLogger(namespace){var _a2;let debugLogger=(_a2=this.upstream)===null||_a2===void 0?void 0:
196
- _a2.makeLogger(namespace);return(fields,...args)=>{var _a3;let severity=(_a3=fields.severity)!==null&&_a3!==void 0?_a3:LogSeverity.INFO,json2=Object.assign({severity,message:util.format(...args)},fields),jsonString=JSON.stringify(json2);debugLogger?debugLogger(fields,jsonString):console.log("%s",jsonString)}}setFilters(){var _a2;(_a2=this.upstream)===null||_a2===void 0||_a2.setFilters()}};function getStructuredBackend(upstream){return new StructuredBackend(upstream)}exports.env={nodeEnables:"GOO\
197
- GLE_SDK_NODE_LOGGING"};var loggerCache=new Map,cachedBackend;function setBackend(backend){cachedBackend=backend,loggerCache.clear()}function log(namespace,parent){if(!cachedBackend&&!process2.env[exports.env.nodeEnables]||!namespace)return exports.placeholder;parent&&(namespace=`${parent.instance.namespace}:${namespace}`);let existing=loggerCache.get(namespace);if(existing)return existing.func;if(cachedBackend===null)return exports.placeholder;cachedBackend===void 0&&(cachedBackend=getNodeBackend());
198
- let logger=(()=>{let previousBackend;return new AdhocDebugLogger(namespace,(fields,...args)=>{if(previousBackend!==cachedBackend){if(cachedBackend===null)return;cachedBackend===void 0&&(cachedBackend=getNodeBackend()),previousBackend=cachedBackend}cachedBackend?.log(namespace,fields,...args)})})();return loggerCache.set(namespace,logger),logger.func}}});var require_src4=__commonJS({"node_modules/google-logging-utils/build/src/index.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.
199
- __exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});__exportStar(require_logging_utils2(),exports)}});var require_package2=__commonJS({"node_modules/google-auth-library/package.json"(exports,module){module.exports={name:"google-auth-library",version:"10.9.1",author:"Google Inc.",description:"Google APIs Authentication Client Library for Node.js",engines:{node:">=18"},main:"./build/src/index.js",types:"./build/src/index.d.ts",repository:{type:"git",directory:"core/packages/google-auth-library-nodejs",url:"https://github.com/googleapis/google-cloud-node.git"},keywords:["google","api","google apis",
184
+ env.HOME||"",".config",CLOUDSDK_CONFIG_DIRECTORY));return path2.join(configDir,WELL_KNOWN_CERTIFICATE_CONFIG_FILE)}function _isWindows(){return os.platform().startsWith("win")}}});var require_package2=__commonJS({"node_modules/google-auth-library/package.json"(exports,module){module.exports={name:"google-auth-library",version:"10.9.1",author:"Google Inc.",description:"Google APIs Authentication Client Library for Node.js",engines:{node:">=18"},main:"./build/src/index.js",types:"./build/src/index.d.ts",repository:{type:"git",directory:"core/packages/google-auth-library-nodejs",url:"https://github.com/googleapis/google-cloud-node.git"},keywords:["google","api","google apis",
200
185
  "client","client library"],dependencies:{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11",gaxios:"^7.1.4","gcp-metadata":"8.1.2","google-logging-utils":"1.1.3",jws:"^4.0.0"},devDependencies:{"@types/base64-js":"^1.2.5","@types/jws":"^3.1.0","@types/mocha":"^10.0.10","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","assert-rejects":"^1.0.0",c8:"^10.1.3",codecov:"^3.8.3",gts:"^6.0.2","is-docker":"^3.0.0",jsdoc:"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-re\
201
186
  gion-tag":"^4.0.0",karma:"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1",keypair:"^1.0.4",mocha:"^11.1.0",mv:"^2.1.1",ncp:"^2.0.0",nock:"^14.0.5","null-loader":"^4.0.1",puppeteer:"^24.0.0",sinon:"21.0.3","ts-loader":"^9.5.2",typescript:"5.8.3",webpack:"^5.97.1","webpack-cli":"^6.0.1"},files:["build/src","!build/src/**/*.map"],scripts:{test:"c8 mocha build/test",
202
187
  clean:"gts clean",prepare:"npm run compile",lint:"gts check --no-inline-config",compile:"tsc -p .",fix:"gts fix",pretest:"npm run compile -- --sourceMap",docs:"jsdoc -c .jsdoc.js","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap",webpack:"webpack","browser-test":"karma start",prelint:"cd samples; npm li\
203
- nk ../; npm install"},license:"Apache-2.0",homepage:"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/google-auth-library-nodejs"}}});var require_shared2=__commonJS({"node_modules/google-auth-library/build/src/shared.cjs"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.USER_AGENT=exports.PRODUCT_NAME=exports.pkg=void 0;var pkg=require_package2();exports.pkg=pkg;var PRODUCT_NAME="google-api-nodejs-client";exports.PRODUCT_NAME=PRODUCT_NAME;var USER_AGENT=`${PRODUCT_NAME}/${pkg.version}`;exports.USER_AGENT=USER_AGENT}});var require_authclient=__commonJS({"node_modules/google-auth-library/build/src/auth/authclient.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.AuthClient=exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=exports.DEFAULT_UNIVERSE=void 0;var events_1=__require("events"),gaxios_1=require_src(),util_1=require_util2(),google_logging_utils_1=require_src4(),shared_cjs_1=require_shared2();exports.DEFAULT_UNIVERSE="googleapis.com";exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=
188
+ nk ../; npm install"},license:"Apache-2.0",homepage:"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/google-auth-library-nodejs"}}});var require_shared2=__commonJS({"node_modules/google-auth-library/build/src/shared.cjs"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.USER_AGENT=exports.PRODUCT_NAME=exports.pkg=void 0;var pkg=require_package2();exports.pkg=pkg;var PRODUCT_NAME="google-api-nodejs-client";exports.PRODUCT_NAME=PRODUCT_NAME;var USER_AGENT=`${PRODUCT_NAME}/${pkg.version}`;exports.USER_AGENT=USER_AGENT}});var require_authclient=__commonJS({"node_modules/google-auth-library/build/src/auth/authclient.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.AuthClient=exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=exports.DEFAULT_UNIVERSE=void 0;var events_1=__require("events"),gaxios_1=require_src(),util_1=require_util2(),google_logging_utils_1=require_src2(),shared_cjs_1=require_shared2();exports.DEFAULT_UNIVERSE="googleapis.com";exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=
204
189
  300*1e3;var AuthClient=class _AuthClient extends events_1.EventEmitter{apiKey;projectId;quotaProjectId;transporter;credentials={};eagerRefreshThresholdMillis=exports.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;forceRefreshOnFailure=!1;universeDomain=exports.DEFAULT_UNIVERSE;static RequestMethodNameSymbol=Symbol("request method name");static RequestLogIdSymbol=Symbol("request log id");constructor(opts={}){super();let options=(0,util_1.originalOrCamelOptions)(opts);this.apiKey=opts.apiKey,this.projectId=
205
190
  options.get("project_id")??null,this.quotaProjectId=options.get("quota_project_id"),this.credentials=options.get("credentials")??{},this.universeDomain=options.get("universe_domain")??exports.DEFAULT_UNIVERSE,this.transporter=opts.transporter??new gaxios_1.Gaxios(opts.transporterOptions),options.get("useAuthRequestParameters")!==!1&&(this.transporter.interceptors.request.add(_AuthClient.DEFAULT_REQUEST_INTERCEPTOR),this.transporter.interceptors.response.add(_AuthClient.DEFAULT_RESPONSE_INTERCEPTOR)),
206
191
  opts.eagerRefreshThresholdMillis&&(this.eagerRefreshThresholdMillis=opts.eagerRefreshThresholdMillis),this.forceRefreshOnFailure=opts.forceRefreshOnFailure??!1}fetch(...args){let input=args[0],init=args[1],url,headers=new Headers;return typeof input=="string"?url=new URL(input):input instanceof URL?url=input:input&&input.url&&(url=new URL(input.url)),input&&typeof input=="object"&&"headers"in input&&gaxios_1.Gaxios.mergeHeaders(headers,input.headers),init&&gaxios_1.Gaxios.mergeHeaders(headers,new Headers(
@@ -475,7 +460,7 @@ let accessTokenResponse=await this.getAccessToken(),headers=new Headers({authori
475
460
  opts.headers,requestHeaders),response=await this.transporter.request(opts)}catch(e){let res=e.response;if(res){let statusCode=res.status,isReadableStream=res.config.data instanceof stream.Readable;if(!reAuthRetried&&(statusCode===401||statusCode===403)&&!isReadableStream&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(opts,!0)}throw e}return response}async refreshAccessTokenAsync(){let subjectToken=(await this.authClient.getAccessToken()).token,stsCredentialsOptions={
476
461
  grantType:STS_GRANT_TYPE,requestedTokenType:STS_REQUEST_TOKEN_TYPE,subjectToken,subjectTokenType:STS_SUBJECT_TOKEN_TYPE},stsResponse=await this.stsCredential.exchangeToken(stsCredentialsOptions,void 0,this.credentialAccessBoundary),sourceCredExpireDate=this.authClient.credentials?.expiry_date||null,expiryDate=stsResponse.expires_in?new Date().getTime()+stsResponse.expires_in*1e3:sourceCredExpireDate;return this.cachedDownscopedAccessToken={access_token:stsResponse.access_token,expiry_date:expiryDate,
477
462
  res:stsResponse.res},this.credentials={},Object.assign(this.credentials,this.cachedDownscopedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedDownscopedAccessToken}isExpired(downscopedAccessToken){let now=new Date().getTime();return downscopedAccessToken.expiry_date?now>=downscopedAccessToken.expiry_date-
478
- this.eagerRefreshThresholdMillis:!1}};exports.DownscopedClient=DownscopedClient}});var require_passthrough=__commonJS({"node_modules/google-auth-library/build/src/auth/passthrough.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.PassThroughClient=void 0;var authclient_1=require_authclient(),PassThroughClient=class extends authclient_1.AuthClient{async request(opts){return this.transporter.request(opts)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}};exports.PassThroughClient=PassThroughClient}});var require_src5=__commonJS({"node_modules/google-auth-library/build/src/index.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.
463
+ this.eagerRefreshThresholdMillis:!1}};exports.DownscopedClient=DownscopedClient}});var require_passthrough=__commonJS({"node_modules/google-auth-library/build/src/auth/passthrough.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.PassThroughClient=void 0;var authclient_1=require_authclient(),PassThroughClient=class extends authclient_1.AuthClient{async request(opts){return this.transporter.request(opts)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}};exports.PassThroughClient=PassThroughClient}});var require_src4=__commonJS({"node_modules/google-auth-library/build/src/index.js"(exports){"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.
479
464
  __exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});exports.GoogleAuth=exports.auth=exports.GDCH_SERVICE_ACCOUNT_TYPE=exports.GdchClient=exports.PassThroughClient=exports.ExternalAccountAuthorizedUserClient=exports.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=exports.ExecutableError=exports.PluggableAuthClient=exports.DownscopedClient=exports.BaseExternalAccountClient=
480
465
  exports.ExternalAccountClient=exports.IdentityPoolClient=exports.AwsRequestSigner=exports.AwsClient=exports.UserRefreshClient=exports.LoginTicket=exports.ClientAuthentication=exports.OAuth2Client=exports.CodeChallengeMethod=exports.Impersonated=exports.JWT=exports.JWTAccess=exports.IdTokenClient=exports.IAMAuth=exports.GCPEnv=exports.Compute=exports.DEFAULT_UNIVERSE=exports.AuthClient=exports.gaxios=exports.gcpMetadata=void 0;var googleauth_1=require_googleauth();Object.defineProperty(exports,"G\
481
466
  oogleAuth",{enumerable:!0,get:function(){return googleauth_1.GoogleAuth}});exports.gcpMetadata=require_src3();exports.gaxios=require_src();var authclient_1=require_authclient();Object.defineProperty(exports,"AuthClient",{enumerable:!0,get:function(){return authclient_1.AuthClient}});Object.defineProperty(exports,"DEFAULT_UNIVERSE",{enumerable:!0,get:function(){return authclient_1.DEFAULT_UNIVERSE}});var computeclient_1=require_computeclient();Object.defineProperty(exports,"Compute",{enumerable:!0,
@@ -612,7 +597,7 @@ socket.once("finish",socket.destroy),socket.end(`HTTP/1.1 ${code} ${http.STATUS_
612
597
  `+Object.keys(headers).map(h=>`${h}: ${headers[h]}`).join(`\r
613
598
  `)+`\r
614
599
  \r
615
- `+message)}function abortHandshakeOrEmitwsClientError(server,req,socket,code,message,headers){if(server.listenerCount("wsClientError")){let err=new Error(message);Error.captureStackTrace(err,abortHandshakeOrEmitwsClientError),server.emit("wsClientError",err,socket,req)}else abortHandshake(socket,code,message,headers)}}});var import_p_retry=__toESM(require_p_retry(),1),import_google_auth_library=__toESM(require_src5(),1);import{createWriteStream}from"fs";import*as fs from"fs/promises";import{writeFile}from"fs/promises";import{Readable}from"node:stream";import{finished}from"node:stream/promises";var import_stream=__toESM(require_stream(),1),import_extension=__toESM(require_extension(),1),import_permessage_deflate=__toESM(require_permessage_deflate(),1),import_receiver=__toESM(require_receiver(),1),import_sender=__toESM(require_sender(),1),import_subprotocol=__toESM(require_subprotocol(),1),import_websocket=__toESM(require_websocket(),1),import_websocket_server=__toESM(require_websocket_server(),1);import*as path from"path";var _defaultBaseGeminiUrl,_defaultBaseVertexUrl;function getDefaultBaseUrls(){return{geminiUrl:_defaultBaseGeminiUrl,vertexUrl:_defaultBaseVertexUrl}}function getBaseUrl(httpOptions,vertexai,vertexBaseUrlFromEnv,geminiBaseUrlFromEnv){var _a2,_b;if(!httpOptions?.baseUrl){let defaultBaseUrls=getDefaultBaseUrls();return vertexai?(_a2=defaultBaseUrls.vertexUrl)!==null&&_a2!==void 0?_a2:vertexBaseUrlFromEnv:(_b=defaultBaseUrls.geminiUrl)!==null&&_b!==void 0?_b:geminiBaseUrlFromEnv}return httpOptions.baseUrl}var BaseModule=class{};function formatMap(templateString,valueMap){
600
+ `+message)}function abortHandshakeOrEmitwsClientError(server,req,socket,code,message,headers){if(server.listenerCount("wsClientError")){let err=new Error(message);Error.captureStackTrace(err,abortHandshakeOrEmitwsClientError),server.emit("wsClientError",err,socket,req)}else abortHandshake(socket,code,message,headers)}}});var import_p_retry=__toESM(require_p_retry(),1),import_google_auth_library=__toESM(require_src4(),1);import{createWriteStream}from"fs";import*as fs from"fs/promises";import{writeFile}from"fs/promises";import{Readable}from"node:stream";import{finished}from"node:stream/promises";var import_stream=__toESM(require_stream(),1),import_extension=__toESM(require_extension(),1),import_permessage_deflate=__toESM(require_permessage_deflate(),1),import_receiver=__toESM(require_receiver(),1),import_sender=__toESM(require_sender(),1),import_subprotocol=__toESM(require_subprotocol(),1),import_websocket=__toESM(require_websocket(),1),import_websocket_server=__toESM(require_websocket_server(),1);import*as path from"path";var _defaultBaseGeminiUrl,_defaultBaseVertexUrl;function getDefaultBaseUrls(){return{geminiUrl:_defaultBaseGeminiUrl,vertexUrl:_defaultBaseVertexUrl}}function getBaseUrl(httpOptions,vertexai,vertexBaseUrlFromEnv,geminiBaseUrlFromEnv){var _a2,_b;if(!httpOptions?.baseUrl){let defaultBaseUrls=getDefaultBaseUrls();return vertexai?(_a2=defaultBaseUrls.vertexUrl)!==null&&_a2!==void 0?_a2:vertexBaseUrlFromEnv:(_b=defaultBaseUrls.geminiUrl)!==null&&_b!==void 0?_b:geminiBaseUrlFromEnv}return httpOptions.baseUrl}var BaseModule=class{};function formatMap(templateString,valueMap){
616
601
  let regex=/\{([^}]+)\}/g;return templateString.replace(regex,(match2,key)=>{if(Object.prototype.hasOwnProperty.call(valueMap,key)){let value=valueMap[key];return value!=null?String(value):""}else throw new Error(`Key '${key}' not found in valueMap.`)})}function setValueByPath(data,keys,value){for(let i=0;i<keys.length-1;i++){let key=keys[i];if(key.endsWith("[]")){let keyName=key.slice(0,-2);if(!(keyName in data))if(Array.isArray(value))data[keyName]=Array.from({length:value.length},()=>({}));else
617
602
  throw new Error(`Value must be a list given an array path ${key}`);if(Array.isArray(data[keyName])){let arrayData=data[keyName];if(Array.isArray(value))for(let j=0;j<arrayData.length;j++){let entry=arrayData[j];setValueByPath(entry,keys.slice(i+1),value[j])}else for(let d of arrayData)setValueByPath(d,keys.slice(i+1),value)}return}else if(key.endsWith("[0]")){let keyName=key.slice(0,-3);keyName in data||(data[keyName]=[{}]);let arrayData=data[keyName];setValueByPath(arrayData[0],keys.slice(i+1),
618
603
  value);return}(!data[key]||typeof data[key]!="object")&&(data[key]={}),data=data[key]}let keyToSet=keys[keys.length-1],existingData=data[keyToSet];if(existingData!==void 0){if(!value||typeof value=="object"&&Object.keys(value).length===0||value===existingData)return;if(typeof existingData=="object"&&typeof value=="object"&&existingData!==null&&value!==null)Object.assign(existingData,value);else throw new Error(`Cannot set value for an existing key. Key: ${keyToSet}`)}else keyToSet==="_self"&&typeof value==
@@ -788,133 +773,133 @@ Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolT
788
773
  fromObject,["cachedContent"]);parentObject!==void 0&&fromCachedContent!=null&&setValueByPath(parentObject,["cachedContent"],tCachedContentName(apiClient,fromCachedContent));let fromResponseModalities=getValueByPath(fromObject,["responseModalities"]);fromResponseModalities!=null&&setValueByPath(toObject,["responseModalities"],fromResponseModalities);let fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);
789
774
  let fromSpeechConfig=getValueByPath(fromObject,["speechConfig"]);if(fromSpeechConfig!=null&&setValueByPath(toObject,["speechConfig"],tSpeechConfig(fromSpeechConfig)),getValueByPath(fromObject,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromThinkingConfig=getValueByPath(fromObject,["thinkingConfig"]);fromThinkingConfig!=null&&setValueByPath(toObject,["thinkingConfig"],fromThinkingConfig);
790
775
  let fromAudioTranscriptionConfig=getValueByPath(fromObject,["audioTranscriptionConfig"]);fromAudioTranscriptionConfig!=null&&setValueByPath(toObject,["audioTranscriptionConfig"],fromAudioTranscriptionConfig);let fromImageConfig=getValueByPath(fromObject,["imageConfig"]);fromImageConfig!=null&&setValueByPath(toObject,["imageConfig"],imageConfigToMldev$1(fromImageConfig));let fromEnableEnhancedCivicAnswers=getValueByPath(fromObject,["enableEnhancedCivicAnswers"]);if(fromEnableEnhancedCivicAnswers!=
791
- null&&setValueByPath(toObject,["enableEnhancedCivicAnswers"],fromEnableEnhancedCivicAnswers),getValueByPath(fromObject,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromContinuationToken=getValueByPath(fromObject,["continuationToken"]);return parentObject!==void 0&&fromContinuationToken!=null&&setValueByPath(parentObject,["continuationToken"],fromContinuationToken),toObject}
792
- function generateContentResponseFromMldev$1(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromCandidates=getValueByPath(fromObject,["candidates"]);if(fromCandidates!=null){let transformedList=fromCandidates;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>candidateFromMldev$1(item))),setValueByPath(toObject,["candidates"],transformedList)}
793
- let fromModelVersion=getValueByPath(fromObject,["modelVersion"]);fromModelVersion!=null&&setValueByPath(toObject,["modelVersion"],fromModelVersion);let fromPromptFeedback=getValueByPath(fromObject,["promptFeedback"]);fromPromptFeedback!=null&&setValueByPath(toObject,["promptFeedback"],fromPromptFeedback);let fromResponseId=getValueByPath(fromObject,["responseId"]);fromResponseId!=null&&setValueByPath(toObject,["responseId"],fromResponseId);let fromUsageMetadata=getValueByPath(fromObject,["usageM\
794
- etadata"]);fromUsageMetadata!=null&&setValueByPath(toObject,["usageMetadata"],fromUsageMetadata);let fromModelStatus=getValueByPath(fromObject,["modelStatus"]);return fromModelStatus!=null&&setValueByPath(toObject,["modelStatus"],fromModelStatus),toObject}function getBatchJobParametersToMldev(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],tBatchJobName(apiClient,fromName)),toObject}function getBatchJobParametersToVertex(apiClient,fromObject){
795
- let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],tBatchJobName(apiClient,fromName)),toObject}function googleMapsToMldev$4(fromObject){let toObject={},fromAuthConfig=getValueByPath(fromObject,["authConfig"]);fromAuthConfig!=null&&setValueByPath(toObject,["authConfig"],authConfigToMldev$4(fromAuthConfig));let fromEnableWidget=getValueByPath(fromObject,["enableWidget"]);if(fromEnableWidget!=null&&setValueByPath(toObject,["en\
796
- ableWidget"],fromEnableWidget),getValueByPath(fromObject,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function googleSearchToMldev$4(fromObject){let toObject={};if(getValueByPath(fromObject,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");
797
- if(getValueByPath(fromObject,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromSearchTypes=getValueByPath(fromObject,["searchTypes"]);fromSearchTypes!=null&&setValueByPath(toObject,["searchTypes"],fromSearchTypes);let fromTimeRangeFilter=getValueByPath(fromObject,["timeRangeFilter"]);return fromTimeRangeFilter!=null&&setValueByPath(toObject,["timeRangeFilter"],fromTimeRangeFilter),
798
- toObject}function imageConfigToMldev$1(fromObject){let toObject={},fromAspectRatio=getValueByPath(fromObject,["aspectRatio"]);fromAspectRatio!=null&&setValueByPath(toObject,["aspectRatio"],fromAspectRatio);let fromImageSize=getValueByPath(fromObject,["imageSize"]);if(fromImageSize!=null&&setValueByPath(toObject,["imageSize"],fromImageSize),getValueByPath(fromObject,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is only supported in Gemini Enterprise Agent Platform mod\
799
- e, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["imageOutputOptions"])!==
800
- void 0)throw new Error("imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["prominentPeople"])!==void 0)throw new Error("prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function inlinedRequestToMldev(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(
801
- toObject,["request","model"],tModel(apiClient,fromModel));let fromContents=getValueByPath(fromObject,["contents"]);if(fromContents!=null){let transformedList=tContents(fromContents);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>contentToMldev$4(item))),setValueByPath(toObject,["request","contents"],transformedList)}let fromMetadata=getValueByPath(fromObject,["metadata"]);fromMetadata!=null&&setValueByPath(toObject,["metadata"],fromMetadata);let fromConfig=getValueByPath(
802
- fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["request","generationConfig"],generateContentConfigToMldev$1(apiClient,fromConfig,getValueByPath(toObject,["request"],{}))),toObject}function inlinedResponseFromMldev(fromObject){let toObject={},fromResponse=getValueByPath(fromObject,["response"]);fromResponse!=null&&setValueByPath(toObject,["response"],generateContentResponseFromMldev$1(fromResponse));let fromMetadata=getValueByPath(fromObject,["metadata"]);fromMetadata!=null&&
803
- setValueByPath(toObject,["metadata"],fromMetadata);let fromError=getValueByPath(fromObject,["error"]);return fromError!=null&&setValueByPath(toObject,["error"],fromError),toObject}function listBatchJobsConfigToMldev(fromObject,parentObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);if(parentObject!==void 0&&
804
- fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken),getValueByPath(fromObject,["filter"])!==void 0)throw new Error("filter parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function listBatchJobsConfigToVertex(fromObject,parentObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSiz\
805
- e"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken);let fromFilter=getValueByPath(fromObject,["filter"]);return parentObject!==void 0&&fromFilter!=null&&setValueByPath(parentObject,["_query","filter"],fromFilter),toObject}function listBatchJobsParametersToMldev(fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listBatchJobsConfigToMldev(
806
- fromConfig,toObject),toObject}function listBatchJobsParametersToVertex(fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listBatchJobsConfigToVertex(fromConfig,toObject),toObject}function listBatchJobsResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,
807
- ["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromBatchJobs=getValueByPath(fromObject,["operations"]);if(fromBatchJobs!=null){let transformedList=fromBatchJobs;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>batchJobFromMldev(item))),setValueByPath(toObject,["batchJobs"],transformedList)}return toObject}function listBatchJobsResponseFromVertex(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,
808
- ["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromBatchJobs=getValueByPath(fromObject,["batchPredictionJobs"]);if(fromBatchJobs!=null){let transformedList=fromBatchJobs;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>batchJobFromVertex(item))),setValueByPath(
809
- toObject,["batchJobs"],transformedList)}return toObject}function partToMldev$4(fromObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=null&&setValueByPath(toObject,["toolCall"],fromToolCall);let fromToolResponse=getValueByPath(fromObject,["toolResponse"]);fromToolResponse!=null&&setValueByPath(toObject,
810
- ["toolResponse"],fromToolResponse);let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(
811
- toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],functionCallToMldev$4(fromFunctionCall));let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);
812
- let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thou\
813
- ghtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata);let fromPartMetadata=getValueByPath(fromObject,["partMetadata"]);fromPartMetadata!=null&&setValueByPath(toObject,["partMetadata"],fromPartMetadata);let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);
814
- let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function safetySettingToMldev$3(fromObject){let toObject={},fromCategory=getValueByPath(fromObject,["category"]);if(fromCategory!=null&&setValueByPath(toObject,["category"],fromCategory),getValueByPath(fromObject,["method"])!==void 0)throw new Error("method parameter is only supported in Gemini Enterprise Agent Platform mode\
815
- , not in Gemini Developer API mode.");let fromThreshold=getValueByPath(fromObject,["threshold"]);return fromThreshold!=null&&setValueByPath(toObject,["threshold"],fromThreshold),toObject}function toolConfigToMldev$2(fromObject){let toObject={},fromFunctionCallingConfig=getValueByPath(fromObject,["functionCallingConfig"]);fromFunctionCallingConfig!=null&&setValueByPath(toObject,["functionCallingConfig"],functionCallingConfigToMldev$2(fromFunctionCallingConfig));let fromRetrievalConfig=getValueByPath(
816
- fromObject,["retrievalConfig"]);fromRetrievalConfig!=null&&setValueByPath(toObject,["retrievalConfig"],fromRetrievalConfig);let fromIncludeServerSideToolInvocations=getValueByPath(fromObject,["includeServerSideToolInvocations"]);return fromIncludeServerSideToolInvocations!=null&&setValueByPath(toObject,["includeServerSideToolInvocations"],fromIncludeServerSideToolInvocations),toObject}function toolToMldev$4(fromObject){let toObject={};if(getValueByPath(fromObject,["retrieval"])!==void 0)throw new Error(
817
- "retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],googleMapsToMldev$4(fromGoogleMaps));let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,
818
- ["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);if(fromComputerUse!=null&&setValueByPath(toObject,["computerUse"],fromComputerUse),getValueByPath(fromObject,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, no\
819
- t in Gemini Developer API mode.");if(getValueByPath(fromObject,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromFunctionDeclarations=getValueByPath(fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functio\
820
- nDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleSearch"]);fromGoogleSearch!=null&&setValueByPath(toObject,["googleSearch"],googleSearchToMldev$4(fromGoogleSearch));let fromGoogleSearchRetrieval=getValueByPath(fromObject,["googleSearchRetrieval"]);if(fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval),getValueByPath(fromObject,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter\
821
- is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromUrlContext=getValueByPath(fromObject,["urlContext"]);fromUrlContext!=null&&setValueByPath(toObject,["urlContext"],fromUrlContext);let fromFileSearch=getValueByPath(fromObject,["fileSearch"]);return fromFileSearch!=null&&setValueByPath(toObject,["fileSearch"],fromFileSearch),toObject}function vertexMultimodalDatasetDestinationFromVertex(fromObject){let toObject={},fromBigqueryDestination=getValueByPath(
822
- fromObject,["bigqueryDestination","outputUri"]);fromBigqueryDestination!=null&&setValueByPath(toObject,["bigqueryDestination"],fromBigqueryDestination);let fromDisplayName=getValueByPath(fromObject,["displayName"]);return fromDisplayName!=null&&setValueByPath(toObject,["displayName"],fromDisplayName),toObject}function vertexMultimodalDatasetDestinationToVertex(fromObject){let toObject={},fromBigqueryDestination=getValueByPath(fromObject,["bigqueryDestination"]);fromBigqueryDestination!=null&&setValueByPath(
823
- toObject,["bigqueryDestination","outputUri"],fromBigqueryDestination);let fromDisplayName=getValueByPath(fromObject,["displayName"]);return fromDisplayName!=null&&setValueByPath(toObject,["displayName"],fromDisplayName),toObject}var PagedItem;(function(PagedItem2){PagedItem2.PAGED_ITEM_BATCH_JOBS="batchJobs",PagedItem2.PAGED_ITEM_MODELS="models",PagedItem2.PAGED_ITEM_TUNING_JOBS="tuningJobs",PagedItem2.PAGED_ITEM_FILES="files",PagedItem2.PAGED_ITEM_CACHED_CONTENTS="cachedContents",PagedItem2.PAGED_ITEM_FILE_SEARCH_STORES=
824
- "fileSearchStores",PagedItem2.PAGED_ITEM_DOCUMENTS="documents",PagedItem2.PAGED_ITEM_SKILLS="skills"})(PagedItem||(PagedItem={}));var Pager=class{constructor(name,request,response,params){this.pageInternal=[],this.paramsInternal={},this.requestInternal=request,this.init(name,response,params)}init(name,response,params){var _a2,_b;this.nameInternal=name,this.pageInternal=response[this.nameInternal]||[],this.sdkHttpResponseInternal=response?.sdkHttpResponse,this.idxInternal=0;let requestParams={config:{}};
825
- !params||Object.keys(params).length===0?requestParams={config:{}}:typeof params=="object"?requestParams=Object.assign({},params):requestParams=params,requestParams.config&&(requestParams.config.pageToken=response.nextPageToken),this.paramsInternal=requestParams,this.pageInternalSize=(_b=(_a2=requestParams.config)===null||_a2===void 0?void 0:_a2.pageSize)!==null&&_b!==void 0?_b:this.pageInternal.length}initNextPage(response){this.init(this.nameInternal,response,this.paramsInternal)}get page(){return this.
826
- pageInternal}get name(){return this.nameInternal}get pageSize(){return this.pageInternalSize}get sdkHttpResponse(){return this.sdkHttpResponseInternal}get params(){return this.paramsInternal}get pageLength(){return this.pageInternal.length}getItem(index){return this.pageInternal[index]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};let item=this.getItem(this.idxInternal);return this.
827
- idxInternal+=1,{value:item,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");let response=await this.requestInternal(this.params);return this.initNextPage(response),this.page}hasNextPage(){var _a2;return((_a2=this.params.config)===null||_a2===void 0?void 0:_a2.pageToken)!==void 0}};var Batches=class extends BaseModule{constructor(apiClient){super(),this.apiClient=apiClient,this.list=async(params={})=>new Pager(PagedItem.
828
- PAGED_ITEM_BATCH_JOBS,x=>this.listInternal(x),await this.listInternal(params),params),this.create=async params=>(this.apiClient.isVertexAI()&&(params.config=this.formatDestination(params.src,params.config)),this.createInternal(params)),this.createEmbeddings=async params=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw new Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches\
829
- .createEmbeddings.");return this.createEmbeddingsInternal(params)}}createInlinedGenerateContentRequest(params){let body=createBatchJobParametersToMldev(this.apiClient,params),urlParams=body._url,path2=formatMap("{model}:batchGenerateContent",urlParams),requestsWrapper=body.batch.inputConfig.requests,requests=requestsWrapper.requests,newRequests=[];for(let request of requests){let requestDict=Object.assign({},request);if(requestDict.systemInstruction){let systemInstructionValue=requestDict.systemInstruction;
830
- delete requestDict.systemInstruction;let requestContent=requestDict.request;requestContent.systemInstruction=systemInstructionValue,requestDict.request=requestContent}newRequests.push(requestDict)}return requestsWrapper.requests=newRequests,delete body.config,delete body._url,delete body._query,{path:path2,body}}getGcsUri(src){if(typeof src=="string")return src.startsWith("gs://")?src:void 0;if(!Array.isArray(src)&&src.gcsUri&&src.gcsUri.length>0)return src.gcsUri[0]}getBigqueryUri(src){if(typeof src==
831
- "string")return src.startsWith("bq://")?src:void 0;if(!Array.isArray(src))return src.bigqueryUri}formatDestination(src,config){let newConfig=config?Object.assign({},config):{},timestampStr=Date.now().toString();if(newConfig.displayName||(newConfig.displayName=`genaiBatchJob_${timestampStr}`),newConfig.dest===void 0){let gcsUri=this.getGcsUri(src),bigqueryUri=this.getBigqueryUri(src);if(gcsUri)gcsUri.endsWith(".jsonl")?newConfig.dest=`${gcsUri.slice(0,-6)}/dest`:newConfig.dest=`${gcsUri}_dest_${timestampStr}`;else if(bigqueryUri)
832
- newConfig.dest=`${bigqueryUri}_dest_${timestampStr}`;else throw new Error("Unsupported source for Gemini Enterprise Agent Platform (previously known as Vertex AI): No GCS or BigQuery URI found.")}return newConfig}async createInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=createBatchJobParametersToVertex(this.apiClient,params);return path2=formatMap("batchPredictionJobs",body._url),queryParams=body._query,delete body._url,delete body.
833
- _query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>batchJobFromVertex(apiResponse))}else{let body=createBatchJobParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:batchGenerateContent",body._url),queryParams=
834
- body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>batchJobFromMldev(apiResponse))}}async createEmbeddingsInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.
835
- isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=createEmbeddingsBatchJobParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:asyncBatchEmbedContent",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===
836
- null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>batchJobFromMldev(apiResponse))}}async get(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=getBatchJobParametersToVertex(this.apiClient,params);return path2=formatMap("batchPredictionJobs/{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(
837
- body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>batchJobFromVertex(apiResponse))}else{let body=getBatchJobParametersToMldev(this.apiClient,params);return path2=formatMap("batches/{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,
838
- body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>batchJobFromMldev(apiResponse))}}async cancel(params){var _a2,_b,_c,_d;let path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=cancelBatchJobParametersToVertex(this.apiClient,params);path2=formatMap("batchPredictionJobs/{name}:ca\
839
- ncel",body._url),queryParams=body._query,delete body._url,delete body._query,await this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal})}else{let body=cancelBatchJobParametersToMldev(this.apiClient,params);path2=formatMap("batches/{name}:cancel",body._url),queryParams=body._query,delete body._url,delete body._query,
840
- await this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal})}}async listInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=listBatchJobsParametersToVertex(params);return path2=formatMap("batchPredictionJobs",body._url),queryParams=body._query,delete body.
841
- _url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=listBatchJobsResponseFromVertex(
842
- apiResponse),typedResp=new ListBatchJobsResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=listBatchJobsParametersToMldev(params);return path2=formatMap("batches",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).
843
- then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=listBatchJobsResponseFromMldev(apiResponse),typedResp=new ListBatchJobsResponse;return Object.assign(typedResp,resp),typedResp})}}async delete(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=deleteBatchJobParametersToVertex(this.apiClient,params);
844
- return path2=formatMap("batchPredictionJobs/{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.
845
- headers},response2})),response.then(apiResponse=>deleteResourceJobFromVertex(apiResponse))}else{let body=deleteBatchJobParametersToMldev(this.apiClient,params);return path2=formatMap("batches/{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:
846
- _d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>deleteResourceJobFromMldev(apiResponse))}}};function authConfigToMldev$3(fromObject){let toObject={},fromApiKey=getValueByPath(fromObject,["apiKey"]);if(fromApiKey!=null&&setValueByPath(toObject,["apiKey"],fromApiKey),getValueByPath(fromObject,["apiKeyConfig"])!==void 0)throw new Error("apiKe\
847
- yConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["authType"])!==void 0)throw new Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Deve\
848
- loper API mode.");if(getValueByPath(fromObject,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["oidcConfig"])!==void 0)throw new Error("oidcConfig para\
849
- meter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function contentToMldev$3(fromObject){let toObject={},fromParts=getValueByPath(fromObject,["parts"]);if(fromParts!=null){let transformedList=fromParts;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>partToMldev$3(item))),setValueByPath(toObject,["parts"],transformedList)}let fromRole=getValueByPath(fromObject,["role"]);return fromRole!=null&&setValueByPath(
850
- toObject,["role"],fromRole),toObject}function contentToVertex$3(fromObject){let toObject={},fromParts=getValueByPath(fromObject,["parts"]);if(fromParts!=null){let transformedList=fromParts;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>partToVertex$3(item))),setValueByPath(toObject,["parts"],transformedList)}let fromRole=getValueByPath(fromObject,["role"]);return fromRole!=null&&setValueByPath(toObject,["role"],fromRole),toObject}function createCachedContentConfigToMldev(fromObject,parentObject){
776
+ null&&setValueByPath(toObject,["enableEnhancedCivicAnswers"],fromEnableEnhancedCivicAnswers),getValueByPath(fromObject,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromContinuationToken=getValueByPath(fromObject,["continuationToken"]);if(parentObject!==void 0&&fromContinuationToken!=null&&setValueByPath(parentObject,["continuationToken"],fromContinuationToken),getValueByPath(
777
+ fromObject,["generationOutputConfig"])!==void 0)throw new Error("generationOutputConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromStore=getValueByPath(fromObject,["store"]);return parentObject!==void 0&&fromStore!=null&&setValueByPath(parentObject,["store"],fromStore),toObject}function generateContentResponseFromMldev$1(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=
778
+ null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromCandidates=getValueByPath(fromObject,["candidates"]);if(fromCandidates!=null){let transformedList=fromCandidates;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>candidateFromMldev$1(item))),setValueByPath(toObject,["candidates"],transformedList)}let fromModelVersion=getValueByPath(fromObject,["modelVersion"]);fromModelVersion!=null&&setValueByPath(toObject,["modelVersion"],fromModelVersion);
779
+ let fromPromptFeedback=getValueByPath(fromObject,["promptFeedback"]);fromPromptFeedback!=null&&setValueByPath(toObject,["promptFeedback"],fromPromptFeedback);let fromResponseId=getValueByPath(fromObject,["responseId"]);fromResponseId!=null&&setValueByPath(toObject,["responseId"],fromResponseId);let fromUsageMetadata=getValueByPath(fromObject,["usageMetadata"]);fromUsageMetadata!=null&&setValueByPath(toObject,["usageMetadata"],fromUsageMetadata);let fromModelStatus=getValueByPath(fromObject,["mod\
780
+ elStatus"]);return fromModelStatus!=null&&setValueByPath(toObject,["modelStatus"],fromModelStatus),toObject}function getBatchJobParametersToMldev(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],tBatchJobName(apiClient,fromName)),toObject}function getBatchJobParametersToVertex(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,
781
+ ["_url","name"],tBatchJobName(apiClient,fromName)),toObject}function googleMapsToMldev$4(fromObject){let toObject={},fromAuthConfig=getValueByPath(fromObject,["authConfig"]);fromAuthConfig!=null&&setValueByPath(toObject,["authConfig"],authConfigToMldev$4(fromAuthConfig));let fromEnableWidget=getValueByPath(fromObject,["enableWidget"]);if(fromEnableWidget!=null&&setValueByPath(toObject,["enableWidget"],fromEnableWidget),getValueByPath(fromObject,["groundingTypes"])!==void 0)throw new Error("groun\
782
+ dingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function googleSearchToMldev$4(fromObject){let toObject={};if(getValueByPath(fromObject,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is on\
783
+ ly supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromSearchTypes=getValueByPath(fromObject,["searchTypes"]);fromSearchTypes!=null&&setValueByPath(toObject,["searchTypes"],fromSearchTypes);let fromTimeRangeFilter=getValueByPath(fromObject,["timeRangeFilter"]);return fromTimeRangeFilter!=null&&setValueByPath(toObject,["timeRangeFilter"],fromTimeRangeFilter),toObject}function imageConfigToMldev$1(fromObject){let toObject={},fromAspectRatio=getValueByPath(
784
+ fromObject,["aspectRatio"]);fromAspectRatio!=null&&setValueByPath(toObject,["aspectRatio"],fromAspectRatio);let fromImageSize=getValueByPath(fromObject,["imageSize"]);if(fromImageSize!=null&&setValueByPath(toObject,["imageSize"],fromImageSize),getValueByPath(fromObject,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["outputMimeType"])!==void 0)throw new Error(
785
+ "outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["imageOutputOptions"])!==void 0)throw new Error("imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform \
786
+ mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["prominentPeople"])!==void 0)throw new Error("prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function inlinedRequestToMldev(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["request","model"],tModel(apiClient,fromModel));let fromContents=getValueByPath(fromObject,
787
+ ["contents"]);if(fromContents!=null){let transformedList=tContents(fromContents);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>contentToMldev$4(item))),setValueByPath(toObject,["request","contents"],transformedList)}let fromMetadata=getValueByPath(fromObject,["metadata"]);fromMetadata!=null&&setValueByPath(toObject,["metadata"],fromMetadata);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["request","generationCon\
788
+ fig"],generateContentConfigToMldev$1(apiClient,fromConfig,getValueByPath(toObject,["request"],{}))),toObject}function inlinedResponseFromMldev(fromObject){let toObject={},fromResponse=getValueByPath(fromObject,["response"]);fromResponse!=null&&setValueByPath(toObject,["response"],generateContentResponseFromMldev$1(fromResponse));let fromMetadata=getValueByPath(fromObject,["metadata"]);fromMetadata!=null&&setValueByPath(toObject,["metadata"],fromMetadata);let fromError=getValueByPath(fromObject,[
789
+ "error"]);return fromError!=null&&setValueByPath(toObject,["error"],fromError),toObject}function listBatchJobsConfigToMldev(fromObject,parentObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);if(parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken),getValueByPath(
790
+ fromObject,["filter"])!==void 0)throw new Error("filter parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function listBatchJobsConfigToVertex(fromObject,parentObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);parentObject!==void 0&&fromPageToken!=
791
+ null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken);let fromFilter=getValueByPath(fromObject,["filter"]);return parentObject!==void 0&&fromFilter!=null&&setValueByPath(parentObject,["_query","filter"],fromFilter),toObject}function listBatchJobsParametersToMldev(fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listBatchJobsConfigToMldev(fromConfig,toObject),toObject}function listBatchJobsParametersToVertex(fromObject){let toObject={},
792
+ fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listBatchJobsConfigToVertex(fromConfig,toObject),toObject}function listBatchJobsResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);
793
+ let fromBatchJobs=getValueByPath(fromObject,["operations"]);if(fromBatchJobs!=null){let transformedList=fromBatchJobs;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>batchJobFromMldev(item))),setValueByPath(toObject,["batchJobs"],transformedList)}return toObject}function listBatchJobsResponseFromVertex(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);
794
+ let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromBatchJobs=getValueByPath(fromObject,["batchPredictionJobs"]);if(fromBatchJobs!=null){let transformedList=fromBatchJobs;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>batchJobFromVertex(item))),setValueByPath(toObject,["batchJobs"],transformedList)}return toObject}function partToMldev$4(fromObject){let toObject={},
795
+ fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=null&&setValueByPath(toObject,["toolCall"],fromToolCall);let fromToolResponse=getValueByPath(fromObject,["toolResponse"]);fromToolResponse!=null&&setValueByPath(toObject,["toolResponse"],fromToolResponse);let fromAudioTranscription=getValueByPath(fromObject,["audioTrans\
796
+ cription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["f\
797
+ ileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],functionCallToMldev$4(fromFunctionCall));let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&
798
+ setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,
799
+ ["videoMetadata"]);fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata);let fromPartMetadata=getValueByPath(fromObject,["partMetadata"]);fromPartMetadata!=null&&setValueByPath(toObject,["partMetadata"],fromPartMetadata);let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=
800
+ null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function safetySettingToMldev$3(fromObject){let toObject={},fromCategory=getValueByPath(fromObject,["category"]);if(fromCategory!=null&&setValueByPath(toObject,["category"],fromCategory),getValueByPath(fromObject,["method"])!==void 0)throw new Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromThreshold=getValueByPath(fromObject,["threshold"]);
801
+ return fromThreshold!=null&&setValueByPath(toObject,["threshold"],fromThreshold),toObject}function toolConfigToMldev$2(fromObject){let toObject={},fromFunctionCallingConfig=getValueByPath(fromObject,["functionCallingConfig"]);fromFunctionCallingConfig!=null&&setValueByPath(toObject,["functionCallingConfig"],functionCallingConfigToMldev$2(fromFunctionCallingConfig));let fromRetrievalConfig=getValueByPath(fromObject,["retrievalConfig"]);fromRetrievalConfig!=null&&setValueByPath(toObject,["retrieva\
802
+ lConfig"],fromRetrievalConfig);let fromIncludeServerSideToolInvocations=getValueByPath(fromObject,["includeServerSideToolInvocations"]);return fromIncludeServerSideToolInvocations!=null&&setValueByPath(toObject,["includeServerSideToolInvocations"],fromIncludeServerSideToolInvocations),toObject}function toolToMldev$4(fromObject){let toObject={};if(getValueByPath(fromObject,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not \
803
+ in Gemini Developer API mode.");let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],googleMapsToMldev$4(fromGoogleMaps));let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["\
804
+ codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);if(fromComputerUse!=null&&setValueByPath(toObject,["computerUse"],fromComputerUse),getValueByPath(fromObject,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["exaAiSearch"])!==
805
+ void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromFunctionDeclarations=getValueByPath(fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functionDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["\
806
+ googleSearch"]);fromGoogleSearch!=null&&setValueByPath(toObject,["googleSearch"],googleSearchToMldev$4(fromGoogleSearch));let fromGoogleSearchRetrieval=getValueByPath(fromObject,["googleSearchRetrieval"]);if(fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval),getValueByPath(fromObject,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Develop\
807
+ er API mode.");let fromUrlContext=getValueByPath(fromObject,["urlContext"]);fromUrlContext!=null&&setValueByPath(toObject,["urlContext"],fromUrlContext);let fromFileSearch=getValueByPath(fromObject,["fileSearch"]);return fromFileSearch!=null&&setValueByPath(toObject,["fileSearch"],fromFileSearch),toObject}function vertexMultimodalDatasetDestinationFromVertex(fromObject){let toObject={},fromBigqueryDestination=getValueByPath(fromObject,["bigqueryDestination","outputUri"]);fromBigqueryDestination!=
808
+ null&&setValueByPath(toObject,["bigqueryDestination"],fromBigqueryDestination);let fromDisplayName=getValueByPath(fromObject,["displayName"]);return fromDisplayName!=null&&setValueByPath(toObject,["displayName"],fromDisplayName),toObject}function vertexMultimodalDatasetDestinationToVertex(fromObject){let toObject={},fromBigqueryDestination=getValueByPath(fromObject,["bigqueryDestination"]);fromBigqueryDestination!=null&&setValueByPath(toObject,["bigqueryDestination","outputUri"],fromBigqueryDestination);
809
+ let fromDisplayName=getValueByPath(fromObject,["displayName"]);return fromDisplayName!=null&&setValueByPath(toObject,["displayName"],fromDisplayName),toObject}var PagedItem;(function(PagedItem2){PagedItem2.PAGED_ITEM_BATCH_JOBS="batchJobs",PagedItem2.PAGED_ITEM_MODELS="models",PagedItem2.PAGED_ITEM_TUNING_JOBS="tuningJobs",PagedItem2.PAGED_ITEM_FILES="files",PagedItem2.PAGED_ITEM_CACHED_CONTENTS="cachedContents",PagedItem2.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",PagedItem2.PAGED_ITEM_DOCUMENTS=
810
+ "documents",PagedItem2.PAGED_ITEM_SKILLS="skills"})(PagedItem||(PagedItem={}));var Pager=class{constructor(name,request,response,params){this.pageInternal=[],this.paramsInternal={},this.requestInternal=request,this.init(name,response,params)}init(name,response,params){var _a2,_b;this.nameInternal=name,this.pageInternal=response[this.nameInternal]||[],this.sdkHttpResponseInternal=response?.sdkHttpResponse,this.idxInternal=0;let requestParams={config:{}};!params||Object.keys(params).length===0?requestParams=
811
+ {config:{}}:typeof params=="object"?requestParams=Object.assign({},params):requestParams=params,requestParams.config&&(requestParams.config.pageToken=response.nextPageToken),this.paramsInternal=requestParams,this.pageInternalSize=(_b=(_a2=requestParams.config)===null||_a2===void 0?void 0:_a2.pageSize)!==null&&_b!==void 0?_b:this.pageInternal.length}initNextPage(response){this.init(this.nameInternal,response,this.paramsInternal)}get page(){return this.pageInternal}get name(){return this.nameInternal}get pageSize(){
812
+ return this.pageInternalSize}get sdkHttpResponse(){return this.sdkHttpResponseInternal}get params(){return this.paramsInternal}get pageLength(){return this.pageInternal.length}getItem(index){return this.pageInternal[index]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};let item=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:item,done:!1}},return:async()=>({value:void 0,
813
+ done:!0})}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");let response=await this.requestInternal(this.params);return this.initNextPage(response),this.page}hasNextPage(){var _a2;return((_a2=this.params.config)===null||_a2===void 0?void 0:_a2.pageToken)!==void 0}};var Batches=class extends BaseModule{constructor(apiClient){super(),this.apiClient=apiClient,this.list=async(params={})=>new Pager(PagedItem.PAGED_ITEM_BATCH_JOBS,x=>this.listInternal(x),await this.listInternal(
814
+ params),params),this.create=async params=>(this.apiClient.isVertexAI()&&(params.config=this.formatDestination(params.src,params.config)),this.createInternal(params)),this.createEmbeddings=async params=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw new Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(params)}}createInlinedGenerateContentRequest(params){
815
+ let body=createBatchJobParametersToMldev(this.apiClient,params),urlParams=body._url,path2=formatMap("{model}:batchGenerateContent",urlParams),requestsWrapper=body.batch.inputConfig.requests,requests=requestsWrapper.requests,newRequests=[];for(let request of requests){let requestDict=Object.assign({},request);if(requestDict.systemInstruction){let systemInstructionValue=requestDict.systemInstruction;delete requestDict.systemInstruction;let requestContent=requestDict.request;requestContent.systemInstruction=
816
+ systemInstructionValue,requestDict.request=requestContent}newRequests.push(requestDict)}return requestsWrapper.requests=newRequests,delete body.config,delete body._url,delete body._query,{path:path2,body}}getGcsUri(src){if(typeof src=="string")return src.startsWith("gs://")?src:void 0;if(!Array.isArray(src)&&src.gcsUri&&src.gcsUri.length>0)return src.gcsUri[0]}getBigqueryUri(src){if(typeof src=="string")return src.startsWith("bq://")?src:void 0;if(!Array.isArray(src))return src.bigqueryUri}formatDestination(src,config){
817
+ let newConfig=config?Object.assign({},config):{},timestampStr=Date.now().toString();if(newConfig.displayName||(newConfig.displayName=`genaiBatchJob_${timestampStr}`),newConfig.dest===void 0){let gcsUri=this.getGcsUri(src),bigqueryUri=this.getBigqueryUri(src);if(gcsUri)gcsUri.endsWith(".jsonl")?newConfig.dest=`${gcsUri.slice(0,-6)}/dest`:newConfig.dest=`${gcsUri}_dest_${timestampStr}`;else if(bigqueryUri)newConfig.dest=`${bigqueryUri}_dest_${timestampStr}`;else throw new Error("Unsupported source\
818
+ for Gemini Enterprise Agent Platform (previously known as Vertex AI): No GCS or BigQuery URI found.")}return newConfig}async createInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=createBatchJobParametersToVertex(this.apiClient,params);return path2=formatMap("batchPredictionJobs",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"\
819
+ POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>batchJobFromVertex(apiResponse))}else{let body=createBatchJobParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:batchGenerateContent",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,
820
+ body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>batchJobFromMldev(apiResponse))}}async createEmbeddingsInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=createEmbeddingsBatchJobParametersToMldev(
821
+ this.apiClient,params);return path2=formatMap("{model}:asyncBatchEmbedContent",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>batchJobFromMldev(apiResponse))}}async get(params){
822
+ var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=getBatchJobParametersToVertex(this.apiClient,params);return path2=formatMap("batchPredictionJobs/{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:
823
+ _b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>batchJobFromVertex(apiResponse))}else{let body=getBatchJobParametersToMldev(this.apiClient,params);return path2=formatMap("batches/{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||
824
+ _d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>batchJobFromMldev(apiResponse))}}async cancel(params){var _a2,_b,_c,_d;let path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=cancelBatchJobParametersToVertex(this.apiClient,params);path2=formatMap("batchPredictionJobs/{name}:cancel",body._url),queryParams=body._query,delete body._url,delete body._query,await this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),
825
+ httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal})}else{let body=cancelBatchJobParametersToMldev(this.apiClient,params);path2=formatMap("batches/{name}:cancel",body._url),queryParams=body._query,delete body._url,delete body._query,await this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:
826
+ _c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal})}}async listInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=listBatchJobsParametersToVertex(params);return path2=formatMap("batchPredictionJobs",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===
827
+ null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=listBatchJobsResponseFromVertex(apiResponse),typedResp=new ListBatchJobsResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=listBatchJobsParametersToMldev(params);
828
+ return path2=formatMap("batches",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},
829
+ response2})),response.then(apiResponse=>{let resp=listBatchJobsResponseFromMldev(apiResponse),typedResp=new ListBatchJobsResponse;return Object.assign(typedResp,resp),typedResp})}}async delete(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=deleteBatchJobParametersToVertex(this.apiClient,params);return path2=formatMap("batchPredictionJobs/{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request(
830
+ {path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>deleteResourceJobFromVertex(apiResponse))}else{let body=deleteBatchJobParametersToMldev(this.
831
+ apiClient,params);return path2=formatMap("batches/{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.
832
+ headers},response2})),response.then(apiResponse=>deleteResourceJobFromMldev(apiResponse))}}};function authConfigToMldev$3(fromObject){let toObject={},fromApiKey=getValueByPath(fromObject,["apiKey"]);if(fromApiKey!=null&&setValueByPath(toObject,["apiKey"],fromApiKey),getValueByPath(fromObject,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["authType"])!==
833
+ void 0)throw new Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is only supported in Gemini Ent\
834
+ erprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function contentToMldev$3(fromObject){let toObject={},
835
+ fromParts=getValueByPath(fromObject,["parts"]);if(fromParts!=null){let transformedList=fromParts;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>partToMldev$3(item))),setValueByPath(toObject,["parts"],transformedList)}let fromRole=getValueByPath(fromObject,["role"]);return fromRole!=null&&setValueByPath(toObject,["role"],fromRole),toObject}function contentToVertex$3(fromObject){let toObject={},fromParts=getValueByPath(fromObject,["parts"]);if(fromParts!=null){let transformedList=fromParts;
836
+ Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>partToVertex$3(item))),setValueByPath(toObject,["parts"],transformedList)}let fromRole=getValueByPath(fromObject,["role"]);return fromRole!=null&&setValueByPath(toObject,["role"],fromRole),toObject}function createCachedContentConfigToMldev(fromObject,parentObject){let toObject={},fromTtl=getValueByPath(fromObject,["ttl"]);parentObject!==void 0&&fromTtl!=null&&setValueByPath(parentObject,["ttl"],fromTtl);let fromExpireTime=getValueByPath(
837
+ fromObject,["expireTime"]);parentObject!==void 0&&fromExpireTime!=null&&setValueByPath(parentObject,["expireTime"],fromExpireTime);let fromDisplayName=getValueByPath(fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["displayName"],fromDisplayName);let fromContents=getValueByPath(fromObject,["contents"]);if(parentObject!==void 0&&fromContents!=null){let transformedList=tContents(fromContents);Array.isArray(transformedList)&&(transformedList=transformedList.
838
+ map(item=>contentToMldev$3(item))),setValueByPath(parentObject,["contents"],transformedList)}let fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);parentObject!==void 0&&fromSystemInstruction!=null&&setValueByPath(parentObject,["systemInstruction"],contentToMldev$3(tContent(fromSystemInstruction)));let fromTools=getValueByPath(fromObject,["tools"]);if(parentObject!==void 0&&fromTools!=null){let transformedList=fromTools;Array.isArray(transformedList)&&(transformedList=transformedList.
839
+ map(item=>toolToMldev$3(item))),setValueByPath(parentObject,["tools"],transformedList)}let fromToolConfig=getValueByPath(fromObject,["toolConfig"]);if(parentObject!==void 0&&fromToolConfig!=null&&setValueByPath(parentObject,["toolConfig"],toolConfigToMldev$1(fromToolConfig)),getValueByPath(fromObject,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function createCachedContentConfigToVertex(fromObject,parentObject){
851
840
  let toObject={},fromTtl=getValueByPath(fromObject,["ttl"]);parentObject!==void 0&&fromTtl!=null&&setValueByPath(parentObject,["ttl"],fromTtl);let fromExpireTime=getValueByPath(fromObject,["expireTime"]);parentObject!==void 0&&fromExpireTime!=null&&setValueByPath(parentObject,["expireTime"],fromExpireTime);let fromDisplayName=getValueByPath(fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["displayName"],fromDisplayName);let fromContents=getValueByPath(
852
- fromObject,["contents"]);if(parentObject!==void 0&&fromContents!=null){let transformedList=tContents(fromContents);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>contentToMldev$3(item))),setValueByPath(parentObject,["contents"],transformedList)}let fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);parentObject!==void 0&&fromSystemInstruction!=null&&setValueByPath(parentObject,["systemInstruction"],contentToMldev$3(tContent(fromSystemInstruction)));
853
- let fromTools=getValueByPath(fromObject,["tools"]);if(parentObject!==void 0&&fromTools!=null){let transformedList=fromTools;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToMldev$3(item))),setValueByPath(parentObject,["tools"],transformedList)}let fromToolConfig=getValueByPath(fromObject,["toolConfig"]);if(parentObject!==void 0&&fromToolConfig!=null&&setValueByPath(parentObject,["toolConfig"],toolConfigToMldev$1(fromToolConfig)),getValueByPath(fromObject,["kmsKeyN\
854
- ame"])!==void 0)throw new Error("kmsKeyName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function createCachedContentConfigToVertex(fromObject,parentObject){let toObject={},fromTtl=getValueByPath(fromObject,["ttl"]);parentObject!==void 0&&fromTtl!=null&&setValueByPath(parentObject,["ttl"],fromTtl);let fromExpireTime=getValueByPath(fromObject,["expireTime"]);parentObject!==void 0&&fromExpireTime!=null&&setValueByPath(parentObject,
855
- ["expireTime"],fromExpireTime);let fromDisplayName=getValueByPath(fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["displayName"],fromDisplayName);let fromContents=getValueByPath(fromObject,["contents"]);if(parentObject!==void 0&&fromContents!=null){let transformedList=tContents(fromContents);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>contentToVertex$3(item))),setValueByPath(parentObject,["contents"],transformedList)}
856
- let fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);parentObject!==void 0&&fromSystemInstruction!=null&&setValueByPath(parentObject,["systemInstruction"],contentToVertex$3(tContent(fromSystemInstruction)));let fromTools=getValueByPath(fromObject,["tools"]);if(parentObject!==void 0&&fromTools!=null){let transformedList=fromTools;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToVertex$3(item))),setValueByPath(parentObject,["tools"],transformedList)}
857
- let fromToolConfig=getValueByPath(fromObject,["toolConfig"]);parentObject!==void 0&&fromToolConfig!=null&&setValueByPath(parentObject,["toolConfig"],toolConfigToVertex$1(fromToolConfig));let fromKmsKeyName=getValueByPath(fromObject,["kmsKeyName"]);return parentObject!==void 0&&fromKmsKeyName!=null&&setValueByPath(parentObject,["encryption_spec","kmsKeyName"],fromKmsKeyName),toObject}function createCachedContentParametersToMldev(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,
858
- ["model"]);fromModel!=null&&setValueByPath(toObject,["model"],tCachesModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&createCachedContentConfigToMldev(fromConfig,toObject),toObject}function createCachedContentParametersToVertex(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["model"],tCachesModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["c\
859
- onfig"]);return fromConfig!=null&&createCachedContentConfigToVertex(fromConfig,toObject),toObject}function deleteCachedContentParametersToMldev(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName)),toObject}function deleteCachedContentParametersToVertex(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(
860
- toObject,["_url","name"],tCachedContentName(apiClient,fromName)),toObject}function deleteCachedContentResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);return fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse),toObject}function deleteCachedContentResponseFromVertex(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);return fromSdkHttpResponse!=null&&setValueByPath(
861
- toObject,["sdkHttpResponse"],fromSdkHttpResponse),toObject}function functionCallToMldev$3(fromObject){let toObject={},fromArgs=getValueByPath(fromObject,["args"]);fromArgs!=null&&setValueByPath(toObject,["args"],fromArgs);let fromId=getValueByPath(fromObject,["id"]);fromId!=null&&setValueByPath(toObject,["id"],fromId);let fromName=getValueByPath(fromObject,["name"]);if(fromName!=null&&setValueByPath(toObject,["name"],fromName),getValueByPath(fromObject,["partialArgs"])!==void 0)throw new Error("\
862
- partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["willContinue"])!==void 0)throw new Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function functionCallingConfigToMldev$1(fromObject){let toObject={},fromAllowedFunctionNames=getValueByPath(fromObject,["allowedFunctionNames"]);fromAllowedFunctionNames!=null&&
863
- setValueByPath(toObject,["allowedFunctionNames"],fromAllowedFunctionNames);let fromMode=getValueByPath(fromObject,["mode"]);if(fromMode!=null&&setValueByPath(toObject,["mode"],fromMode),getValueByPath(fromObject,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function getCachedContentParametersToMldev(apiClient,fromObject){let toObject={},
864
- fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName)),toObject}function getCachedContentParametersToVertex(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName)),toObject}function googleMapsToMldev$3(fromObject){let toObject={},fromAuthConfig=getValueByPath(fromObject,["auth\
865
- Config"]);fromAuthConfig!=null&&setValueByPath(toObject,["authConfig"],authConfigToMldev$3(fromAuthConfig));let fromEnableWidget=getValueByPath(fromObject,["enableWidget"]);if(fromEnableWidget!=null&&setValueByPath(toObject,["enableWidget"],fromEnableWidget),getValueByPath(fromObject,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function googleSearchToMldev$3(fromObject){
866
- let toObject={};if(getValueByPath(fromObject,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromSearchTypes=getValueByPath(fromObject,["searchTypes"]);fromSearchTypes!=null&&
867
- setValueByPath(toObject,["searchTypes"],fromSearchTypes);let fromTimeRangeFilter=getValueByPath(fromObject,["timeRangeFilter"]);return fromTimeRangeFilter!=null&&setValueByPath(toObject,["timeRangeFilter"],fromTimeRangeFilter),toObject}function listCachedContentsConfigToMldev(fromObject,parentObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(
868
- fromObject,["pageToken"]);return parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken),toObject}function listCachedContentsConfigToVertex(fromObject,parentObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);return parentObject!==void 0&&fromPageToken!=null&&
869
- setValueByPath(parentObject,["_query","pageToken"],fromPageToken),toObject}function listCachedContentsParametersToMldev(fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listCachedContentsConfigToMldev(fromConfig,toObject),toObject}function listCachedContentsParametersToVertex(fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listCachedContentsConfigToVertex(fromConfig,toObject),toObject}function listCachedContentsResponseFromMldev(fromObject){
870
- let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromCachedContents=getValueByPath(fromObject,["cachedContents"]);if(fromCachedContents!=null){let transformedList=fromCachedContents;Array.isArray(transformedList)&&(transformedList=
871
- transformedList.map(item=>item)),setValueByPath(toObject,["cachedContents"],transformedList)}return toObject}function listCachedContentsResponseFromVertex(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromCachedContents=getValueByPath(
872
- fromObject,["cachedContents"]);if(fromCachedContents!=null){let transformedList=fromCachedContents;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["cachedContents"],transformedList)}return toObject}function mcpServerToVertex$3(fromObject){let toObject={};if(getValueByPath(fromObject,["name"])!==void 0)throw new Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(
873
- fromObject,["streamableHttpTransport"])!==void 0)throw new Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function partToMldev$3(fromObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=null&&setValueByPath(
874
- toObject,["toolCall"],fromToolCall);let fromToolResponse=getValueByPath(fromObject,["toolResponse"]);fromToolResponse!=null&&setValueByPath(toObject,["toolResponse"],fromToolResponse);let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["co\
875
- deExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],functionCallToMldev$3(fromFunctionCall));
876
- let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(
877
- toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata);let fromPartMetadata=getValueByPath(fromObject,["partMetadata"]);fromPartMetadata!=null&&setValueByPath(toObject,["partMetadata"],fromPartMetadata);
878
- let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function partToVertex$3(fromObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);if(fromMediaResolution!=null&&setValueByPath(
879
- toObject,["mediaResolution"],fromMediaResolution),getValueByPath(fromObject,["toolCall"])!==void 0)throw new Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);
880
- fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=
881
- null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],fromFunctionCall);let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);
882
- let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);if(fromVideoMetadata!=null&&setValueByPath(
883
- toObject,["videoMetadata"],fromVideoMetadata),getValueByPath(fromObject,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&
884
- setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function toolConfigToMldev$1(fromObject){let toObject={},fromFunctionCallingConfig=getValueByPath(fromObject,["functionCallingConfig"]);fromFunctionCallingConfig!=null&&setValueByPath(toObject,["functionCallingConfig"],functionCallingConfigToMldev$1(fromFunctionCallingConfig));let fromRetrievalConfig=getValueByPath(fromObject,["retrievalConfig"]);fromRetrievalConfig!=null&&setValueByPath(toObject,["retrievalConfig"],fromRetrievalConfig);
885
- let fromIncludeServerSideToolInvocations=getValueByPath(fromObject,["includeServerSideToolInvocations"]);return fromIncludeServerSideToolInvocations!=null&&setValueByPath(toObject,["includeServerSideToolInvocations"],fromIncludeServerSideToolInvocations),toObject}function toolConfigToVertex$1(fromObject){let toObject={},fromFunctionCallingConfig=getValueByPath(fromObject,["functionCallingConfig"]);fromFunctionCallingConfig!=null&&setValueByPath(toObject,["functionCallingConfig"],fromFunctionCallingConfig);
886
- let fromRetrievalConfig=getValueByPath(fromObject,["retrievalConfig"]);if(fromRetrievalConfig!=null&&setValueByPath(toObject,["retrievalConfig"],fromRetrievalConfig),getValueByPath(fromObject,["includeServerSideToolInvocations"])!==void 0)throw new Error("includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function toolToMldev$3(fromObject){let toObject={};if(getValueByPath(fromObject,["retriev\
887
- al"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],googleMapsToMldev$3(fromGoogleMaps));let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),
888
- setValueByPath(toObject,["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);if(fromComputerUse!=null&&setValueByPath(toObject,["computerUse"],fromComputerUse),getValueByPath(fromObject,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise\
889
- Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromFunctionDeclarations=getValueByPath(fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(
890
- toObject,["functionDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleSearch"]);fromGoogleSearch!=null&&setValueByPath(toObject,["googleSearch"],googleSearchToMldev$3(fromGoogleSearch));let fromGoogleSearchRetrieval=getValueByPath(fromObject,["googleSearchRetrieval"]);if(fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval),getValueByPath(fromObject,["parallelAiSearch"])!==void 0)throw new Error("parallel\
891
- AiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromUrlContext=getValueByPath(fromObject,["urlContext"]);fromUrlContext!=null&&setValueByPath(toObject,["urlContext"],fromUrlContext);let fromFileSearch=getValueByPath(fromObject,["fileSearch"]);return fromFileSearch!=null&&setValueByPath(toObject,["fileSearch"],fromFileSearch),toObject}function toolToVertex$3(fromObject){let toObject={},fromRetrieval=getValueByPath(fromObject,[
892
- "retrieval"]);fromRetrieval!=null&&setValueByPath(toObject,["retrieval"],fromRetrieval);let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],fromGoogleMaps);let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>mcpServerToVertex$3(item))),setValueByPath(toObject,["mcpServers"],transformedList)}
893
- let fromCodeExecution=getValueByPath(fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);fromComputerUse!=null&&setValueByPath(toObject,["computerUse"],fromComputerUse);let fromEnterpriseWebSearch=getValueByPath(fromObject,["enterpriseWebSearch"]);fromEnterpriseWebSearch!=null&&setValueByPath(toObject,["enterpriseWebSearch"],fromEnterpriseWebSearch);let fromExaAiSearch=getValueByPath(
894
- fromObject,["exaAiSearch"]);fromExaAiSearch!=null&&setValueByPath(toObject,["exaAiSearch"],fromExaAiSearch);let fromFunctionDeclarations=getValueByPath(fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functionDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleSearch"]);fromGoogleSearch!=
895
- null&&setValueByPath(toObject,["googleSearch"],fromGoogleSearch);let fromGoogleSearchRetrieval=getValueByPath(fromObject,["googleSearchRetrieval"]);fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval);let fromParallelAiSearch=getValueByPath(fromObject,["parallelAiSearch"]);fromParallelAiSearch!=null&&setValueByPath(toObject,["parallelAiSearch"],fromParallelAiSearch);let fromUrlContext=getValueByPath(fromObject,["urlContext"]);if(fromUrlContext!=
896
- null&&setValueByPath(toObject,["urlContext"],fromUrlContext),getValueByPath(fromObject,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function updateCachedContentConfigToMldev(fromObject,parentObject){let toObject={},fromTtl=getValueByPath(fromObject,["ttl"]);parentObject!==void 0&&fromTtl!=null&&setValueByPath(parentObject,["ttl"],fromTtl);let fromExpireTime=getValueByPath(
897
- fromObject,["expireTime"]);return parentObject!==void 0&&fromExpireTime!=null&&setValueByPath(parentObject,["expireTime"],fromExpireTime),toObject}function updateCachedContentConfigToVertex(fromObject,parentObject){let toObject={},fromTtl=getValueByPath(fromObject,["ttl"]);parentObject!==void 0&&fromTtl!=null&&setValueByPath(parentObject,["ttl"],fromTtl);let fromExpireTime=getValueByPath(fromObject,["expireTime"]);return parentObject!==void 0&&fromExpireTime!=null&&setValueByPath(parentObject,["\
898
- expireTime"],fromExpireTime),toObject}function updateCachedContentParametersToMldev(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&updateCachedContentConfigToMldev(fromConfig,toObject),toObject}function updateCachedContentParametersToVertex(apiClient,fromObject){let toObject={},fromName=getValueByPath(
899
- fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&updateCachedContentConfigToVertex(fromConfig,toObject),toObject}var Caches=class extends BaseModule{constructor(apiClient){super(),this.apiClient=apiClient,this.list=async(params={})=>new Pager(PagedItem.PAGED_ITEM_CACHED_CONTENTS,x=>this.listInternal(x),await this.listInternal(params),params)}async create(params){
900
- var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=createCachedContentParametersToVertex(this.apiClient,params);return path2=formatMap("cachedContents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:
901
- _b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}else{let body=createCachedContentParametersToMldev(this.apiClient,params);return path2=formatMap("cachedContents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.
902
- abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async get(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=getCachedContentParametersToVertex(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===
903
- void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}else{let body=getCachedContentParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:
904
- _c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async delete(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=deleteCachedContentParametersToVertex(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.
905
- stringify(body),httpMethod:"DELETE",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=deleteCachedContentResponseFromVertex(apiResponse),typedResp=new DeleteCachedContentResponse;return Object.assign(
906
- typedResp,resp),typedResp})}else{let body=deleteCachedContentParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{
907
- let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=deleteCachedContentResponseFromMldev(apiResponse),typedResp=new DeleteCachedContentResponse;return Object.assign(typedResp,resp),typedResp})}}async update(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=updateCachedContentParametersToVertex(this.apiClient,params);return path2=formatMap("{name}",body._url),
908
- queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"PATCH",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}else{let body=updateCachedContentParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=
909
- body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"PATCH",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async listInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=listCachedContentsParametersToVertex(
910
- params);return path2=formatMap("cachedContents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.
911
- headers},response2})),response.then(apiResponse=>{let resp=listCachedContentsResponseFromVertex(apiResponse),typedResp=new ListCachedContentsResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=listCachedContentsParametersToMldev(params);return path2=formatMap("cachedContents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===
912
- null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=listCachedContentsResponseFromMldev(apiResponse),typedResp=new ListCachedContentsResponse;return Object.assign(typedResp,resp),typedResp})}}};function __rest(s,e){var t={};for(var p in s)
913
- Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t}function __values(o){var s=typeof Symbol=="function"&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],
914
- done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function __await(v){return this instanceof __await?(this.v=v,this):new __await(v)}function __asyncGenerator(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g=generator.apply(thisArg,_arguments||[]),i,q=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),verb("next"),verb("throw"),verb("return",
915
- awaitReturn),i[Symbol.asyncIterator]=function(){return this},i;function awaitReturn(f){return function(v){return Promise.resolve(v).then(f,reject)}}function verb(n,f){g[n]&&(i[n]=function(v){return new Promise(function(a,b){q.push([n,v,a,b])>1||resume(n,v)})},f&&(i[n]=f(i[n])))}function resume(n,v){try{step(g[n](v))}catch(e){settle(q[0][3],e)}}function step(r){r.value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}function fulfill(value){resume("next",value)}
916
- function reject(value){resume("throw",value)}function settle(f,v){f(v),q.shift(),q.length&&resume(q[0][0],q[0][1])}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m=o[Symbol.asyncIterator],i;return m?m.call(o):(o=typeof __values=="function"?__values(o):o[Symbol.iterator](),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){
917
- v=o[n](v),settle(resolve,reject,v.done,v.value)})}}function settle(resolve,reject,d,v){Promise.resolve(v).then(function(v2){resolve({value:v2,done:d})},reject)}}function isValidResponse(response){var _a2;if(response.candidates==null||response.candidates.length===0)return!1;let content=(_a2=response.candidates[0])===null||_a2===void 0?void 0:_a2.content;return content===void 0?!1:isValidContent(content)}function isValidContent(content){if(content.parts===void 0||content.parts.length===0)return!1;for(let part of content.parts)if(part===void 0||Object.keys(part).length===0)return!1;return!0}function validateHistory(history){if(history.length!==0){for(let content of history)
841
+ fromObject,["contents"]);if(parentObject!==void 0&&fromContents!=null){let transformedList=tContents(fromContents);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>contentToVertex$3(item))),setValueByPath(parentObject,["contents"],transformedList)}let fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);parentObject!==void 0&&fromSystemInstruction!=null&&setValueByPath(parentObject,["systemInstruction"],contentToVertex$3(tContent(fromSystemInstruction)));
842
+ let fromTools=getValueByPath(fromObject,["tools"]);if(parentObject!==void 0&&fromTools!=null){let transformedList=fromTools;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToVertex$3(item))),setValueByPath(parentObject,["tools"],transformedList)}let fromToolConfig=getValueByPath(fromObject,["toolConfig"]);parentObject!==void 0&&fromToolConfig!=null&&setValueByPath(parentObject,["toolConfig"],toolConfigToVertex$1(fromToolConfig));let fromKmsKeyName=getValueByPath(fromObject,
843
+ ["kmsKeyName"]);return parentObject!==void 0&&fromKmsKeyName!=null&&setValueByPath(parentObject,["encryption_spec","kmsKeyName"],fromKmsKeyName),toObject}function createCachedContentParametersToMldev(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["model"],tCachesModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&createCachedContentConfigToMldev(fromConfig,toObject),
844
+ toObject}function createCachedContentParametersToVertex(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["model"],tCachesModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&createCachedContentConfigToVertex(fromConfig,toObject),toObject}function deleteCachedContentParametersToMldev(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=
845
+ null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName)),toObject}function deleteCachedContentParametersToVertex(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName)),toObject}function deleteCachedContentResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);return fromSdkHttpResponse!=
846
+ null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse),toObject}function deleteCachedContentResponseFromVertex(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);return fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse),toObject}function functionCallToMldev$3(fromObject){let toObject={},fromArgs=getValueByPath(fromObject,["args"]);fromArgs!=null&&setValueByPath(toObject,["args"],fromArgs);let fromId=getValueByPath(
847
+ fromObject,["id"]);fromId!=null&&setValueByPath(toObject,["id"],fromId);let fromName=getValueByPath(fromObject,["name"]);if(fromName!=null&&setValueByPath(toObject,["name"],fromName),getValueByPath(fromObject,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["willContinue"])!==void 0)throw new Error("willContinue parameter is only supported in Gemini Enterp\
848
+ rise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function functionCallingConfigToMldev$1(fromObject){let toObject={},fromAllowedFunctionNames=getValueByPath(fromObject,["allowedFunctionNames"]);fromAllowedFunctionNames!=null&&setValueByPath(toObject,["allowedFunctionNames"],fromAllowedFunctionNames);let fromMode=getValueByPath(fromObject,["mode"]);if(fromMode!=null&&setValueByPath(toObject,["mode"],fromMode),getValueByPath(fromObject,["streamFunctionCallArguments"])!==
849
+ void 0)throw new Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function getCachedContentParametersToMldev(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName)),toObject}function getCachedContentParametersToVertex(apiClient,fromObject){let toObject={},fromName=getValueByPath(
850
+ fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName)),toObject}function googleMapsToMldev$3(fromObject){let toObject={},fromAuthConfig=getValueByPath(fromObject,["authConfig"]);fromAuthConfig!=null&&setValueByPath(toObject,["authConfig"],authConfigToMldev$3(fromAuthConfig));let fromEnableWidget=getValueByPath(fromObject,["enableWidget"]);if(fromEnableWidget!=null&&setValueByPath(toObject,["enableWidget"],fromEnableWidget),getValueByPath(
851
+ fromObject,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function googleSearchToMldev$3(fromObject){let toObject={};if(getValueByPath(fromObject,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["excludeDomai\
852
+ ns"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromSearchTypes=getValueByPath(fromObject,["searchTypes"]);fromSearchTypes!=null&&setValueByPath(toObject,["searchTypes"],fromSearchTypes);let fromTimeRangeFilter=getValueByPath(fromObject,["timeRangeFilter"]);return fromTimeRangeFilter!=null&&setValueByPath(toObject,["timeRangeFilter"],fromTimeRangeFilter),toObject}function listCachedContentsConfigToMldev(fromObject,parentObject){
853
+ let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);return parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken),toObject}function listCachedContentsConfigToVertex(fromObject,parentObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==
854
+ void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);return parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken),toObject}function listCachedContentsParametersToMldev(fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listCachedContentsConfigToMldev(fromConfig,toObject),toObject}function listCachedContentsParametersToVertex(fromObject){
855
+ let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listCachedContentsConfigToVertex(fromConfig,toObject),toObject}function listCachedContentsResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,
856
+ ["nextPageToken"],fromNextPageToken);let fromCachedContents=getValueByPath(fromObject,["cachedContents"]);if(fromCachedContents!=null){let transformedList=fromCachedContents;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["cachedContents"],transformedList)}return toObject}function listCachedContentsResponseFromVertex(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&
857
+ setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromCachedContents=getValueByPath(fromObject,["cachedContents"]);if(fromCachedContents!=null){let transformedList=fromCachedContents;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["cachedContents"],transformedList)}return toObject}
858
+ function mcpServerToVertex$3(fromObject){let toObject={};if(getValueByPath(fromObject,["name"])!==void 0)throw new Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["streamableHttpTransport"])!==void 0)throw new Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function partToMldev$3(fromObject){let toObject={},
859
+ fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=null&&setValueByPath(toObject,["toolCall"],fromToolCall);let fromToolResponse=getValueByPath(fromObject,["toolResponse"]);fromToolResponse!=null&&setValueByPath(toObject,["toolResponse"],fromToolResponse);let fromAudioTranscription=getValueByPath(fromObject,["audioTrans\
860
+ cription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["f\
861
+ ileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],functionCallToMldev$3(fromFunctionCall));let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&
862
+ setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,
863
+ ["videoMetadata"]);fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata);let fromPartMetadata=getValueByPath(fromObject,["partMetadata"]);fromPartMetadata!=null&&setValueByPath(toObject,["partMetadata"],fromPartMetadata);let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=
864
+ null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function partToVertex$3(fromObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);if(fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution),getValueByPath(fromObject,["toolCall"])!==void 0)throw new Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,
865
+ ["toolResponse"])!==void 0)throw new Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);
866
+ let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],fromFunctionCall);let fromFunctionResponse=getValueByPath(fromObject,["functionRespo\
867
+ nse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(
868
+ fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);if(fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata),getValueByPath(fromObject,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromMediaProcessing=getValueByPath(
869
+ fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function toolConfigToMldev$1(fromObject){let toObject={},fromFunctionCallingConfig=getValueByPath(fromObject,["functionCallingConfig"]);fromFunctionCallingConfig!=null&&setValueByPath(toObject,["functio\
870
+ nCallingConfig"],functionCallingConfigToMldev$1(fromFunctionCallingConfig));let fromRetrievalConfig=getValueByPath(fromObject,["retrievalConfig"]);fromRetrievalConfig!=null&&setValueByPath(toObject,["retrievalConfig"],fromRetrievalConfig);let fromIncludeServerSideToolInvocations=getValueByPath(fromObject,["includeServerSideToolInvocations"]);return fromIncludeServerSideToolInvocations!=null&&setValueByPath(toObject,["includeServerSideToolInvocations"],fromIncludeServerSideToolInvocations),toObject}
871
+ function toolConfigToVertex$1(fromObject){let toObject={},fromFunctionCallingConfig=getValueByPath(fromObject,["functionCallingConfig"]);fromFunctionCallingConfig!=null&&setValueByPath(toObject,["functionCallingConfig"],fromFunctionCallingConfig);let fromRetrievalConfig=getValueByPath(fromObject,["retrievalConfig"]);if(fromRetrievalConfig!=null&&setValueByPath(toObject,["retrievalConfig"],fromRetrievalConfig),getValueByPath(fromObject,["includeServerSideToolInvocations"])!==void 0)throw new Error(
872
+ "includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function toolToMldev$3(fromObject){let toObject={};if(getValueByPath(fromObject,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,
873
+ ["googleMaps"],googleMapsToMldev$3(fromGoogleMaps));let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,
874
+ ["computerUse"]);if(fromComputerUse!=null&&setValueByPath(toObject,["computerUse"],fromComputerUse),getValueByPath(fromObject,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromFunctionDeclarations=getValueByPath(
875
+ fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functionDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleSearch"]);fromGoogleSearch!=null&&setValueByPath(toObject,["googleSearch"],googleSearchToMldev$3(fromGoogleSearch));let fromGoogleSearchRetrieval=getValueByPath(fromObject,["google\
876
+ SearchRetrieval"]);if(fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval),getValueByPath(fromObject,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromUrlContext=getValueByPath(fromObject,["urlContext"]);fromUrlContext!=null&&setValueByPath(toObject,["urlContext"],fromUrlContext);let fromFileSearch=getValueByPath(
877
+ fromObject,["fileSearch"]);return fromFileSearch!=null&&setValueByPath(toObject,["fileSearch"],fromFileSearch),toObject}function toolToVertex$3(fromObject){let toObject={},fromRetrieval=getValueByPath(fromObject,["retrieval"]);fromRetrieval!=null&&setValueByPath(toObject,["retrieval"],fromRetrieval);let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],fromGoogleMaps);let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);
878
+ if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>mcpServerToVertex$3(item))),setValueByPath(toObject,["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);fromComputerUse!=null&&setValueByPath(toObject,["computerUse"],fromComputerUse);
879
+ let fromEnterpriseWebSearch=getValueByPath(fromObject,["enterpriseWebSearch"]);fromEnterpriseWebSearch!=null&&setValueByPath(toObject,["enterpriseWebSearch"],fromEnterpriseWebSearch);let fromExaAiSearch=getValueByPath(fromObject,["exaAiSearch"]);fromExaAiSearch!=null&&setValueByPath(toObject,["exaAiSearch"],fromExaAiSearch);let fromFunctionDeclarations=getValueByPath(fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(
880
+ transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functionDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleSearch"]);fromGoogleSearch!=null&&setValueByPath(toObject,["googleSearch"],fromGoogleSearch);let fromGoogleSearchRetrieval=getValueByPath(fromObject,["googleSearchRetrieval"]);fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval);let fromParallelAiSearch=getValueByPath(
881
+ fromObject,["parallelAiSearch"]);fromParallelAiSearch!=null&&setValueByPath(toObject,["parallelAiSearch"],fromParallelAiSearch);let fromUrlContext=getValueByPath(fromObject,["urlContext"]);if(fromUrlContext!=null&&setValueByPath(toObject,["urlContext"],fromUrlContext),getValueByPath(fromObject,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function updateCachedContentConfigToMldev(fromObject,parentObject){
882
+ let toObject={},fromTtl=getValueByPath(fromObject,["ttl"]);parentObject!==void 0&&fromTtl!=null&&setValueByPath(parentObject,["ttl"],fromTtl);let fromExpireTime=getValueByPath(fromObject,["expireTime"]);return parentObject!==void 0&&fromExpireTime!=null&&setValueByPath(parentObject,["expireTime"],fromExpireTime),toObject}function updateCachedContentConfigToVertex(fromObject,parentObject){let toObject={},fromTtl=getValueByPath(fromObject,["ttl"]);parentObject!==void 0&&fromTtl!=null&&setValueByPath(
883
+ parentObject,["ttl"],fromTtl);let fromExpireTime=getValueByPath(fromObject,["expireTime"]);return parentObject!==void 0&&fromExpireTime!=null&&setValueByPath(parentObject,["expireTime"],fromExpireTime),toObject}function updateCachedContentParametersToMldev(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=
884
+ null&&updateCachedContentConfigToMldev(fromConfig,toObject),toObject}function updateCachedContentParametersToVertex(apiClient,fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["_url","name"],tCachedContentName(apiClient,fromName));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&updateCachedContentConfigToVertex(fromConfig,toObject),toObject}var Caches=class extends BaseModule{constructor(apiClient){super(),
885
+ this.apiClient=apiClient,this.list=async(params={})=>new Pager(PagedItem.PAGED_ITEM_CACHED_CONTENTS,x=>this.listInternal(x),await this.listInternal(params),params)}async create(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=createCachedContentParametersToVertex(this.apiClient,params);return path2=formatMap("cachedContents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,
886
+ body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}else{let body=createCachedContentParametersToMldev(this.apiClient,params);return path2=formatMap("cachedContents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,
887
+ body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async get(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=getCachedContentParametersToVertex(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body.
888
+ _url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}else{let body=getCachedContentParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body.
889
+ _query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async delete(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=deleteCachedContentParametersToVertex(this.apiClient,params);return path2=
890
+ formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),
891
+ response.then(apiResponse=>{let resp=deleteCachedContentResponseFromVertex(apiResponse),typedResp=new DeleteCachedContentResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=deleteCachedContentParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_c=params.config)===null||_c===
892
+ void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=deleteCachedContentResponseFromMldev(apiResponse),typedResp=new DeleteCachedContentResponse;return Object.assign(typedResp,resp),typedResp})}}async update(params){var _a2,_b,_c,_d;let response,path2="",
893
+ queryParams={};if(this.apiClient.isVertexAI()){let body=updateCachedContentParametersToVertex(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"PATCH",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.
894
+ json()),response.then(resp=>resp)}else{let body=updateCachedContentParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"PATCH",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),
895
+ response.then(resp=>resp)}}async listInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=listCachedContentsParametersToVertex(params);return path2=formatMap("cachedContents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.
896
+ config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=listCachedContentsResponseFromVertex(apiResponse),typedResp=new ListCachedContentsResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=listCachedContentsParametersToMldev(params);return path2=formatMap("cachedContents",body._url),
897
+ queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=listCachedContentsResponseFromMldev(
898
+ apiResponse),typedResp=new ListCachedContentsResponse;return Object.assign(typedResp,resp),typedResp})}}};function __rest(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t}function __values(o){var s=typeof Symbol=="function"&&Symbol.
899
+ iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function __await(v){return this instanceof __await?(this.v=v,this):new __await(v)}function __asyncGenerator(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g=generator.apply(thisArg,_arguments||
900
+ []),i,q=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),verb("next"),verb("throw"),verb("return",awaitReturn),i[Symbol.asyncIterator]=function(){return this},i;function awaitReturn(f){return function(v){return Promise.resolve(v).then(f,reject)}}function verb(n,f){g[n]&&(i[n]=function(v){return new Promise(function(a,b){q.push([n,v,a,b])>1||resume(n,v)})},f&&(i[n]=f(i[n])))}function resume(n,v){try{step(g[n](v))}catch(e){settle(q[0][3],e)}}function step(r){
901
+ r.value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){f(v),q.shift(),q.length&&resume(q[0][0],q[0][1])}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m=o[Symbol.asyncIterator],i;return m?m.call(o):(o=typeof __values=="function"?__values(o):o[Symbol.iterator](),i={},verb("next"),verb(
902
+ "throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){v=o[n](v),settle(resolve,reject,v.done,v.value)})}}function settle(resolve,reject,d,v){Promise.resolve(v).then(function(v2){resolve({value:v2,done:d})},reject)}}function isValidResponse(response){var _a2;if(response.candidates==null||response.candidates.length===0)return!1;let content=(_a2=response.candidates[0])===null||_a2===void 0?void 0:_a2.content;return content===void 0?!1:isValidContent(content)}function isValidContent(content){if(content.parts===void 0||content.parts.length===0)return!1;for(let part of content.parts)if(part===void 0||Object.keys(part).length===0)return!1;return!0}function validateHistory(history){if(history.length!==0){for(let content of history)
918
903
  if(content.role!=="user"&&content.role!=="model")throw new Error(`Role must be user or model, but got ${content.role}.`)}}function extractCuratedHistory(comprehensiveHistory){if(comprehensiveHistory===void 0||comprehensiveHistory.length===0)return[];let curatedHistory=[],length=comprehensiveHistory.length,i=0;for(;i<length;)if(comprehensiveHistory[i].role==="user")curatedHistory.push(comprehensiveHistory[i]),i++;else{let modelOutput=[],isValid=!0;for(;i<length&&comprehensiveHistory[i].role==="mo\
919
904
  del";)modelOutput.push(comprehensiveHistory[i]),isValid&&!isValidContent(comprehensiveHistory[i])&&(isValid=!1),i++;isValid?curatedHistory.push(...modelOutput):curatedHistory.pop()}return curatedHistory}var Chats=class{constructor(modelsModule,apiClient){this.modelsModule=modelsModule,this.apiClient=apiClient}create(params){return new Chat(this.apiClient,this.modelsModule,params.model,params.config,structuredClone(params.history))}},Chat=class{constructor(apiClient,modelsModule,model,config={},history=[]){
920
905
  this.apiClient=apiClient,this.modelsModule=modelsModule,this.model=model,this.config=config,this.history=history,this.sendPromise=Promise.resolve(),validateHistory(history)}async sendMessage(params){var _a2;await this.sendPromise;let inputContent=tContent(params.message),responsePromise=this.modelsModule.generateContent({model:this.model,contents:this.getHistory(!0).concat(inputContent),config:(_a2=params.config)!==null&&_a2!==void 0?_a2:this.config});return this.sendPromise=(async()=>{var _a3,_b,
@@ -956,9 +941,12 @@ null&&setValueByPath(toObject,["temperature"],fromTemperature);let fromThinkingC
956
941
  void 0)throw new Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromTranslationConfig=getValueByPath(fromObject,["translationConfig"]);return fromTranslationConfig!=null&&setValueByPath(toObject,["translationConfig"],fromTranslationConfig),toObject}function googleMapsToMldev$2(fromObject){let toObject={},fromAuthConfig=getValueByPath(fromObject,["authConfig"]);fromAuthConfig!=null&&setValueByPath(toObject,
957
942
  ["authConfig"],authConfigToMldev$2(fromAuthConfig));let fromEnableWidget=getValueByPath(fromObject,["enableWidget"]);if(fromEnableWidget!=null&&setValueByPath(toObject,["enableWidget"],fromEnableWidget),getValueByPath(fromObject,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function googleSearchToMldev$2(fromObject){let toObject={};if(getValueByPath(fromObject,
958
943
  ["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromSearchTypes=getValueByPath(fromObject,["searchTypes"]);fromSearchTypes!=null&&setValueByPath(toObject,["searchTypes"],fromSearchTypes);
959
- let fromTimeRangeFilter=getValueByPath(fromObject,["timeRangeFilter"]);return fromTimeRangeFilter!=null&&setValueByPath(toObject,["timeRangeFilter"],fromTimeRangeFilter),toObject}function liveConnectConfigToMldev$1(fromObject,parentObject){let toObject={},fromGenerationConfig=getValueByPath(fromObject,["generationConfig"]);parentObject!==void 0&&fromGenerationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig"],fromGenerationConfig);let fromResponseModalities=getValueByPath(fromObject,
960
- ["responseModalities"]);parentObject!==void 0&&fromResponseModalities!=null&&setValueByPath(parentObject,["setup","generationConfig","responseModalities"],fromResponseModalities);let fromTemperature=getValueByPath(fromObject,["temperature"]);parentObject!==void 0&&fromTemperature!=null&&setValueByPath(parentObject,["setup","generationConfig","temperature"],fromTemperature);let fromTopP=getValueByPath(fromObject,["topP"]);parentObject!==void 0&&fromTopP!=null&&setValueByPath(parentObject,["setup",
961
- "generationConfig","topP"],fromTopP);let fromTopK=getValueByPath(fromObject,["topK"]);parentObject!==void 0&&fromTopK!=null&&setValueByPath(parentObject,["setup","generationConfig","topK"],fromTopK);let fromMaxOutputTokens=getValueByPath(fromObject,["maxOutputTokens"]);parentObject!==void 0&&fromMaxOutputTokens!=null&&setValueByPath(parentObject,["setup","generationConfig","maxOutputTokens"],fromMaxOutputTokens);let fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);parentObject!==
944
+ let fromTimeRangeFilter=getValueByPath(fromObject,["timeRangeFilter"]);return fromTimeRangeFilter!=null&&setValueByPath(toObject,["timeRangeFilter"],fromTimeRangeFilter),toObject}function liveClientContextUpdateToMldev(fromObject){let toObject={},fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);fromSystemInstruction!=null&&setValueByPath(toObject,["systemInstruction"],contentToMldev$2(tContent(fromSystemInstruction)));let fromTools=getValueByPath(fromObject,["tools"]);return fromTools!=
945
+ null&&setValueByPath(toObject,["tools"],liveClientContextUpdateToolsToMldev(fromTools)),toObject}function liveClientContextUpdateToVertex(fromObject){let toObject={},fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);fromSystemInstruction!=null&&setValueByPath(toObject,["systemInstruction"],contentToVertex$2(tContent(fromSystemInstruction)));let fromTools=getValueByPath(fromObject,["tools"]);return fromTools!=null&&setValueByPath(toObject,["tools"],liveClientContextUpdateToolsToVertex(
946
+ fromTools)),toObject}function liveClientContextUpdateToolsToMldev(fromObject){let toObject={},fromTools=getValueByPath(fromObject,["tools"]);if(fromTools!=null){let transformedList=tTools(fromTools);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToMldev$2(tTool(item)))),setValueByPath(toObject,["tools"],transformedList)}return toObject}function liveClientContextUpdateToolsToVertex(fromObject){let toObject={},fromTools=getValueByPath(fromObject,["tools"]);if(fromTools!=
947
+ null){let transformedList=tTools(fromTools);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToVertex$2(tTool(item)))),setValueByPath(toObject,["tools"],transformedList)}return toObject}function liveConnectConfigToMldev$1(fromObject,parentObject){let toObject={},fromGenerationConfig=getValueByPath(fromObject,["generationConfig"]);parentObject!==void 0&&fromGenerationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig"],fromGenerationConfig);let fromResponseModalities=getValueByPath(
948
+ fromObject,["responseModalities"]);parentObject!==void 0&&fromResponseModalities!=null&&setValueByPath(parentObject,["setup","generationConfig","responseModalities"],fromResponseModalities);let fromTemperature=getValueByPath(fromObject,["temperature"]);parentObject!==void 0&&fromTemperature!=null&&setValueByPath(parentObject,["setup","generationConfig","temperature"],fromTemperature);let fromTopP=getValueByPath(fromObject,["topP"]);parentObject!==void 0&&fromTopP!=null&&setValueByPath(parentObject,
949
+ ["setup","generationConfig","topP"],fromTopP);let fromTopK=getValueByPath(fromObject,["topK"]);parentObject!==void 0&&fromTopK!=null&&setValueByPath(parentObject,["setup","generationConfig","topK"],fromTopK);let fromMaxOutputTokens=getValueByPath(fromObject,["maxOutputTokens"]);parentObject!==void 0&&fromMaxOutputTokens!=null&&setValueByPath(parentObject,["setup","generationConfig","maxOutputTokens"],fromMaxOutputTokens);let fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);parentObject!==
962
950
  void 0&&fromMediaResolution!=null&&setValueByPath(parentObject,["setup","generationConfig","mediaResolution"],fromMediaResolution);let fromSeed=getValueByPath(fromObject,["seed"]);parentObject!==void 0&&fromSeed!=null&&setValueByPath(parentObject,["setup","generationConfig","seed"],fromSeed);let fromSpeechConfig=getValueByPath(fromObject,["speechConfig"]);parentObject!==void 0&&fromSpeechConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","speechConfig"],tLiveSpeechConfig(fromSpeechConfig));
963
951
  let fromThinkingConfig=getValueByPath(fromObject,["thinkingConfig"]);parentObject!==void 0&&fromThinkingConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","thinkingConfig"],fromThinkingConfig);let fromEnableAffectiveDialog=getValueByPath(fromObject,["enableAffectiveDialog"]);parentObject!==void 0&&fromEnableAffectiveDialog!=null&&setValueByPath(parentObject,["setup","generationConfig","enableAffectiveDialog"],fromEnableAffectiveDialog);let fromSystemInstruction=getValueByPath(
964
952
  fromObject,["systemInstruction"]);parentObject!==void 0&&fromSystemInstruction!=null&&setValueByPath(parentObject,["setup","systemInstruction"],contentToMldev$2(tContent(fromSystemInstruction)));let fromTools=getValueByPath(fromObject,["tools"]);if(parentObject!==void 0&&fromTools!=null){let transformedList=tTools(fromTools);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToMldev$2(tTool(item)))),setValueByPath(parentObject,["setup","tools"],transformedList)}let fromSessionResumption=getValueByPath(
@@ -966,44 +954,44 @@ fromObject,["sessionResumption"]);parentObject!==void 0&&fromSessionResumption!=
966
954
  outputAudioTranscription"]);parentObject!==void 0&&fromOutputAudioTranscription!=null&&setValueByPath(parentObject,["setup","outputAudioTranscription"],fromOutputAudioTranscription);let fromRealtimeInputConfig=getValueByPath(fromObject,["realtimeInputConfig"]);parentObject!==void 0&&fromRealtimeInputConfig!=null&&setValueByPath(parentObject,["setup","realtimeInputConfig"],fromRealtimeInputConfig);let fromContextWindowCompression=getValueByPath(fromObject,["contextWindowCompression"]);parentObject!==
967
955
  void 0&&fromContextWindowCompression!=null&&setValueByPath(parentObject,["setup","contextWindowCompression"],fromContextWindowCompression);let fromProactivity=getValueByPath(fromObject,["proactivity"]);if(parentObject!==void 0&&fromProactivity!=null&&setValueByPath(parentObject,["setup","proactivity"],fromProactivity),getValueByPath(fromObject,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Dev\
968
956
  eloper API mode.");let fromAvatarConfig=getValueByPath(fromObject,["avatarConfig"]);parentObject!==void 0&&fromAvatarConfig!=null&&setValueByPath(parentObject,["setup","avatarConfig"],fromAvatarConfig);let fromSafetySettings=getValueByPath(fromObject,["safetySettings"]);if(parentObject!==void 0&&fromSafetySettings!=null){let transformedList=fromSafetySettings;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>safetySettingToMldev$2(item))),setValueByPath(parentObject,["se\
969
- tup","safetySettings"],transformedList)}let fromTranslationConfig=getValueByPath(fromObject,["translationConfig"]);return parentObject!==void 0&&fromTranslationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","translationConfig"],fromTranslationConfig),toObject}function liveConnectConfigToVertex(fromObject,parentObject){let toObject={},fromGenerationConfig=getValueByPath(fromObject,["generationConfig"]);parentObject!==void 0&&fromGenerationConfig!=null&&setValueByPath(parentObject,
970
- ["setup","generationConfig"],generationConfigToVertex$1(fromGenerationConfig));let fromResponseModalities=getValueByPath(fromObject,["responseModalities"]);parentObject!==void 0&&fromResponseModalities!=null&&setValueByPath(parentObject,["setup","generationConfig","responseModalities"],fromResponseModalities);let fromTemperature=getValueByPath(fromObject,["temperature"]);parentObject!==void 0&&fromTemperature!=null&&setValueByPath(parentObject,["setup","generationConfig","temperature"],fromTemperature);
971
- let fromTopP=getValueByPath(fromObject,["topP"]);parentObject!==void 0&&fromTopP!=null&&setValueByPath(parentObject,["setup","generationConfig","topP"],fromTopP);let fromTopK=getValueByPath(fromObject,["topK"]);parentObject!==void 0&&fromTopK!=null&&setValueByPath(parentObject,["setup","generationConfig","topK"],fromTopK);let fromMaxOutputTokens=getValueByPath(fromObject,["maxOutputTokens"]);parentObject!==void 0&&fromMaxOutputTokens!=null&&setValueByPath(parentObject,["setup","generationConfig",
972
- "maxOutputTokens"],fromMaxOutputTokens);let fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);parentObject!==void 0&&fromMediaResolution!=null&&setValueByPath(parentObject,["setup","generationConfig","mediaResolution"],fromMediaResolution);let fromSeed=getValueByPath(fromObject,["seed"]);parentObject!==void 0&&fromSeed!=null&&setValueByPath(parentObject,["setup","generationConfig","seed"],fromSeed);let fromSpeechConfig=getValueByPath(fromObject,["speechConfig"]);parentObject!==void 0&&
973
- fromSpeechConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","speechConfig"],speechConfigToVertex$1(tLiveSpeechConfig(fromSpeechConfig)));let fromThinkingConfig=getValueByPath(fromObject,["thinkingConfig"]);parentObject!==void 0&&fromThinkingConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","thinkingConfig"],fromThinkingConfig);let fromEnableAffectiveDialog=getValueByPath(fromObject,["enableAffectiveDialog"]);parentObject!==void 0&&fromEnableAffectiveDialog!=
974
- null&&setValueByPath(parentObject,["setup","generationConfig","enableAffectiveDialog"],fromEnableAffectiveDialog);let fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);parentObject!==void 0&&fromSystemInstruction!=null&&setValueByPath(parentObject,["setup","systemInstruction"],contentToVertex$2(tContent(fromSystemInstruction)));let fromTools=getValueByPath(fromObject,["tools"]);if(parentObject!==void 0&&fromTools!=null){let transformedList=tTools(fromTools);Array.isArray(transformedList)&&
975
- (transformedList=transformedList.map(item=>toolToVertex$2(tTool(item)))),setValueByPath(parentObject,["setup","tools"],transformedList)}let fromSessionResumption=getValueByPath(fromObject,["sessionResumption"]);parentObject!==void 0&&fromSessionResumption!=null&&setValueByPath(parentObject,["setup","sessionResumption"],fromSessionResumption);let fromInputAudioTranscription=getValueByPath(fromObject,["inputAudioTranscription"]);parentObject!==void 0&&fromInputAudioTranscription!=null&&setValueByPath(
976
- parentObject,["setup","inputAudioTranscription"],fromInputAudioTranscription);let fromOutputAudioTranscription=getValueByPath(fromObject,["outputAudioTranscription"]);parentObject!==void 0&&fromOutputAudioTranscription!=null&&setValueByPath(parentObject,["setup","outputAudioTranscription"],fromOutputAudioTranscription);let fromRealtimeInputConfig=getValueByPath(fromObject,["realtimeInputConfig"]);parentObject!==void 0&&fromRealtimeInputConfig!=null&&setValueByPath(parentObject,["setup","realtime\
977
- InputConfig"],fromRealtimeInputConfig);let fromContextWindowCompression=getValueByPath(fromObject,["contextWindowCompression"]);parentObject!==void 0&&fromContextWindowCompression!=null&&setValueByPath(parentObject,["setup","contextWindowCompression"],fromContextWindowCompression);let fromProactivity=getValueByPath(fromObject,["proactivity"]);parentObject!==void 0&&fromProactivity!=null&&setValueByPath(parentObject,["setup","proactivity"],fromProactivity);let fromExplicitVadSignal=getValueByPath(
978
- fromObject,["explicitVadSignal"]);parentObject!==void 0&&fromExplicitVadSignal!=null&&setValueByPath(parentObject,["setup","explicitVadSignal"],fromExplicitVadSignal);let fromAvatarConfig=getValueByPath(fromObject,["avatarConfig"]);parentObject!==void 0&&fromAvatarConfig!=null&&setValueByPath(parentObject,["setup","avatarConfig"],fromAvatarConfig);let fromSafetySettings=getValueByPath(fromObject,["safetySettings"]);if(parentObject!==void 0&&fromSafetySettings!=null){let transformedList=fromSafetySettings;
979
- Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(parentObject,["setup","safetySettings"],transformedList)}let fromTranslationConfig=getValueByPath(fromObject,["translationConfig"]);return parentObject!==void 0&&fromTranslationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","translationConfig"],fromTranslationConfig),toObject}function liveConnectParametersToMldev(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,
980
- ["model"]);fromModel!=null&&setValueByPath(toObject,["setup","model"],tModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["config"],liveConnectConfigToMldev$1(fromConfig,toObject)),toObject}function liveConnectParametersToVertex(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["setup","model"],tModel(apiClient,fromModel));let fromConfig=getValueByPath(
981
- fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["config"],liveConnectConfigToVertex(fromConfig,toObject)),toObject}function liveMusicSetConfigParametersToMldev(fromObject){let toObject={},fromMusicGenerationConfig=getValueByPath(fromObject,["musicGenerationConfig"]);return fromMusicGenerationConfig!=null&&setValueByPath(toObject,["musicGenerationConfig"],fromMusicGenerationConfig),toObject}function liveMusicSetWeightedPromptsParametersToMldev(fromObject){let toObject={},
982
- fromWeightedPrompts=getValueByPath(fromObject,["weightedPrompts"]);if(fromWeightedPrompts!=null){let transformedList=fromWeightedPrompts;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["weightedPrompts"],transformedList)}return toObject}function liveSendRealtimeInputParametersToMldev(fromObject){let toObject={},fromMedia=getValueByPath(fromObject,["media"]);if(fromMedia!=null){let transformedList=tBlobs(fromMedia);Array.isArray(transformedList)&&
983
- (transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["mediaChunks"],transformedList)}let fromAudio=getValueByPath(fromObject,["audio"]);fromAudio!=null&&setValueByPath(toObject,["audio"],tAudioBlob(fromAudio));let fromAudioStreamEnd=getValueByPath(fromObject,["audioStreamEnd"]);fromAudioStreamEnd!=null&&setValueByPath(toObject,["audioStreamEnd"],fromAudioStreamEnd);let fromVideo=getValueByPath(fromObject,["video"]);fromVideo!=null&&setValueByPath(toObject,["video"],tImageBlob(
984
- fromVideo));let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromActivityStart=getValueByPath(fromObject,["activityStart"]);fromActivityStart!=null&&setValueByPath(toObject,["activityStart"],fromActivityStart);let fromActivityEnd=getValueByPath(fromObject,["activityEnd"]);return fromActivityEnd!=null&&setValueByPath(toObject,["activityEnd"],fromActivityEnd),toObject}function liveSendRealtimeInputParametersToVertex(fromObject){let toObject={},
985
- fromMedia=getValueByPath(fromObject,["media"]);if(fromMedia!=null){let transformedList=tBlobs(fromMedia);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["mediaChunks"],transformedList)}let fromAudio=getValueByPath(fromObject,["audio"]);fromAudio!=null&&setValueByPath(toObject,["audio"],tAudioBlob(fromAudio));let fromAudioStreamEnd=getValueByPath(fromObject,["audioStreamEnd"]);fromAudioStreamEnd!=null&&setValueByPath(toObject,["audioStrea\
986
- mEnd"],fromAudioStreamEnd);let fromVideo=getValueByPath(fromObject,["video"]);fromVideo!=null&&setValueByPath(toObject,["video"],tImageBlob(fromVideo));let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromActivityStart=getValueByPath(fromObject,["activityStart"]);fromActivityStart!=null&&setValueByPath(toObject,["activityStart"],fromActivityStart);let fromActivityEnd=getValueByPath(fromObject,["activityEnd"]);return fromActivityEnd!=
987
- null&&setValueByPath(toObject,["activityEnd"],fromActivityEnd),toObject}function liveServerMessageFromVertex(fromObject){let toObject={},fromSetupComplete=getValueByPath(fromObject,["setupComplete"]);fromSetupComplete!=null&&setValueByPath(toObject,["setupComplete"],fromSetupComplete);let fromServerContent=getValueByPath(fromObject,["serverContent"]);fromServerContent!=null&&setValueByPath(toObject,["serverContent"],fromServerContent);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=
988
- null&&setValueByPath(toObject,["toolCall"],fromToolCall);let fromToolCallCancellation=getValueByPath(fromObject,["toolCallCancellation"]);fromToolCallCancellation!=null&&setValueByPath(toObject,["toolCallCancellation"],fromToolCallCancellation);let fromUsageMetadata=getValueByPath(fromObject,["usageMetadata"]);fromUsageMetadata!=null&&setValueByPath(toObject,["usageMetadata"],usageMetadataFromVertex(fromUsageMetadata));let fromGoAway=getValueByPath(fromObject,["goAway"]);fromGoAway!=null&&setValueByPath(
989
- toObject,["goAway"],fromGoAway);let fromSessionResumptionUpdate=getValueByPath(fromObject,["sessionResumptionUpdate"]);fromSessionResumptionUpdate!=null&&setValueByPath(toObject,["sessionResumptionUpdate"],fromSessionResumptionUpdate);let fromVoiceActivityDetectionSignal=getValueByPath(fromObject,["voiceActivityDetectionSignal"]);fromVoiceActivityDetectionSignal!=null&&setValueByPath(toObject,["voiceActivityDetectionSignal"],fromVoiceActivityDetectionSignal);let fromVoiceActivity=getValueByPath(
990
- fromObject,["voiceActivity"]);return fromVoiceActivity!=null&&setValueByPath(toObject,["voiceActivity"],voiceActivityFromVertex(fromVoiceActivity)),toObject}function mcpServerToVertex$2(fromObject){let toObject={};if(getValueByPath(fromObject,["name"])!==void 0)throw new Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["streamableHttpTransport"])!==void 0)throw new Error("streamableHttpTransport pa\
991
- rameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function multiSpeakerVoiceConfigToVertex$1(fromObject){let toObject={},fromSpeakerVoiceConfigs=getValueByPath(fromObject,["speakerVoiceConfigs"]);if(fromSpeakerVoiceConfigs!=null){let transformedList=fromSpeakerVoiceConfigs;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>speakerVoiceConfigToVertex$1(item))),setValueByPath(toObject,["speakerVoiceConfig\
992
- s"],transformedList)}return toObject}function partToMldev$2(fromObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=null&&setValueByPath(toObject,["toolCall"],fromToolCall);let fromToolResponse=getValueByPath(fromObject,["toolResponse"]);fromToolResponse!=null&&setValueByPath(toObject,["toolRespon\
993
- se"],fromToolResponse);let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,
994
- ["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],functionCallToMldev$2(fromFunctionCall));let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);
995
- let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thou\
996
- ghtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata);let fromPartMetadata=getValueByPath(fromObject,["partMetadata"]);fromPartMetadata!=null&&setValueByPath(toObject,["partMetadata"],fromPartMetadata);let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);
997
- let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function partToVertex$2(fromObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);if(fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution),getValueByPath(fromObject,["toolCall"])!==void 0)throw new Error("toolCall parameter is only supported in Gemini\
998
- Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeE\
999
- xecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(
1000
- toObject,["functionCall"],fromFunctionCall);let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,
1001
- ["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);if(fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata),getValueByPath(fromObject,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is\
1002
- only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function replicatedVoiceConfigToVertex$1(fromObject){let toObject={},
1003
- fromMimeType=getValueByPath(fromObject,["mimeType"]);fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType);let fromVoiceSampleAudio=getValueByPath(fromObject,["voiceSampleAudio"]);if(fromVoiceSampleAudio!=null&&setValueByPath(toObject,["voiceSampleAudio"],fromVoiceSampleAudio),getValueByPath(fromObject,["consentAudio"])!==void 0)throw new Error("consentAudio parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(
1004
- fromObject,["voiceConsentSignature"])!==void 0)throw new Error("voiceConsentSignature parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function safetySettingToMldev$2(fromObject){let toObject={},fromCategory=getValueByPath(fromObject,["category"]);if(fromCategory!=null&&setValueByPath(toObject,["category"],fromCategory),getValueByPath(fromObject,["method"])!==void 0)throw new Error("method parameter is only supported in Gem\
1005
- ini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromThreshold=getValueByPath(fromObject,["threshold"]);return fromThreshold!=null&&setValueByPath(toObject,["threshold"],fromThreshold),toObject}function sessionResumptionConfigToMldev$1(fromObject){let toObject={},fromHandle=getValueByPath(fromObject,["handle"]);if(fromHandle!=null&&setValueByPath(toObject,["handle"],fromHandle),getValueByPath(fromObject,["transparent"])!==void 0)throw new Error("transparent parameter i\
1006
- s only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function speakerVoiceConfigToVertex$1(fromObject){let toObject={},fromSpeaker=getValueByPath(fromObject,["speaker"]);fromSpeaker!=null&&setValueByPath(toObject,["speaker"],fromSpeaker);let fromVoiceConfig=getValueByPath(fromObject,["voiceConfig"]);return fromVoiceConfig!=null&&setValueByPath(toObject,["voiceConfig"],voiceConfigToVertex$1(fromVoiceConfig)),toObject}function speechConfigToVertex$1(fromObject){
957
+ tup","safetySettings"],transformedList)}let fromTranslationConfig=getValueByPath(fromObject,["translationConfig"]);parentObject!==void 0&&fromTranslationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","translationConfig"],fromTranslationConfig);let fromLabels=getValueByPath(fromObject,["labels"]);return parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["setup","labels"],fromLabels),toObject}function liveConnectConfigToVertex(fromObject,parentObject){let toObject={},
958
+ fromGenerationConfig=getValueByPath(fromObject,["generationConfig"]);parentObject!==void 0&&fromGenerationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig"],generationConfigToVertex$1(fromGenerationConfig));let fromResponseModalities=getValueByPath(fromObject,["responseModalities"]);parentObject!==void 0&&fromResponseModalities!=null&&setValueByPath(parentObject,["setup","generationConfig","responseModalities"],fromResponseModalities);let fromTemperature=getValueByPath(fromObject,
959
+ ["temperature"]);parentObject!==void 0&&fromTemperature!=null&&setValueByPath(parentObject,["setup","generationConfig","temperature"],fromTemperature);let fromTopP=getValueByPath(fromObject,["topP"]);parentObject!==void 0&&fromTopP!=null&&setValueByPath(parentObject,["setup","generationConfig","topP"],fromTopP);let fromTopK=getValueByPath(fromObject,["topK"]);parentObject!==void 0&&fromTopK!=null&&setValueByPath(parentObject,["setup","generationConfig","topK"],fromTopK);let fromMaxOutputTokens=getValueByPath(
960
+ fromObject,["maxOutputTokens"]);parentObject!==void 0&&fromMaxOutputTokens!=null&&setValueByPath(parentObject,["setup","generationConfig","maxOutputTokens"],fromMaxOutputTokens);let fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);parentObject!==void 0&&fromMediaResolution!=null&&setValueByPath(parentObject,["setup","generationConfig","mediaResolution"],fromMediaResolution);let fromSeed=getValueByPath(fromObject,["seed"]);parentObject!==void 0&&fromSeed!=null&&setValueByPath(parentObject,
961
+ ["setup","generationConfig","seed"],fromSeed);let fromSpeechConfig=getValueByPath(fromObject,["speechConfig"]);parentObject!==void 0&&fromSpeechConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","speechConfig"],speechConfigToVertex$1(tLiveSpeechConfig(fromSpeechConfig)));let fromThinkingConfig=getValueByPath(fromObject,["thinkingConfig"]);parentObject!==void 0&&fromThinkingConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","thinkingConfig"],fromThinkingConfig);
962
+ let fromEnableAffectiveDialog=getValueByPath(fromObject,["enableAffectiveDialog"]);parentObject!==void 0&&fromEnableAffectiveDialog!=null&&setValueByPath(parentObject,["setup","generationConfig","enableAffectiveDialog"],fromEnableAffectiveDialog);let fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);parentObject!==void 0&&fromSystemInstruction!=null&&setValueByPath(parentObject,["setup","systemInstruction"],contentToVertex$2(tContent(fromSystemInstruction)));let fromTools=getValueByPath(
963
+ fromObject,["tools"]);if(parentObject!==void 0&&fromTools!=null){let transformedList=tTools(fromTools);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToVertex$2(tTool(item)))),setValueByPath(parentObject,["setup","tools"],transformedList)}let fromSessionResumption=getValueByPath(fromObject,["sessionResumption"]);parentObject!==void 0&&fromSessionResumption!=null&&setValueByPath(parentObject,["setup","sessionResumption"],fromSessionResumption);let fromInputAudioTranscription=getValueByPath(
964
+ fromObject,["inputAudioTranscription"]);parentObject!==void 0&&fromInputAudioTranscription!=null&&setValueByPath(parentObject,["setup","inputAudioTranscription"],fromInputAudioTranscription);let fromOutputAudioTranscription=getValueByPath(fromObject,["outputAudioTranscription"]);parentObject!==void 0&&fromOutputAudioTranscription!=null&&setValueByPath(parentObject,["setup","outputAudioTranscription"],fromOutputAudioTranscription);let fromRealtimeInputConfig=getValueByPath(fromObject,["realtimeIn\
965
+ putConfig"]);parentObject!==void 0&&fromRealtimeInputConfig!=null&&setValueByPath(parentObject,["setup","realtimeInputConfig"],fromRealtimeInputConfig);let fromContextWindowCompression=getValueByPath(fromObject,["contextWindowCompression"]);parentObject!==void 0&&fromContextWindowCompression!=null&&setValueByPath(parentObject,["setup","contextWindowCompression"],fromContextWindowCompression);let fromProactivity=getValueByPath(fromObject,["proactivity"]);parentObject!==void 0&&fromProactivity!=null&&
966
+ setValueByPath(parentObject,["setup","proactivity"],fromProactivity);let fromExplicitVadSignal=getValueByPath(fromObject,["explicitVadSignal"]);parentObject!==void 0&&fromExplicitVadSignal!=null&&setValueByPath(parentObject,["setup","explicitVadSignal"],fromExplicitVadSignal);let fromAvatarConfig=getValueByPath(fromObject,["avatarConfig"]);parentObject!==void 0&&fromAvatarConfig!=null&&setValueByPath(parentObject,["setup","avatarConfig"],fromAvatarConfig);let fromSafetySettings=getValueByPath(fromObject,
967
+ ["safetySettings"]);if(parentObject!==void 0&&fromSafetySettings!=null){let transformedList=fromSafetySettings;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(parentObject,["setup","safetySettings"],transformedList)}let fromTranslationConfig=getValueByPath(fromObject,["translationConfig"]);parentObject!==void 0&&fromTranslationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","translationConfig"],fromTranslationConfig);let fromLabels=getValueByPath(
968
+ fromObject,["labels"]);return parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["setup","labels"],fromLabels),toObject}function liveConnectParametersToMldev(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["setup","model"],tModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["config"],liveConnectConfigToMldev$1(fromConfig,
969
+ toObject)),toObject}function liveConnectParametersToVertex(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["setup","model"],tModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["config"],liveConnectConfigToVertex(fromConfig,toObject)),toObject}function liveMusicSetConfigParametersToMldev(fromObject){let toObject={},fromMusicGenerationConfig=getValueByPath(
970
+ fromObject,["musicGenerationConfig"]);return fromMusicGenerationConfig!=null&&setValueByPath(toObject,["musicGenerationConfig"],fromMusicGenerationConfig),toObject}function liveMusicSetWeightedPromptsParametersToMldev(fromObject){let toObject={},fromWeightedPrompts=getValueByPath(fromObject,["weightedPrompts"]);if(fromWeightedPrompts!=null){let transformedList=fromWeightedPrompts;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["weightedP\
971
+ rompts"],transformedList)}return toObject}function liveSendRealtimeInputParametersToMldev(fromObject){let toObject={},fromMedia=getValueByPath(fromObject,["media"]);if(fromMedia!=null){let transformedList=tBlobs(fromMedia);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["mediaChunks"],transformedList)}let fromAudio=getValueByPath(fromObject,["audio"]);fromAudio!=null&&setValueByPath(toObject,["audio"],tAudioBlob(fromAudio));let fromAudioStreamEnd=getValueByPath(
972
+ fromObject,["audioStreamEnd"]);fromAudioStreamEnd!=null&&setValueByPath(toObject,["audioStreamEnd"],fromAudioStreamEnd);let fromVideo=getValueByPath(fromObject,["video"]);fromVideo!=null&&setValueByPath(toObject,["video"],tImageBlob(fromVideo));let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromActivityStart=getValueByPath(fromObject,["activityStart"]);fromActivityStart!=null&&setValueByPath(toObject,["activityStart"],fromActivityStart);
973
+ let fromActivityEnd=getValueByPath(fromObject,["activityEnd"]);return fromActivityEnd!=null&&setValueByPath(toObject,["activityEnd"],fromActivityEnd),toObject}function liveSendRealtimeInputParametersToVertex(fromObject){let toObject={},fromMedia=getValueByPath(fromObject,["media"]);if(fromMedia!=null){let transformedList=tBlobs(fromMedia);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["mediaChunks"],transformedList)}let fromAudio=getValueByPath(
974
+ fromObject,["audio"]);fromAudio!=null&&setValueByPath(toObject,["audio"],tAudioBlob(fromAudio));let fromAudioStreamEnd=getValueByPath(fromObject,["audioStreamEnd"]);fromAudioStreamEnd!=null&&setValueByPath(toObject,["audioStreamEnd"],fromAudioStreamEnd);let fromVideo=getValueByPath(fromObject,["video"]);fromVideo!=null&&setValueByPath(toObject,["video"],tImageBlob(fromVideo));let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromActivityStart=getValueByPath(
975
+ fromObject,["activityStart"]);fromActivityStart!=null&&setValueByPath(toObject,["activityStart"],fromActivityStart);let fromActivityEnd=getValueByPath(fromObject,["activityEnd"]);return fromActivityEnd!=null&&setValueByPath(toObject,["activityEnd"],fromActivityEnd),toObject}function liveServerMessageFromVertex(fromObject){let toObject={},fromSetupComplete=getValueByPath(fromObject,["setupComplete"]);fromSetupComplete!=null&&setValueByPath(toObject,["setupComplete"],fromSetupComplete);let fromServerContent=getValueByPath(
976
+ fromObject,["serverContent"]);fromServerContent!=null&&setValueByPath(toObject,["serverContent"],fromServerContent);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=null&&setValueByPath(toObject,["toolCall"],fromToolCall);let fromToolCallCancellation=getValueByPath(fromObject,["toolCallCancellation"]);fromToolCallCancellation!=null&&setValueByPath(toObject,["toolCallCancellation"],fromToolCallCancellation);let fromUsageMetadata=getValueByPath(fromObject,["usageMetadata"]);fromUsageMetadata!=
977
+ null&&setValueByPath(toObject,["usageMetadata"],usageMetadataFromVertex(fromUsageMetadata));let fromGoAway=getValueByPath(fromObject,["goAway"]);fromGoAway!=null&&setValueByPath(toObject,["goAway"],fromGoAway);let fromSessionResumptionUpdate=getValueByPath(fromObject,["sessionResumptionUpdate"]);fromSessionResumptionUpdate!=null&&setValueByPath(toObject,["sessionResumptionUpdate"],fromSessionResumptionUpdate);let fromVoiceActivityDetectionSignal=getValueByPath(fromObject,["voiceActivityDetection\
978
+ Signal"]);fromVoiceActivityDetectionSignal!=null&&setValueByPath(toObject,["voiceActivityDetectionSignal"],fromVoiceActivityDetectionSignal);let fromVoiceActivity=getValueByPath(fromObject,["voiceActivity"]);return fromVoiceActivity!=null&&setValueByPath(toObject,["voiceActivity"],voiceActivityFromVertex(fromVoiceActivity)),toObject}function mcpServerToVertex$2(fromObject){let toObject={};if(getValueByPath(fromObject,["name"])!==void 0)throw new Error("name parameter is only supported in Gemini \
979
+ Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["streamableHttpTransport"])!==void 0)throw new Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function multiSpeakerVoiceConfigToVertex$1(fromObject){let toObject={},fromSpeakerVoiceConfigs=getValueByPath(fromObject,["speakerVoiceConfigs"]);if(fromSpeakerVoiceConfigs!=null){let transformedList=fromSpeakerVoiceConfigs;
980
+ Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>speakerVoiceConfigToVertex$1(item))),setValueByPath(toObject,["speakerVoiceConfigs"],transformedList)}return toObject}function partToMldev$2(fromObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=null&&setValueByPath(toObject,
981
+ ["toolCall"],fromToolCall);let fromToolResponse=getValueByPath(fromObject,["toolResponse"]);fromToolResponse!=null&&setValueByPath(toObject,["toolResponse"],fromToolResponse);let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecuti\
982
+ onResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],functionCallToMldev$2(fromFunctionCall));let fromFunctionResponse=getValueByPath(
983
+ fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(
984
+ fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata);let fromPartMetadata=getValueByPath(fromObject,["partMetadata"]);fromPartMetadata!=null&&setValueByPath(toObject,["partMetadata"],fromPartMetadata);let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);
985
+ fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function partToVertex$2(fromObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);if(fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution),getValueByPath(fromObject,
986
+ ["toolCall"])!==void 0)throw new Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],
987
+ fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(
988
+ fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],fromFunctionCall);let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,
989
+ ["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);if(fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata),getValueByPath(fromObject,["partMe\
990
+ tadata"])!==void 0)throw new Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function replicatedVoiceConfigToVertex$1(fromObject){
991
+ let toObject={},fromMimeType=getValueByPath(fromObject,["mimeType"]);fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType);let fromVoiceSampleAudio=getValueByPath(fromObject,["voiceSampleAudio"]);if(fromVoiceSampleAudio!=null&&setValueByPath(toObject,["voiceSampleAudio"],fromVoiceSampleAudio),getValueByPath(fromObject,["consentAudio"])!==void 0)throw new Error("consentAudio parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");
992
+ if(getValueByPath(fromObject,["voiceConsentSignature"])!==void 0)throw new Error("voiceConsentSignature parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function safetySettingToMldev$2(fromObject){let toObject={},fromCategory=getValueByPath(fromObject,["category"]);if(fromCategory!=null&&setValueByPath(toObject,["category"],fromCategory),getValueByPath(fromObject,["method"])!==void 0)throw new Error("method parameter is onl\
993
+ y supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromThreshold=getValueByPath(fromObject,["threshold"]);return fromThreshold!=null&&setValueByPath(toObject,["threshold"],fromThreshold),toObject}function sessionResumptionConfigToMldev$1(fromObject){let toObject={},fromHandle=getValueByPath(fromObject,["handle"]);if(fromHandle!=null&&setValueByPath(toObject,["handle"],fromHandle),getValueByPath(fromObject,["transparent"])!==void 0)throw new Error("trans\
994
+ parent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function speakerVoiceConfigToVertex$1(fromObject){let toObject={},fromSpeaker=getValueByPath(fromObject,["speaker"]);fromSpeaker!=null&&setValueByPath(toObject,["speaker"],fromSpeaker);let fromVoiceConfig=getValueByPath(fromObject,["voiceConfig"]);return fromVoiceConfig!=null&&setValueByPath(toObject,["voiceConfig"],voiceConfigToVertex$1(fromVoiceConfig)),toObject}function speechConfigToVertex$1(fromObject){
1007
995
  let toObject={},fromVoiceConfig=getValueByPath(fromObject,["voiceConfig"]);fromVoiceConfig!=null&&setValueByPath(toObject,["voiceConfig"],voiceConfigToVertex$1(fromVoiceConfig));let fromLanguageCode=getValueByPath(fromObject,["languageCode"]);fromLanguageCode!=null&&setValueByPath(toObject,["languageCode"],fromLanguageCode);let fromMultiSpeakerVoiceConfig=getValueByPath(fromObject,["multiSpeakerVoiceConfig"]);return fromMultiSpeakerVoiceConfig!=null&&setValueByPath(toObject,["multiSpeakerVoiceCo\
1008
996
  nfig"],multiSpeakerVoiceConfigToVertex$1(fromMultiSpeakerVoiceConfig)),toObject}function toolToMldev$2(fromObject){let toObject={};if(getValueByPath(fromObject,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],googleMapsToMldev$2(fromGoogleMaps));let fromMcpServers=getValueByPath(
1009
997
  fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);if(fromComputerUse!=null&&setValueByPath(toObject,["compute\
@@ -1087,226 +1075,229 @@ void 0&&fromToolConfig!=null&&setValueByPath(parentObject,["toolConfig"],toolCon
1087
1075
  fromObject,["responseModalities"]);fromResponseModalities!=null&&setValueByPath(toObject,["responseModalities"],fromResponseModalities);let fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromSpeechConfig=getValueByPath(fromObject,["speechConfig"]);if(fromSpeechConfig!=null&&setValueByPath(toObject,["speechConfig"],tSpeechConfig(fromSpeechConfig)),getValueByPath(fromObject,["audioTi\
1088
1076
  mestamp"])!==void 0)throw new Error("audioTimestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromThinkingConfig=getValueByPath(fromObject,["thinkingConfig"]);fromThinkingConfig!=null&&setValueByPath(toObject,["thinkingConfig"],fromThinkingConfig);let fromAudioTranscriptionConfig=getValueByPath(fromObject,["audioTranscriptionConfig"]);fromAudioTranscriptionConfig!=null&&setValueByPath(toObject,["audioTranscriptionConfig"],fromAudioTranscriptionConfig);
1089
1077
  let fromImageConfig=getValueByPath(fromObject,["imageConfig"]);fromImageConfig!=null&&setValueByPath(toObject,["imageConfig"],imageConfigToMldev(fromImageConfig));let fromEnableEnhancedCivicAnswers=getValueByPath(fromObject,["enableEnhancedCivicAnswers"]);if(fromEnableEnhancedCivicAnswers!=null&&setValueByPath(toObject,["enableEnhancedCivicAnswers"],fromEnableEnhancedCivicAnswers),getValueByPath(fromObject,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is only support\
1090
- ed in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromContinuationToken=getValueByPath(fromObject,["continuationToken"]);return parentObject!==void 0&&fromContinuationToken!=null&&setValueByPath(parentObject,["continuationToken"],fromContinuationToken),toObject}function generateContentConfigToVertex(apiClient,fromObject,parentObject,rootObject){let toObject={},fromServiceTier=getValueByPath(fromObject,["serviceTier"]);parentObject!==void 0&&fromServiceTier!=null&&
1091
- setValueByPath(parentObject,["serviceTier"],fromServiceTier);let fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);parentObject!==void 0&&fromSystemInstruction!=null&&setValueByPath(parentObject,["systemInstruction"],contentToVertex$1(tContent(fromSystemInstruction)));let fromTemperature=getValueByPath(fromObject,["temperature"]);fromTemperature!=null&&setValueByPath(toObject,["temperature"],fromTemperature);let fromTopP=getValueByPath(fromObject,["topP"]);fromTopP!=null&&setValueByPath(
1092
- toObject,["topP"],fromTopP);let fromTopK=getValueByPath(fromObject,["topK"]);fromTopK!=null&&setValueByPath(toObject,["topK"],fromTopK);let fromCandidateCount=getValueByPath(fromObject,["candidateCount"]);fromCandidateCount!=null&&setValueByPath(toObject,["candidateCount"],fromCandidateCount);let fromMaxOutputTokens=getValueByPath(fromObject,["maxOutputTokens"]);fromMaxOutputTokens!=null&&setValueByPath(toObject,["maxOutputTokens"],fromMaxOutputTokens);let fromStopSequences=getValueByPath(fromObject,
1093
- ["stopSequences"]);fromStopSequences!=null&&setValueByPath(toObject,["stopSequences"],fromStopSequences);let fromResponseLogprobs=getValueByPath(fromObject,["responseLogprobs"]);fromResponseLogprobs!=null&&setValueByPath(toObject,["responseLogprobs"],fromResponseLogprobs);let fromLogprobs=getValueByPath(fromObject,["logprobs"]);fromLogprobs!=null&&setValueByPath(toObject,["logprobs"],fromLogprobs);let fromPresencePenalty=getValueByPath(fromObject,["presencePenalty"]);fromPresencePenalty!=null&&setValueByPath(
1094
- toObject,["presencePenalty"],fromPresencePenalty);let fromFrequencyPenalty=getValueByPath(fromObject,["frequencyPenalty"]);fromFrequencyPenalty!=null&&setValueByPath(toObject,["frequencyPenalty"],fromFrequencyPenalty);let fromSeed=getValueByPath(fromObject,["seed"]);fromSeed!=null&&setValueByPath(toObject,["seed"],fromSeed);let fromResponseMimeType=getValueByPath(fromObject,["responseMimeType"]);fromResponseMimeType!=null&&setValueByPath(toObject,["responseMimeType"],fromResponseMimeType);let fromResponseSchema=getValueByPath(
1095
- fromObject,["responseSchema"]);fromResponseSchema!=null&&setValueByPath(toObject,["responseSchema"],tSchema(fromResponseSchema));let fromResponseJsonSchema=getValueByPath(fromObject,["responseJsonSchema"]);fromResponseJsonSchema!=null&&setValueByPath(toObject,["responseJsonSchema"],fromResponseJsonSchema);let fromRoutingConfig=getValueByPath(fromObject,["routingConfig"]);fromRoutingConfig!=null&&setValueByPath(toObject,["routingConfig"],fromRoutingConfig);let fromModelSelectionConfig=getValueByPath(
1096
- fromObject,["modelSelectionConfig"]);fromModelSelectionConfig!=null&&setValueByPath(toObject,["modelConfig"],fromModelSelectionConfig);let fromSafetySettings=getValueByPath(fromObject,["safetySettings"]);if(parentObject!==void 0&&fromSafetySettings!=null){let transformedList=fromSafetySettings;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(parentObject,["safetySettings"],transformedList)}let fromTools=getValueByPath(fromObject,["tools"]);if(parentObject!==
1097
- void 0&&fromTools!=null){let transformedList=tTools(fromTools);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToVertex$1(tTool(item)))),setValueByPath(parentObject,["tools"],transformedList)}let fromToolConfig=getValueByPath(fromObject,["toolConfig"]);parentObject!==void 0&&fromToolConfig!=null&&setValueByPath(parentObject,["toolConfig"],toolConfigToVertex(fromToolConfig));let fromLabels=getValueByPath(fromObject,["labels"]);parentObject!==void 0&&fromLabels!=null&&
1098
- setValueByPath(parentObject,["labels"],fromLabels);let fromCachedContent=getValueByPath(fromObject,["cachedContent"]);parentObject!==void 0&&fromCachedContent!=null&&setValueByPath(parentObject,["cachedContent"],tCachedContentName(apiClient,fromCachedContent));let fromResponseModalities=getValueByPath(fromObject,["responseModalities"]);fromResponseModalities!=null&&setValueByPath(toObject,["responseModalities"],fromResponseModalities);let fromMediaResolution=getValueByPath(fromObject,["mediaReso\
1099
- lution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromSpeechConfig=getValueByPath(fromObject,["speechConfig"]);fromSpeechConfig!=null&&setValueByPath(toObject,["speechConfig"],speechConfigToVertex(tSpeechConfig(fromSpeechConfig)));let fromAudioTimestamp=getValueByPath(fromObject,["audioTimestamp"]);fromAudioTimestamp!=null&&setValueByPath(toObject,["audioTimestamp"],fromAudioTimestamp);let fromThinkingConfig=getValueByPath(fromObject,["thin\
1100
- kingConfig"]);fromThinkingConfig!=null&&setValueByPath(toObject,["thinkingConfig"],fromThinkingConfig);let fromAudioTranscriptionConfig=getValueByPath(fromObject,["audioTranscriptionConfig"]);fromAudioTranscriptionConfig!=null&&setValueByPath(toObject,["audioTranscriptionConfig"],fromAudioTranscriptionConfig);let fromImageConfig=getValueByPath(fromObject,["imageConfig"]);if(fromImageConfig!=null&&setValueByPath(toObject,["imageConfig"],imageConfigToVertex(fromImageConfig)),getValueByPath(fromObject,
1101
- ["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromModelArmorConfig=getValueByPath(fromObject,["modelArmorConfig"]);parentObject!==void 0&&fromModelArmorConfig!=null&&setValueByPath(parentObject,["modelArmorConfig"],fromModelArmorConfig);let fromContinuationToken=getValueByPath(fromObject,["continuationToken"]);return parentObject!==void 0&&fromContinuationToken!=
1102
- null&&setValueByPath(parentObject,["continuationToken"],fromContinuationToken),toObject}function generateContentParametersToMldev(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromContents=getValueByPath(fromObject,["contents"]);if(fromContents!=null){let transformedList=tContents(fromContents);Array.isArray(transformedList)&&(transformedList=transformedList.
1103
- map(item=>contentToMldev$1(item))),setValueByPath(toObject,["contents"],transformedList)}let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["generationConfig"],generateContentConfigToMldev(apiClient,fromConfig,toObject)),toObject}function generateContentParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));
1104
- let fromContents=getValueByPath(fromObject,["contents"]);if(fromContents!=null){let transformedList=tContents(fromContents);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>contentToVertex$1(item))),setValueByPath(toObject,["contents"],transformedList)}let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["generationConfig"],generateContentConfigToVertex(apiClient,fromConfig,toObject)),toObject}function generateContentResponseFromMldev(fromObject,rootObject){
1105
- let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromCandidates=getValueByPath(fromObject,["candidates"]);if(fromCandidates!=null){let transformedList=fromCandidates;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>candidateFromMldev(item))),setValueByPath(toObject,["candidates"],transformedList)}let fromModelVersion=getValueByPath(fromObject,
1106
- ["modelVersion"]);fromModelVersion!=null&&setValueByPath(toObject,["modelVersion"],fromModelVersion);let fromPromptFeedback=getValueByPath(fromObject,["promptFeedback"]);fromPromptFeedback!=null&&setValueByPath(toObject,["promptFeedback"],fromPromptFeedback);let fromResponseId=getValueByPath(fromObject,["responseId"]);fromResponseId!=null&&setValueByPath(toObject,["responseId"],fromResponseId);let fromUsageMetadata=getValueByPath(fromObject,["usageMetadata"]);fromUsageMetadata!=null&&setValueByPath(
1107
- toObject,["usageMetadata"],fromUsageMetadata);let fromModelStatus=getValueByPath(fromObject,["modelStatus"]);return fromModelStatus!=null&&setValueByPath(toObject,["modelStatus"],fromModelStatus),toObject}function generateContentResponseFromVertex(fromObject,_rootObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromCandidates=getValueByPath(fromObject,["candid\
1108
- ates"]);if(fromCandidates!=null){let transformedList=fromCandidates;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["candidates"],transformedList)}let fromCreateTime=getValueByPath(fromObject,["createTime"]);fromCreateTime!=null&&setValueByPath(toObject,["createTime"],fromCreateTime);let fromModelVersion=getValueByPath(fromObject,["modelVersion"]);fromModelVersion!=null&&setValueByPath(toObject,["modelVersion"],fromModelVersion);let fromPromptFeedback=getValueByPath(
1109
- fromObject,["promptFeedback"]);fromPromptFeedback!=null&&setValueByPath(toObject,["promptFeedback"],fromPromptFeedback);let fromResponseId=getValueByPath(fromObject,["responseId"]);fromResponseId!=null&&setValueByPath(toObject,["responseId"],fromResponseId);let fromUsageMetadata=getValueByPath(fromObject,["usageMetadata"]);return fromUsageMetadata!=null&&setValueByPath(toObject,["usageMetadata"],fromUsageMetadata),toObject}function generateImagesConfigToVertex(fromObject,parentObject,_rootObject){
1110
- let toObject={},fromOutputGcsUri=getValueByPath(fromObject,["outputGcsUri"]);parentObject!==void 0&&fromOutputGcsUri!=null&&setValueByPath(parentObject,["parameters","storageUri"],fromOutputGcsUri);let fromNegativePrompt=getValueByPath(fromObject,["negativePrompt"]);parentObject!==void 0&&fromNegativePrompt!=null&&setValueByPath(parentObject,["parameters","negativePrompt"],fromNegativePrompt);let fromNumberOfImages=getValueByPath(fromObject,["numberOfImages"]);parentObject!==void 0&&fromNumberOfImages!=
1111
- null&&setValueByPath(parentObject,["parameters","sampleCount"],fromNumberOfImages);let fromAspectRatio=getValueByPath(fromObject,["aspectRatio"]);parentObject!==void 0&&fromAspectRatio!=null&&setValueByPath(parentObject,["parameters","aspectRatio"],fromAspectRatio);let fromGuidanceScale=getValueByPath(fromObject,["guidanceScale"]);parentObject!==void 0&&fromGuidanceScale!=null&&setValueByPath(parentObject,["parameters","guidanceScale"],fromGuidanceScale);let fromSeed=getValueByPath(fromObject,["\
1112
- seed"]);parentObject!==void 0&&fromSeed!=null&&setValueByPath(parentObject,["parameters","seed"],fromSeed);let fromSafetyFilterLevel=getValueByPath(fromObject,["safetyFilterLevel"]);parentObject!==void 0&&fromSafetyFilterLevel!=null&&setValueByPath(parentObject,["parameters","safetySetting"],fromSafetyFilterLevel);let fromPersonGeneration=getValueByPath(fromObject,["personGeneration"]);parentObject!==void 0&&fromPersonGeneration!=null&&setValueByPath(parentObject,["parameters","personGeneration"],
1113
- fromPersonGeneration);let fromIncludeSafetyAttributes=getValueByPath(fromObject,["includeSafetyAttributes"]);parentObject!==void 0&&fromIncludeSafetyAttributes!=null&&setValueByPath(parentObject,["parameters","includeSafetyAttributes"],fromIncludeSafetyAttributes);let fromIncludeRaiReason=getValueByPath(fromObject,["includeRaiReason"]);parentObject!==void 0&&fromIncludeRaiReason!=null&&setValueByPath(parentObject,["parameters","includeRaiReason"],fromIncludeRaiReason);let fromLanguage=getValueByPath(
1114
- fromObject,["language"]);parentObject!==void 0&&fromLanguage!=null&&setValueByPath(parentObject,["parameters","language"],fromLanguage);let fromOutputMimeType=getValueByPath(fromObject,["outputMimeType"]);parentObject!==void 0&&fromOutputMimeType!=null&&setValueByPath(parentObject,["parameters","outputOptions","mimeType"],fromOutputMimeType);let fromOutputCompressionQuality=getValueByPath(fromObject,["outputCompressionQuality"]);parentObject!==void 0&&fromOutputCompressionQuality!=null&&setValueByPath(
1115
- parentObject,["parameters","outputOptions","compressionQuality"],fromOutputCompressionQuality);let fromAddWatermark=getValueByPath(fromObject,["addWatermark"]);parentObject!==void 0&&fromAddWatermark!=null&&setValueByPath(parentObject,["parameters","addWatermark"],fromAddWatermark);let fromLabels=getValueByPath(fromObject,["labels"]);parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["labels"],fromLabels);let fromImageSize=getValueByPath(fromObject,["imageSize"]);parentObject!==
1116
- void 0&&fromImageSize!=null&&setValueByPath(parentObject,["parameters","sampleImageSize"],fromImageSize);let fromEnhancePrompt=getValueByPath(fromObject,["enhancePrompt"]);return parentObject!==void 0&&fromEnhancePrompt!=null&&setValueByPath(parentObject,["parameters","enhancePrompt"],fromEnhancePrompt),toObject}function generateImagesParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url",
1117
- "model"],tModel(apiClient,fromModel));let fromPrompt=getValueByPath(fromObject,["prompt"]);fromPrompt!=null&&setValueByPath(toObject,["instances[0]","prompt"],fromPrompt);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&generateImagesConfigToVertex(fromConfig,toObject),toObject}function generateImagesResponseFromVertex(fromObject,rootObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,
1118
- ["sdkHttpResponse"],fromSdkHttpResponse);let fromGeneratedImages=getValueByPath(fromObject,["predictions"]);if(fromGeneratedImages!=null){let transformedList=fromGeneratedImages;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedImageFromVertex(item))),setValueByPath(toObject,["generatedImages"],transformedList)}let fromPositivePromptSafetyAttributes=getValueByPath(fromObject,["positivePromptSafetyAttributes"]);return fromPositivePromptSafetyAttributes!=null&&setValueByPath(
1119
- toObject,["positivePromptSafetyAttributes"],safetyAttributesFromVertex(fromPositivePromptSafetyAttributes)),toObject}function generateVideosConfigToMldev(fromObject,parentObject,rootObject){let toObject={},fromNumberOfVideos=getValueByPath(fromObject,["numberOfVideos"]);if(parentObject!==void 0&&fromNumberOfVideos!=null&&setValueByPath(parentObject,["parameters","sampleCount"],fromNumberOfVideos),getValueByPath(fromObject,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is only\
1120
- supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["fps"])!==void 0)throw new Error("fps parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromDurationSeconds=getValueByPath(fromObject,["durationSeconds"]);if(parentObject!==void 0&&fromDurationSeconds!=null&&setValueByPath(parentObject,["parameters","durationSeconds"],fromDurationSeconds),getValueByPath(fromObject,["see\
1121
- d"])!==void 0)throw new Error("seed parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromAspectRatio=getValueByPath(fromObject,["aspectRatio"]);parentObject!==void 0&&fromAspectRatio!=null&&setValueByPath(parentObject,["parameters","aspectRatio"],fromAspectRatio);let fromResolution=getValueByPath(fromObject,["resolution"]);parentObject!==void 0&&fromResolution!=null&&setValueByPath(parentObject,["parameters","resolution"],fromResolution);
1122
- let fromPersonGeneration=getValueByPath(fromObject,["personGeneration"]);if(parentObject!==void 0&&fromPersonGeneration!=null&&setValueByPath(parentObject,["parameters","personGeneration"],fromPersonGeneration),getValueByPath(fromObject,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromNegativePrompt=getValueByPath(fromObject,["negativePrompt"]);parentObject!==void 0&&fromNegativePrompt!=
1123
- null&&setValueByPath(parentObject,["parameters","negativePrompt"],fromNegativePrompt);let fromEnhancePrompt=getValueByPath(fromObject,["enhancePrompt"]);if(parentObject!==void 0&&fromEnhancePrompt!=null&&setValueByPath(parentObject,["parameters","enhancePrompt"],fromEnhancePrompt),getValueByPath(fromObject,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromLastFrame=getValueByPath(
1124
- fromObject,["lastFrame"]);parentObject!==void 0&&fromLastFrame!=null&&setValueByPath(parentObject,["instances[0]","lastFrame"],imageToMldev(fromLastFrame));let fromReferenceImages=getValueByPath(fromObject,["referenceImages"]);if(parentObject!==void 0&&fromReferenceImages!=null){let transformedList=fromReferenceImages;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>videoGenerationReferenceImageToMldev(item))),setValueByPath(parentObject,["instances[0]","referenceImages"],
1125
- transformedList)}if(getValueByPath(fromObject,["mask"])!==void 0)throw new Error("mask parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["labels"])!==void 0)throw new Error("labels parameter is only supported i\
1126
- n Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromWebhookConfig=getValueByPath(fromObject,["webhookConfig"]);if(parentObject!==void 0&&fromWebhookConfig!=null&&setValueByPath(parentObject,["webhookConfig"],fromWebhookConfig),getValueByPath(fromObject,["resizeMode"])!==void 0)throw new Error("resizeMode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function generateVideosConfigToVertex(fromObject,parentObject,rootObject){
1127
- let toObject={},fromNumberOfVideos=getValueByPath(fromObject,["numberOfVideos"]);parentObject!==void 0&&fromNumberOfVideos!=null&&setValueByPath(parentObject,["parameters","sampleCount"],fromNumberOfVideos);let fromOutputGcsUri=getValueByPath(fromObject,["outputGcsUri"]);parentObject!==void 0&&fromOutputGcsUri!=null&&setValueByPath(parentObject,["parameters","storageUri"],fromOutputGcsUri);let fromFps=getValueByPath(fromObject,["fps"]);parentObject!==void 0&&fromFps!=null&&setValueByPath(parentObject,
1128
- ["parameters","fps"],fromFps);let fromDurationSeconds=getValueByPath(fromObject,["durationSeconds"]);parentObject!==void 0&&fromDurationSeconds!=null&&setValueByPath(parentObject,["parameters","durationSeconds"],fromDurationSeconds);let fromSeed=getValueByPath(fromObject,["seed"]);parentObject!==void 0&&fromSeed!=null&&setValueByPath(parentObject,["parameters","seed"],fromSeed);let fromAspectRatio=getValueByPath(fromObject,["aspectRatio"]);parentObject!==void 0&&fromAspectRatio!=null&&setValueByPath(
1129
- parentObject,["parameters","aspectRatio"],fromAspectRatio);let fromResolution=getValueByPath(fromObject,["resolution"]);parentObject!==void 0&&fromResolution!=null&&setValueByPath(parentObject,["parameters","resolution"],fromResolution);let fromPersonGeneration=getValueByPath(fromObject,["personGeneration"]);parentObject!==void 0&&fromPersonGeneration!=null&&setValueByPath(parentObject,["parameters","personGeneration"],fromPersonGeneration);let fromPubsubTopic=getValueByPath(fromObject,["pubsubT\
1130
- opic"]);parentObject!==void 0&&fromPubsubTopic!=null&&setValueByPath(parentObject,["parameters","pubsubTopic"],fromPubsubTopic);let fromNegativePrompt=getValueByPath(fromObject,["negativePrompt"]);parentObject!==void 0&&fromNegativePrompt!=null&&setValueByPath(parentObject,["parameters","negativePrompt"],fromNegativePrompt);let fromEnhancePrompt=getValueByPath(fromObject,["enhancePrompt"]);parentObject!==void 0&&fromEnhancePrompt!=null&&setValueByPath(parentObject,["parameters","enhancePrompt"],
1131
- fromEnhancePrompt);let fromGenerateAudio=getValueByPath(fromObject,["generateAudio"]);parentObject!==void 0&&fromGenerateAudio!=null&&setValueByPath(parentObject,["parameters","generateAudio"],fromGenerateAudio);let fromLastFrame=getValueByPath(fromObject,["lastFrame"]);parentObject!==void 0&&fromLastFrame!=null&&setValueByPath(parentObject,["instances[0]","lastFrame"],imageToVertex(fromLastFrame));let fromReferenceImages=getValueByPath(fromObject,["referenceImages"]);if(parentObject!==void 0&&fromReferenceImages!=
1132
- null){let transformedList=fromReferenceImages;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>videoGenerationReferenceImageToVertex(item))),setValueByPath(parentObject,["instances[0]","referenceImages"],transformedList)}let fromMask=getValueByPath(fromObject,["mask"]);parentObject!==void 0&&fromMask!=null&&setValueByPath(parentObject,["instances[0]","mask"],videoGenerationMaskToVertex(fromMask));let fromCompressionQuality=getValueByPath(fromObject,["compressionQuality"]);
1133
- parentObject!==void 0&&fromCompressionQuality!=null&&setValueByPath(parentObject,["parameters","compressionQuality"],fromCompressionQuality);let fromLabels=getValueByPath(fromObject,["labels"]);if(parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["labels"],fromLabels),getValueByPath(fromObject,["webhookConfig"])!==void 0)throw new Error("webhookConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromResizeMode=getValueByPath(
1134
- fromObject,["resizeMode"]);return parentObject!==void 0&&fromResizeMode!=null&&setValueByPath(parentObject,["parameters","resizeMode"],fromResizeMode),toObject}function generateVideosOperationFromMldev(fromObject,rootObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["name"],fromName);let fromMetadata=getValueByPath(fromObject,["metadata"]);fromMetadata!=null&&setValueByPath(toObject,["metadata"],fromMetadata);let fromDone=getValueByPath(
1135
- fromObject,["done"]);fromDone!=null&&setValueByPath(toObject,["done"],fromDone);let fromError=getValueByPath(fromObject,["error"]);fromError!=null&&setValueByPath(toObject,["error"],fromError);let fromResponse=getValueByPath(fromObject,["response","generateVideoResponse"]);return fromResponse!=null&&setValueByPath(toObject,["response"],generateVideosResponseFromMldev(fromResponse)),toObject}function generateVideosOperationFromVertex(fromObject,rootObject){let toObject={},fromName=getValueByPath(
1136
- fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["name"],fromName);let fromMetadata=getValueByPath(fromObject,["metadata"]);fromMetadata!=null&&setValueByPath(toObject,["metadata"],fromMetadata);let fromDone=getValueByPath(fromObject,["done"]);fromDone!=null&&setValueByPath(toObject,["done"],fromDone);let fromError=getValueByPath(fromObject,["error"]);fromError!=null&&setValueByPath(toObject,["error"],fromError);let fromResponse=getValueByPath(fromObject,["response"]);return fromResponse!=
1137
- null&&setValueByPath(toObject,["response"],generateVideosResponseFromVertex(fromResponse)),toObject}function generateVideosParametersToMldev(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromPrompt=getValueByPath(fromObject,["prompt"]);fromPrompt!=null&&setValueByPath(toObject,["instances[0]","prompt"],fromPrompt);let fromImage=getValueByPath(fromObject,["i\
1138
- mage"]);fromImage!=null&&setValueByPath(toObject,["instances[0]","image"],imageToMldev(fromImage));let fromVideo=getValueByPath(fromObject,["video"]);fromVideo!=null&&setValueByPath(toObject,["instances[0]","video"],videoToMldev(fromVideo));let fromSource=getValueByPath(fromObject,["source"]);fromSource!=null&&generateVideosSourceToMldev(fromSource,toObject);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&generateVideosConfigToMldev(fromConfig,toObject),toObject}function generateVideosParametersToVertex(apiClient,fromObject,rootObject){
1139
- let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromPrompt=getValueByPath(fromObject,["prompt"]);fromPrompt!=null&&setValueByPath(toObject,["instances[0]","prompt"],fromPrompt);let fromImage=getValueByPath(fromObject,["image"]);fromImage!=null&&setValueByPath(toObject,["instances[0]","image"],imageToVertex(fromImage));let fromVideo=getValueByPath(fromObject,["video"]);fromVideo!=null&&setValueByPath(
1140
- toObject,["instances[0]","video"],videoToVertex(fromVideo));let fromSource=getValueByPath(fromObject,["source"]);fromSource!=null&&generateVideosSourceToVertex(fromSource,toObject);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&generateVideosConfigToVertex(fromConfig,toObject),toObject}function generateVideosResponseFromMldev(fromObject,rootObject){let toObject={},fromGeneratedVideos=getValueByPath(fromObject,["generatedSamples"]);if(fromGeneratedVideos!=null){let transformedList=fromGeneratedVideos;
1141
- Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedVideoFromMldev(item))),setValueByPath(toObject,["generatedVideos"],transformedList)}let fromRaiMediaFilteredCount=getValueByPath(fromObject,["raiMediaFilteredCount"]);fromRaiMediaFilteredCount!=null&&setValueByPath(toObject,["raiMediaFilteredCount"],fromRaiMediaFilteredCount);let fromRaiMediaFilteredReasons=getValueByPath(fromObject,["raiMediaFilteredReasons"]);return fromRaiMediaFilteredReasons!=null&&setValueByPath(
1142
- toObject,["raiMediaFilteredReasons"],fromRaiMediaFilteredReasons),toObject}function generateVideosResponseFromVertex(fromObject,rootObject){let toObject={},fromGeneratedVideos=getValueByPath(fromObject,["videos"]);if(fromGeneratedVideos!=null){let transformedList=fromGeneratedVideos;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedVideoFromVertex(item))),setValueByPath(toObject,["generatedVideos"],transformedList)}let fromRaiMediaFilteredCount=getValueByPath(fromObject,
1143
- ["raiMediaFilteredCount"]);fromRaiMediaFilteredCount!=null&&setValueByPath(toObject,["raiMediaFilteredCount"],fromRaiMediaFilteredCount);let fromRaiMediaFilteredReasons=getValueByPath(fromObject,["raiMediaFilteredReasons"]);return fromRaiMediaFilteredReasons!=null&&setValueByPath(toObject,["raiMediaFilteredReasons"],fromRaiMediaFilteredReasons),toObject}function generateVideosSourceToMldev(fromObject,parentObject,rootObject){let toObject={},fromPrompt=getValueByPath(fromObject,["prompt"]);parentObject!==
1144
- void 0&&fromPrompt!=null&&setValueByPath(parentObject,["instances[0]","prompt"],fromPrompt);let fromImage=getValueByPath(fromObject,["image"]);parentObject!==void 0&&fromImage!=null&&setValueByPath(parentObject,["instances[0]","image"],imageToMldev(fromImage));let fromVideo=getValueByPath(fromObject,["video"]);return parentObject!==void 0&&fromVideo!=null&&setValueByPath(parentObject,["instances[0]","video"],videoToMldev(fromVideo)),toObject}function generateVideosSourceToVertex(fromObject,parentObject,rootObject){
1145
- let toObject={},fromPrompt=getValueByPath(fromObject,["prompt"]);parentObject!==void 0&&fromPrompt!=null&&setValueByPath(parentObject,["instances[0]","prompt"],fromPrompt);let fromImage=getValueByPath(fromObject,["image"]);parentObject!==void 0&&fromImage!=null&&setValueByPath(parentObject,["instances[0]","image"],imageToVertex(fromImage));let fromVideo=getValueByPath(fromObject,["video"]);return parentObject!==void 0&&fromVideo!=null&&setValueByPath(parentObject,["instances[0]","video"],videoToVertex(
1146
- fromVideo)),toObject}function generatedImageFromVertex(fromObject,rootObject){let toObject={},fromImage=getValueByPath(fromObject,["_self"]);fromImage!=null&&setValueByPath(toObject,["image"],imageFromVertex(fromImage));let fromRaiFilteredReason=getValueByPath(fromObject,["raiFilteredReason"]);fromRaiFilteredReason!=null&&setValueByPath(toObject,["raiFilteredReason"],fromRaiFilteredReason);let fromSafetyAttributes=getValueByPath(fromObject,["_self"]);fromSafetyAttributes!=null&&setValueByPath(toObject,
1147
- ["safetyAttributes"],safetyAttributesFromVertex(fromSafetyAttributes));let fromEnhancedPrompt=getValueByPath(fromObject,["prompt"]);return fromEnhancedPrompt!=null&&setValueByPath(toObject,["enhancedPrompt"],fromEnhancedPrompt),toObject}function generatedImageMaskFromVertex(fromObject,rootObject){let toObject={},fromMask=getValueByPath(fromObject,["_self"]);fromMask!=null&&setValueByPath(toObject,["mask"],imageFromVertex(fromMask));let fromLabels=getValueByPath(fromObject,["labels"]);if(fromLabels!=
1148
- null){let transformedList=fromLabels;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["labels"],transformedList)}return toObject}function generatedVideoFromMldev(fromObject,rootObject){let toObject={},fromVideo=getValueByPath(fromObject,["video"]);return fromVideo!=null&&setValueByPath(toObject,["video"],videoFromMldev(fromVideo)),toObject}function generatedVideoFromVertex(fromObject,rootObject){let toObject={},fromVideo=getValueByPath(fromObject,
1149
- ["_self"]);return fromVideo!=null&&setValueByPath(toObject,["video"],videoFromVertex(fromVideo)),toObject}function generationConfigToVertex(fromObject,rootObject){let toObject={},fromModelSelectionConfig=getValueByPath(fromObject,["modelSelectionConfig"]);fromModelSelectionConfig!=null&&setValueByPath(toObject,["modelConfig"],fromModelSelectionConfig);let fromResponseJsonSchema=getValueByPath(fromObject,["responseJsonSchema"]);fromResponseJsonSchema!=null&&setValueByPath(toObject,["responseJsonS\
1150
- chema"],fromResponseJsonSchema);let fromAudioTranscriptionConfig=getValueByPath(fromObject,["audioTranscriptionConfig"]);fromAudioTranscriptionConfig!=null&&setValueByPath(toObject,["audioTranscriptionConfig"],fromAudioTranscriptionConfig);let fromAudioTimestamp=getValueByPath(fromObject,["audioTimestamp"]);fromAudioTimestamp!=null&&setValueByPath(toObject,["audioTimestamp"],fromAudioTimestamp);let fromCandidateCount=getValueByPath(fromObject,["candidateCount"]);fromCandidateCount!=null&&setValueByPath(
1151
- toObject,["candidateCount"],fromCandidateCount);let fromEnableAffectiveDialog=getValueByPath(fromObject,["enableAffectiveDialog"]);fromEnableAffectiveDialog!=null&&setValueByPath(toObject,["enableAffectiveDialog"],fromEnableAffectiveDialog);let fromFrequencyPenalty=getValueByPath(fromObject,["frequencyPenalty"]);fromFrequencyPenalty!=null&&setValueByPath(toObject,["frequencyPenalty"],fromFrequencyPenalty);let fromLogprobs=getValueByPath(fromObject,["logprobs"]);fromLogprobs!=null&&setValueByPath(
1152
- toObject,["logprobs"],fromLogprobs);let fromMaxOutputTokens=getValueByPath(fromObject,["maxOutputTokens"]);fromMaxOutputTokens!=null&&setValueByPath(toObject,["maxOutputTokens"],fromMaxOutputTokens);let fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromPresencePenalty=getValueByPath(fromObject,["presencePenalty"]);fromPresencePenalty!=null&&setValueByPath(toObject,["presencePenalt\
1153
- y"],fromPresencePenalty);let fromResponseFormat=getValueByPath(fromObject,["responseFormat"]);if(fromResponseFormat!=null){let transformedList=fromResponseFormat;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["responseFormat"],transformedList)}let fromResponseLogprobs=getValueByPath(fromObject,["responseLogprobs"]);fromResponseLogprobs!=null&&setValueByPath(toObject,["responseLogprobs"],fromResponseLogprobs);let fromResponseMimeType=getValueByPath(
1154
- fromObject,["responseMimeType"]);fromResponseMimeType!=null&&setValueByPath(toObject,["responseMimeType"],fromResponseMimeType);let fromResponseModalities=getValueByPath(fromObject,["responseModalities"]);fromResponseModalities!=null&&setValueByPath(toObject,["responseModalities"],fromResponseModalities);let fromResponseSchema=getValueByPath(fromObject,["responseSchema"]);fromResponseSchema!=null&&setValueByPath(toObject,["responseSchema"],fromResponseSchema);let fromRoutingConfig=getValueByPath(
1155
- fromObject,["routingConfig"]);fromRoutingConfig!=null&&setValueByPath(toObject,["routingConfig"],fromRoutingConfig);let fromSeed=getValueByPath(fromObject,["seed"]);fromSeed!=null&&setValueByPath(toObject,["seed"],fromSeed);let fromSpeechConfig=getValueByPath(fromObject,["speechConfig"]);fromSpeechConfig!=null&&setValueByPath(toObject,["speechConfig"],speechConfigToVertex(fromSpeechConfig));let fromStopSequences=getValueByPath(fromObject,["stopSequences"]);fromStopSequences!=null&&setValueByPath(
1156
- toObject,["stopSequences"],fromStopSequences);let fromTemperature=getValueByPath(fromObject,["temperature"]);fromTemperature!=null&&setValueByPath(toObject,["temperature"],fromTemperature);let fromThinkingConfig=getValueByPath(fromObject,["thinkingConfig"]);fromThinkingConfig!=null&&setValueByPath(toObject,["thinkingConfig"],fromThinkingConfig);let fromTopK=getValueByPath(fromObject,["topK"]);fromTopK!=null&&setValueByPath(toObject,["topK"],fromTopK);let fromTopP=getValueByPath(fromObject,["topP"]);
1157
- if(fromTopP!=null&&setValueByPath(toObject,["topP"],fromTopP),getValueByPath(fromObject,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromTranslationConfig=getValueByPath(fromObject,["translationConfig"]);return fromTranslationConfig!=null&&setValueByPath(toObject,["translationConfig"],fromTranslationConfig),toObject}function getModelParametersToMldev(apiClient,fromObject,_rootObject){
1158
- let toObject={},fromModel=getValueByPath(fromObject,["model"]);return fromModel!=null&&setValueByPath(toObject,["_url","name"],tModel(apiClient,fromModel)),toObject}function getModelParametersToVertex(apiClient,fromObject,_rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);return fromModel!=null&&setValueByPath(toObject,["_url","name"],tModel(apiClient,fromModel)),toObject}function googleMapsToMldev$1(fromObject,rootObject){let toObject={},fromAuthConfig=getValueByPath(fromObject,
1159
- ["authConfig"]);fromAuthConfig!=null&&setValueByPath(toObject,["authConfig"],authConfigToMldev$1(fromAuthConfig));let fromEnableWidget=getValueByPath(fromObject,["enableWidget"]);if(fromEnableWidget!=null&&setValueByPath(toObject,["enableWidget"],fromEnableWidget),getValueByPath(fromObject,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function googleSearchToMldev$1(fromObject,_rootObject){
1160
- let toObject={};if(getValueByPath(fromObject,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromSearchTypes=getValueByPath(fromObject,["searchTypes"]);fromSearchTypes!=null&&
1161
- setValueByPath(toObject,["searchTypes"],fromSearchTypes);let fromTimeRangeFilter=getValueByPath(fromObject,["timeRangeFilter"]);return fromTimeRangeFilter!=null&&setValueByPath(toObject,["timeRangeFilter"],fromTimeRangeFilter),toObject}function imageConfigToMldev(fromObject,_rootObject){let toObject={},fromAspectRatio=getValueByPath(fromObject,["aspectRatio"]);fromAspectRatio!=null&&setValueByPath(toObject,["aspectRatio"],fromAspectRatio);let fromImageSize=getValueByPath(fromObject,["imageSize"]);
1162
- if(fromImageSize!=null&&setValueByPath(toObject,["imageSize"],fromImageSize),getValueByPath(fromObject,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,[
1163
- "outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["imageOutputOptions"])!==void 0)throw new Error("imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["prominentPeople"])!==void 0)throw new Error("prominentPeople parameter is only \
1164
- supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function imageConfigToVertex(fromObject,_rootObject){let toObject={},fromAspectRatio=getValueByPath(fromObject,["aspectRatio"]);fromAspectRatio!=null&&setValueByPath(toObject,["aspectRatio"],fromAspectRatio);let fromImageSize=getValueByPath(fromObject,["imageSize"]);fromImageSize!=null&&setValueByPath(toObject,["imageSize"],fromImageSize);let fromPersonGeneration=getValueByPath(fromObject,["pe\
1165
- rsonGeneration"]);fromPersonGeneration!=null&&setValueByPath(toObject,["personGeneration"],fromPersonGeneration);let fromOutputMimeType=getValueByPath(fromObject,["outputMimeType"]);fromOutputMimeType!=null&&setValueByPath(toObject,["imageOutputOptions","mimeType"],fromOutputMimeType);let fromOutputCompressionQuality=getValueByPath(fromObject,["outputCompressionQuality"]);fromOutputCompressionQuality!=null&&setValueByPath(toObject,["imageOutputOptions","compressionQuality"],fromOutputCompressionQuality);
1166
- let fromImageOutputOptions=getValueByPath(fromObject,["imageOutputOptions"]);fromImageOutputOptions!=null&&setValueByPath(toObject,["imageOutputOptions"],fromImageOutputOptions);let fromProminentPeople=getValueByPath(fromObject,["prominentPeople"]);return fromProminentPeople!=null&&setValueByPath(toObject,["prominentPeople"],fromProminentPeople),toObject}function imageFromVertex(fromObject,_rootObject){let toObject={},fromGcsUri=getValueByPath(fromObject,["gcsUri"]);fromGcsUri!=null&&setValueByPath(
1167
- toObject,["gcsUri"],fromGcsUri);let fromImageBytes=getValueByPath(fromObject,["bytesBase64Encoded"]);fromImageBytes!=null&&setValueByPath(toObject,["imageBytes"],tBytes(fromImageBytes));let fromMimeType=getValueByPath(fromObject,["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function imageToMldev(fromObject,_rootObject){let toObject={};if(getValueByPath(fromObject,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is only supported in Gem\
1168
- ini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromImageBytes=getValueByPath(fromObject,["imageBytes"]);fromImageBytes!=null&&setValueByPath(toObject,["bytesBase64Encoded"],tBytes(fromImageBytes));let fromMimeType=getValueByPath(fromObject,["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function imageToVertex(fromObject,_rootObject){let toObject={},fromGcsUri=getValueByPath(fromObject,["gcsUri"]);fromGcsUri!=null&&
1169
- setValueByPath(toObject,["gcsUri"],fromGcsUri);let fromImageBytes=getValueByPath(fromObject,["imageBytes"]);fromImageBytes!=null&&setValueByPath(toObject,["bytesBase64Encoded"],tBytes(fromImageBytes));let fromMimeType=getValueByPath(fromObject,["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function listModelsConfigToMldev(apiClient,fromObject,parentObject,_rootObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==
1170
- void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken);let fromFilter=getValueByPath(fromObject,["filter"]);parentObject!==void 0&&fromFilter!=null&&setValueByPath(parentObject,["_query","filter"],fromFilter);let fromQueryBase=getValueByPath(fromObject,["queryBase"]);return parentObject!==void 0&&
1171
- fromQueryBase!=null&&setValueByPath(parentObject,["_url","models_url"],tModelsUrl(apiClient,fromQueryBase)),toObject}function listModelsConfigToVertex(apiClient,fromObject,parentObject,_rootObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,
1172
- ["_query","pageToken"],fromPageToken);let fromFilter=getValueByPath(fromObject,["filter"]);parentObject!==void 0&&fromFilter!=null&&setValueByPath(parentObject,["_query","filter"],fromFilter);let fromQueryBase=getValueByPath(fromObject,["queryBase"]);return parentObject!==void 0&&fromQueryBase!=null&&setValueByPath(parentObject,["_url","models_url"],tModelsUrl(apiClient,fromQueryBase)),toObject}function listModelsParametersToMldev(apiClient,fromObject,rootObject){let toObject={},fromConfig=getValueByPath(
1173
- fromObject,["config"]);return fromConfig!=null&&listModelsConfigToMldev(apiClient,fromConfig,toObject),toObject}function listModelsParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listModelsConfigToVertex(apiClient,fromConfig,toObject),toObject}function listModelsResponseFromMldev(fromObject,rootObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=
1174
- null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromModels=getValueByPath(fromObject,["_self"]);if(fromModels!=null){let transformedList=tExtractModels(fromModels);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>modelFromMldev(item))),setValueByPath(toObject,["models"],transformedList)}return toObject}
1175
- function listModelsResponseFromVertex(fromObject,rootObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromModels=getValueByPath(fromObject,["_self"]);if(fromModels!=null){let transformedList=tExtractModels(fromModels);
1176
- Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>modelFromVertex(item))),setValueByPath(toObject,["models"],transformedList)}return toObject}function maskReferenceConfigToVertex(fromObject,_rootObject){let toObject={},fromMaskMode=getValueByPath(fromObject,["maskMode"]);fromMaskMode!=null&&setValueByPath(toObject,["maskMode"],fromMaskMode);let fromSegmentationClasses=getValueByPath(fromObject,["segmentationClasses"]);fromSegmentationClasses!=null&&setValueByPath(toObject,
1177
- ["maskClasses"],fromSegmentationClasses);let fromMaskDilation=getValueByPath(fromObject,["maskDilation"]);return fromMaskDilation!=null&&setValueByPath(toObject,["dilation"],fromMaskDilation),toObject}function mcpServerToVertex$1(fromObject,_rootObject){let toObject={};if(getValueByPath(fromObject,["name"])!==void 0)throw new Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["streamableHttpTransport"])!==
1178
- void 0)throw new Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function modelFromMldev(fromObject,rootObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["name"],fromName);let fromDisplayName=getValueByPath(fromObject,["displayName"]);fromDisplayName!=null&&setValueByPath(toObject,["displayName"],fromDisplayName);let fromDescription=getValueByPath(
1179
- fromObject,["description"]);fromDescription!=null&&setValueByPath(toObject,["description"],fromDescription);let fromVersion=getValueByPath(fromObject,["version"]);fromVersion!=null&&setValueByPath(toObject,["version"],fromVersion);let fromTunedModelInfo=getValueByPath(fromObject,["_self"]);fromTunedModelInfo!=null&&setValueByPath(toObject,["tunedModelInfo"],tunedModelInfoFromMldev(fromTunedModelInfo));let fromInputTokenLimit=getValueByPath(fromObject,["inputTokenLimit"]);fromInputTokenLimit!=null&&
1180
- setValueByPath(toObject,["inputTokenLimit"],fromInputTokenLimit);let fromOutputTokenLimit=getValueByPath(fromObject,["outputTokenLimit"]);fromOutputTokenLimit!=null&&setValueByPath(toObject,["outputTokenLimit"],fromOutputTokenLimit);let fromSupportedActions=getValueByPath(fromObject,["supportedGenerationMethods"]);fromSupportedActions!=null&&setValueByPath(toObject,["supportedActions"],fromSupportedActions);let fromTemperature=getValueByPath(fromObject,["temperature"]);fromTemperature!=null&&setValueByPath(
1181
- toObject,["temperature"],fromTemperature);let fromMaxTemperature=getValueByPath(fromObject,["maxTemperature"]);fromMaxTemperature!=null&&setValueByPath(toObject,["maxTemperature"],fromMaxTemperature);let fromTopP=getValueByPath(fromObject,["topP"]);fromTopP!=null&&setValueByPath(toObject,["topP"],fromTopP);let fromTopK=getValueByPath(fromObject,["topK"]);fromTopK!=null&&setValueByPath(toObject,["topK"],fromTopK);let fromThinking=getValueByPath(fromObject,["thinking"]);return fromThinking!=null&&
1182
- setValueByPath(toObject,["thinking"],fromThinking),toObject}function modelFromVertex(fromObject,rootObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["name"],fromName);let fromDisplayName=getValueByPath(fromObject,["displayName"]);fromDisplayName!=null&&setValueByPath(toObject,["displayName"],fromDisplayName);let fromDescription=getValueByPath(fromObject,["description"]);fromDescription!=null&&setValueByPath(toObject,["description"],fromDescription);
1183
- let fromVersion=getValueByPath(fromObject,["versionId"]);fromVersion!=null&&setValueByPath(toObject,["version"],fromVersion);let fromEndpoints=getValueByPath(fromObject,["deployedModels"]);if(fromEndpoints!=null){let transformedList=fromEndpoints;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>endpointFromVertex(item))),setValueByPath(toObject,["endpoints"],transformedList)}let fromLabels=getValueByPath(fromObject,["labels"]);fromLabels!=null&&setValueByPath(toObject,[
1184
- "labels"],fromLabels);let fromTunedModelInfo=getValueByPath(fromObject,["_self"]);fromTunedModelInfo!=null&&setValueByPath(toObject,["tunedModelInfo"],tunedModelInfoFromVertex(fromTunedModelInfo));let fromDefaultCheckpointId=getValueByPath(fromObject,["defaultCheckpointId"]);fromDefaultCheckpointId!=null&&setValueByPath(toObject,["defaultCheckpointId"],fromDefaultCheckpointId);let fromCheckpoints=getValueByPath(fromObject,["checkpoints"]);if(fromCheckpoints!=null){let transformedList=fromCheckpoints;
1185
- Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["checkpoints"],transformedList)}return toObject}function multiSpeakerVoiceConfigToVertex(fromObject,rootObject){let toObject={},fromSpeakerVoiceConfigs=getValueByPath(fromObject,["speakerVoiceConfigs"]);if(fromSpeakerVoiceConfigs!=null){let transformedList=fromSpeakerVoiceConfigs;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>speakerVoiceConfigToVertex(item))),setValueByPath(
1186
- toObject,["speakerVoiceConfigs"],transformedList)}return toObject}function partToMldev$1(fromObject,rootObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=null&&setValueByPath(toObject,["toolCall"],fromToolCall);let fromToolResponse=getValueByPath(fromObject,["toolResponse"]);fromToolResponse!=null&&
1187
- setValueByPath(toObject,["toolResponse"],fromToolResponse);let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=
1188
- null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],functionCallToMldev$1(fromFunctionCall));let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["funct\
1189
- ionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=
1190
- null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata);let fromPartMetadata=getValueByPath(fromObject,["partMetadata"]);fromPartMetadata!=null&&setValueByPath(toObject,["partMetadata"],fromPartMetadata);let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["me\
1191
- diaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function partToVertex$1(fromObject,_rootObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);if(fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution),getValueByPath(fromObject,["toolCall"])!==void 0)throw new Error(
1192
- "toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(
1078
+ ed in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromContinuationToken=getValueByPath(fromObject,["continuationToken"]);if(parentObject!==void 0&&fromContinuationToken!=null&&setValueByPath(parentObject,["continuationToken"],fromContinuationToken),getValueByPath(fromObject,["generationOutputConfig"])!==void 0)throw new Error("generationOutputConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromStore=getValueByPath(
1079
+ fromObject,["store"]);return parentObject!==void 0&&fromStore!=null&&setValueByPath(parentObject,["store"],fromStore),toObject}function generateContentConfigToVertex(apiClient,fromObject,parentObject,rootObject){let toObject={},fromServiceTier=getValueByPath(fromObject,["serviceTier"]);parentObject!==void 0&&fromServiceTier!=null&&setValueByPath(parentObject,["serviceTier"],fromServiceTier);let fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);parentObject!==void 0&&fromSystemInstruction!=
1080
+ null&&setValueByPath(parentObject,["systemInstruction"],contentToVertex$1(tContent(fromSystemInstruction)));let fromTemperature=getValueByPath(fromObject,["temperature"]);fromTemperature!=null&&setValueByPath(toObject,["temperature"],fromTemperature);let fromTopP=getValueByPath(fromObject,["topP"]);fromTopP!=null&&setValueByPath(toObject,["topP"],fromTopP);let fromTopK=getValueByPath(fromObject,["topK"]);fromTopK!=null&&setValueByPath(toObject,["topK"],fromTopK);let fromCandidateCount=getValueByPath(
1081
+ fromObject,["candidateCount"]);fromCandidateCount!=null&&setValueByPath(toObject,["candidateCount"],fromCandidateCount);let fromMaxOutputTokens=getValueByPath(fromObject,["maxOutputTokens"]);fromMaxOutputTokens!=null&&setValueByPath(toObject,["maxOutputTokens"],fromMaxOutputTokens);let fromStopSequences=getValueByPath(fromObject,["stopSequences"]);fromStopSequences!=null&&setValueByPath(toObject,["stopSequences"],fromStopSequences);let fromResponseLogprobs=getValueByPath(fromObject,["responseLog\
1082
+ probs"]);fromResponseLogprobs!=null&&setValueByPath(toObject,["responseLogprobs"],fromResponseLogprobs);let fromLogprobs=getValueByPath(fromObject,["logprobs"]);fromLogprobs!=null&&setValueByPath(toObject,["logprobs"],fromLogprobs);let fromPresencePenalty=getValueByPath(fromObject,["presencePenalty"]);fromPresencePenalty!=null&&setValueByPath(toObject,["presencePenalty"],fromPresencePenalty);let fromFrequencyPenalty=getValueByPath(fromObject,["frequencyPenalty"]);fromFrequencyPenalty!=null&&setValueByPath(
1083
+ toObject,["frequencyPenalty"],fromFrequencyPenalty);let fromSeed=getValueByPath(fromObject,["seed"]);fromSeed!=null&&setValueByPath(toObject,["seed"],fromSeed);let fromResponseMimeType=getValueByPath(fromObject,["responseMimeType"]);fromResponseMimeType!=null&&setValueByPath(toObject,["responseMimeType"],fromResponseMimeType);let fromResponseSchema=getValueByPath(fromObject,["responseSchema"]);fromResponseSchema!=null&&setValueByPath(toObject,["responseSchema"],tSchema(fromResponseSchema));let fromResponseJsonSchema=getValueByPath(
1084
+ fromObject,["responseJsonSchema"]);fromResponseJsonSchema!=null&&setValueByPath(toObject,["responseJsonSchema"],fromResponseJsonSchema);let fromRoutingConfig=getValueByPath(fromObject,["routingConfig"]);fromRoutingConfig!=null&&setValueByPath(toObject,["routingConfig"],fromRoutingConfig);let fromModelSelectionConfig=getValueByPath(fromObject,["modelSelectionConfig"]);fromModelSelectionConfig!=null&&setValueByPath(toObject,["modelConfig"],fromModelSelectionConfig);let fromSafetySettings=getValueByPath(
1085
+ fromObject,["safetySettings"]);if(parentObject!==void 0&&fromSafetySettings!=null){let transformedList=fromSafetySettings;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(parentObject,["safetySettings"],transformedList)}let fromTools=getValueByPath(fromObject,["tools"]);if(parentObject!==void 0&&fromTools!=null){let transformedList=tTools(fromTools);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToVertex$1(tTool(item)))),
1086
+ setValueByPath(parentObject,["tools"],transformedList)}let fromToolConfig=getValueByPath(fromObject,["toolConfig"]);parentObject!==void 0&&fromToolConfig!=null&&setValueByPath(parentObject,["toolConfig"],toolConfigToVertex(fromToolConfig));let fromLabels=getValueByPath(fromObject,["labels"]);parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["labels"],fromLabels);let fromCachedContent=getValueByPath(fromObject,["cachedContent"]);parentObject!==void 0&&fromCachedContent!=null&&
1087
+ setValueByPath(parentObject,["cachedContent"],tCachedContentName(apiClient,fromCachedContent));let fromResponseModalities=getValueByPath(fromObject,["responseModalities"]);fromResponseModalities!=null&&setValueByPath(toObject,["responseModalities"],fromResponseModalities);let fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromSpeechConfig=getValueByPath(fromObject,["speechConfig"]);
1088
+ fromSpeechConfig!=null&&setValueByPath(toObject,["speechConfig"],speechConfigToVertex(tSpeechConfig(fromSpeechConfig)));let fromAudioTimestamp=getValueByPath(fromObject,["audioTimestamp"]);fromAudioTimestamp!=null&&setValueByPath(toObject,["audioTimestamp"],fromAudioTimestamp);let fromThinkingConfig=getValueByPath(fromObject,["thinkingConfig"]);fromThinkingConfig!=null&&setValueByPath(toObject,["thinkingConfig"],fromThinkingConfig);let fromAudioTranscriptionConfig=getValueByPath(fromObject,["aud\
1089
+ ioTranscriptionConfig"]);fromAudioTranscriptionConfig!=null&&setValueByPath(toObject,["audioTranscriptionConfig"],fromAudioTranscriptionConfig);let fromImageConfig=getValueByPath(fromObject,["imageConfig"]);if(fromImageConfig!=null&&setValueByPath(toObject,["imageConfig"],imageConfigToVertex(fromImageConfig)),getValueByPath(fromObject,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterp\
1090
+ rise Agent Platform mode.");let fromModelArmorConfig=getValueByPath(fromObject,["modelArmorConfig"]);parentObject!==void 0&&fromModelArmorConfig!=null&&setValueByPath(parentObject,["modelArmorConfig"],fromModelArmorConfig);let fromContinuationToken=getValueByPath(fromObject,["continuationToken"]);parentObject!==void 0&&fromContinuationToken!=null&&setValueByPath(parentObject,["continuationToken"],fromContinuationToken);let fromGenerationOutputConfig=getValueByPath(fromObject,["generationOutputCo\
1091
+ nfig"]);if(parentObject!==void 0&&fromGenerationOutputConfig!=null&&setValueByPath(parentObject,["outputConfig"],fromGenerationOutputConfig),getValueByPath(fromObject,["store"])!==void 0)throw new Error("store parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function generateContentParametersToMldev(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(
1092
+ toObject,["_url","model"],tModel(apiClient,fromModel));let fromContents=getValueByPath(fromObject,["contents"]);if(fromContents!=null){let transformedList=tContents(fromContents);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>contentToMldev$1(item))),setValueByPath(toObject,["contents"],transformedList)}let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["generationConfig"],generateContentConfigToMldev(apiClient,fromConfig,
1093
+ toObject)),toObject}function generateContentParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromContents=getValueByPath(fromObject,["contents"]);if(fromContents!=null){let transformedList=tContents(fromContents);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>contentToVertex$1(item))),setValueByPath(toObject,["con\
1094
+ tents"],transformedList)}let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["generationConfig"],generateContentConfigToVertex(apiClient,fromConfig,toObject)),toObject}function generateContentResponseFromMldev(fromObject,rootObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromCandidates=getValueByPath(fromObject,
1095
+ ["candidates"]);if(fromCandidates!=null){let transformedList=fromCandidates;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>candidateFromMldev(item))),setValueByPath(toObject,["candidates"],transformedList)}let fromModelVersion=getValueByPath(fromObject,["modelVersion"]);fromModelVersion!=null&&setValueByPath(toObject,["modelVersion"],fromModelVersion);let fromPromptFeedback=getValueByPath(fromObject,["promptFeedback"]);fromPromptFeedback!=null&&setValueByPath(toObject,
1096
+ ["promptFeedback"],fromPromptFeedback);let fromResponseId=getValueByPath(fromObject,["responseId"]);fromResponseId!=null&&setValueByPath(toObject,["responseId"],fromResponseId);let fromUsageMetadata=getValueByPath(fromObject,["usageMetadata"]);fromUsageMetadata!=null&&setValueByPath(toObject,["usageMetadata"],fromUsageMetadata);let fromModelStatus=getValueByPath(fromObject,["modelStatus"]);return fromModelStatus!=null&&setValueByPath(toObject,["modelStatus"],fromModelStatus),toObject}function generateContentResponseFromVertex(fromObject,_rootObject){
1097
+ let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromCandidates=getValueByPath(fromObject,["candidates"]);if(fromCandidates!=null){let transformedList=fromCandidates;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["candidates"],transformedList)}let fromCreateTime=getValueByPath(fromObject,["createTime"]);fromCreateTime!=
1098
+ null&&setValueByPath(toObject,["createTime"],fromCreateTime);let fromModelVersion=getValueByPath(fromObject,["modelVersion"]);fromModelVersion!=null&&setValueByPath(toObject,["modelVersion"],fromModelVersion);let fromPromptFeedback=getValueByPath(fromObject,["promptFeedback"]);fromPromptFeedback!=null&&setValueByPath(toObject,["promptFeedback"],fromPromptFeedback);let fromResponseId=getValueByPath(fromObject,["responseId"]);fromResponseId!=null&&setValueByPath(toObject,["responseId"],fromResponseId);
1099
+ let fromUsageMetadata=getValueByPath(fromObject,["usageMetadata"]);return fromUsageMetadata!=null&&setValueByPath(toObject,["usageMetadata"],fromUsageMetadata),toObject}function generateImagesConfigToVertex(fromObject,parentObject,_rootObject){let toObject={},fromOutputGcsUri=getValueByPath(fromObject,["outputGcsUri"]);parentObject!==void 0&&fromOutputGcsUri!=null&&setValueByPath(parentObject,["parameters","storageUri"],fromOutputGcsUri);let fromNegativePrompt=getValueByPath(fromObject,["negativ\
1100
+ ePrompt"]);parentObject!==void 0&&fromNegativePrompt!=null&&setValueByPath(parentObject,["parameters","negativePrompt"],fromNegativePrompt);let fromNumberOfImages=getValueByPath(fromObject,["numberOfImages"]);parentObject!==void 0&&fromNumberOfImages!=null&&setValueByPath(parentObject,["parameters","sampleCount"],fromNumberOfImages);let fromAspectRatio=getValueByPath(fromObject,["aspectRatio"]);parentObject!==void 0&&fromAspectRatio!=null&&setValueByPath(parentObject,["parameters","aspectRatio"],
1101
+ fromAspectRatio);let fromGuidanceScale=getValueByPath(fromObject,["guidanceScale"]);parentObject!==void 0&&fromGuidanceScale!=null&&setValueByPath(parentObject,["parameters","guidanceScale"],fromGuidanceScale);let fromSeed=getValueByPath(fromObject,["seed"]);parentObject!==void 0&&fromSeed!=null&&setValueByPath(parentObject,["parameters","seed"],fromSeed);let fromSafetyFilterLevel=getValueByPath(fromObject,["safetyFilterLevel"]);parentObject!==void 0&&fromSafetyFilterLevel!=null&&setValueByPath(
1102
+ parentObject,["parameters","safetySetting"],fromSafetyFilterLevel);let fromPersonGeneration=getValueByPath(fromObject,["personGeneration"]);parentObject!==void 0&&fromPersonGeneration!=null&&setValueByPath(parentObject,["parameters","personGeneration"],fromPersonGeneration);let fromIncludeSafetyAttributes=getValueByPath(fromObject,["includeSafetyAttributes"]);parentObject!==void 0&&fromIncludeSafetyAttributes!=null&&setValueByPath(parentObject,["parameters","includeSafetyAttributes"],fromIncludeSafetyAttributes);
1103
+ let fromIncludeRaiReason=getValueByPath(fromObject,["includeRaiReason"]);parentObject!==void 0&&fromIncludeRaiReason!=null&&setValueByPath(parentObject,["parameters","includeRaiReason"],fromIncludeRaiReason);let fromLanguage=getValueByPath(fromObject,["language"]);parentObject!==void 0&&fromLanguage!=null&&setValueByPath(parentObject,["parameters","language"],fromLanguage);let fromOutputMimeType=getValueByPath(fromObject,["outputMimeType"]);parentObject!==void 0&&fromOutputMimeType!=null&&setValueByPath(
1104
+ parentObject,["parameters","outputOptions","mimeType"],fromOutputMimeType);let fromOutputCompressionQuality=getValueByPath(fromObject,["outputCompressionQuality"]);parentObject!==void 0&&fromOutputCompressionQuality!=null&&setValueByPath(parentObject,["parameters","outputOptions","compressionQuality"],fromOutputCompressionQuality);let fromAddWatermark=getValueByPath(fromObject,["addWatermark"]);parentObject!==void 0&&fromAddWatermark!=null&&setValueByPath(parentObject,["parameters","addWatermark"],
1105
+ fromAddWatermark);let fromLabels=getValueByPath(fromObject,["labels"]);parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["labels"],fromLabels);let fromImageSize=getValueByPath(fromObject,["imageSize"]);parentObject!==void 0&&fromImageSize!=null&&setValueByPath(parentObject,["parameters","sampleImageSize"],fromImageSize);let fromEnhancePrompt=getValueByPath(fromObject,["enhancePrompt"]);return parentObject!==void 0&&fromEnhancePrompt!=null&&setValueByPath(parentObject,["parame\
1106
+ ters","enhancePrompt"],fromEnhancePrompt),toObject}function generateImagesParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromPrompt=getValueByPath(fromObject,["prompt"]);fromPrompt!=null&&setValueByPath(toObject,["instances[0]","prompt"],fromPrompt);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&generateImagesConfigToVertex(
1107
+ fromConfig,toObject),toObject}function generateImagesResponseFromVertex(fromObject,rootObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromGeneratedImages=getValueByPath(fromObject,["predictions"]);if(fromGeneratedImages!=null){let transformedList=fromGeneratedImages;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedImageFromVertex(
1108
+ item))),setValueByPath(toObject,["generatedImages"],transformedList)}let fromPositivePromptSafetyAttributes=getValueByPath(fromObject,["positivePromptSafetyAttributes"]);return fromPositivePromptSafetyAttributes!=null&&setValueByPath(toObject,["positivePromptSafetyAttributes"],safetyAttributesFromVertex(fromPositivePromptSafetyAttributes)),toObject}function generateVideosConfigToMldev(fromObject,parentObject,rootObject){let toObject={},fromNumberOfVideos=getValueByPath(fromObject,["numberOfVideo\
1109
+ s"]);if(parentObject!==void 0&&fromNumberOfVideos!=null&&setValueByPath(parentObject,["parameters","sampleCount"],fromNumberOfVideos),getValueByPath(fromObject,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["fps"])!==void 0)throw new Error("fps parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromDurationSeconds=getValueByPath(
1110
+ fromObject,["durationSeconds"]);if(parentObject!==void 0&&fromDurationSeconds!=null&&setValueByPath(parentObject,["parameters","durationSeconds"],fromDurationSeconds),getValueByPath(fromObject,["seed"])!==void 0)throw new Error("seed parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromAspectRatio=getValueByPath(fromObject,["aspectRatio"]);parentObject!==void 0&&fromAspectRatio!=null&&setValueByPath(parentObject,["parameters","aspectRa\
1111
+ tio"],fromAspectRatio);let fromResolution=getValueByPath(fromObject,["resolution"]);parentObject!==void 0&&fromResolution!=null&&setValueByPath(parentObject,["parameters","resolution"],fromResolution);let fromPersonGeneration=getValueByPath(fromObject,["personGeneration"]);if(parentObject!==void 0&&fromPersonGeneration!=null&&setValueByPath(parentObject,["parameters","personGeneration"],fromPersonGeneration),getValueByPath(fromObject,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic paramet\
1112
+ er is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromNegativePrompt=getValueByPath(fromObject,["negativePrompt"]);parentObject!==void 0&&fromNegativePrompt!=null&&setValueByPath(parentObject,["parameters","negativePrompt"],fromNegativePrompt);let fromEnhancePrompt=getValueByPath(fromObject,["enhancePrompt"]);if(parentObject!==void 0&&fromEnhancePrompt!=null&&setValueByPath(parentObject,["parameters","enhancePrompt"],fromEnhancePrompt),getValueByPath(
1113
+ fromObject,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromLastFrame=getValueByPath(fromObject,["lastFrame"]);parentObject!==void 0&&fromLastFrame!=null&&setValueByPath(parentObject,["instances[0]","lastFrame"],imageToMldev(fromLastFrame));let fromReferenceImages=getValueByPath(fromObject,["referenceImages"]);if(parentObject!==void 0&&fromReferenceImages!=null){let transformedList=fromReferenceImages;
1114
+ Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>videoGenerationReferenceImageToMldev(item))),setValueByPath(parentObject,["instances[0]","referenceImages"],transformedList)}if(getValueByPath(fromObject,["mask"])!==void 0)throw new Error("mask parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is only supporte\
1115
+ d in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["labels"])!==void 0)throw new Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromWebhookConfig=getValueByPath(fromObject,["webhookConfig"]);if(parentObject!==void 0&&fromWebhookConfig!=null&&setValueByPath(parentObject,["webhookConfig"],fromWebhookConfig),getValueByPath(fromObject,["resizeMode"])!==void 0)throw new Error(
1116
+ "resizeMode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function generateVideosConfigToVertex(fromObject,parentObject,rootObject){let toObject={},fromNumberOfVideos=getValueByPath(fromObject,["numberOfVideos"]);parentObject!==void 0&&fromNumberOfVideos!=null&&setValueByPath(parentObject,["parameters","sampleCount"],fromNumberOfVideos);let fromOutputGcsUri=getValueByPath(fromObject,["outputGcsUri"]);parentObject!==void 0&&
1117
+ fromOutputGcsUri!=null&&setValueByPath(parentObject,["parameters","storageUri"],fromOutputGcsUri);let fromFps=getValueByPath(fromObject,["fps"]);parentObject!==void 0&&fromFps!=null&&setValueByPath(parentObject,["parameters","fps"],fromFps);let fromDurationSeconds=getValueByPath(fromObject,["durationSeconds"]);parentObject!==void 0&&fromDurationSeconds!=null&&setValueByPath(parentObject,["parameters","durationSeconds"],fromDurationSeconds);let fromSeed=getValueByPath(fromObject,["seed"]);parentObject!==
1118
+ void 0&&fromSeed!=null&&setValueByPath(parentObject,["parameters","seed"],fromSeed);let fromAspectRatio=getValueByPath(fromObject,["aspectRatio"]);parentObject!==void 0&&fromAspectRatio!=null&&setValueByPath(parentObject,["parameters","aspectRatio"],fromAspectRatio);let fromResolution=getValueByPath(fromObject,["resolution"]);parentObject!==void 0&&fromResolution!=null&&setValueByPath(parentObject,["parameters","resolution"],fromResolution);let fromPersonGeneration=getValueByPath(fromObject,["pe\
1119
+ rsonGeneration"]);parentObject!==void 0&&fromPersonGeneration!=null&&setValueByPath(parentObject,["parameters","personGeneration"],fromPersonGeneration);let fromPubsubTopic=getValueByPath(fromObject,["pubsubTopic"]);parentObject!==void 0&&fromPubsubTopic!=null&&setValueByPath(parentObject,["parameters","pubsubTopic"],fromPubsubTopic);let fromNegativePrompt=getValueByPath(fromObject,["negativePrompt"]);parentObject!==void 0&&fromNegativePrompt!=null&&setValueByPath(parentObject,["parameters","neg\
1120
+ ativePrompt"],fromNegativePrompt);let fromEnhancePrompt=getValueByPath(fromObject,["enhancePrompt"]);parentObject!==void 0&&fromEnhancePrompt!=null&&setValueByPath(parentObject,["parameters","enhancePrompt"],fromEnhancePrompt);let fromGenerateAudio=getValueByPath(fromObject,["generateAudio"]);parentObject!==void 0&&fromGenerateAudio!=null&&setValueByPath(parentObject,["parameters","generateAudio"],fromGenerateAudio);let fromLastFrame=getValueByPath(fromObject,["lastFrame"]);parentObject!==void 0&&
1121
+ fromLastFrame!=null&&setValueByPath(parentObject,["instances[0]","lastFrame"],imageToVertex(fromLastFrame));let fromReferenceImages=getValueByPath(fromObject,["referenceImages"]);if(parentObject!==void 0&&fromReferenceImages!=null){let transformedList=fromReferenceImages;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>videoGenerationReferenceImageToVertex(item))),setValueByPath(parentObject,["instances[0]","referenceImages"],transformedList)}let fromMask=getValueByPath(
1122
+ fromObject,["mask"]);parentObject!==void 0&&fromMask!=null&&setValueByPath(parentObject,["instances[0]","mask"],videoGenerationMaskToVertex(fromMask));let fromCompressionQuality=getValueByPath(fromObject,["compressionQuality"]);parentObject!==void 0&&fromCompressionQuality!=null&&setValueByPath(parentObject,["parameters","compressionQuality"],fromCompressionQuality);let fromLabels=getValueByPath(fromObject,["labels"]);if(parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["labe\
1123
+ ls"],fromLabels),getValueByPath(fromObject,["webhookConfig"])!==void 0)throw new Error("webhookConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromResizeMode=getValueByPath(fromObject,["resizeMode"]);return parentObject!==void 0&&fromResizeMode!=null&&setValueByPath(parentObject,["parameters","resizeMode"],fromResizeMode),toObject}function generateVideosOperationFromMldev(fromObject,rootObject){let toObject={},fromName=getValueByPath(
1124
+ fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["name"],fromName);let fromMetadata=getValueByPath(fromObject,["metadata"]);fromMetadata!=null&&setValueByPath(toObject,["metadata"],fromMetadata);let fromDone=getValueByPath(fromObject,["done"]);fromDone!=null&&setValueByPath(toObject,["done"],fromDone);let fromError=getValueByPath(fromObject,["error"]);fromError!=null&&setValueByPath(toObject,["error"],fromError);let fromResponse=getValueByPath(fromObject,["response","generateVideoRe\
1125
+ sponse"]);return fromResponse!=null&&setValueByPath(toObject,["response"],generateVideosResponseFromMldev(fromResponse)),toObject}function generateVideosOperationFromVertex(fromObject,rootObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["name"],fromName);let fromMetadata=getValueByPath(fromObject,["metadata"]);fromMetadata!=null&&setValueByPath(toObject,["metadata"],fromMetadata);let fromDone=getValueByPath(fromObject,["done"]);fromDone!=
1126
+ null&&setValueByPath(toObject,["done"],fromDone);let fromError=getValueByPath(fromObject,["error"]);fromError!=null&&setValueByPath(toObject,["error"],fromError);let fromResponse=getValueByPath(fromObject,["response"]);return fromResponse!=null&&setValueByPath(toObject,["response"],generateVideosResponseFromVertex(fromResponse)),toObject}function generateVideosParametersToMldev(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(
1127
+ toObject,["_url","model"],tModel(apiClient,fromModel));let fromPrompt=getValueByPath(fromObject,["prompt"]);fromPrompt!=null&&setValueByPath(toObject,["instances[0]","prompt"],fromPrompt);let fromImage=getValueByPath(fromObject,["image"]);fromImage!=null&&setValueByPath(toObject,["instances[0]","image"],imageToMldev(fromImage));let fromVideo=getValueByPath(fromObject,["video"]);fromVideo!=null&&setValueByPath(toObject,["instances[0]","video"],videoToMldev(fromVideo));let fromSource=getValueByPath(
1128
+ fromObject,["source"]);fromSource!=null&&generateVideosSourceToMldev(fromSource,toObject);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&generateVideosConfigToMldev(fromConfig,toObject),toObject}function generateVideosParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromPrompt=getValueByPath(fromObject,["prompt"]);
1129
+ fromPrompt!=null&&setValueByPath(toObject,["instances[0]","prompt"],fromPrompt);let fromImage=getValueByPath(fromObject,["image"]);fromImage!=null&&setValueByPath(toObject,["instances[0]","image"],imageToVertex(fromImage));let fromVideo=getValueByPath(fromObject,["video"]);fromVideo!=null&&setValueByPath(toObject,["instances[0]","video"],videoToVertex(fromVideo));let fromSource=getValueByPath(fromObject,["source"]);fromSource!=null&&generateVideosSourceToVertex(fromSource,toObject);let fromConfig=getValueByPath(
1130
+ fromObject,["config"]);return fromConfig!=null&&generateVideosConfigToVertex(fromConfig,toObject),toObject}function generateVideosResponseFromMldev(fromObject,rootObject){let toObject={},fromGeneratedVideos=getValueByPath(fromObject,["generatedSamples"]);if(fromGeneratedVideos!=null){let transformedList=fromGeneratedVideos;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedVideoFromMldev(item))),setValueByPath(toObject,["generatedVideos"],transformedList)}let fromRaiMediaFilteredCount=getValueByPath(
1131
+ fromObject,["raiMediaFilteredCount"]);fromRaiMediaFilteredCount!=null&&setValueByPath(toObject,["raiMediaFilteredCount"],fromRaiMediaFilteredCount);let fromRaiMediaFilteredReasons=getValueByPath(fromObject,["raiMediaFilteredReasons"]);return fromRaiMediaFilteredReasons!=null&&setValueByPath(toObject,["raiMediaFilteredReasons"],fromRaiMediaFilteredReasons),toObject}function generateVideosResponseFromVertex(fromObject,rootObject){let toObject={},fromGeneratedVideos=getValueByPath(fromObject,["vide\
1132
+ os"]);if(fromGeneratedVideos!=null){let transformedList=fromGeneratedVideos;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedVideoFromVertex(item))),setValueByPath(toObject,["generatedVideos"],transformedList)}let fromRaiMediaFilteredCount=getValueByPath(fromObject,["raiMediaFilteredCount"]);fromRaiMediaFilteredCount!=null&&setValueByPath(toObject,["raiMediaFilteredCount"],fromRaiMediaFilteredCount);let fromRaiMediaFilteredReasons=getValueByPath(fromObject,["ra\
1133
+ iMediaFilteredReasons"]);return fromRaiMediaFilteredReasons!=null&&setValueByPath(toObject,["raiMediaFilteredReasons"],fromRaiMediaFilteredReasons),toObject}function generateVideosSourceToMldev(fromObject,parentObject,rootObject){let toObject={},fromPrompt=getValueByPath(fromObject,["prompt"]);parentObject!==void 0&&fromPrompt!=null&&setValueByPath(parentObject,["instances[0]","prompt"],fromPrompt);let fromImage=getValueByPath(fromObject,["image"]);parentObject!==void 0&&fromImage!=null&&setValueByPath(
1134
+ parentObject,["instances[0]","image"],imageToMldev(fromImage));let fromVideo=getValueByPath(fromObject,["video"]);return parentObject!==void 0&&fromVideo!=null&&setValueByPath(parentObject,["instances[0]","video"],videoToMldev(fromVideo)),toObject}function generateVideosSourceToVertex(fromObject,parentObject,rootObject){let toObject={},fromPrompt=getValueByPath(fromObject,["prompt"]);parentObject!==void 0&&fromPrompt!=null&&setValueByPath(parentObject,["instances[0]","prompt"],fromPrompt);let fromImage=getValueByPath(
1135
+ fromObject,["image"]);parentObject!==void 0&&fromImage!=null&&setValueByPath(parentObject,["instances[0]","image"],imageToVertex(fromImage));let fromVideo=getValueByPath(fromObject,["video"]);return parentObject!==void 0&&fromVideo!=null&&setValueByPath(parentObject,["instances[0]","video"],videoToVertex(fromVideo)),toObject}function generatedImageFromVertex(fromObject,rootObject){let toObject={},fromImage=getValueByPath(fromObject,["_self"]);fromImage!=null&&setValueByPath(toObject,["image"],imageFromVertex(
1136
+ fromImage));let fromRaiFilteredReason=getValueByPath(fromObject,["raiFilteredReason"]);fromRaiFilteredReason!=null&&setValueByPath(toObject,["raiFilteredReason"],fromRaiFilteredReason);let fromSafetyAttributes=getValueByPath(fromObject,["_self"]);fromSafetyAttributes!=null&&setValueByPath(toObject,["safetyAttributes"],safetyAttributesFromVertex(fromSafetyAttributes));let fromEnhancedPrompt=getValueByPath(fromObject,["prompt"]);return fromEnhancedPrompt!=null&&setValueByPath(toObject,["enhancedPr\
1137
+ ompt"],fromEnhancedPrompt),toObject}function generatedImageMaskFromVertex(fromObject,rootObject){let toObject={},fromMask=getValueByPath(fromObject,["_self"]);fromMask!=null&&setValueByPath(toObject,["mask"],imageFromVertex(fromMask));let fromLabels=getValueByPath(fromObject,["labels"]);if(fromLabels!=null){let transformedList=fromLabels;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["labels"],transformedList)}return toObject}function generatedVideoFromMldev(fromObject,rootObject){
1138
+ let toObject={},fromVideo=getValueByPath(fromObject,["video"]);return fromVideo!=null&&setValueByPath(toObject,["video"],videoFromMldev(fromVideo)),toObject}function generatedVideoFromVertex(fromObject,rootObject){let toObject={},fromVideo=getValueByPath(fromObject,["_self"]);return fromVideo!=null&&setValueByPath(toObject,["video"],videoFromVertex(fromVideo)),toObject}function generationConfigToVertex(fromObject,rootObject){let toObject={},fromModelSelectionConfig=getValueByPath(fromObject,["mo\
1139
+ delSelectionConfig"]);fromModelSelectionConfig!=null&&setValueByPath(toObject,["modelConfig"],fromModelSelectionConfig);let fromResponseJsonSchema=getValueByPath(fromObject,["responseJsonSchema"]);fromResponseJsonSchema!=null&&setValueByPath(toObject,["responseJsonSchema"],fromResponseJsonSchema);let fromAudioTranscriptionConfig=getValueByPath(fromObject,["audioTranscriptionConfig"]);fromAudioTranscriptionConfig!=null&&setValueByPath(toObject,["audioTranscriptionConfig"],fromAudioTranscriptionConfig);
1140
+ let fromAudioTimestamp=getValueByPath(fromObject,["audioTimestamp"]);fromAudioTimestamp!=null&&setValueByPath(toObject,["audioTimestamp"],fromAudioTimestamp);let fromCandidateCount=getValueByPath(fromObject,["candidateCount"]);fromCandidateCount!=null&&setValueByPath(toObject,["candidateCount"],fromCandidateCount);let fromEnableAffectiveDialog=getValueByPath(fromObject,["enableAffectiveDialog"]);fromEnableAffectiveDialog!=null&&setValueByPath(toObject,["enableAffectiveDialog"],fromEnableAffectiveDialog);
1141
+ let fromFrequencyPenalty=getValueByPath(fromObject,["frequencyPenalty"]);fromFrequencyPenalty!=null&&setValueByPath(toObject,["frequencyPenalty"],fromFrequencyPenalty);let fromLogprobs=getValueByPath(fromObject,["logprobs"]);fromLogprobs!=null&&setValueByPath(toObject,["logprobs"],fromLogprobs);let fromMaxOutputTokens=getValueByPath(fromObject,["maxOutputTokens"]);fromMaxOutputTokens!=null&&setValueByPath(toObject,["maxOutputTokens"],fromMaxOutputTokens);let fromMediaResolution=getValueByPath(fromObject,
1142
+ ["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromPresencePenalty=getValueByPath(fromObject,["presencePenalty"]);fromPresencePenalty!=null&&setValueByPath(toObject,["presencePenalty"],fromPresencePenalty);let fromResponseFormat=getValueByPath(fromObject,["responseFormat"]);if(fromResponseFormat!=null){let transformedList=fromResponseFormat;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(
1143
+ toObject,["responseFormat"],transformedList)}let fromResponseLogprobs=getValueByPath(fromObject,["responseLogprobs"]);fromResponseLogprobs!=null&&setValueByPath(toObject,["responseLogprobs"],fromResponseLogprobs);let fromResponseMimeType=getValueByPath(fromObject,["responseMimeType"]);fromResponseMimeType!=null&&setValueByPath(toObject,["responseMimeType"],fromResponseMimeType);let fromResponseModalities=getValueByPath(fromObject,["responseModalities"]);fromResponseModalities!=null&&setValueByPath(
1144
+ toObject,["responseModalities"],fromResponseModalities);let fromResponseSchema=getValueByPath(fromObject,["responseSchema"]);fromResponseSchema!=null&&setValueByPath(toObject,["responseSchema"],fromResponseSchema);let fromRoutingConfig=getValueByPath(fromObject,["routingConfig"]);fromRoutingConfig!=null&&setValueByPath(toObject,["routingConfig"],fromRoutingConfig);let fromSeed=getValueByPath(fromObject,["seed"]);fromSeed!=null&&setValueByPath(toObject,["seed"],fromSeed);let fromSpeechConfig=getValueByPath(
1145
+ fromObject,["speechConfig"]);fromSpeechConfig!=null&&setValueByPath(toObject,["speechConfig"],speechConfigToVertex(fromSpeechConfig));let fromStopSequences=getValueByPath(fromObject,["stopSequences"]);fromStopSequences!=null&&setValueByPath(toObject,["stopSequences"],fromStopSequences);let fromTemperature=getValueByPath(fromObject,["temperature"]);fromTemperature!=null&&setValueByPath(toObject,["temperature"],fromTemperature);let fromThinkingConfig=getValueByPath(fromObject,["thinkingConfig"]);fromThinkingConfig!=
1146
+ null&&setValueByPath(toObject,["thinkingConfig"],fromThinkingConfig);let fromTopK=getValueByPath(fromObject,["topK"]);fromTopK!=null&&setValueByPath(toObject,["topK"],fromTopK);let fromTopP=getValueByPath(fromObject,["topP"]);if(fromTopP!=null&&setValueByPath(toObject,["topP"],fromTopP),getValueByPath(fromObject,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mod\
1147
+ e.");let fromTranslationConfig=getValueByPath(fromObject,["translationConfig"]);return fromTranslationConfig!=null&&setValueByPath(toObject,["translationConfig"],fromTranslationConfig),toObject}function getModelParametersToMldev(apiClient,fromObject,_rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);return fromModel!=null&&setValueByPath(toObject,["_url","name"],tModel(apiClient,fromModel)),toObject}function getModelParametersToVertex(apiClient,fromObject,_rootObject){let toObject={},
1148
+ fromModel=getValueByPath(fromObject,["model"]);return fromModel!=null&&setValueByPath(toObject,["_url","name"],tModel(apiClient,fromModel)),toObject}function googleMapsToMldev$1(fromObject,rootObject){let toObject={},fromAuthConfig=getValueByPath(fromObject,["authConfig"]);fromAuthConfig!=null&&setValueByPath(toObject,["authConfig"],authConfigToMldev$1(fromAuthConfig));let fromEnableWidget=getValueByPath(fromObject,["enableWidget"]);if(fromEnableWidget!=null&&setValueByPath(toObject,["enableWidg\
1149
+ et"],fromEnableWidget),getValueByPath(fromObject,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function googleSearchToMldev$1(fromObject,_rootObject){let toObject={};if(getValueByPath(fromObject,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API m\
1150
+ ode.");if(getValueByPath(fromObject,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromSearchTypes=getValueByPath(fromObject,["searchTypes"]);fromSearchTypes!=null&&setValueByPath(toObject,["searchTypes"],fromSearchTypes);let fromTimeRangeFilter=getValueByPath(fromObject,["timeRangeFilter"]);return fromTimeRangeFilter!=null&&setValueByPath(toObject,["timeRangeFilter"],fromTimeRangeFilter),
1151
+ toObject}function imageConfigToMldev(fromObject,_rootObject){let toObject={},fromAspectRatio=getValueByPath(fromObject,["aspectRatio"]);fromAspectRatio!=null&&setValueByPath(toObject,["aspectRatio"],fromAspectRatio);let fromImageSize=getValueByPath(fromObject,["imageSize"]);if(fromImageSize!=null&&setValueByPath(toObject,["imageSize"],fromImageSize),getValueByPath(fromObject,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is only supported in Gemini Enterprise Agent Pl\
1152
+ atform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["imageOut\
1153
+ putOptions"])!==void 0)throw new Error("imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["prominentPeople"])!==void 0)throw new Error("prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function imageConfigToVertex(fromObject,_rootObject){let toObject={},fromAspectRatio=getValueByPath(fromObject,["aspectRa\
1154
+ tio"]);fromAspectRatio!=null&&setValueByPath(toObject,["aspectRatio"],fromAspectRatio);let fromImageSize=getValueByPath(fromObject,["imageSize"]);fromImageSize!=null&&setValueByPath(toObject,["imageSize"],fromImageSize);let fromPersonGeneration=getValueByPath(fromObject,["personGeneration"]);fromPersonGeneration!=null&&setValueByPath(toObject,["personGeneration"],fromPersonGeneration);let fromOutputMimeType=getValueByPath(fromObject,["outputMimeType"]);fromOutputMimeType!=null&&setValueByPath(toObject,
1155
+ ["imageOutputOptions","mimeType"],fromOutputMimeType);let fromOutputCompressionQuality=getValueByPath(fromObject,["outputCompressionQuality"]);fromOutputCompressionQuality!=null&&setValueByPath(toObject,["imageOutputOptions","compressionQuality"],fromOutputCompressionQuality);let fromImageOutputOptions=getValueByPath(fromObject,["imageOutputOptions"]);fromImageOutputOptions!=null&&setValueByPath(toObject,["imageOutputOptions"],fromImageOutputOptions);let fromProminentPeople=getValueByPath(fromObject,
1156
+ ["prominentPeople"]);return fromProminentPeople!=null&&setValueByPath(toObject,["prominentPeople"],fromProminentPeople),toObject}function imageFromVertex(fromObject,_rootObject){let toObject={},fromGcsUri=getValueByPath(fromObject,["gcsUri"]);fromGcsUri!=null&&setValueByPath(toObject,["gcsUri"],fromGcsUri);let fromImageBytes=getValueByPath(fromObject,["bytesBase64Encoded"]);fromImageBytes!=null&&setValueByPath(toObject,["imageBytes"],tBytes(fromImageBytes));let fromMimeType=getValueByPath(fromObject,
1157
+ ["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function imageToMldev(fromObject,_rootObject){let toObject={};if(getValueByPath(fromObject,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromImageBytes=getValueByPath(fromObject,["imageBytes"]);fromImageBytes!=null&&setValueByPath(toObject,["bytesBase64Encoded"],tBytes(fromImageBytes));let fromMimeType=getValueByPath(
1158
+ fromObject,["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function imageToVertex(fromObject,_rootObject){let toObject={},fromGcsUri=getValueByPath(fromObject,["gcsUri"]);fromGcsUri!=null&&setValueByPath(toObject,["gcsUri"],fromGcsUri);let fromImageBytes=getValueByPath(fromObject,["imageBytes"]);fromImageBytes!=null&&setValueByPath(toObject,["bytesBase64Encoded"],tBytes(fromImageBytes));let fromMimeType=getValueByPath(fromObject,["mimeType"]);
1159
+ return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function listModelsConfigToMldev(apiClient,fromObject,parentObject,_rootObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken);
1160
+ let fromFilter=getValueByPath(fromObject,["filter"]);parentObject!==void 0&&fromFilter!=null&&setValueByPath(parentObject,["_query","filter"],fromFilter);let fromQueryBase=getValueByPath(fromObject,["queryBase"]);return parentObject!==void 0&&fromQueryBase!=null&&setValueByPath(parentObject,["_url","models_url"],tModelsUrl(apiClient,fromQueryBase)),toObject}function listModelsConfigToVertex(apiClient,fromObject,parentObject,_rootObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pa\
1161
+ geSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken);let fromFilter=getValueByPath(fromObject,["filter"]);parentObject!==void 0&&fromFilter!=null&&setValueByPath(parentObject,["_query","filter"],fromFilter);let fromQueryBase=getValueByPath(fromObject,["queryBase"]);return parentObject!==
1162
+ void 0&&fromQueryBase!=null&&setValueByPath(parentObject,["_url","models_url"],tModelsUrl(apiClient,fromQueryBase)),toObject}function listModelsParametersToMldev(apiClient,fromObject,rootObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listModelsConfigToMldev(apiClient,fromConfig,toObject),toObject}function listModelsParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=
1163
+ null&&listModelsConfigToVertex(apiClient,fromConfig,toObject),toObject}function listModelsResponseFromMldev(fromObject,rootObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromModels=getValueByPath(fromObject,
1164
+ ["_self"]);if(fromModels!=null){let transformedList=tExtractModels(fromModels);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>modelFromMldev(item))),setValueByPath(toObject,["models"],transformedList)}return toObject}function listModelsResponseFromVertex(fromObject,rootObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(
1165
+ fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromModels=getValueByPath(fromObject,["_self"]);if(fromModels!=null){let transformedList=tExtractModels(fromModels);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>modelFromVertex(item))),setValueByPath(toObject,["models"],transformedList)}return toObject}function maskReferenceConfigToVertex(fromObject,_rootObject){let toObject={},fromMaskMode=getValueByPath(
1166
+ fromObject,["maskMode"]);fromMaskMode!=null&&setValueByPath(toObject,["maskMode"],fromMaskMode);let fromSegmentationClasses=getValueByPath(fromObject,["segmentationClasses"]);fromSegmentationClasses!=null&&setValueByPath(toObject,["maskClasses"],fromSegmentationClasses);let fromMaskDilation=getValueByPath(fromObject,["maskDilation"]);return fromMaskDilation!=null&&setValueByPath(toObject,["dilation"],fromMaskDilation),toObject}function mcpServerToVertex$1(fromObject,_rootObject){let toObject={};
1167
+ if(getValueByPath(fromObject,["name"])!==void 0)throw new Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["streamableHttpTransport"])!==void 0)throw new Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function modelFromMldev(fromObject,rootObject){let toObject={},fromName=getValueByPath(fromObject,
1168
+ ["name"]);fromName!=null&&setValueByPath(toObject,["name"],fromName);let fromDisplayName=getValueByPath(fromObject,["displayName"]);fromDisplayName!=null&&setValueByPath(toObject,["displayName"],fromDisplayName);let fromDescription=getValueByPath(fromObject,["description"]);fromDescription!=null&&setValueByPath(toObject,["description"],fromDescription);let fromVersion=getValueByPath(fromObject,["version"]);fromVersion!=null&&setValueByPath(toObject,["version"],fromVersion);let fromTunedModelInfo=getValueByPath(
1169
+ fromObject,["_self"]);fromTunedModelInfo!=null&&setValueByPath(toObject,["tunedModelInfo"],tunedModelInfoFromMldev(fromTunedModelInfo));let fromInputTokenLimit=getValueByPath(fromObject,["inputTokenLimit"]);fromInputTokenLimit!=null&&setValueByPath(toObject,["inputTokenLimit"],fromInputTokenLimit);let fromOutputTokenLimit=getValueByPath(fromObject,["outputTokenLimit"]);fromOutputTokenLimit!=null&&setValueByPath(toObject,["outputTokenLimit"],fromOutputTokenLimit);let fromSupportedActions=getValueByPath(
1170
+ fromObject,["supportedGenerationMethods"]);fromSupportedActions!=null&&setValueByPath(toObject,["supportedActions"],fromSupportedActions);let fromTemperature=getValueByPath(fromObject,["temperature"]);fromTemperature!=null&&setValueByPath(toObject,["temperature"],fromTemperature);let fromMaxTemperature=getValueByPath(fromObject,["maxTemperature"]);fromMaxTemperature!=null&&setValueByPath(toObject,["maxTemperature"],fromMaxTemperature);let fromTopP=getValueByPath(fromObject,["topP"]);fromTopP!=null&&
1171
+ setValueByPath(toObject,["topP"],fromTopP);let fromTopK=getValueByPath(fromObject,["topK"]);fromTopK!=null&&setValueByPath(toObject,["topK"],fromTopK);let fromThinking=getValueByPath(fromObject,["thinking"]);return fromThinking!=null&&setValueByPath(toObject,["thinking"],fromThinking),toObject}function modelFromVertex(fromObject,rootObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["name"],fromName);let fromDisplayName=getValueByPath(fromObject,
1172
+ ["displayName"]);fromDisplayName!=null&&setValueByPath(toObject,["displayName"],fromDisplayName);let fromDescription=getValueByPath(fromObject,["description"]);fromDescription!=null&&setValueByPath(toObject,["description"],fromDescription);let fromVersion=getValueByPath(fromObject,["versionId"]);fromVersion!=null&&setValueByPath(toObject,["version"],fromVersion);let fromEndpoints=getValueByPath(fromObject,["deployedModels"]);if(fromEndpoints!=null){let transformedList=fromEndpoints;Array.isArray(
1173
+ transformedList)&&(transformedList=transformedList.map(item=>endpointFromVertex(item))),setValueByPath(toObject,["endpoints"],transformedList)}let fromLabels=getValueByPath(fromObject,["labels"]);fromLabels!=null&&setValueByPath(toObject,["labels"],fromLabels);let fromTunedModelInfo=getValueByPath(fromObject,["_self"]);fromTunedModelInfo!=null&&setValueByPath(toObject,["tunedModelInfo"],tunedModelInfoFromVertex(fromTunedModelInfo));let fromDefaultCheckpointId=getValueByPath(fromObject,["defaultC\
1174
+ heckpointId"]);fromDefaultCheckpointId!=null&&setValueByPath(toObject,["defaultCheckpointId"],fromDefaultCheckpointId);let fromCheckpoints=getValueByPath(fromObject,["checkpoints"]);if(fromCheckpoints!=null){let transformedList=fromCheckpoints;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["checkpoints"],transformedList)}return toObject}function multiSpeakerVoiceConfigToVertex(fromObject,rootObject){let toObject={},fromSpeakerVoiceConfigs=getValueByPath(
1175
+ fromObject,["speakerVoiceConfigs"]);if(fromSpeakerVoiceConfigs!=null){let transformedList=fromSpeakerVoiceConfigs;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>speakerVoiceConfigToVertex(item))),setValueByPath(toObject,["speakerVoiceConfigs"],transformedList)}return toObject}function partToMldev$1(fromObject,rootObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResoluti\
1176
+ on"],fromMediaResolution);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=null&&setValueByPath(toObject,["toolCall"],fromToolCall);let fromToolResponse=getValueByPath(fromObject,["toolResponse"]);fromToolResponse!=null&&setValueByPath(toObject,["toolResponse"],fromToolResponse);let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(
1193
1177
  fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=
1194
- null&&setValueByPath(toObject,["functionCall"],fromFunctionCall);let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(
1195
- fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);if(fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata),getValueByPath(fromObject,["partMetadata"])!==void 0)throw new Error("partMetadata p\
1196
- arameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function productImageToVertex(fromObject,rootObject){let toObject={},
1197
- fromProductImage=getValueByPath(fromObject,["productImage"]);return fromProductImage!=null&&setValueByPath(toObject,["image"],imageToVertex(fromProductImage)),toObject}function recontextImageConfigToVertex(fromObject,parentObject,_rootObject){let toObject={},fromNumberOfImages=getValueByPath(fromObject,["numberOfImages"]);parentObject!==void 0&&fromNumberOfImages!=null&&setValueByPath(parentObject,["parameters","sampleCount"],fromNumberOfImages);let fromBaseSteps=getValueByPath(fromObject,["base\
1198
- Steps"]);parentObject!==void 0&&fromBaseSteps!=null&&setValueByPath(parentObject,["parameters","baseSteps"],fromBaseSteps);let fromOutputGcsUri=getValueByPath(fromObject,["outputGcsUri"]);parentObject!==void 0&&fromOutputGcsUri!=null&&setValueByPath(parentObject,["parameters","storageUri"],fromOutputGcsUri);let fromSeed=getValueByPath(fromObject,["seed"]);parentObject!==void 0&&fromSeed!=null&&setValueByPath(parentObject,["parameters","seed"],fromSeed);let fromSafetyFilterLevel=getValueByPath(fromObject,
1199
- ["safetyFilterLevel"]);parentObject!==void 0&&fromSafetyFilterLevel!=null&&setValueByPath(parentObject,["parameters","safetySetting"],fromSafetyFilterLevel);let fromPersonGeneration=getValueByPath(fromObject,["personGeneration"]);parentObject!==void 0&&fromPersonGeneration!=null&&setValueByPath(parentObject,["parameters","personGeneration"],fromPersonGeneration);let fromAddWatermark=getValueByPath(fromObject,["addWatermark"]);parentObject!==void 0&&fromAddWatermark!=null&&setValueByPath(parentObject,
1200
- ["parameters","addWatermark"],fromAddWatermark);let fromOutputMimeType=getValueByPath(fromObject,["outputMimeType"]);parentObject!==void 0&&fromOutputMimeType!=null&&setValueByPath(parentObject,["parameters","outputOptions","mimeType"],fromOutputMimeType);let fromOutputCompressionQuality=getValueByPath(fromObject,["outputCompressionQuality"]);parentObject!==void 0&&fromOutputCompressionQuality!=null&&setValueByPath(parentObject,["parameters","outputOptions","compressionQuality"],fromOutputCompressionQuality);
1201
- let fromEnhancePrompt=getValueByPath(fromObject,["enhancePrompt"]);parentObject!==void 0&&fromEnhancePrompt!=null&&setValueByPath(parentObject,["parameters","enhancePrompt"],fromEnhancePrompt);let fromLabels=getValueByPath(fromObject,["labels"]);return parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["labels"],fromLabels),toObject}function recontextImageParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=
1202
- null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromSource=getValueByPath(fromObject,["source"]);fromSource!=null&&recontextImageSourceToVertex(fromSource,toObject);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&recontextImageConfigToVertex(fromConfig,toObject),toObject}function recontextImageResponseFromVertex(fromObject,rootObject){let toObject={},fromGeneratedImages=getValueByPath(fromObject,["predictions"]);if(fromGeneratedImages!=
1203
- null){let transformedList=fromGeneratedImages;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedImageFromVertex(item))),setValueByPath(toObject,["generatedImages"],transformedList)}return toObject}function recontextImageSourceToVertex(fromObject,parentObject,rootObject){let toObject={},fromPrompt=getValueByPath(fromObject,["prompt"]);parentObject!==void 0&&fromPrompt!=null&&setValueByPath(parentObject,["instances[0]","prompt"],fromPrompt);let fromPersonImage=getValueByPath(
1204
- fromObject,["personImage"]);parentObject!==void 0&&fromPersonImage!=null&&setValueByPath(parentObject,["instances[0]","personImage","image"],imageToVertex(fromPersonImage));let fromProductImages=getValueByPath(fromObject,["productImages"]);if(parentObject!==void 0&&fromProductImages!=null){let transformedList=fromProductImages;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>productImageToVertex(item))),setValueByPath(parentObject,["instances[0]","productImages"],transformedList)}
1205
- return toObject}function referenceImageAPIInternalToVertex(fromObject,rootObject){let toObject={},fromReferenceImage=getValueByPath(fromObject,["referenceImage"]);fromReferenceImage!=null&&setValueByPath(toObject,["referenceImage"],imageToVertex(fromReferenceImage));let fromReferenceId=getValueByPath(fromObject,["referenceId"]);fromReferenceId!=null&&setValueByPath(toObject,["referenceId"],fromReferenceId);let fromReferenceType=getValueByPath(fromObject,["referenceType"]);fromReferenceType!=null&&
1206
- setValueByPath(toObject,["referenceType"],fromReferenceType);let fromMaskImageConfig=getValueByPath(fromObject,["maskImageConfig"]);fromMaskImageConfig!=null&&setValueByPath(toObject,["maskImageConfig"],maskReferenceConfigToVertex(fromMaskImageConfig));let fromControlImageConfig=getValueByPath(fromObject,["controlImageConfig"]);fromControlImageConfig!=null&&setValueByPath(toObject,["controlImageConfig"],controlReferenceConfigToVertex(fromControlImageConfig));let fromStyleImageConfig=getValueByPath(
1207
- fromObject,["styleImageConfig"]);fromStyleImageConfig!=null&&setValueByPath(toObject,["styleImageConfig"],fromStyleImageConfig);let fromSubjectImageConfig=getValueByPath(fromObject,["subjectImageConfig"]);return fromSubjectImageConfig!=null&&setValueByPath(toObject,["subjectImageConfig"],fromSubjectImageConfig),toObject}function replicatedVoiceConfigToVertex(fromObject,_rootObject){let toObject={},fromMimeType=getValueByPath(fromObject,["mimeType"]);fromMimeType!=null&&setValueByPath(toObject,["\
1208
- mimeType"],fromMimeType);let fromVoiceSampleAudio=getValueByPath(fromObject,["voiceSampleAudio"]);if(fromVoiceSampleAudio!=null&&setValueByPath(toObject,["voiceSampleAudio"],fromVoiceSampleAudio),getValueByPath(fromObject,["consentAudio"])!==void 0)throw new Error("consentAudio parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["voiceConsentSignature"])!==void 0)throw new Error("voiceConsentSignature parameter i\
1209
- s only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function safetyAttributesFromVertex(fromObject,_rootObject){let toObject={},fromCategories=getValueByPath(fromObject,["safetyAttributes","categories"]);fromCategories!=null&&setValueByPath(toObject,["categories"],fromCategories);let fromScores=getValueByPath(fromObject,["safetyAttributes","scores"]);fromScores!=null&&setValueByPath(toObject,["scores"],fromScores);let fromContentType=getValueByPath(
1210
- fromObject,["contentType"]);return fromContentType!=null&&setValueByPath(toObject,["contentType"],fromContentType),toObject}function safetySettingToMldev$1(fromObject,_rootObject){let toObject={},fromCategory=getValueByPath(fromObject,["category"]);if(fromCategory!=null&&setValueByPath(toObject,["category"],fromCategory),getValueByPath(fromObject,["method"])!==void 0)throw new Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");
1211
- let fromThreshold=getValueByPath(fromObject,["threshold"]);return fromThreshold!=null&&setValueByPath(toObject,["threshold"],fromThreshold),toObject}function scribbleImageToVertex(fromObject,rootObject){let toObject={},fromImage=getValueByPath(fromObject,["image"]);return fromImage!=null&&setValueByPath(toObject,["image"],imageToVertex(fromImage)),toObject}function segmentImageConfigToVertex(fromObject,parentObject,_rootObject){let toObject={},fromMode=getValueByPath(fromObject,["mode"]);parentObject!==
1212
- void 0&&fromMode!=null&&setValueByPath(parentObject,["parameters","mode"],fromMode);let fromMaxPredictions=getValueByPath(fromObject,["maxPredictions"]);parentObject!==void 0&&fromMaxPredictions!=null&&setValueByPath(parentObject,["parameters","maxPredictions"],fromMaxPredictions);let fromConfidenceThreshold=getValueByPath(fromObject,["confidenceThreshold"]);parentObject!==void 0&&fromConfidenceThreshold!=null&&setValueByPath(parentObject,["parameters","confidenceThreshold"],fromConfidenceThreshold);
1213
- let fromMaskDilation=getValueByPath(fromObject,["maskDilation"]);parentObject!==void 0&&fromMaskDilation!=null&&setValueByPath(parentObject,["parameters","maskDilation"],fromMaskDilation);let fromBinaryColorThreshold=getValueByPath(fromObject,["binaryColorThreshold"]);parentObject!==void 0&&fromBinaryColorThreshold!=null&&setValueByPath(parentObject,["parameters","binaryColorThreshold"],fromBinaryColorThreshold);let fromLabels=getValueByPath(fromObject,["labels"]);return parentObject!==void 0&&fromLabels!=
1214
- null&&setValueByPath(parentObject,["labels"],fromLabels),toObject}function segmentImageParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromSource=getValueByPath(fromObject,["source"]);fromSource!=null&&segmentImageSourceToVertex(fromSource,toObject);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&segmentImageConfigToVertex(
1215
- fromConfig,toObject),toObject}function segmentImageResponseFromVertex(fromObject,rootObject){let toObject={},fromGeneratedMasks=getValueByPath(fromObject,["predictions"]);if(fromGeneratedMasks!=null){let transformedList=fromGeneratedMasks;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedImageMaskFromVertex(item))),setValueByPath(toObject,["generatedMasks"],transformedList)}return toObject}function segmentImageSourceToVertex(fromObject,parentObject,rootObject){let toObject={},
1216
- fromPrompt=getValueByPath(fromObject,["prompt"]);parentObject!==void 0&&fromPrompt!=null&&setValueByPath(parentObject,["instances[0]","prompt"],fromPrompt);let fromImage=getValueByPath(fromObject,["image"]);parentObject!==void 0&&fromImage!=null&&setValueByPath(parentObject,["instances[0]","image"],imageToVertex(fromImage));let fromScribbleImage=getValueByPath(fromObject,["scribbleImage"]);return parentObject!==void 0&&fromScribbleImage!=null&&setValueByPath(parentObject,["instances[0]","scribbl\
1217
- e"],scribbleImageToVertex(fromScribbleImage)),toObject}function speakerVoiceConfigToVertex(fromObject,rootObject){let toObject={},fromSpeaker=getValueByPath(fromObject,["speaker"]);fromSpeaker!=null&&setValueByPath(toObject,["speaker"],fromSpeaker);let fromVoiceConfig=getValueByPath(fromObject,["voiceConfig"]);return fromVoiceConfig!=null&&setValueByPath(toObject,["voiceConfig"],voiceConfigToVertex(fromVoiceConfig)),toObject}function speechConfigToVertex(fromObject,rootObject){let toObject={},fromVoiceConfig=getValueByPath(
1218
- fromObject,["voiceConfig"]);fromVoiceConfig!=null&&setValueByPath(toObject,["voiceConfig"],voiceConfigToVertex(fromVoiceConfig));let fromLanguageCode=getValueByPath(fromObject,["languageCode"]);fromLanguageCode!=null&&setValueByPath(toObject,["languageCode"],fromLanguageCode);let fromMultiSpeakerVoiceConfig=getValueByPath(fromObject,["multiSpeakerVoiceConfig"]);return fromMultiSpeakerVoiceConfig!=null&&setValueByPath(toObject,["multiSpeakerVoiceConfig"],multiSpeakerVoiceConfigToVertex(fromMultiSpeakerVoiceConfig)),
1219
- toObject}function toolConfigToMldev(fromObject,rootObject){let toObject={},fromFunctionCallingConfig=getValueByPath(fromObject,["functionCallingConfig"]);fromFunctionCallingConfig!=null&&setValueByPath(toObject,["functionCallingConfig"],functionCallingConfigToMldev(fromFunctionCallingConfig));let fromRetrievalConfig=getValueByPath(fromObject,["retrievalConfig"]);fromRetrievalConfig!=null&&setValueByPath(toObject,["retrievalConfig"],fromRetrievalConfig);let fromIncludeServerSideToolInvocations=getValueByPath(
1220
- fromObject,["includeServerSideToolInvocations"]);return fromIncludeServerSideToolInvocations!=null&&setValueByPath(toObject,["includeServerSideToolInvocations"],fromIncludeServerSideToolInvocations),toObject}function toolConfigToVertex(fromObject,_rootObject){let toObject={},fromFunctionCallingConfig=getValueByPath(fromObject,["functionCallingConfig"]);fromFunctionCallingConfig!=null&&setValueByPath(toObject,["functionCallingConfig"],fromFunctionCallingConfig);let fromRetrievalConfig=getValueByPath(
1221
- fromObject,["retrievalConfig"]);if(fromRetrievalConfig!=null&&setValueByPath(toObject,["retrievalConfig"],fromRetrievalConfig),getValueByPath(fromObject,["includeServerSideToolInvocations"])!==void 0)throw new Error("includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function toolToMldev$1(fromObject,rootObject){let toObject={};if(getValueByPath(fromObject,["retrieval"])!==void 0)throw new Error(
1222
- "retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],googleMapsToMldev$1(fromGoogleMaps));let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,
1223
- ["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);if(fromComputerUse!=null&&setValueByPath(toObject,["computerUse"],fromComputerUse),getValueByPath(fromObject,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, no\
1224
- t in Gemini Developer API mode.");if(getValueByPath(fromObject,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromFunctionDeclarations=getValueByPath(fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functio\
1225
- nDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleSearch"]);fromGoogleSearch!=null&&setValueByPath(toObject,["googleSearch"],googleSearchToMldev$1(fromGoogleSearch));let fromGoogleSearchRetrieval=getValueByPath(fromObject,["googleSearchRetrieval"]);if(fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval),getValueByPath(fromObject,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter\
1226
- is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromUrlContext=getValueByPath(fromObject,["urlContext"]);fromUrlContext!=null&&setValueByPath(toObject,["urlContext"],fromUrlContext);let fromFileSearch=getValueByPath(fromObject,["fileSearch"]);return fromFileSearch!=null&&setValueByPath(toObject,["fileSearch"],fromFileSearch),toObject}function toolToVertex$1(fromObject,rootObject){let toObject={},fromRetrieval=getValueByPath(fromObject,["retrie\
1227
- val"]);fromRetrieval!=null&&setValueByPath(toObject,["retrieval"],fromRetrieval);let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],fromGoogleMaps);let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>mcpServerToVertex$1(item))),setValueByPath(toObject,["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(
1228
- fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);fromComputerUse!=null&&setValueByPath(toObject,["computerUse"],fromComputerUse);let fromEnterpriseWebSearch=getValueByPath(fromObject,["enterpriseWebSearch"]);fromEnterpriseWebSearch!=null&&setValueByPath(toObject,["enterpriseWebSearch"],fromEnterpriseWebSearch);let fromExaAiSearch=getValueByPath(fromObject,["exaAiSearc\
1229
- h"]);fromExaAiSearch!=null&&setValueByPath(toObject,["exaAiSearch"],fromExaAiSearch);let fromFunctionDeclarations=getValueByPath(fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functionDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleSearch"]);fromGoogleSearch!=null&&setValueByPath(toObject,
1230
- ["googleSearch"],fromGoogleSearch);let fromGoogleSearchRetrieval=getValueByPath(fromObject,["googleSearchRetrieval"]);fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval);let fromParallelAiSearch=getValueByPath(fromObject,["parallelAiSearch"]);fromParallelAiSearch!=null&&setValueByPath(toObject,["parallelAiSearch"],fromParallelAiSearch);let fromUrlContext=getValueByPath(fromObject,["urlContext"]);if(fromUrlContext!=null&&setValueByPath(toObject,
1231
- ["urlContext"],fromUrlContext),getValueByPath(fromObject,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function tunedModelInfoFromMldev(fromObject,_rootObject){let toObject={},fromBaseModel=getValueByPath(fromObject,["baseModel"]);fromBaseModel!=null&&setValueByPath(toObject,["baseModel"],fromBaseModel);let fromCreateTime=getValueByPath(fromObject,["createTime"]);fromCreateTime!=
1232
- null&&setValueByPath(toObject,["createTime"],fromCreateTime);let fromUpdateTime=getValueByPath(fromObject,["updateTime"]);return fromUpdateTime!=null&&setValueByPath(toObject,["updateTime"],fromUpdateTime),toObject}function tunedModelInfoFromVertex(fromObject,_rootObject){let toObject={},fromBaseModel=getValueByPath(fromObject,["labels","google-vertex-llm-tuning-base-model-id"]);fromBaseModel!=null&&setValueByPath(toObject,["baseModel"],fromBaseModel);let fromCreateTime=getValueByPath(fromObject,
1233
- ["createTime"]);fromCreateTime!=null&&setValueByPath(toObject,["createTime"],fromCreateTime);let fromUpdateTime=getValueByPath(fromObject,["updateTime"]);return fromUpdateTime!=null&&setValueByPath(toObject,["updateTime"],fromUpdateTime),toObject}function updateModelConfigToMldev(fromObject,parentObject,_rootObject){let toObject={},fromDisplayName=getValueByPath(fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["displayName"],fromDisplayName);
1234
- let fromDescription=getValueByPath(fromObject,["description"]);parentObject!==void 0&&fromDescription!=null&&setValueByPath(parentObject,["description"],fromDescription);let fromDefaultCheckpointId=getValueByPath(fromObject,["defaultCheckpointId"]);return parentObject!==void 0&&fromDefaultCheckpointId!=null&&setValueByPath(parentObject,["defaultCheckpointId"],fromDefaultCheckpointId),toObject}function updateModelConfigToVertex(fromObject,parentObject,_rootObject){let toObject={},fromDisplayName=getValueByPath(
1235
- fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["displayName"],fromDisplayName);let fromDescription=getValueByPath(fromObject,["description"]);parentObject!==void 0&&fromDescription!=null&&setValueByPath(parentObject,["description"],fromDescription);let fromDefaultCheckpointId=getValueByPath(fromObject,["defaultCheckpointId"]);return parentObject!==void 0&&fromDefaultCheckpointId!=null&&setValueByPath(parentObject,["defaultCheckpointId"],fromDefaultCheckpointId),
1236
- toObject}function updateModelParametersToMldev(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","name"],tModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&updateModelConfigToMldev(fromConfig,toObject),toObject}function updateModelParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=
1237
- null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&updateModelConfigToVertex(fromConfig,toObject),toObject}function upscaleImageAPIConfigInternalToVertex(fromObject,parentObject,_rootObject){let toObject={},fromOutputGcsUri=getValueByPath(fromObject,["outputGcsUri"]);parentObject!==void 0&&fromOutputGcsUri!=null&&setValueByPath(parentObject,["parameters","storageUri"],fromOutputGcsUri);let fromSafetyFilterLevel=getValueByPath(
1238
- fromObject,["safetyFilterLevel"]);parentObject!==void 0&&fromSafetyFilterLevel!=null&&setValueByPath(parentObject,["parameters","safetySetting"],fromSafetyFilterLevel);let fromPersonGeneration=getValueByPath(fromObject,["personGeneration"]);parentObject!==void 0&&fromPersonGeneration!=null&&setValueByPath(parentObject,["parameters","personGeneration"],fromPersonGeneration);let fromIncludeRaiReason=getValueByPath(fromObject,["includeRaiReason"]);parentObject!==void 0&&fromIncludeRaiReason!=null&&
1239
- setValueByPath(parentObject,["parameters","includeRaiReason"],fromIncludeRaiReason);let fromOutputMimeType=getValueByPath(fromObject,["outputMimeType"]);parentObject!==void 0&&fromOutputMimeType!=null&&setValueByPath(parentObject,["parameters","outputOptions","mimeType"],fromOutputMimeType);let fromOutputCompressionQuality=getValueByPath(fromObject,["outputCompressionQuality"]);parentObject!==void 0&&fromOutputCompressionQuality!=null&&setValueByPath(parentObject,["parameters","outputOptions","c\
1240
- ompressionQuality"],fromOutputCompressionQuality);let fromEnhanceInputImage=getValueByPath(fromObject,["enhanceInputImage"]);parentObject!==void 0&&fromEnhanceInputImage!=null&&setValueByPath(parentObject,["parameters","upscaleConfig","enhanceInputImage"],fromEnhanceInputImage);let fromImagePreservationFactor=getValueByPath(fromObject,["imagePreservationFactor"]);parentObject!==void 0&&fromImagePreservationFactor!=null&&setValueByPath(parentObject,["parameters","upscaleConfig","imagePreservation\
1241
- Factor"],fromImagePreservationFactor);let fromLabels=getValueByPath(fromObject,["labels"]);parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["labels"],fromLabels);let fromNumberOfImages=getValueByPath(fromObject,["numberOfImages"]);parentObject!==void 0&&fromNumberOfImages!=null&&setValueByPath(parentObject,["parameters","sampleCount"],fromNumberOfImages);let fromMode=getValueByPath(fromObject,["mode"]);return parentObject!==void 0&&fromMode!=null&&setValueByPath(parentObject,
1242
- ["parameters","mode"],fromMode),toObject}function upscaleImageAPIParametersInternalToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromImage=getValueByPath(fromObject,["image"]);fromImage!=null&&setValueByPath(toObject,["instances[0]","image"],imageToVertex(fromImage));let fromUpscaleFactor=getValueByPath(fromObject,["upscaleFactor"]);fromUpscaleFactor!=
1243
- null&&setValueByPath(toObject,["parameters","upscaleConfig","upscaleFactor"],fromUpscaleFactor);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&upscaleImageAPIConfigInternalToVertex(fromConfig,toObject),toObject}function upscaleImageResponseFromVertex(fromObject,rootObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromGeneratedImages=getValueByPath(
1244
- fromObject,["predictions"]);if(fromGeneratedImages!=null){let transformedList=fromGeneratedImages;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedImageFromVertex(item))),setValueByPath(toObject,["generatedImages"],transformedList)}return toObject}function videoFromMldev(fromObject,_rootObject){let toObject={},fromUri=getValueByPath(fromObject,["uri"]);fromUri!=null&&setValueByPath(toObject,["uri"],fromUri);let fromVideoBytes=getValueByPath(fromObject,["encoded\
1245
- Video"]);fromVideoBytes!=null&&setValueByPath(toObject,["videoBytes"],tBytes(fromVideoBytes));let fromMimeType=getValueByPath(fromObject,["encoding"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function videoFromVertex(fromObject,_rootObject){let toObject={},fromUri=getValueByPath(fromObject,["gcsUri"]);fromUri!=null&&setValueByPath(toObject,["uri"],fromUri);let fromVideoBytes=getValueByPath(fromObject,["bytesBase64Encoded"]);fromVideoBytes!=null&&setValueByPath(
1246
- toObject,["videoBytes"],tBytes(fromVideoBytes));let fromMimeType=getValueByPath(fromObject,["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function videoGenerationMaskToVertex(fromObject,rootObject){let toObject={},fromImage=getValueByPath(fromObject,["image"]);fromImage!=null&&setValueByPath(toObject,["_self"],imageToVertex(fromImage));let fromMaskMode=getValueByPath(fromObject,["maskMode"]);return fromMaskMode!=null&&setValueByPath(toObject,
1247
- ["maskMode"],fromMaskMode),toObject}function videoGenerationReferenceImageToMldev(fromObject,rootObject){let toObject={},fromImage=getValueByPath(fromObject,["image"]);fromImage!=null&&setValueByPath(toObject,["image"],imageToMldev(fromImage));let fromReferenceType=getValueByPath(fromObject,["referenceType"]);return fromReferenceType!=null&&setValueByPath(toObject,["referenceType"],fromReferenceType),toObject}function videoGenerationReferenceImageToVertex(fromObject,rootObject){let toObject={},fromImage=getValueByPath(
1248
- fromObject,["image"]);fromImage!=null&&setValueByPath(toObject,["image"],imageToVertex(fromImage));let fromReferenceType=getValueByPath(fromObject,["referenceType"]);return fromReferenceType!=null&&setValueByPath(toObject,["referenceType"],fromReferenceType),toObject}function videoToMldev(fromObject,_rootObject){let toObject={},fromUri=getValueByPath(fromObject,["uri"]);fromUri!=null&&setValueByPath(toObject,["uri"],fromUri);let fromVideoBytes=getValueByPath(fromObject,["videoBytes"]);fromVideoBytes!=
1249
- null&&setValueByPath(toObject,["encodedVideo"],tBytes(fromVideoBytes));let fromMimeType=getValueByPath(fromObject,["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["encoding"],fromMimeType),toObject}function videoToVertex(fromObject,_rootObject){let toObject={},fromUri=getValueByPath(fromObject,["uri"]);fromUri!=null&&setValueByPath(toObject,["gcsUri"],fromUri);let fromVideoBytes=getValueByPath(fromObject,["videoBytes"]);fromVideoBytes!=null&&setValueByPath(toObject,["bytesBase64\
1250
- Encoded"],tBytes(fromVideoBytes));let fromMimeType=getValueByPath(fromObject,["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function voiceConfigToVertex(fromObject,rootObject){let toObject={},fromReplicatedVoiceConfig=getValueByPath(fromObject,["replicatedVoiceConfig"]);fromReplicatedVoiceConfig!=null&&setValueByPath(toObject,["replicatedVoiceConfig"],replicatedVoiceConfigToVertex(fromReplicatedVoiceConfig));let fromPrebuiltVoiceConfig=getValueByPath(
1251
- fromObject,["prebuiltVoiceConfig"]);fromPrebuiltVoiceConfig!=null&&setValueByPath(toObject,["prebuiltVoiceConfig"],fromPrebuiltVoiceConfig);let fromVoice=getValueByPath(fromObject,["voice"]);return fromVoice!=null&&setValueByPath(toObject,["voice"],fromVoice),toObject}function createFileSearchStoreConfigToMldev(apiClient,fromObject,parentObject){let toObject={},fromDisplayName=getValueByPath(fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["d\
1252
- isplayName"],fromDisplayName);let fromEmbeddingModel=getValueByPath(fromObject,["embeddingModel"]);return parentObject!==void 0&&fromEmbeddingModel!=null&&setValueByPath(parentObject,["embeddingModel"],tModel(apiClient,fromEmbeddingModel)),toObject}function createFileSearchStoreParametersToMldev(apiClient,fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&createFileSearchStoreConfigToMldev(apiClient,fromConfig,toObject),toObject}function deleteFileSearchStoreConfigToMldev(fromObject,parentObject){
1253
- let toObject={},fromForce=getValueByPath(fromObject,["force"]);return parentObject!==void 0&&fromForce!=null&&setValueByPath(parentObject,["_query","force"],fromForce),toObject}function deleteFileSearchStoreParametersToMldev(fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["_url","name"],fromName);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&deleteFileSearchStoreConfigToMldev(fromConfig,toObject),toObject}
1254
- function getFileSearchStoreParametersToMldev(fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],fromName),toObject}function importFileConfigToMldev(fromObject,parentObject){let toObject={},fromCustomMetadata=getValueByPath(fromObject,["customMetadata"]);if(parentObject!==void 0&&fromCustomMetadata!=null){let transformedList=fromCustomMetadata;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),
1255
- setValueByPath(parentObject,["customMetadata"],transformedList)}let fromChunkingConfig=getValueByPath(fromObject,["chunkingConfig"]);return parentObject!==void 0&&fromChunkingConfig!=null&&setValueByPath(parentObject,["chunkingConfig"],fromChunkingConfig),toObject}function importFileOperationFromMldev(fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["name"],fromName);let fromMetadata=getValueByPath(fromObject,["metadata"]);fromMetadata!=
1256
- null&&setValueByPath(toObject,["metadata"],fromMetadata);let fromDone=getValueByPath(fromObject,["done"]);fromDone!=null&&setValueByPath(toObject,["done"],fromDone);let fromError=getValueByPath(fromObject,["error"]);fromError!=null&&setValueByPath(toObject,["error"],fromError);let fromResponse=getValueByPath(fromObject,["response"]);return fromResponse!=null&&setValueByPath(toObject,["response"],importFileResponseFromMldev(fromResponse)),toObject}function importFileParametersToMldev(fromObject){
1257
- let toObject={},fromFileSearchStoreName=getValueByPath(fromObject,["fileSearchStoreName"]);fromFileSearchStoreName!=null&&setValueByPath(toObject,["_url","file_search_store_name"],fromFileSearchStoreName);let fromFileName=getValueByPath(fromObject,["fileName"]);fromFileName!=null&&setValueByPath(toObject,["fileName"],fromFileName);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&importFileConfigToMldev(fromConfig,toObject),toObject}function importFileResponseFromMldev(fromObject){
1258
- let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromParent=getValueByPath(fromObject,["parent"]);fromParent!=null&&setValueByPath(toObject,["parent"],fromParent);let fromDocumentName=getValueByPath(fromObject,["documentName"]);return fromDocumentName!=null&&setValueByPath(toObject,["documentName"],fromDocumentName),toObject}function listFileSearchStoresConfigToMldev(fromObject,parentObject){
1259
- let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);return parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken),toObject}function listFileSearchStoresParametersToMldev(fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=
1260
- null&&listFileSearchStoresConfigToMldev(fromConfig,toObject),toObject}function listFileSearchStoresResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromFileSearchStores=getValueByPath(fromObject,
1261
- ["fileSearchStores"]);if(fromFileSearchStores!=null){let transformedList=fromFileSearchStores;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["fileSearchStores"],transformedList)}return toObject}function uploadToFileSearchStoreConfigToMldev(fromObject,parentObject){let toObject={},fromMimeType=getValueByPath(fromObject,["mimeType"]);parentObject!==void 0&&fromMimeType!=null&&setValueByPath(parentObject,["mimeType"],fromMimeType);let fromDisplayName=getValueByPath(
1262
- fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["displayName"],fromDisplayName);let fromCustomMetadata=getValueByPath(fromObject,["customMetadata"]);if(parentObject!==void 0&&fromCustomMetadata!=null){let transformedList=fromCustomMetadata;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(parentObject,["customMetadata"],transformedList)}let fromChunkingConfig=getValueByPath(fromObject,["chunking\
1263
- Config"]);return parentObject!==void 0&&fromChunkingConfig!=null&&setValueByPath(parentObject,["chunkingConfig"],fromChunkingConfig),toObject}function uploadToFileSearchStoreParametersToMldev(fromObject){let toObject={},fromFileSearchStoreName=getValueByPath(fromObject,["fileSearchStoreName"]);fromFileSearchStoreName!=null&&setValueByPath(toObject,["_url","file_search_store_name"],fromFileSearchStoreName);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&uploadToFileSearchStoreConfigToMldev(
1264
- fromConfig,toObject),toObject}function uploadToFileSearchStoreResumableResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);return fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse),toObject}var CONTENT_TYPE_HEADER="Content-Type",SERVER_TIMEOUT_HEADER="X-Server-Timeout",USER_AGENT_HEADER="User-Agent",GOOGLE_API_CLIENT_HEADER="x-goog-api-client",SDK_VERSION="2.30.0",LIBRARY_LABEL=`google-genai-sdk\
1265
- /${SDK_VERSION}`,VERTEX_AI_API_DEFAULT_VERSION="v1beta1",GOOGLE_AI_API_DEFAULT_VERSION="v1beta",MULTI_REGIONAL_LOCATIONS=new Set(["us","eu"]),UNDICI_GLOBAL_DISPATCHER_SYMBOL$1=Symbol.for("undici.globalDispatcher.1");function isNodeRuntime$1(){var _a2,_b;return typeof((_b=(_a2=globalThis.process)===null||_a2===void 0?void 0:_a2.versions)===null||_b===void 0?void 0:_b.node)=="string"}function createUndiciNoTimeoutDispatcher$1(){return{dispatch(opts,handler){let globalDispatcher=globalThis[UNDICI_GLOBAL_DISPATCHER_SYMBOL$1];
1266
- if(!globalDispatcher&&typeof Headers<"u"&&(new Headers,globalDispatcher=globalThis[UNDICI_GLOBAL_DISPATCHER_SYMBOL$1]),!globalDispatcher||typeof globalDispatcher.dispatch!="function")throw new Error("Undici globalDispatcher is not available.");return globalDispatcher.dispatch(Object.assign(Object.assign({},opts),{headersTimeout:0,bodyTimeout:0}),handler)}}}function createAttemptSignal(timeout,callerSignal){let noop=()=>{};if(!(timeout&&timeout>0)&&!callerSignal)return{signal:void 0,dispose:noop};
1267
- let controller=new AbortController,timeoutHandle;timeout&&timeout>0&&(timeoutHandle=setTimeout(()=>controller.abort(),timeout),timeoutHandle&&typeof timeoutHandle.unref=="function"&&timeoutHandle.unref());let onCallerAbort=()=>controller.abort();return callerSignal&&(callerSignal.aborted?controller.abort():callerSignal.addEventListener("abort",onCallerAbort)),{signal:controller.signal,dispose:()=>{timeoutHandle!==void 0&&clearTimeout(timeoutHandle),callerSignal?.removeEventListener("abort",onCallerAbort)}}}
1268
- var DEFAULT_RETRY_ATTEMPTS=5,DEFAULT_RETRY_INITIAL_DELAY=1,DEFAULT_RETRY_MAX_DELAY=60,DEFAULT_RETRY_EXP_BASE=2,DEFAULT_RETRY_JITTER=1,DEFAULT_RETRY_HTTP_STATUS_CODES=[408,429,500,502,503,504],ApiClient=class{constructor(opts){var _a2,_b,_c;this.clientOptions=Object.assign({},opts),this.customBaseUrl=(_a2=opts.httpOptions)===null||_a2===void 0?void 0:_a2.baseUrl;let initHttpOptions={};if(this.clientOptions.vertexai){if(!this.clientOptions.location&&!this.clientOptions.apiKey&&!this.customBaseUrl&&
1269
- (this.clientOptions.location="global"),!(this.clientOptions.project&&this.clientOptions.location||this.clientOptions.apiKey)&&!this.customBaseUrl)throw new Error("Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.");let hasConstructorAuth=opts.project&&opts.location||!!opts.apiKey;this.customBaseUrl&&!hasConstructorAuth?(initHttpOptions.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0):this.
1270
- clientOptions.apiKey&&!this.clientOptions.project||this.clientOptions.location==="global"?initHttpOptions.baseUrl="https://aiplatform.googleapis.com/":this.clientOptions.project&&this.clientOptions.location&&MULTI_REGIONAL_LOCATIONS.has(this.clientOptions.location)?initHttpOptions.baseUrl=`https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`:this.clientOptions.project&&this.clientOptions.location&&(initHttpOptions.baseUrl=`https://${this.clientOptions.location}-aiplatform.googl\
1271
- eapis.com/`),initHttpOptions.apiVersion=(_b=this.clientOptions.apiVersion)!==null&&_b!==void 0?_b:VERTEX_AI_API_DEFAULT_VERSION}else this.clientOptions.apiKey||console.warn("API key should be set when using the Gemini API."),initHttpOptions.apiVersion=(_c=this.clientOptions.apiVersion)!==null&&_c!==void 0?_c:GOOGLE_AI_API_DEFAULT_VERSION,initHttpOptions.baseUrl="https://generativelanguage.googleapis.com/";initHttpOptions.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=initHttpOptions,
1272
- opts.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(initHttpOptions,opts.httpOptions))}isVertexAI(){var _a2;return(_a2=this.clientOptions.vertexai)!==null&&_a2!==void 0?_a2:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getCustomBaseUrl(){return this.customBaseUrl}async getAuthHeaders(){let headers=new Headers;return await this.clientOptions.auth.addAuthHeaders(headers),headers}getApiVersion(){if(this.clientOptions.httpOptions&&
1273
- this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw new Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw new Error("Base URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)
1274
- return this.clientOptions.httpOptions.headers;throw new Error("Headers are not set.")}getFetch(){var _a2;return(_a2=this.clientOptions.httpOptions)===null||_a2===void 0?void 0:_a2.fetch}getTimeout(){var _a2;return(_a2=this.clientOptions.httpOptions)===null||_a2===void 0?void 0:_a2.timeout}getRequestUrlInternal(httpOptions){if(!httpOptions||httpOptions.baseUrl===void 0||httpOptions.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");let urlElement=[httpOptions.baseUrl.endsWith(
1275
- "/")?httpOptions.baseUrl.slice(0,-1):httpOptions.baseUrl];return httpOptions.apiVersion&&httpOptions.apiVersion!==""&&urlElement.push(httpOptions.apiVersion),urlElement.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){let baseUrl=this.getBaseUrl(),urlParts=new URL(baseUrl);return urlParts.protocol=urlParts.protocol=="http:"?"ws":"wss",urlParts.toString()}setBaseUrl(url){
1276
- if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=url;else throw new Error("HTTP options are not correctly set.")}constructUrl(path2,httpOptions,prependProjectLocation){let urlElement=[this.getRequestUrlInternal(httpOptions)];return prependProjectLocation&&urlElement.push(this.getBaseResourcePath()),path2!==""&&urlElement.push(path2),new URL(`${urlElement.join("/")}`)}shouldPrependVertexProjectPath(request,httpOptions){return!(httpOptions.baseUrl&&httpOptions.baseUrlResourceScope===
1277
- ResourceScope.COLLECTION||!this.clientOptions.vertexai||!this.clientOptions.project||!this.clientOptions.location||request.path.startsWith("projects/")||request.httpMethod==="GET"&&request.path.startsWith("publishers/google/models"))}async request(request){let patchedHttpOptions=this.clientOptions.httpOptions;request.httpOptions&&(patchedHttpOptions=this.patchHttpOptions(this.clientOptions.httpOptions,request.httpOptions));let prependProjectLocation=this.shouldPrependVertexProjectPath(request,patchedHttpOptions),
1278
- url=this.constructUrl(request.path,patchedHttpOptions,prependProjectLocation);if(request.queryParams)for(let[key,value]of Object.entries(request.queryParams))url.searchParams.append(key,String(value));let requestInit={};if(request.httpMethod==="GET"){if(request.body&&request.body!=="{}")throw new Error("Request body should be empty for GET request, but got non empty request body")}else requestInit.body=request.body;return requestInit=await this.includeExtraHttpOptionsToRequestInit(requestInit,patchedHttpOptions,
1279
- url.toString()),this.unaryApiCall(url,requestInit,request.httpMethod,patchedHttpOptions.retryOptions,patchedHttpOptions.timeout,request.abortSignal,patchedHttpOptions.fetch)}patchHttpOptions(baseHttpOptions,requestHttpOptions){let patchedHttpOptions=JSON.parse(JSON.stringify(baseHttpOptions));baseHttpOptions.fetch&&(patchedHttpOptions.fetch=baseHttpOptions.fetch);for(let[key,value]of Object.entries(requestHttpOptions))typeof value=="object"?patchedHttpOptions[key]=Object.assign(Object.assign({},
1280
- patchedHttpOptions[key]),value):value!==void 0&&(patchedHttpOptions[key]=value);return patchedHttpOptions}async requestStream(request){let patchedHttpOptions=this.clientOptions.httpOptions;request.httpOptions&&(patchedHttpOptions=this.patchHttpOptions(this.clientOptions.httpOptions,request.httpOptions));let prependProjectLocation=this.shouldPrependVertexProjectPath(request,patchedHttpOptions),url=this.constructUrl(request.path,patchedHttpOptions,prependProjectLocation);(!url.searchParams.has("al\
1281
- t")||url.searchParams.get("alt")!=="sse")&&url.searchParams.set("alt","sse");let requestInit={};return requestInit.body=request.body,requestInit=await this.includeExtraHttpOptionsToRequestInit(requestInit,patchedHttpOptions,url.toString()),this.streamApiCall(url,requestInit,request.httpMethod,patchedHttpOptions.retryOptions,patchedHttpOptions.timeout,request.abortSignal,patchedHttpOptions.fetch)}async includeExtraHttpOptionsToRequestInit(requestInit,httpOptions,url){return isNodeRuntime$1()&&!httpOptions?.
1282
- fetch&&!("dispatcher"in requestInit)&&(requestInit.dispatcher=createUndiciNoTimeoutDispatcher$1()),httpOptions&&httpOptions.extraBody!==null&&includeExtraBodyToRequestInit(requestInit,httpOptions.extraBody),requestInit.headers=await this.getHeadersInternal(httpOptions,url),requestInit}async unaryApiCall(url,requestInit,httpMethod,retryOptions,timeout,abortSignal,fetchFn){return this.apiCall(url.toString(),Object.assign(Object.assign({},requestInit),{method:httpMethod}),retryOptions,timeout,abortSignal,
1283
- fetchFn).then(async response=>(await throwErrorIfNotOK(response),new HttpResponse(response))).catch(e=>{throw e instanceof Error?e:new Error(`exception ${e} sending request`,{cause:e})})}async streamApiCall(url,requestInit,httpMethod,retryOptions,timeout,abortSignal,fetchFn){return this.apiCall(url.toString(),Object.assign(Object.assign({},requestInit),{method:httpMethod}),retryOptions,timeout,abortSignal,fetchFn).then(async response=>(await throwErrorIfNotOK(response),this.processStreamResponse(
1284
- response))).catch(e=>{throw e instanceof Error?e:new Error(`exception ${e} sending request`,{cause:e})})}processStreamResponse(response){return __asyncGenerator(this,arguments,function*(){var _a2;let reader=(_a2=response?.body)===null||_a2===void 0?void 0:_a2.getReader(),decoder=new TextDecoder("utf-8");if(!reader)throw new Error("Response body is empty");try{let buffer="",dataPrefix="data:",delimiters=[`
1178
+ null&&setValueByPath(toObject,["functionCall"],functionCallToMldev$1(fromFunctionCall));let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);
1179
+ let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata);let fromPartMetadata=getValueByPath(fromObject,["partMet\
1180
+ adata"]);fromPartMetadata!=null&&setValueByPath(toObject,["partMetadata"],fromPartMetadata);let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function partToVertex$1(fromObject,_rootObject){let toObject={},fromMediaResolution=getValueByPath(
1181
+ fromObject,["mediaResolution"]);if(fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution),getValueByPath(fromObject,["toolCall"])!==void 0)throw new Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["toolResponse"])!==void 0)throw new Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");
1182
+ let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);
1183
+ let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],fromFunctionCall);let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineDat\
1184
+ a"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(
1185
+ fromObject,["videoMetadata"]);if(fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata),getValueByPath(fromObject,["partMetadata"])!==void 0)throw new Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(
1186
+ fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function productImageToVertex(fromObject,rootObject){let toObject={},fromProductImage=getValueByPath(fromObject,["productImage"]);return fromProductImage!=null&&setValueByPath(toObject,["image"],imageToVertex(fromProductImage)),toObject}function recontextImageConfigToVertex(fromObject,parentObject,_rootObject){let toObject={},fromNumberOfImages=getValueByPath(fromObject,
1187
+ ["numberOfImages"]);parentObject!==void 0&&fromNumberOfImages!=null&&setValueByPath(parentObject,["parameters","sampleCount"],fromNumberOfImages);let fromBaseSteps=getValueByPath(fromObject,["baseSteps"]);parentObject!==void 0&&fromBaseSteps!=null&&setValueByPath(parentObject,["parameters","baseSteps"],fromBaseSteps);let fromOutputGcsUri=getValueByPath(fromObject,["outputGcsUri"]);parentObject!==void 0&&fromOutputGcsUri!=null&&setValueByPath(parentObject,["parameters","storageUri"],fromOutputGcsUri);
1188
+ let fromSeed=getValueByPath(fromObject,["seed"]);parentObject!==void 0&&fromSeed!=null&&setValueByPath(parentObject,["parameters","seed"],fromSeed);let fromSafetyFilterLevel=getValueByPath(fromObject,["safetyFilterLevel"]);parentObject!==void 0&&fromSafetyFilterLevel!=null&&setValueByPath(parentObject,["parameters","safetySetting"],fromSafetyFilterLevel);let fromPersonGeneration=getValueByPath(fromObject,["personGeneration"]);parentObject!==void 0&&fromPersonGeneration!=null&&setValueByPath(parentObject,
1189
+ ["parameters","personGeneration"],fromPersonGeneration);let fromAddWatermark=getValueByPath(fromObject,["addWatermark"]);parentObject!==void 0&&fromAddWatermark!=null&&setValueByPath(parentObject,["parameters","addWatermark"],fromAddWatermark);let fromOutputMimeType=getValueByPath(fromObject,["outputMimeType"]);parentObject!==void 0&&fromOutputMimeType!=null&&setValueByPath(parentObject,["parameters","outputOptions","mimeType"],fromOutputMimeType);let fromOutputCompressionQuality=getValueByPath(
1190
+ fromObject,["outputCompressionQuality"]);parentObject!==void 0&&fromOutputCompressionQuality!=null&&setValueByPath(parentObject,["parameters","outputOptions","compressionQuality"],fromOutputCompressionQuality);let fromEnhancePrompt=getValueByPath(fromObject,["enhancePrompt"]);parentObject!==void 0&&fromEnhancePrompt!=null&&setValueByPath(parentObject,["parameters","enhancePrompt"],fromEnhancePrompt);let fromLabels=getValueByPath(fromObject,["labels"]);return parentObject!==void 0&&fromLabels!=null&&
1191
+ setValueByPath(parentObject,["labels"],fromLabels),toObject}function recontextImageParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromSource=getValueByPath(fromObject,["source"]);fromSource!=null&&recontextImageSourceToVertex(fromSource,toObject);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&recontextImageConfigToVertex(
1192
+ fromConfig,toObject),toObject}function recontextImageResponseFromVertex(fromObject,rootObject){let toObject={},fromGeneratedImages=getValueByPath(fromObject,["predictions"]);if(fromGeneratedImages!=null){let transformedList=fromGeneratedImages;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedImageFromVertex(item))),setValueByPath(toObject,["generatedImages"],transformedList)}return toObject}function recontextImageSourceToVertex(fromObject,parentObject,rootObject){
1193
+ let toObject={},fromPrompt=getValueByPath(fromObject,["prompt"]);parentObject!==void 0&&fromPrompt!=null&&setValueByPath(parentObject,["instances[0]","prompt"],fromPrompt);let fromPersonImage=getValueByPath(fromObject,["personImage"]);parentObject!==void 0&&fromPersonImage!=null&&setValueByPath(parentObject,["instances[0]","personImage","image"],imageToVertex(fromPersonImage));let fromProductImages=getValueByPath(fromObject,["productImages"]);if(parentObject!==void 0&&fromProductImages!=null){let transformedList=fromProductImages;
1194
+ Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>productImageToVertex(item))),setValueByPath(parentObject,["instances[0]","productImages"],transformedList)}return toObject}function referenceImageAPIInternalToVertex(fromObject,rootObject){let toObject={},fromReferenceImage=getValueByPath(fromObject,["referenceImage"]);fromReferenceImage!=null&&setValueByPath(toObject,["referenceImage"],imageToVertex(fromReferenceImage));let fromReferenceId=getValueByPath(fromObject,["ref\
1195
+ erenceId"]);fromReferenceId!=null&&setValueByPath(toObject,["referenceId"],fromReferenceId);let fromReferenceType=getValueByPath(fromObject,["referenceType"]);fromReferenceType!=null&&setValueByPath(toObject,["referenceType"],fromReferenceType);let fromMaskImageConfig=getValueByPath(fromObject,["maskImageConfig"]);fromMaskImageConfig!=null&&setValueByPath(toObject,["maskImageConfig"],maskReferenceConfigToVertex(fromMaskImageConfig));let fromControlImageConfig=getValueByPath(fromObject,["controlI\
1196
+ mageConfig"]);fromControlImageConfig!=null&&setValueByPath(toObject,["controlImageConfig"],controlReferenceConfigToVertex(fromControlImageConfig));let fromStyleImageConfig=getValueByPath(fromObject,["styleImageConfig"]);fromStyleImageConfig!=null&&setValueByPath(toObject,["styleImageConfig"],fromStyleImageConfig);let fromSubjectImageConfig=getValueByPath(fromObject,["subjectImageConfig"]);return fromSubjectImageConfig!=null&&setValueByPath(toObject,["subjectImageConfig"],fromSubjectImageConfig),
1197
+ toObject}function replicatedVoiceConfigToVertex(fromObject,_rootObject){let toObject={},fromMimeType=getValueByPath(fromObject,["mimeType"]);fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType);let fromVoiceSampleAudio=getValueByPath(fromObject,["voiceSampleAudio"]);if(fromVoiceSampleAudio!=null&&setValueByPath(toObject,["voiceSampleAudio"],fromVoiceSampleAudio),getValueByPath(fromObject,["consentAudio"])!==void 0)throw new Error("consentAudio parameter is only supported in Gem\
1198
+ ini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(getValueByPath(fromObject,["voiceConsentSignature"])!==void 0)throw new Error("voiceConsentSignature parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function safetyAttributesFromVertex(fromObject,_rootObject){let toObject={},fromCategories=getValueByPath(fromObject,["safetyAttributes","categories"]);fromCategories!=null&&setValueByPath(toObject,["ca\
1199
+ tegories"],fromCategories);let fromScores=getValueByPath(fromObject,["safetyAttributes","scores"]);fromScores!=null&&setValueByPath(toObject,["scores"],fromScores);let fromContentType=getValueByPath(fromObject,["contentType"]);return fromContentType!=null&&setValueByPath(toObject,["contentType"],fromContentType),toObject}function safetySettingToMldev$1(fromObject,_rootObject){let toObject={},fromCategory=getValueByPath(fromObject,["category"]);if(fromCategory!=null&&setValueByPath(toObject,["cat\
1200
+ egory"],fromCategory),getValueByPath(fromObject,["method"])!==void 0)throw new Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromThreshold=getValueByPath(fromObject,["threshold"]);return fromThreshold!=null&&setValueByPath(toObject,["threshold"],fromThreshold),toObject}function scribbleImageToVertex(fromObject,rootObject){let toObject={},fromImage=getValueByPath(fromObject,["image"]);return fromImage!=null&&setValueByPath(
1201
+ toObject,["image"],imageToVertex(fromImage)),toObject}function segmentImageConfigToVertex(fromObject,parentObject,_rootObject){let toObject={},fromMode=getValueByPath(fromObject,["mode"]);parentObject!==void 0&&fromMode!=null&&setValueByPath(parentObject,["parameters","mode"],fromMode);let fromMaxPredictions=getValueByPath(fromObject,["maxPredictions"]);parentObject!==void 0&&fromMaxPredictions!=null&&setValueByPath(parentObject,["parameters","maxPredictions"],fromMaxPredictions);let fromConfidenceThreshold=getValueByPath(
1202
+ fromObject,["confidenceThreshold"]);parentObject!==void 0&&fromConfidenceThreshold!=null&&setValueByPath(parentObject,["parameters","confidenceThreshold"],fromConfidenceThreshold);let fromMaskDilation=getValueByPath(fromObject,["maskDilation"]);parentObject!==void 0&&fromMaskDilation!=null&&setValueByPath(parentObject,["parameters","maskDilation"],fromMaskDilation);let fromBinaryColorThreshold=getValueByPath(fromObject,["binaryColorThreshold"]);parentObject!==void 0&&fromBinaryColorThreshold!=null&&
1203
+ setValueByPath(parentObject,["parameters","binaryColorThreshold"],fromBinaryColorThreshold);let fromLabels=getValueByPath(fromObject,["labels"]);return parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["labels"],fromLabels),toObject}function segmentImageParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromSource=getValueByPath(
1204
+ fromObject,["source"]);fromSource!=null&&segmentImageSourceToVertex(fromSource,toObject);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&segmentImageConfigToVertex(fromConfig,toObject),toObject}function segmentImageResponseFromVertex(fromObject,rootObject){let toObject={},fromGeneratedMasks=getValueByPath(fromObject,["predictions"]);if(fromGeneratedMasks!=null){let transformedList=fromGeneratedMasks;Array.isArray(transformedList)&&(transformedList=transformedList.map(
1205
+ item=>generatedImageMaskFromVertex(item))),setValueByPath(toObject,["generatedMasks"],transformedList)}return toObject}function segmentImageSourceToVertex(fromObject,parentObject,rootObject){let toObject={},fromPrompt=getValueByPath(fromObject,["prompt"]);parentObject!==void 0&&fromPrompt!=null&&setValueByPath(parentObject,["instances[0]","prompt"],fromPrompt);let fromImage=getValueByPath(fromObject,["image"]);parentObject!==void 0&&fromImage!=null&&setValueByPath(parentObject,["instances[0]","i\
1206
+ mage"],imageToVertex(fromImage));let fromScribbleImage=getValueByPath(fromObject,["scribbleImage"]);return parentObject!==void 0&&fromScribbleImage!=null&&setValueByPath(parentObject,["instances[0]","scribble"],scribbleImageToVertex(fromScribbleImage)),toObject}function speakerVoiceConfigToVertex(fromObject,rootObject){let toObject={},fromSpeaker=getValueByPath(fromObject,["speaker"]);fromSpeaker!=null&&setValueByPath(toObject,["speaker"],fromSpeaker);let fromVoiceConfig=getValueByPath(fromObject,
1207
+ ["voiceConfig"]);return fromVoiceConfig!=null&&setValueByPath(toObject,["voiceConfig"],voiceConfigToVertex(fromVoiceConfig)),toObject}function speechConfigToVertex(fromObject,rootObject){let toObject={},fromVoiceConfig=getValueByPath(fromObject,["voiceConfig"]);fromVoiceConfig!=null&&setValueByPath(toObject,["voiceConfig"],voiceConfigToVertex(fromVoiceConfig));let fromLanguageCode=getValueByPath(fromObject,["languageCode"]);fromLanguageCode!=null&&setValueByPath(toObject,["languageCode"],fromLanguageCode);
1208
+ let fromMultiSpeakerVoiceConfig=getValueByPath(fromObject,["multiSpeakerVoiceConfig"]);return fromMultiSpeakerVoiceConfig!=null&&setValueByPath(toObject,["multiSpeakerVoiceConfig"],multiSpeakerVoiceConfigToVertex(fromMultiSpeakerVoiceConfig)),toObject}function toolConfigToMldev(fromObject,rootObject){let toObject={},fromFunctionCallingConfig=getValueByPath(fromObject,["functionCallingConfig"]);fromFunctionCallingConfig!=null&&setValueByPath(toObject,["functionCallingConfig"],functionCallingConfigToMldev(
1209
+ fromFunctionCallingConfig));let fromRetrievalConfig=getValueByPath(fromObject,["retrievalConfig"]);fromRetrievalConfig!=null&&setValueByPath(toObject,["retrievalConfig"],fromRetrievalConfig);let fromIncludeServerSideToolInvocations=getValueByPath(fromObject,["includeServerSideToolInvocations"]);return fromIncludeServerSideToolInvocations!=null&&setValueByPath(toObject,["includeServerSideToolInvocations"],fromIncludeServerSideToolInvocations),toObject}function toolConfigToVertex(fromObject,_rootObject){
1210
+ let toObject={},fromFunctionCallingConfig=getValueByPath(fromObject,["functionCallingConfig"]);fromFunctionCallingConfig!=null&&setValueByPath(toObject,["functionCallingConfig"],fromFunctionCallingConfig);let fromRetrievalConfig=getValueByPath(fromObject,["retrievalConfig"]);if(fromRetrievalConfig!=null&&setValueByPath(toObject,["retrievalConfig"],fromRetrievalConfig),getValueByPath(fromObject,["includeServerSideToolInvocations"])!==void 0)throw new Error("includeServerSideToolInvocations parame\
1211
+ ter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function toolToMldev$1(fromObject,rootObject){let toObject={};if(getValueByPath(fromObject,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],googleMapsToMldev$1(
1212
+ fromGoogleMaps));let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);if(fromComputerUse!=
1213
+ null&&setValueByPath(toObject,["computerUse"],fromComputerUse),getValueByPath(fromObject,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromFunctionDeclarations=getValueByPath(
1214
+ fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functionDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleSearch"]);fromGoogleSearch!=null&&setValueByPath(toObject,["googleSearch"],googleSearchToMldev$1(fromGoogleSearch));let fromGoogleSearchRetrieval=getValueByPath(fromObject,["google\
1215
+ SearchRetrieval"]);if(fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval),getValueByPath(fromObject,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromUrlContext=getValueByPath(fromObject,["urlContext"]);fromUrlContext!=null&&setValueByPath(toObject,["urlContext"],fromUrlContext);let fromFileSearch=getValueByPath(
1216
+ fromObject,["fileSearch"]);return fromFileSearch!=null&&setValueByPath(toObject,["fileSearch"],fromFileSearch),toObject}function toolToVertex$1(fromObject,rootObject){let toObject={},fromRetrieval=getValueByPath(fromObject,["retrieval"]);fromRetrieval!=null&&setValueByPath(toObject,["retrieval"],fromRetrieval);let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],fromGoogleMaps);let fromMcpServers=getValueByPath(fromObject,["mcp\
1217
+ Servers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>mcpServerToVertex$1(item))),setValueByPath(toObject,["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);fromComputerUse!=null&&setValueByPath(toObject,["compu\
1218
+ terUse"],fromComputerUse);let fromEnterpriseWebSearch=getValueByPath(fromObject,["enterpriseWebSearch"]);fromEnterpriseWebSearch!=null&&setValueByPath(toObject,["enterpriseWebSearch"],fromEnterpriseWebSearch);let fromExaAiSearch=getValueByPath(fromObject,["exaAiSearch"]);fromExaAiSearch!=null&&setValueByPath(toObject,["exaAiSearch"],fromExaAiSearch);let fromFunctionDeclarations=getValueByPath(fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;
1219
+ Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functionDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleSearch"]);fromGoogleSearch!=null&&setValueByPath(toObject,["googleSearch"],fromGoogleSearch);let fromGoogleSearchRetrieval=getValueByPath(fromObject,["googleSearchRetrieval"]);fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval);let fromParallelAiSearch=getValueByPath(
1220
+ fromObject,["parallelAiSearch"]);fromParallelAiSearch!=null&&setValueByPath(toObject,["parallelAiSearch"],fromParallelAiSearch);let fromUrlContext=getValueByPath(fromObject,["urlContext"]);if(fromUrlContext!=null&&setValueByPath(toObject,["urlContext"],fromUrlContext),getValueByPath(fromObject,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return toObject}function tunedModelInfoFromMldev(fromObject,_rootObject){
1221
+ let toObject={},fromBaseModel=getValueByPath(fromObject,["baseModel"]);fromBaseModel!=null&&setValueByPath(toObject,["baseModel"],fromBaseModel);let fromCreateTime=getValueByPath(fromObject,["createTime"]);fromCreateTime!=null&&setValueByPath(toObject,["createTime"],fromCreateTime);let fromUpdateTime=getValueByPath(fromObject,["updateTime"]);return fromUpdateTime!=null&&setValueByPath(toObject,["updateTime"],fromUpdateTime),toObject}function tunedModelInfoFromVertex(fromObject,_rootObject){let toObject={},
1222
+ fromBaseModel=getValueByPath(fromObject,["labels","google-vertex-llm-tuning-base-model-id"]);fromBaseModel!=null&&setValueByPath(toObject,["baseModel"],fromBaseModel);let fromCreateTime=getValueByPath(fromObject,["createTime"]);fromCreateTime!=null&&setValueByPath(toObject,["createTime"],fromCreateTime);let fromUpdateTime=getValueByPath(fromObject,["updateTime"]);return fromUpdateTime!=null&&setValueByPath(toObject,["updateTime"],fromUpdateTime),toObject}function updateModelConfigToMldev(fromObject,parentObject,_rootObject){
1223
+ let toObject={},fromDisplayName=getValueByPath(fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["displayName"],fromDisplayName);let fromDescription=getValueByPath(fromObject,["description"]);parentObject!==void 0&&fromDescription!=null&&setValueByPath(parentObject,["description"],fromDescription);let fromDefaultCheckpointId=getValueByPath(fromObject,["defaultCheckpointId"]);return parentObject!==void 0&&fromDefaultCheckpointId!=null&&setValueByPath(
1224
+ parentObject,["defaultCheckpointId"],fromDefaultCheckpointId),toObject}function updateModelConfigToVertex(fromObject,parentObject,_rootObject){let toObject={},fromDisplayName=getValueByPath(fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["displayName"],fromDisplayName);let fromDescription=getValueByPath(fromObject,["description"]);parentObject!==void 0&&fromDescription!=null&&setValueByPath(parentObject,["description"],fromDescription);let fromDefaultCheckpointId=getValueByPath(
1225
+ fromObject,["defaultCheckpointId"]);return parentObject!==void 0&&fromDefaultCheckpointId!=null&&setValueByPath(parentObject,["defaultCheckpointId"],fromDefaultCheckpointId),toObject}function updateModelParametersToMldev(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","name"],tModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&updateModelConfigToMldev(
1226
+ fromConfig,toObject),toObject}function updateModelParametersToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&updateModelConfigToVertex(fromConfig,toObject),toObject}function upscaleImageAPIConfigInternalToVertex(fromObject,parentObject,_rootObject){let toObject={},fromOutputGcsUri=getValueByPath(
1227
+ fromObject,["outputGcsUri"]);parentObject!==void 0&&fromOutputGcsUri!=null&&setValueByPath(parentObject,["parameters","storageUri"],fromOutputGcsUri);let fromSafetyFilterLevel=getValueByPath(fromObject,["safetyFilterLevel"]);parentObject!==void 0&&fromSafetyFilterLevel!=null&&setValueByPath(parentObject,["parameters","safetySetting"],fromSafetyFilterLevel);let fromPersonGeneration=getValueByPath(fromObject,["personGeneration"]);parentObject!==void 0&&fromPersonGeneration!=null&&setValueByPath(parentObject,
1228
+ ["parameters","personGeneration"],fromPersonGeneration);let fromIncludeRaiReason=getValueByPath(fromObject,["includeRaiReason"]);parentObject!==void 0&&fromIncludeRaiReason!=null&&setValueByPath(parentObject,["parameters","includeRaiReason"],fromIncludeRaiReason);let fromOutputMimeType=getValueByPath(fromObject,["outputMimeType"]);parentObject!==void 0&&fromOutputMimeType!=null&&setValueByPath(parentObject,["parameters","outputOptions","mimeType"],fromOutputMimeType);let fromOutputCompressionQuality=getValueByPath(
1229
+ fromObject,["outputCompressionQuality"]);parentObject!==void 0&&fromOutputCompressionQuality!=null&&setValueByPath(parentObject,["parameters","outputOptions","compressionQuality"],fromOutputCompressionQuality);let fromEnhanceInputImage=getValueByPath(fromObject,["enhanceInputImage"]);parentObject!==void 0&&fromEnhanceInputImage!=null&&setValueByPath(parentObject,["parameters","upscaleConfig","enhanceInputImage"],fromEnhanceInputImage);let fromImagePreservationFactor=getValueByPath(fromObject,["i\
1230
+ magePreservationFactor"]);parentObject!==void 0&&fromImagePreservationFactor!=null&&setValueByPath(parentObject,["parameters","upscaleConfig","imagePreservationFactor"],fromImagePreservationFactor);let fromLabels=getValueByPath(fromObject,["labels"]);parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["labels"],fromLabels);let fromNumberOfImages=getValueByPath(fromObject,["numberOfImages"]);parentObject!==void 0&&fromNumberOfImages!=null&&setValueByPath(parentObject,["parameter\
1231
+ s","sampleCount"],fromNumberOfImages);let fromMode=getValueByPath(fromObject,["mode"]);return parentObject!==void 0&&fromMode!=null&&setValueByPath(parentObject,["parameters","mode"],fromMode),toObject}function upscaleImageAPIParametersInternalToVertex(apiClient,fromObject,rootObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["_url","model"],tModel(apiClient,fromModel));let fromImage=getValueByPath(fromObject,["image"]);fromImage!=null&&
1232
+ setValueByPath(toObject,["instances[0]","image"],imageToVertex(fromImage));let fromUpscaleFactor=getValueByPath(fromObject,["upscaleFactor"]);fromUpscaleFactor!=null&&setValueByPath(toObject,["parameters","upscaleConfig","upscaleFactor"],fromUpscaleFactor);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&upscaleImageAPIConfigInternalToVertex(fromConfig,toObject),toObject}function upscaleImageResponseFromVertex(fromObject,rootObject){let toObject={},fromSdkHttpResponse=getValueByPath(
1233
+ fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromGeneratedImages=getValueByPath(fromObject,["predictions"]);if(fromGeneratedImages!=null){let transformedList=fromGeneratedImages;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>generatedImageFromVertex(item))),setValueByPath(toObject,["generatedImages"],transformedList)}return toObject}function videoFromMldev(fromObject,_rootObject){let toObject={},
1234
+ fromUri=getValueByPath(fromObject,["uri"]);fromUri!=null&&setValueByPath(toObject,["uri"],fromUri);let fromVideoBytes=getValueByPath(fromObject,["encodedVideo"]);fromVideoBytes!=null&&setValueByPath(toObject,["videoBytes"],tBytes(fromVideoBytes));let fromMimeType=getValueByPath(fromObject,["encoding"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function videoFromVertex(fromObject,_rootObject){let toObject={},fromUri=getValueByPath(fromObject,["gcsUri"]);
1235
+ fromUri!=null&&setValueByPath(toObject,["uri"],fromUri);let fromVideoBytes=getValueByPath(fromObject,["bytesBase64Encoded"]);fromVideoBytes!=null&&setValueByPath(toObject,["videoBytes"],tBytes(fromVideoBytes));let fromMimeType=getValueByPath(fromObject,["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function videoGenerationMaskToVertex(fromObject,rootObject){let toObject={},fromImage=getValueByPath(fromObject,["image"]);fromImage!=null&&setValueByPath(
1236
+ toObject,["_self"],imageToVertex(fromImage));let fromMaskMode=getValueByPath(fromObject,["maskMode"]);return fromMaskMode!=null&&setValueByPath(toObject,["maskMode"],fromMaskMode),toObject}function videoGenerationReferenceImageToMldev(fromObject,rootObject){let toObject={},fromImage=getValueByPath(fromObject,["image"]);fromImage!=null&&setValueByPath(toObject,["image"],imageToMldev(fromImage));let fromReferenceType=getValueByPath(fromObject,["referenceType"]);return fromReferenceType!=null&&setValueByPath(
1237
+ toObject,["referenceType"],fromReferenceType),toObject}function videoGenerationReferenceImageToVertex(fromObject,rootObject){let toObject={},fromImage=getValueByPath(fromObject,["image"]);fromImage!=null&&setValueByPath(toObject,["image"],imageToVertex(fromImage));let fromReferenceType=getValueByPath(fromObject,["referenceType"]);return fromReferenceType!=null&&setValueByPath(toObject,["referenceType"],fromReferenceType),toObject}function videoToMldev(fromObject,_rootObject){let toObject={},fromUri=getValueByPath(
1238
+ fromObject,["uri"]);fromUri!=null&&setValueByPath(toObject,["uri"],fromUri);let fromVideoBytes=getValueByPath(fromObject,["videoBytes"]);fromVideoBytes!=null&&setValueByPath(toObject,["encodedVideo"],tBytes(fromVideoBytes));let fromMimeType=getValueByPath(fromObject,["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["encoding"],fromMimeType),toObject}function videoToVertex(fromObject,_rootObject){let toObject={},fromUri=getValueByPath(fromObject,["uri"]);fromUri!=null&&setValueByPath(
1239
+ toObject,["gcsUri"],fromUri);let fromVideoBytes=getValueByPath(fromObject,["videoBytes"]);fromVideoBytes!=null&&setValueByPath(toObject,["bytesBase64Encoded"],tBytes(fromVideoBytes));let fromMimeType=getValueByPath(fromObject,["mimeType"]);return fromMimeType!=null&&setValueByPath(toObject,["mimeType"],fromMimeType),toObject}function voiceConfigToVertex(fromObject,rootObject){let toObject={},fromReplicatedVoiceConfig=getValueByPath(fromObject,["replicatedVoiceConfig"]);fromReplicatedVoiceConfig!=
1240
+ null&&setValueByPath(toObject,["replicatedVoiceConfig"],replicatedVoiceConfigToVertex(fromReplicatedVoiceConfig));let fromPrebuiltVoiceConfig=getValueByPath(fromObject,["prebuiltVoiceConfig"]);fromPrebuiltVoiceConfig!=null&&setValueByPath(toObject,["prebuiltVoiceConfig"],fromPrebuiltVoiceConfig);let fromVoice=getValueByPath(fromObject,["voice"]);return fromVoice!=null&&setValueByPath(toObject,["voice"],fromVoice),toObject}function createFileSearchStoreConfigToMldev(apiClient,fromObject,parentObject){
1241
+ let toObject={},fromDisplayName=getValueByPath(fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["displayName"],fromDisplayName);let fromEmbeddingModel=getValueByPath(fromObject,["embeddingModel"]);return parentObject!==void 0&&fromEmbeddingModel!=null&&setValueByPath(parentObject,["embeddingModel"],tModel(apiClient,fromEmbeddingModel)),toObject}function createFileSearchStoreParametersToMldev(apiClient,fromObject){let toObject={},fromConfig=getValueByPath(
1242
+ fromObject,["config"]);return fromConfig!=null&&createFileSearchStoreConfigToMldev(apiClient,fromConfig,toObject),toObject}function deleteFileSearchStoreConfigToMldev(fromObject,parentObject){let toObject={},fromForce=getValueByPath(fromObject,["force"]);return parentObject!==void 0&&fromForce!=null&&setValueByPath(parentObject,["_query","force"],fromForce),toObject}function deleteFileSearchStoreParametersToMldev(fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=
1243
+ null&&setValueByPath(toObject,["_url","name"],fromName);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&deleteFileSearchStoreConfigToMldev(fromConfig,toObject),toObject}function getFileSearchStoreParametersToMldev(fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],fromName),toObject}function importFileConfigToMldev(fromObject,parentObject){let toObject={},fromCustomMetadata=getValueByPath(
1244
+ fromObject,["customMetadata"]);if(parentObject!==void 0&&fromCustomMetadata!=null){let transformedList=fromCustomMetadata;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(parentObject,["customMetadata"],transformedList)}let fromChunkingConfig=getValueByPath(fromObject,["chunkingConfig"]);return parentObject!==void 0&&fromChunkingConfig!=null&&setValueByPath(parentObject,["chunkingConfig"],fromChunkingConfig),toObject}function importFileOperationFromMldev(fromObject){
1245
+ let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["name"],fromName);let fromMetadata=getValueByPath(fromObject,["metadata"]);fromMetadata!=null&&setValueByPath(toObject,["metadata"],fromMetadata);let fromDone=getValueByPath(fromObject,["done"]);fromDone!=null&&setValueByPath(toObject,["done"],fromDone);let fromError=getValueByPath(fromObject,["error"]);fromError!=null&&setValueByPath(toObject,["error"],fromError);let fromResponse=getValueByPath(
1246
+ fromObject,["response"]);return fromResponse!=null&&setValueByPath(toObject,["response"],importFileResponseFromMldev(fromResponse)),toObject}function importFileParametersToMldev(fromObject){let toObject={},fromFileSearchStoreName=getValueByPath(fromObject,["fileSearchStoreName"]);fromFileSearchStoreName!=null&&setValueByPath(toObject,["_url","file_search_store_name"],fromFileSearchStoreName);let fromFileName=getValueByPath(fromObject,["fileName"]);fromFileName!=null&&setValueByPath(toObject,["fi\
1247
+ leName"],fromFileName);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&importFileConfigToMldev(fromConfig,toObject),toObject}function importFileResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromParent=getValueByPath(fromObject,["parent"]);fromParent!=null&&setValueByPath(toObject,["parent"],fromParent);let fromDocumentName=getValueByPath(
1248
+ fromObject,["documentName"]);return fromDocumentName!=null&&setValueByPath(toObject,["documentName"],fromDocumentName),toObject}function listFileSearchStoresConfigToMldev(fromObject,parentObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);return parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,
1249
+ ["_query","pageToken"],fromPageToken),toObject}function listFileSearchStoresParametersToMldev(fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listFileSearchStoresConfigToMldev(fromConfig,toObject),toObject}function listFileSearchStoresResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(
1250
+ fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromFileSearchStores=getValueByPath(fromObject,["fileSearchStores"]);if(fromFileSearchStores!=null){let transformedList=fromFileSearchStores;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["fileSearchStores"],transformedList)}return toObject}function uploadToFileSearchStoreConfigToMldev(fromObject,parentObject){let toObject={},
1251
+ fromMimeType=getValueByPath(fromObject,["mimeType"]);parentObject!==void 0&&fromMimeType!=null&&setValueByPath(parentObject,["mimeType"],fromMimeType);let fromDisplayName=getValueByPath(fromObject,["displayName"]);parentObject!==void 0&&fromDisplayName!=null&&setValueByPath(parentObject,["displayName"],fromDisplayName);let fromCustomMetadata=getValueByPath(fromObject,["customMetadata"]);if(parentObject!==void 0&&fromCustomMetadata!=null){let transformedList=fromCustomMetadata;Array.isArray(transformedList)&&
1252
+ (transformedList=transformedList.map(item=>item)),setValueByPath(parentObject,["customMetadata"],transformedList)}let fromChunkingConfig=getValueByPath(fromObject,["chunkingConfig"]);return parentObject!==void 0&&fromChunkingConfig!=null&&setValueByPath(parentObject,["chunkingConfig"],fromChunkingConfig),toObject}function uploadToFileSearchStoreParametersToMldev(fromObject){let toObject={},fromFileSearchStoreName=getValueByPath(fromObject,["fileSearchStoreName"]);fromFileSearchStoreName!=null&&setValueByPath(
1253
+ toObject,["_url","file_search_store_name"],fromFileSearchStoreName);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&uploadToFileSearchStoreConfigToMldev(fromConfig,toObject),toObject}function uploadToFileSearchStoreResumableResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);return fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse),toObject}var CONTENT_TYPE_HEADER="\
1254
+ Content-Type",SERVER_TIMEOUT_HEADER="X-Server-Timeout",USER_AGENT_HEADER="User-Agent",GOOGLE_API_CLIENT_HEADER="x-goog-api-client",SDK_VERSION="2.31.0",LIBRARY_LABEL=`google-genai-sdk/${SDK_VERSION}`,VERTEX_AI_API_DEFAULT_VERSION="v1beta1",GOOGLE_AI_API_DEFAULT_VERSION="v1beta",MULTI_REGIONAL_LOCATIONS=new Set(["us","eu"]),UNDICI_GLOBAL_DISPATCHER_SYMBOL$1=Symbol.for("undici.globalDispatcher.1");function isNodeRuntime$1(){var _a2,_b;return typeof((_b=(_a2=globalThis.process)===null||_a2===void 0?
1255
+ void 0:_a2.versions)===null||_b===void 0?void 0:_b.node)=="string"}function createUndiciNoTimeoutDispatcher$1(){return{dispatch(opts,handler){let globalDispatcher=globalThis[UNDICI_GLOBAL_DISPATCHER_SYMBOL$1];if(!globalDispatcher&&typeof Headers<"u"&&(new Headers,globalDispatcher=globalThis[UNDICI_GLOBAL_DISPATCHER_SYMBOL$1]),!globalDispatcher||typeof globalDispatcher.dispatch!="function")throw new Error("Undici globalDispatcher is not available.");return globalDispatcher.dispatch(Object.assign(
1256
+ Object.assign({},opts),{headersTimeout:0,bodyTimeout:0}),handler)}}}function createAttemptSignal(timeout,callerSignal){let noop=()=>{};if(!(timeout&&timeout>0)&&!callerSignal)return{signal:void 0,dispose:noop};let controller=new AbortController,timeoutHandle;timeout&&timeout>0&&(timeoutHandle=setTimeout(()=>controller.abort(),timeout),timeoutHandle&&typeof timeoutHandle.unref=="function"&&timeoutHandle.unref());let onCallerAbort=()=>controller.abort();return callerSignal&&(callerSignal.aborted?controller.
1257
+ abort():callerSignal.addEventListener("abort",onCallerAbort)),{signal:controller.signal,dispose:()=>{timeoutHandle!==void 0&&clearTimeout(timeoutHandle),callerSignal?.removeEventListener("abort",onCallerAbort)}}}var DEFAULT_RETRY_ATTEMPTS=5,DEFAULT_RETRY_INITIAL_DELAY=1,DEFAULT_RETRY_MAX_DELAY=60,DEFAULT_RETRY_EXP_BASE=2,DEFAULT_RETRY_JITTER=1,DEFAULT_RETRY_HTTP_STATUS_CODES=[408,429,500,502,503,504],ApiClient=class{constructor(opts){var _a2,_b,_c;this.clientOptions=Object.assign({},opts),this.customBaseUrl=
1258
+ (_a2=opts.httpOptions)===null||_a2===void 0?void 0:_a2.baseUrl;let initHttpOptions={};if(this.clientOptions.vertexai){if(!this.clientOptions.location&&!this.clientOptions.apiKey&&!this.customBaseUrl&&(this.clientOptions.location="global"),!(this.clientOptions.project&&this.clientOptions.location||this.clientOptions.apiKey)&&!this.customBaseUrl)throw new Error("Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.");let hasConstructorAuth=opts.
1259
+ project&&opts.location||!!opts.apiKey;this.customBaseUrl&&!hasConstructorAuth?(initHttpOptions.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0):this.clientOptions.apiKey&&!this.clientOptions.project||this.clientOptions.location==="global"?initHttpOptions.baseUrl="https://aiplatform.googleapis.com/":this.clientOptions.project&&this.clientOptions.location&&MULTI_REGIONAL_LOCATIONS.has(this.clientOptions.location)?initHttpOptions.baseUrl=`https://aipl\
1260
+ atform.${this.clientOptions.location}.rep.googleapis.com/`:this.clientOptions.project&&this.clientOptions.location&&(initHttpOptions.baseUrl=`https://${this.clientOptions.location}-aiplatform.googleapis.com/`),initHttpOptions.apiVersion=(_b=this.clientOptions.apiVersion)!==null&&_b!==void 0?_b:VERTEX_AI_API_DEFAULT_VERSION}else this.clientOptions.apiKey||console.warn("API key should be set when using the Gemini API."),initHttpOptions.apiVersion=(_c=this.clientOptions.apiVersion)!==null&&_c!==void 0?
1261
+ _c:GOOGLE_AI_API_DEFAULT_VERSION,initHttpOptions.baseUrl="https://generativelanguage.googleapis.com/";initHttpOptions.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=initHttpOptions,opts.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(initHttpOptions,opts.httpOptions))}isVertexAI(){var _a2;return(_a2=this.clientOptions.vertexai)!==null&&_a2!==void 0?_a2:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getCustomBaseUrl(){
1262
+ return this.customBaseUrl}async getAuthHeaders(){let headers=new Headers;return await this.clientOptions.auth.addAuthHeaders(headers),headers}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw new Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw new Error("Base \
1263
+ URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;throw new Error("Headers are not set.")}getFetch(){var _a2;return(_a2=this.clientOptions.httpOptions)===null||_a2===void 0?void 0:_a2.fetch}getTimeout(){var _a2;return(_a2=this.clientOptions.httpOptions)===null||_a2===void 0?void 0:_a2.timeout}getRequestUrlInternal(httpOptions){
1264
+ if(!httpOptions||httpOptions.baseUrl===void 0||httpOptions.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");let urlElement=[httpOptions.baseUrl.endsWith("/")?httpOptions.baseUrl.slice(0,-1):httpOptions.baseUrl];return httpOptions.apiVersion&&httpOptions.apiVersion!==""&&urlElement.push(httpOptions.apiVersion),urlElement.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.
1265
+ apiKey}getWebsocketBaseUrl(){let baseUrl=this.getBaseUrl(),urlParts=new URL(baseUrl);return urlParts.protocol=urlParts.protocol=="http:"?"ws":"wss",urlParts.toString()}setBaseUrl(url){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=url;else throw new Error("HTTP options are not correctly set.")}constructUrl(path2,httpOptions,prependProjectLocation){let urlElement=[this.getRequestUrlInternal(httpOptions)];return prependProjectLocation&&urlElement.push(this.getBaseResourcePath()),
1266
+ path2!==""&&urlElement.push(path2),new URL(`${urlElement.join("/")}`)}shouldPrependVertexProjectPath(request,httpOptions){return!(httpOptions.baseUrl&&httpOptions.baseUrlResourceScope===ResourceScope.COLLECTION||!this.clientOptions.vertexai||!this.clientOptions.project||!this.clientOptions.location||request.path.startsWith("projects/")||request.httpMethod==="GET"&&request.path.startsWith("publishers/google/models"))}async request(request){let patchedHttpOptions=this.clientOptions.httpOptions;request.
1267
+ httpOptions&&(patchedHttpOptions=this.patchHttpOptions(this.clientOptions.httpOptions,request.httpOptions));let prependProjectLocation=this.shouldPrependVertexProjectPath(request,patchedHttpOptions),url=this.constructUrl(request.path,patchedHttpOptions,prependProjectLocation);if(request.queryParams)for(let[key,value]of Object.entries(request.queryParams))url.searchParams.append(key,String(value));let requestInit={};if(request.httpMethod==="GET"){if(request.body&&request.body!=="{}")throw new Error(
1268
+ "Request body should be empty for GET request, but got non empty request body")}else requestInit.body=request.body;return requestInit=await this.includeExtraHttpOptionsToRequestInit(requestInit,patchedHttpOptions,url.toString()),this.unaryApiCall(url,requestInit,request.httpMethod,patchedHttpOptions.retryOptions,patchedHttpOptions.timeout,request.abortSignal,patchedHttpOptions.fetch)}patchHttpOptions(baseHttpOptions,requestHttpOptions){let patchedHttpOptions=JSON.parse(JSON.stringify(baseHttpOptions));
1269
+ baseHttpOptions.fetch&&(patchedHttpOptions.fetch=baseHttpOptions.fetch);for(let[key,value]of Object.entries(requestHttpOptions))typeof value=="object"?patchedHttpOptions[key]=Object.assign(Object.assign({},patchedHttpOptions[key]),value):value!==void 0&&(patchedHttpOptions[key]=value);return patchedHttpOptions}async requestStream(request){let patchedHttpOptions=this.clientOptions.httpOptions;request.httpOptions&&(patchedHttpOptions=this.patchHttpOptions(this.clientOptions.httpOptions,request.httpOptions));
1270
+ let prependProjectLocation=this.shouldPrependVertexProjectPath(request,patchedHttpOptions),url=this.constructUrl(request.path,patchedHttpOptions,prependProjectLocation);(!url.searchParams.has("alt")||url.searchParams.get("alt")!=="sse")&&url.searchParams.set("alt","sse");let requestInit={};return requestInit.body=request.body,requestInit=await this.includeExtraHttpOptionsToRequestInit(requestInit,patchedHttpOptions,url.toString()),this.streamApiCall(url,requestInit,request.httpMethod,patchedHttpOptions.
1271
+ retryOptions,patchedHttpOptions.timeout,request.abortSignal,patchedHttpOptions.fetch)}async includeExtraHttpOptionsToRequestInit(requestInit,httpOptions,url){return isNodeRuntime$1()&&!httpOptions?.fetch&&!("dispatcher"in requestInit)&&(requestInit.dispatcher=createUndiciNoTimeoutDispatcher$1()),httpOptions&&httpOptions.extraBody!==null&&includeExtraBodyToRequestInit(requestInit,httpOptions.extraBody),requestInit.headers=await this.getHeadersInternal(httpOptions,url),requestInit}async unaryApiCall(url,requestInit,httpMethod,retryOptions,timeout,abortSignal,fetchFn){
1272
+ return this.apiCall(url.toString(),Object.assign(Object.assign({},requestInit),{method:httpMethod}),retryOptions,timeout,abortSignal,fetchFn).then(async response=>(await throwErrorIfNotOK(response),new HttpResponse(response))).catch(e=>{throw e instanceof Error?e:new Error(`exception ${e} sending request`,{cause:e})})}async streamApiCall(url,requestInit,httpMethod,retryOptions,timeout,abortSignal,fetchFn){return this.apiCall(url.toString(),Object.assign(Object.assign({},requestInit),{method:httpMethod}),
1273
+ retryOptions,timeout,abortSignal,fetchFn).then(async response=>(await throwErrorIfNotOK(response),this.processStreamResponse(response))).catch(e=>{throw e instanceof Error?e:new Error(`exception ${e} sending request`,{cause:e})})}processStreamResponse(response){return __asyncGenerator(this,arguments,function*(){var _a2;let reader=(_a2=response?.body)===null||_a2===void 0?void 0:_a2.getReader(),decoder=new TextDecoder("utf-8");if(!reader)throw new Error("Response body is empty");try{let buffer="",
1274
+ dataPrefix="data:",delimiters=[`
1285
1275
 
1286
1276
  `,"\r\r",`\r
1287
1277
  \r
1288
- `];for(;;){let{done,value}=yield __await(reader.read());if(done){if(buffer.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}let chunkString=decoder.decode(value,{stream:!0});try{let chunkJson=JSON.parse(chunkString);if("error"in chunkJson){let errorJson=JSON.parse(JSON.stringify(chunkJson.error)),status=errorJson.status,code=errorJson.code,errorMessage=`got status: ${status}. ${JSON.stringify(chunkJson)}`;if(code>=400&&code<600)throw new ApiError({message:errorMessage,
1289
- status:code})}}catch(e){if(e.name==="ApiError")throw e}buffer+=chunkString;let delimiterIndex=-1,delimiterLength=0;for(;;){delimiterIndex=-1,delimiterLength=0;for(let delimiter of delimiters){let index=buffer.indexOf(delimiter);index!==-1&&(delimiterIndex===-1||index<delimiterIndex)&&(delimiterIndex=index,delimiterLength=delimiter.length)}if(delimiterIndex===-1)break;let eventString=buffer.substring(0,delimiterIndex);buffer=buffer.substring(delimiterIndex+delimiterLength);let trimmedEvent=eventString.
1290
- trim();if(trimmedEvent.startsWith(dataPrefix)){let processedChunkString=trimmedEvent.substring(dataPrefix.length).trim();try{let partialResponse=new Response(processedChunkString,{headers:response?.headers,status:response?.status,statusText:response?.statusText});yield yield __await(new HttpResponse(partialResponse))}catch(e){throw new Error(`exception parsing stream chunk ${processedChunkString}. ${e}`)}}}}}finally{reader.releaseLock()}})}async apiCall(url,requestInit,retryOptions,timeout,abortSignal,fetchFn){
1291
- var _a2,_b,_c,_d,_e,_f;let fetchFunc=fetchFn??fetch,retryableStatusCodes=(_a2=retryOptions?.httpStatusCodes)!==null&&_a2!==void 0?_a2:DEFAULT_RETRY_HTTP_STATUS_CODES,runFetch=async()=>{let attempt=createAttemptSignal(timeout,abortSignal),response;try{response=await fetchFunc(url,Object.assign(Object.assign({},requestInit),{signal:attempt.signal}))}catch(e){throw attempt.dispose(),e}if(!retryOptions||response.ok||!retryableStatusCodes.includes(response.status))return response;try{await throwErrorIfNotOK(
1292
- response)}finally{attempt.dispose()}return response};if(!retryOptions)return runFetch();let attempts=Math.max(1,(_b=retryOptions.attempts)!==null&&_b!==void 0?_b:DEFAULT_RETRY_ATTEMPTS),minTimeout=Math.round(((_c=retryOptions.initialDelay)!==null&&_c!==void 0?_c:DEFAULT_RETRY_INITIAL_DELAY)*1e3),maxTimeout=Math.max(minTimeout,Math.round(((_d=retryOptions.maxDelay)!==null&&_d!==void 0?_d:DEFAULT_RETRY_MAX_DELAY)*1e3));return(0,import_p_retry.default)(runFetch,{retries:attempts-1,factor:(_e=retryOptions.
1293
- expBase)!==null&&_e!==void 0?_e:DEFAULT_RETRY_EXP_BASE,minTimeout,maxTimeout,randomize:((_f=retryOptions.jitter)!==null&&_f!==void 0?_f:DEFAULT_RETRY_JITTER)>0,onFailedAttempt:info=>{var _a3;if(abortSignal?.aborted)throw(_a3=info.error)!==null&&_a3!==void 0?_a3:info}})}getDefaultHeaders(){let headers={},versionHeaderValue=LIBRARY_LABEL+" "+this.clientOptions.userAgentExtra;return headers[USER_AGENT_HEADER]=versionHeaderValue,headers[GOOGLE_API_CLIENT_HEADER]=versionHeaderValue,headers[CONTENT_TYPE_HEADER]=
1294
- "application/json",headers}async getHeadersInternal(httpOptions,url){let headers=new Headers;if(httpOptions&&httpOptions.headers)for(let[key,value]of Object.entries(httpOptions.headers))headers.append(key,value);return httpOptions?.timeout&&httpOptions.timeout>0&&headers.append(SERVER_TIMEOUT_HEADER,String(Math.ceil(httpOptions.timeout/1e3))),await this.clientOptions.auth.addAuthHeaders(headers,url),headers}getFileName(file){var _a2;let fileName="";return typeof file=="string"&&(fileName=file.replace(
1295
- /[/\\]+$/,""),fileName=(_a2=fileName.split(/[/\\]/).pop())!==null&&_a2!==void 0?_a2:""),fileName}async uploadFile(file,config){var _a2;let fileToUpload={};config!=null&&(fileToUpload.mimeType=config.mimeType,fileToUpload.name=config.name,fileToUpload.displayName=config.displayName),fileToUpload.name&&!fileToUpload.name.startsWith("files/")&&(fileToUpload.name=`files/${fileToUpload.name}`);let uploader=this.clientOptions.uploader,fileStat=await uploader.stat(file);fileToUpload.sizeBytes=String(fileStat.
1296
- size);let mimeType=(_a2=config?.mimeType)!==null&&_a2!==void 0?_a2:fileStat.type;if(mimeType===void 0||mimeType==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");fileToUpload.mimeType=mimeType;let body={file:fileToUpload},fileName=this.getFileName(file),path2=formatMap("upload/v1beta/files",body._url),uploadUrl=await this.fetchUploadUrl(path2,fileToUpload.sizeBytes,fileToUpload.mimeType,fileName,body,config?.httpOptions);return uploader.upload(file,uploadUrl,
1297
- this)}async uploadFileToFileSearchStore(fileSearchStoreName,file,config){var _a2;let uploader=this.clientOptions.uploader,fileStat=await uploader.stat(file),sizeBytes=String(fileStat.size),mimeType=(_a2=config?.mimeType)!==null&&_a2!==void 0?_a2:fileStat.type;if(mimeType===void 0||mimeType==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");let path2=`upload/v1beta/${fileSearchStoreName}:uploadToFileSearchStore`,fileName=this.getFileName(file),body={};config!=
1298
- null&&uploadToFileSearchStoreConfigToMldev(config,body);let uploadUrl=await this.fetchUploadUrl(path2,sizeBytes,mimeType,fileName,body,config?.httpOptions);return uploader.uploadToFileSearchStore(file,uploadUrl,this)}async downloadFile(params){await this.clientOptions.downloader.download(params,this)}async fetchUploadUrl(path2,sizeBytes,mimeType,fileName,body,configHttpOptions){var _a2;let httpOptions={};configHttpOptions?httpOptions=configHttpOptions:httpOptions={apiVersion:"",headers:Object.assign(
1299
- {"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${sizeBytes}`,"X-Goog-Upload-Header-Content-Type":`${mimeType}`},fileName?{"X-Goog-Upload-File-Name":fileName}:{})};let httpResponse=await this.request({path:path2,body:JSON.stringify(body),httpMethod:"POST",httpOptions});if(!httpResponse||!httpResponse?.headers)throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not ha\
1300
- ve headers.");let uploadUrl=(_a2=httpResponse?.headers)===null||_a2===void 0?void 0:_a2["x-goog-upload-url"];if(uploadUrl===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return uploadUrl}};async function throwErrorIfNotOK(response){var _a2;if(response===void 0)throw new Error("response is undefined");if(!response.ok){let status=response.status,errorBody;!((_a2=response.headers.get("content-type"))===null||_a2===void 0)&&_a2.includes(
1301
- "application/json")?errorBody=await response.json():errorBody={error:{message:await response.text(),code:response.status,status:response.statusText}};let errorMessage=JSON.stringify(errorBody);throw status>=400&&status<600?new ApiError({message:errorMessage,status}):new Error(errorMessage)}}function includeExtraBodyToRequestInit(requestInit,extraBody){if(!extraBody||Object.keys(extraBody).length===0)return;if(requestInit.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBod\
1302
- y provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let currentBodyObject={};if(typeof requestInit.body=="string"&&requestInit.body.length>0)try{let parsedBody=JSON.parse(requestInit.body);if(typeof parsedBody=="object"&&parsedBody!==null&&!Array.isArray(parsedBody))currentBodyObject=parsedBody;else{console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying e\
1303
- xtraBody to the request body.");return}}catch{console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function deepMerge(target,source){let output=Object.assign({},target);for(let key in source)if(Object.prototype.hasOwnProperty.call(source,key)){let sourceValue=source[key],targetValue=output[key];sourceValue&&typeof sourceValue=="object"&&!Array.isArray(sourceValue)&&targetValue&&typeof targetValue=="object"&&!Array.
1304
- isArray(targetValue)?output[key]=deepMerge(targetValue,sourceValue):(targetValue&&sourceValue&&typeof targetValue!=typeof sourceValue&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${key}". Original type: ${typeof targetValue}, New type: ${typeof sourceValue}. Overwriting.`),output[key]=sourceValue)}return output}let mergedBody=deepMerge(currentBodyObject,extraBody);requestInit.body=JSON.stringify(mergedBody)}var MCP_LABEL="mcp_used/unknown",hasMcpToolUsageFromMcpToTool=!1;
1305
- function hasMcpToolUsage(tools){for(let tool of tools)if(isMcpCallableTool(tool)||typeof tool=="object"&&"inputSchema"in tool)return!0;return hasMcpToolUsageFromMcpToTool}function setMcpUsageHeader(headers){var _a2;let existingHeader=(_a2=headers[GOOGLE_API_CLIENT_HEADER])!==null&&_a2!==void 0?_a2:"";headers[GOOGLE_API_CLIENT_HEADER]=(existingHeader+` ${MCP_LABEL}`).trimStart()}function isMcpCallableTool(object){return object!==null&&typeof object=="object"&&object instanceof McpCallableTool}function listAllTools(mcpClient_1){
1306
- return __asyncGenerator(this,arguments,function*(mcpClient,maxTools=100){let cursor,numTools=0;for(;numTools<maxTools;){let t=yield __await(mcpClient.listTools({cursor}));for(let tool of t.tools)yield yield __await(tool),numTools++;if(!t.nextCursor)break;cursor=t.nextCursor}})}var McpCallableTool=class _McpCallableTool{constructor(mcpClients=[],config){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=mcpClients,this.config=config}static create(mcpClients,config){return new _McpCallableTool(
1307
- mcpClients,config)}async initialize(){var _a2,e_1,_b,_c;if(this.mcpTools.length>0)return;let functionMap={},mcpTools=[];for(let mcpClient of this.mcpClients)try{for(var _d=!0,_e=(e_1=void 0,__asyncValues(listAllTools(mcpClient))),_f;_f=await _e.next(),_a2=_f.done,!_a2;_d=!0){_c=_f.value,_d=!1;let mcpTool=_c;mcpTools.push(mcpTool);let mcpToolName=mcpTool.name;if(functionMap[mcpToolName])throw new Error(`Duplicate function name ${mcpToolName} found in MCP tools. Please ensure function names are un\
1308
- ique.`);functionMap[mcpToolName]=mcpClient}}catch(e_1_1){e_1={error:e_1_1}}finally{try{!_d&&!_a2&&(_b=_e.return)&&await _b.call(_e)}finally{if(e_1)throw e_1.error}}this.mcpTools=mcpTools,this.functionNameToMcpClient=functionMap}async tool(){return await this.initialize(),mcpToolsToGeminiTool(this.mcpTools,this.config)}async callTool(functionCalls){await this.initialize();let functionCallResponseParts=[];for(let functionCall of functionCalls)if(functionCall.name in this.functionNameToMcpClient){let mcpClient=this.
1309
- functionNameToMcpClient[functionCall.name],requestOptions;this.config.timeout&&(requestOptions={timeout:this.config.timeout});let callToolResponse=await mcpClient.callTool({name:functionCall.name,arguments:functionCall.args},void 0,requestOptions);functionCallResponseParts.push({functionResponse:{name:functionCall.name,response:callToolResponse.isError?{error:callToolResponse}:callToolResponse}})}return functionCallResponseParts}};async function handleWebSocketMessage$1(apiClient,onmessage,event){let serverMessage=new LiveMusicServerMessage,data;event.data instanceof Blob?data=JSON.parse(await event.data.text()):data=JSON.parse(event.data),Object.assign(serverMessage,data),onmessage(serverMessage)}var LiveMusic=class{constructor(apiClient,auth,webSocketFactory){this.apiClient=apiClient,this.auth=auth,this.webSocketFactory=webSocketFactory}async connect(params){var _a2,_b;if(this.apiClient.isVertexAI())throw new Error("Liv\
1278
+ `];for(;;){let{done,value}=yield __await(reader.read());if(done){if(buffer.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}let chunkString=decoder.decode(value,{stream:!0});throwIfStreamErrorChunk(chunkString),buffer+=chunkString;let delimiterIndex=-1,delimiterLength=0;for(;;){delimiterIndex=-1,delimiterLength=0;for(let delimiter of delimiters){let index=buffer.indexOf(delimiter);index!==-1&&(delimiterIndex===-1||index<delimiterIndex)&&(delimiterIndex=index,delimiterLength=
1279
+ delimiter.length)}if(delimiterIndex===-1)break;let eventString=buffer.substring(0,delimiterIndex);buffer=buffer.substring(delimiterIndex+delimiterLength);let trimmedEvent=eventString.trim();if(trimmedEvent.startsWith(dataPrefix)){let processedChunkString=trimmedEvent.substring(dataPrefix.length).trim();throwIfStreamErrorChunk(processedChunkString);try{let partialResponse=new Response(processedChunkString,{headers:response?.headers,status:response?.status,statusText:response?.statusText});yield yield __await(
1280
+ new HttpResponse(partialResponse))}catch(e){throw new Error(`exception parsing stream chunk ${processedChunkString}. ${e}`)}}}}}finally{reader.releaseLock()}})}async apiCall(url,requestInit,retryOptions,timeout,abortSignal,fetchFn){var _a2,_b,_c,_d,_e,_f;let fetchFunc=fetchFn??fetch,retryableStatusCodes=(_a2=retryOptions?.httpStatusCodes)!==null&&_a2!==void 0?_a2:DEFAULT_RETRY_HTTP_STATUS_CODES,runFetch=async()=>{let attempt=createAttemptSignal(timeout,abortSignal),response;try{response=await fetchFunc(
1281
+ url,Object.assign(Object.assign({},requestInit),{signal:attempt.signal}))}catch(e){throw attempt.dispose(),e}if(!retryOptions||response.ok||!retryableStatusCodes.includes(response.status))return response;try{await throwErrorIfNotOK(response)}finally{attempt.dispose()}return response};if(!retryOptions)return runFetch();let attempts=Math.max(1,(_b=retryOptions.attempts)!==null&&_b!==void 0?_b:DEFAULT_RETRY_ATTEMPTS),minTimeout=Math.round(((_c=retryOptions.initialDelay)!==null&&_c!==void 0?_c:DEFAULT_RETRY_INITIAL_DELAY)*
1282
+ 1e3),maxTimeout=Math.max(minTimeout,Math.round(((_d=retryOptions.maxDelay)!==null&&_d!==void 0?_d:DEFAULT_RETRY_MAX_DELAY)*1e3));return(0,import_p_retry.default)(runFetch,{retries:attempts-1,factor:(_e=retryOptions.expBase)!==null&&_e!==void 0?_e:DEFAULT_RETRY_EXP_BASE,minTimeout,maxTimeout,randomize:((_f=retryOptions.jitter)!==null&&_f!==void 0?_f:DEFAULT_RETRY_JITTER)>0,onFailedAttempt:info=>{var _a3;if(abortSignal?.aborted)throw(_a3=info.error)!==null&&_a3!==void 0?_a3:info}})}getDefaultHeaders(){
1283
+ let headers={},versionHeaderValue=LIBRARY_LABEL+" "+this.clientOptions.userAgentExtra;return headers[USER_AGENT_HEADER]=versionHeaderValue,headers[GOOGLE_API_CLIENT_HEADER]=versionHeaderValue,headers[CONTENT_TYPE_HEADER]="application/json",headers}async getHeadersInternal(httpOptions,url){let headers=new Headers;if(httpOptions&&httpOptions.headers)for(let[key,value]of Object.entries(httpOptions.headers))headers.append(key,value);return httpOptions?.timeout&&httpOptions.timeout>0&&headers.append(
1284
+ SERVER_TIMEOUT_HEADER,String(Math.ceil(httpOptions.timeout/1e3))),await this.clientOptions.auth.addAuthHeaders(headers,url),headers}getFileName(file){var _a2;let fileName="";return typeof file=="string"&&(fileName=file.replace(/[/\\]+$/,""),fileName=(_a2=fileName.split(/[/\\]/).pop())!==null&&_a2!==void 0?_a2:""),fileName}async uploadFile(file,config){var _a2;let fileToUpload={};config!=null&&(fileToUpload.mimeType=config.mimeType,fileToUpload.name=config.name,fileToUpload.displayName=config.displayName),
1285
+ fileToUpload.name&&!fileToUpload.name.startsWith("files/")&&(fileToUpload.name=`files/${fileToUpload.name}`);let uploader=this.clientOptions.uploader,fileStat=await uploader.stat(file);fileToUpload.sizeBytes=String(fileStat.size);let mimeType=(_a2=config?.mimeType)!==null&&_a2!==void 0?_a2:fileStat.type;if(mimeType===void 0||mimeType==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");fileToUpload.mimeType=mimeType;let body={file:fileToUpload},fileName=this.
1286
+ getFileName(file),path2=formatMap("upload/v1beta/files",body._url),uploadUrl=await this.fetchUploadUrl(path2,fileToUpload.sizeBytes,fileToUpload.mimeType,fileName,body,config?.httpOptions);return uploader.upload(file,uploadUrl,this)}async uploadFileToFileSearchStore(fileSearchStoreName,file,config){var _a2;let uploader=this.clientOptions.uploader,fileStat=await uploader.stat(file),sizeBytes=String(fileStat.size),mimeType=(_a2=config?.mimeType)!==null&&_a2!==void 0?_a2:fileStat.type;if(mimeType===
1287
+ void 0||mimeType==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");let path2=`upload/v1beta/${fileSearchStoreName}:uploadToFileSearchStore`,fileName=this.getFileName(file),body={};config!=null&&uploadToFileSearchStoreConfigToMldev(config,body);let uploadUrl=await this.fetchUploadUrl(path2,sizeBytes,mimeType,fileName,body,config?.httpOptions);return uploader.uploadToFileSearchStore(file,uploadUrl,this)}async downloadFile(params){await this.clientOptions.downloader.
1288
+ download(params,this)}async fetchUploadUrl(path2,sizeBytes,mimeType,fileName,body,configHttpOptions){var _a2;let httpOptions={};configHttpOptions?httpOptions=configHttpOptions:httpOptions={apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${sizeBytes}`,"X-Goog-Upload-Header-Content-Type":`${mimeType}`},fileName?{"X-Goog-Upload-File-Name":fileName}:{})};let httpResponse=await this.
1289
+ request({path:path2,body:JSON.stringify(body),httpMethod:"POST",httpOptions});if(!httpResponse||!httpResponse?.headers)throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");let uploadUrl=(_a2=httpResponse?.headers)===null||_a2===void 0?void 0:_a2["x-goog-upload-url"];if(uploadUrl===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return uploadUrl}};function throwIfStreamErrorChunk(chunkString){
1290
+ try{let chunkJson=JSON.parse(chunkString);if(chunkJson!==null&&typeof chunkJson=="object"&&"error"in chunkJson&&chunkJson.error!==null&&typeof chunkJson.error=="object"){let errorJson=chunkJson.error,status=errorJson.status,code=errorJson.code,errorMessage=`got status: ${status}. ${JSON.stringify(chunkJson)}`;if(typeof code=="number"&&code>=400&&code<600)throw new ApiError({message:errorMessage,status:code})}}catch(e){let error=e;if(error?.name==="ApiError")throw e}}async function throwErrorIfNotOK(response){
1291
+ var _a2;if(response===void 0)throw new Error("response is undefined");if(!response.ok){let status=response.status,errorBody;!((_a2=response.headers.get("content-type"))===null||_a2===void 0)&&_a2.includes("application/json")?errorBody=await response.json():errorBody={error:{message:await response.text(),code:response.status,status:response.statusText}};let errorMessage=JSON.stringify(errorBody);throw status>=400&&status<600?new ApiError({message:errorMessage,status}):new Error(errorMessage)}}function includeExtraBodyToRequestInit(requestInit,extraBody){
1292
+ if(!extraBody||Object.keys(extraBody).length===0)return;if(requestInit.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let currentBodyObject={};if(typeof requestInit.body=="string"&&requestInit.body.length>0)try{let parsedBody=JSON.parse(requestInit.body);if(typeof parsedBody=="object"&&parsedBody!==null&&!Array.isArray(parsedBody))currentBodyObject=
1293
+ parsedBody;else{console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying extraBody to the request body.");return}}catch{console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function deepMerge(target,source){let output=Object.assign({},target);for(let key in source)if(Object.prototype.hasOwnProperty.call(source,key)){let sourceValue=source[key],targetValue=output[key];
1294
+ sourceValue&&typeof sourceValue=="object"&&!Array.isArray(sourceValue)&&targetValue&&typeof targetValue=="object"&&!Array.isArray(targetValue)?output[key]=deepMerge(targetValue,sourceValue):(targetValue&&sourceValue&&typeof targetValue!=typeof sourceValue&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${key}". Original type: ${typeof targetValue}, New type: ${typeof sourceValue}. Overwriting.`),output[key]=sourceValue)}return output}let mergedBody=deepMerge(currentBodyObject,
1295
+ extraBody);requestInit.body=JSON.stringify(mergedBody)}var MCP_LABEL="mcp_used/unknown",hasMcpToolUsageFromMcpToTool=!1;function hasMcpToolUsage(tools){for(let tool of tools)if(isMcpCallableTool(tool)||typeof tool=="object"&&"inputSchema"in tool)return!0;return hasMcpToolUsageFromMcpToTool}function setMcpUsageHeader(headers){var _a2;let existingHeader=(_a2=headers[GOOGLE_API_CLIENT_HEADER])!==null&&_a2!==void 0?_a2:"";headers[GOOGLE_API_CLIENT_HEADER]=(existingHeader+` ${MCP_LABEL}`).trimStart()}
1296
+ function isMcpCallableTool(object){return object!==null&&typeof object=="object"&&object instanceof McpCallableTool}function listAllTools(mcpClient_1){return __asyncGenerator(this,arguments,function*(mcpClient,maxTools=100){let cursor,numTools=0;for(;numTools<maxTools;){let t=yield __await(mcpClient.listTools({cursor}));for(let tool of t.tools)yield yield __await(tool),numTools++;if(!t.nextCursor)break;cursor=t.nextCursor}})}var McpCallableTool=class _McpCallableTool{constructor(mcpClients=[],config){
1297
+ this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=mcpClients,this.config=config}static create(mcpClients,config){return new _McpCallableTool(mcpClients,config)}async initialize(){var _a2,e_1,_b,_c;if(this.mcpTools.length>0)return;let functionMap={},mcpTools=[];for(let mcpClient of this.mcpClients)try{for(var _d=!0,_e=(e_1=void 0,__asyncValues(listAllTools(mcpClient))),_f;_f=await _e.next(),_a2=_f.done,!_a2;_d=!0){_c=_f.value,_d=!1;let mcpTool=_c;mcpTools.push(mcpTool);let mcpToolName=mcpTool.
1298
+ name;if(functionMap[mcpToolName])throw new Error(`Duplicate function name ${mcpToolName} found in MCP tools. Please ensure function names are unique.`);functionMap[mcpToolName]=mcpClient}}catch(e_1_1){e_1={error:e_1_1}}finally{try{!_d&&!_a2&&(_b=_e.return)&&await _b.call(_e)}finally{if(e_1)throw e_1.error}}this.mcpTools=mcpTools,this.functionNameToMcpClient=functionMap}async tool(){return await this.initialize(),mcpToolsToGeminiTool(this.mcpTools,this.config)}async callTool(functionCalls){await this.
1299
+ initialize();let functionCallResponseParts=[];for(let functionCall of functionCalls)if(functionCall.name in this.functionNameToMcpClient){let mcpClient=this.functionNameToMcpClient[functionCall.name],requestOptions;this.config.timeout&&(requestOptions={timeout:this.config.timeout});let callToolResponse=await mcpClient.callTool({name:functionCall.name,arguments:functionCall.args},void 0,requestOptions);functionCallResponseParts.push({functionResponse:{name:functionCall.name,response:callToolResponse.
1300
+ isError?{error:callToolResponse}:callToolResponse}})}return functionCallResponseParts}};async function handleWebSocketMessage$1(apiClient,onmessage,event){let serverMessage=new LiveMusicServerMessage,data;event.data instanceof Blob?data=JSON.parse(await event.data.text()):data=JSON.parse(event.data),Object.assign(serverMessage,data),onmessage(serverMessage)}var LiveMusic=class{constructor(apiClient,auth,webSocketFactory){this.apiClient=apiClient,this.auth=auth,this.webSocketFactory=webSocketFactory}async connect(params){var _a2,_b;if(this.apiClient.isVertexAI())throw new Error("Liv\
1310
1301
  e music is not supported for Vertex AI.");console.warn("Live music generation is experimental and may change in future versions.");let websocketBaseUrl=this.apiClient.getWebsocketBaseUrl(),apiVersion=this.apiClient.getApiVersion(),headers=mapToHeaders$1(this.apiClient.getDefaultHeaders()),apiKey=this.apiClient.getApiKey(),url=`${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.BidiGenerateMusic?key=${apiKey}`,onopenResolve=()=>{},onopenPromise=new Promise(resolve=>{
1311
1302
  onopenResolve=resolve}),callbacks=params.callbacks,onopenAwaitedCallback=function(){onopenResolve({})},apiClient=this.apiClient,websocketCallbacks={onopen:onopenAwaitedCallback,onmessage:event=>{handleWebSocketMessage$1(apiClient,callbacks.onmessage,event)},onerror:(_a2=callbacks?.onerror)!==null&&_a2!==void 0?_a2:function(e){},onclose:(_b=callbacks?.onclose)!==null&&_b!==void 0?_b:function(e){}},conn=this.webSocketFactory.create(url,headersToMap$1(headers),websocketCallbacks);conn.connect(),await onopenPromise;
1312
1303
  let clientMessage={setup:{model:tModel(this.apiClient,params.model)}};return conn.send(JSON.stringify(clientMessage)),new LiveMusicSession(conn,this.apiClient)}},LiveMusicSession=class{constructor(conn,apiClient){this.conn=conn,this.apiClient=apiClient}async setWeightedPrompts(params){if(!params.weightedPrompts||Object.keys(params.weightedPrompts).length===0)throw new Error("Weighted prompts must be set and contain at least one entry.");let clientContent=liveMusicSetWeightedPromptsParametersToMldev(
@@ -1326,245 +1317,246 @@ Tool"in tool&&typeof tool.callTool=="function"}},defaultLiveSendClientContentPar
1326
1317
  return{clientContent:{turns:contents,turnComplete:params.turnComplete}}}return{clientContent:{turnComplete:params.turnComplete}}}tLiveClienttToolResponse(apiClient,params){let functionResponses=[];if(params.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(params.functionResponses)?functionResponses=params.functionResponses:functionResponses=[params.functionResponses],functionResponses.length===0)throw new Error("functionResponses is required.");for(let functionResponse of functionResponses){
1327
1318
  if(typeof functionResponse!="object"||functionResponse===null||!("name"in functionResponse)||!("response"in functionResponse))throw new Error(`Could not parse function response, type '${typeof functionResponse}'.`);if(!apiClient.isVertexAI()&&!("id"in functionResponse))throw new Error(FUNCTION_RESPONSE_REQUIRES_ID)}return{toolResponse:{functionResponses}}}sendClientContent(params){params=Object.assign(Object.assign({},defaultLiveSendClientContentParamerters),params);let clientMessage=this.tLiveClientContent(
1328
1319
  this.apiClient,params);this.conn.send(JSON.stringify(clientMessage))}sendRealtimeInput(params){let clientMessage={};this.apiClient.isVertexAI()?clientMessage={realtimeInput:liveSendRealtimeInputParametersToVertex(params)}:clientMessage={realtimeInput:liveSendRealtimeInputParametersToMldev(params)},this.conn.send(JSON.stringify(clientMessage))}sendToolResponse(params){if(params.functionResponses==null)throw new Error("Tool response parameters are required.");let clientMessage=this.tLiveClienttToolResponse(
1329
- this.apiClient,params);this.conn.send(JSON.stringify(clientMessage))}close(){this.conn.close()}};function headersToMap(headers){let headerMap={};return headers.forEach((value,key)=>{headerMap[key]=value}),headerMap}function mapToHeaders(map){let headers=new Headers;for(let[key,value]of Object.entries(map))headers.append(key,value);return headers}var DEFAULT_MAX_REMOTE_CALLS=10;function shouldDisableAfc(config){var _a2,_b,_c;if(!((_a2=config?.automaticFunctionCalling)===null||_a2===void 0)&&_a2.disable)
1330
- return!0;let callableToolsPresent=!1;for(let tool of(_b=config?.tools)!==null&&_b!==void 0?_b:[])if(isCallableTool(tool)){callableToolsPresent=!0;break}if(!callableToolsPresent)return!0;let maxCalls=(_c=config?.automaticFunctionCalling)===null||_c===void 0?void 0:_c.maximumRemoteCalls;return maxCalls&&(maxCalls<0||!Number.isInteger(maxCalls))||maxCalls==0?(console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a\
1331
- valid integer value greater than 0. maximumRemoteCalls provided:",maxCalls),!0):!1}function isCallableTool(tool){return"callTool"in tool&&typeof tool.callTool=="function"}function hasCallableTools(params){var _a2,_b,_c;return(_c=(_b=(_a2=params.config)===null||_a2===void 0?void 0:_a2.tools)===null||_b===void 0?void 0:_b.some(tool=>isCallableTool(tool)))!==null&&_c!==void 0?_c:!1}function findAfcIncompatibleToolIndexes(params){var _a2;let afcIncompatibleToolIndexes=[];return!((_a2=params?.config)===
1332
- null||_a2===void 0)&&_a2.tools&&params.config.tools.forEach((tool,index)=>{if(isCallableTool(tool))return;let geminiTool=tool;geminiTool.functionDeclarations&&geminiTool.functionDeclarations.length>0&&afcIncompatibleToolIndexes.push(index)}),afcIncompatibleToolIndexes}function shouldAppendAfcHistory(config){var _a2;return!(!((_a2=config?.automaticFunctionCalling)===null||_a2===void 0)&&_a2.ignoreCallHistory)}function shouldEnableAutomaticContinuation(config,defaultEnabled=!0){return!config||config.
1333
- automaticContinuation===void 0||config.automaticContinuation===null?defaultEnabled:!!config.automaticContinuation}function isResumableFinishReason(finishReason){return finishReason===void 0||finishReason===FinishReason.CONTINUATION}function canResumeStream(enableContinuation,continuationToken,finishReason,hasPromptFeedback=!1){return enableContinuation&&!hasPromptFeedback&&!!continuationToken&&isResumableFinishReason(finishReason)}var MAX_STREAM_RECONNECTS_WITHOUT_PROGRESS=3;function clearIntermediateFinishReason(chunk,enableContinuation,continuationToken){
1334
- var _a2;let firstCandidate=(_a2=chunk.candidates)===null||_a2===void 0?void 0:_a2[0];firstCandidate?.finishReason!==void 0&&canResumeStream(enableContinuation,continuationToken,firstCandidate.finishReason)&&(firstCandidate.finishReason=void 0)}function isStreamAborted(err,config){var _a2;return!!(!((_a2=config?.abortSignal)===null||_a2===void 0)&&_a2.aborted)||err instanceof Error&&err.name==="AbortError"}var StreamContinuation=class{constructor(config){this.config=config,this.reconnectsWithoutProgress=
1335
- 0,this.hop=newStreamHop(void 0),this.enableContinuation=shouldEnableAutomaticContinuation(config,!0)}startHop(){return this.hop=newStreamHop(this.resumeToken),prepareContinuationConfig(this.config,this.resumeToken)}observe(chunk){var _a2,_b;let hop=this.hop;if(hop.receivedAnyChunk=!0,chunk.promptFeedback!==void 0&&chunk.promptFeedback!==null&&(hop.hasPromptFeedback=!0),chunk.usageMetadata)if(this.accumulatedUsageAcrossHops){let mergedUsage=mergeUsageMetadata(this.accumulatedUsageAcrossHops,chunk.
1336
- usageMetadata);chunk=Object.assign(new GenerateContentResponse,chunk,{usageMetadata:mergedUsage}),hop.usage=mergedUsage}else attachInitialPromptTokenCount(chunk.usageMetadata),hop.usage=chunk.usageMetadata;let firstCandidate=(_a2=chunk.candidates)===null||_a2===void 0?void 0:_a2[0];return firstCandidate&&(!((_b=firstCandidate.content)===null||_b===void 0)&&_b.parts&&firstCandidate.content.parts.length>0&&(hop.hasYieldedContent=!0),firstCandidate.finishReason!==void 0&&(hop.finishReason=firstCandidate.
1337
- finishReason),firstCandidate.continuationToken?hop.token=firstCandidate.continuationToken:firstCandidate.finishReason!==void 0&&!isResumableFinishReason(firstCandidate.finishReason)&&(hop.token=void 0),clearIntermediateFinishReason(chunk,this.enableContinuation,hop.token)),chunk}endHop(hopError){let hop=this.hop;if(hop.usage&&(this.accumulatedUsageAcrossHops=hop.usage),hopError&&(isStreamAborted(hopError.error,this.config)||hopError.error instanceof ApiError&&!hop.receivedAnyChunk))throw hopError.
1338
- error;let madeProgress=hop.hasYieldedContent||!!hop.token&&hop.token!==hop.startToken;if(hopError?this.lastError=hopError:madeProgress&&(this.lastError=void 0),[this.resumeToken,this.reconnectsWithoutProgress]=this.nextResumeToken(),canResumeStream(this.enableContinuation,this.resumeToken,hop.finishReason,hop.hasPromptFeedback))return!0;if(hopError)throw hopError.error;if(hop.finishReason===void 0&&!hop.hasPromptFeedback&&this.lastError)throw this.lastError.error;return!1}nextResumeToken(){let hop=this.
1339
- hop,reconnects=this.reconnectsWithoutProgress;return hop.finishReason!==void 0||hop.hasPromptFeedback?hop.finishReason===FinishReason.CONTINUATION&&!hop.hasPromptFeedback&&hop.token&&hop.token!==hop.startToken?[hop.token,0]:[void 0,0]:hop.token&&hop.token!==hop.startToken?[hop.token,0]:hop.hasYieldedContent||reconnects>=MAX_STREAM_RECONNECTS_WITHOUT_PROGRESS?[void 0,reconnects]:[hop.startToken,reconnects+1]}};function newStreamHop(startToken){return{startToken,hasPromptFeedback:!1,hasYieldedContent:!1,
1340
- receivedAnyChunk:!1}}function shouldContinueGeneration(response){var _a2;let candidate=(_a2=response?.candidates)===null||_a2===void 0?void 0:_a2[0];if(candidate?.continuationToken&&isResumableFinishReason(candidate.finishReason))return candidate.continuationToken}function prepareContinuationConfig(baseConfig,continuationToken,clearAutomaticContinuation=!1){let hasAutoCont=baseConfig?.automaticContinuation!==void 0&&baseConfig?.automaticContinuation!==null,needClearAutoCont=clearAutomaticContinuation&&
1341
- hasAutoCont;if(!continuationToken&&!needClearAutoCont)return baseConfig;if(!baseConfig)return continuationToken?{continuationToken}:void 0;let copied=Object.assign({},baseConfig);return continuationToken&&(copied.continuationToken=continuationToken),needClearAutoCont&&delete copied.automaticContinuation,copied}function mergeModalityTokenCounts(prevList,currList){var _a2,_b;let countsByModality=new Map,order=[];for(let item of[...prevList,...currList]){let modality=item.modality;countsByModality.
1342
- has(modality)||(countsByModality.set(modality,0),order.push(modality)),countsByModality.set(modality,((_a2=countsByModality.get(modality))!==null&&_a2!==void 0?_a2:0)+((_b=item.tokenCount)!==null&&_b!==void 0?_b:0))}return order.map(modality=>{var _a3;return{modality,tokenCount:(_a3=countsByModality.get(modality))!==null&&_a3!==void 0?_a3:0}})}function mergeSafetyRatings(prevList,currList){let byCategory=new Map,order=[];for(let rating of[...prevList,...currList]){let category=rating.category;byCategory.
1343
- has(category)||order.push(category),byCategory.set(category,rating)}return order.map(cat=>byCategory.get(cat))}function isMergeableObject(val){if(typeof val!="object"||val===null||Array.isArray(val)||val instanceof HttpResponse)return!1;let proto=Object.getPrototypeOf(val);return proto===null||proto===Object.prototype||val instanceof GenerateContentResponse||val instanceof GenerateContentResponsePromptFeedback||val instanceof GenerateContentResponseUsageMetadata}function isModalityTokenCountArray(fieldName,arr){
1344
- return fieldName.endsWith("TokensDetails")?!0:arr.length>0&&typeof arr[0]=="object"&&arr[0]!==null&&"modality"in arr[0]}function mergeCandidates(prevCandidates,currCandidates){if(prevCandidates.length===0)return currCandidates;if(currCandidates.length===0)return prevCandidates.map(prevCandidate=>mergeResponseObjects(prevCandidate,{},!0,!1));let merged=[],minLen=Math.min(prevCandidates.length,currCandidates.length);for(let i=0;i<minLen;i++)merged.push(mergeResponseObjects(prevCandidates[i],currCandidates[i],
1345
- !0,!1));return prevCandidates.length>minLen&&merged.push(...prevCandidates.slice(minLen)),currCandidates.length>minLen&&merged.push(...currCandidates.slice(minLen)),merged}function getInitialPromptTokenCount(usage){var _a2;if(usage)return(_a2=usage._initialPromptTokenCount)!==null&&_a2!==void 0?_a2:usage.promptTokenCount}function attachInitialPromptTokenCount(usage,initialPromptTokenCount){let resolved=initialPromptTokenCount??getInitialPromptTokenCount(usage);return resolved!==void 0&&Object.defineProperty(
1346
- usage,"_initialPromptTokenCount",{value:resolved,enumerable:!1,configurable:!0,writable:!0}),!(usage instanceof GenerateContentResponseUsageMetadata)&&!Object.prototype.hasOwnProperty.call(usage,"initialPromptTokenCount")&&Object.defineProperty(usage,"initialPromptTokenCount",{get(){return getInitialPromptTokenCount(this)},enumerable:!1,configurable:!0}),usage}function mergeUsageMetadata(prev,curr){var _a2;if(!curr)return prev&&attachInitialPromptTokenCount(prev);if(!prev)return attachInitialPromptTokenCount(
1347
- curr);let initialPrompt=(_a2=getInitialPromptTokenCount(prev))!==null&&_a2!==void 0?_a2:getInitialPromptTokenCount(curr),merged=mergeResponseObjects(prev,curr,!1,!0);return attachInitialPromptTokenCount(merged,initialPrompt)}function shiftCandidateGroundingSupports(prev,curr){let currGm=curr.groundingMetadata,currSupports=currGm?.groundingSupports;if(!Array.isArray(currSupports)||currSupports.length===0)return curr;let prevContent=prev.content,partOffset=Array.isArray(prevContent?.parts)?prevContent.
1348
- parts.length:0,prevGm=prev.groundingMetadata,chunkOffset=Array.isArray(prevGm?.groundingChunks)?prevGm.groundingChunks.length:0;if(partOffset===0&&chunkOffset===0)return curr;let shiftedSupports=currSupports.map(support=>{var _a2;if(!support||typeof support!="object")return support;let nextSupport=Object.assign({},support);return chunkOffset>0&&Array.isArray(support.groundingChunkIndices)&&support.groundingChunkIndices.length>0&&(nextSupport.groundingChunkIndices=support.groundingChunkIndices.map(
1349
- idx=>idx+chunkOffset)),partOffset>0&&support.segment&&typeof support.segment=="object"&&(nextSupport.segment=Object.assign(Object.assign({},support.segment),{partIndex:((_a2=support.segment.partIndex)!==null&&_a2!==void 0?_a2:0)+partOffset})),nextSupport});return Object.assign(Object.assign({},curr),{groundingMetadata:Object.assign(Object.assign({},currGm),{groundingSupports:shiftedSupports})})}function mergeResponseObjects(prev,curr,isCandidate=!1,isUsageMetadata=!1){isCandidate&&(curr=shiftCandidateGroundingSupports(
1350
- prev,curr));let mergedData={},keys=new Set([...Object.keys(prev),...Object.keys(curr)]);for(let fieldName of keys){let prevVal=prev[fieldName],currVal=curr[fieldName];if(isCandidate&&(fieldName==="continuationToken"||fieldName==="finishReason"||fieldName==="finishMessage")){currVal!==void 0&&(mergedData[fieldName]=currVal);continue}if(!isCandidate&&!isUsageMetadata&&fieldName==="candidates"&&Array.isArray(prevVal)){mergedData[fieldName]=mergeCandidates(prevVal,Array.isArray(currVal)?currVal:[]);
1351
- continue}if(fieldName==="usageMetadata"){let mergedUsage=mergeUsageMetadata(prevVal,currVal);mergedUsage!==void 0&&(mergedData[fieldName]=mergedUsage);continue}currVal==null?prevVal!==void 0&&(mergedData[fieldName]=prevVal):prevVal==null?mergedData[fieldName]=currVal:typeof prevVal=="number"&&typeof currVal=="number"&&(isUsageMetadata||fieldName==="tokenCount"||fieldName.endsWith("TokenCount")||fieldName.endsWith("Count")||fieldName.endsWith("Sum"))?mergedData[fieldName]=prevVal+currVal:Array.isArray(
1352
- prevVal)&&Array.isArray(currVal)?isModalityTokenCountArray(fieldName,prevVal)||isModalityTokenCountArray(fieldName,currVal)?mergedData[fieldName]=mergeModalityTokenCounts(prevVal,currVal):fieldName==="safetyRatings"?mergedData[fieldName]=mergeSafetyRatings(prevVal,currVal):mergedData[fieldName]=[...prevVal,...currVal]:isMergeableObject(prevVal)&&isMergeableObject(currVal)?mergedData[fieldName]=mergeResponseObjects(prevVal,currVal,!1,fieldName==="usageMetadata"||isUsageMetadata):mergedData[fieldName]=
1353
- currVal}return mergedData}function mergeContinuationResponses(responses){if(responses.length===0)return new GenerateContentResponse;if(responses.length===1)return responses[0].usageMetadata&&attachInitialPromptTokenCount(responses[0].usageMetadata),responses[0];let mergedRecord=responses[0];for(let i=1;i<responses.length;i++)mergedRecord=mergeResponseObjects(mergedRecord,responses[i],!1,!1);let mergedResponse=new GenerateContentResponse;return Object.assign(mergedResponse,mergedRecord),mergedResponse}
1354
- var Models=class _Models extends BaseModule{constructor(apiClient){super(),this.apiClient=apiClient,this.embedContent=async params=>{if(!this.apiClient.isVertexAI())return params.model.includes("gemini-embedding-2")&&(params.contents=tContents(params.contents)),await this.embedContentInternal(params);if(params.model.includes("gemini")&&params.model!=="gemini-embedding-001"||params.model.includes("maas")){let contents=tContents(params.contents);if(contents.length>1)throw new Error("The embedConte\
1355
- nt API for this model only supports one content at a time.");let paramsPrivate=Object.assign(Object.assign({},params),{content:contents[0],embeddingApiType:EmbeddingApiType.EMBED_CONTENT});return await this.embedContentInternal(paramsPrivate)}else{let paramsPrivate=Object.assign(Object.assign({},params),{embeddingApiType:EmbeddingApiType.PREDICT});return await this.embedContentInternal(paramsPrivate)}},this.generateContent=async params=>{var _a2,_b,_c,_d,_e;let transformedParams=await this.processParamsMaybeAddMcpUsage(
1356
- params);if(this.maybeMoveToResponseJsonSchema(params),!hasCallableTools(params)||shouldDisableAfc(params.config))return shouldEnableAutomaticContinuation(params.config,!0)?await this.generateContentWithContinuation(transformedParams):await this.generateContentInternal(transformedParams);let incompatibleToolIndexes=findAfcIncompatibleToolIndexes(params);if(incompatibleToolIndexes.length>0){let formattedIndexes=incompatibleToolIndexes.map(index=>`tools[${index}]`).join(", ");throw new Error(`Autom\
1357
- atic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${formattedIndexes}.`)}let response,functionResponseContent,automaticFunctionCallingHistory=tContents(transformedParams.contents),maxRemoteCalls=(_c=(_b=(_a2=transformedParams.config)===null||_a2===void 0?void 0:_a2.automaticFunctionCalling)===null||_b===void 0?void 0:_b.maximumRemoteCalls)!==null&&_c!==void 0?_c:DEFAULT_MAX_REMOTE_CALLS,remoteCalls=0;for(;remoteCalls<
1358
- maxRemoteCalls&&(response=await this.generateContentWithContinuation(transformedParams),!(!response.functionCalls||response.functionCalls.length===0));){let responseContent=response.candidates[0].content,functionResponseParts=[];for(let tool of(_e=(_d=params.config)===null||_d===void 0?void 0:_d.tools)!==null&&_e!==void 0?_e:[])if(isCallableTool(tool)){let parts=await tool.callTool(response.functionCalls);functionResponseParts.push(...parts)}remoteCalls++,functionResponseContent={role:"user",parts:functionResponseParts},
1359
- transformedParams.contents=tContents(transformedParams.contents),transformedParams.contents.push(responseContent),transformedParams.contents.push(functionResponseContent),shouldAppendAfcHistory(transformedParams.config)&&(automaticFunctionCallingHistory.push(responseContent),automaticFunctionCallingHistory.push(functionResponseContent))}return shouldAppendAfcHistory(transformedParams.config)&&(response.automaticFunctionCallingHistory=automaticFunctionCallingHistory),response},this.generateContentStream=
1360
- async params=>{var _a2,_b,_c,_d,_e;if(this.maybeMoveToResponseJsonSchema(params),shouldDisableAfc(params.config)){let transformedParams=await this.processParamsMaybeAddMcpUsage(params);return shouldEnableAutomaticContinuation(params.config,!0)?await this.generateContentStreamWithContinuation(transformedParams):await this.generateContentStreamInternal(transformedParams)}let incompatibleToolIndexes=findAfcIncompatibleToolIndexes(params);if(incompatibleToolIndexes.length>0){let formattedIndexes=incompatibleToolIndexes.
1361
- map(index=>`tools[${index}]`).join(", ");throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}let streamFunctionCall=(_c=(_b=(_a2=params?.config)===null||_a2===void 0?void 0:_a2.toolConfig)===null||_b===void 0?void 0:_b.functionCallingConfig)===null||_c===void 0?void 0:_c.streamFunctionCallArguments,disableAfc=(_e=(_d=params?.config)===null||_d===void 0?void 0:_d.automaticFunctionCalling)===
1362
- null||_e===void 0?void 0:_e.disable;if(streamFunctionCall&&!disableAfc)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(
1363
- params)},this.generateImages=async params=>(_Models.loggedGenerateImagesWarning||(_Models.loggedGenerateImagesWarning=!0,console.warn("The generateImages method is deprecated and will be removed in the next major release (not before Jan. 1 2027). Please use the generateContent method with image models instead. See https://ai.google.dev/gemini-api/docs/deprecations#imagen-models and https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/capabilities/image-generation#generate-images")),
1364
- await this.generateImagesInternal(params).then(apiResponse=>{var _a2;let positivePromptSafetyAttributes,generatedImages=[];if(apiResponse?.generatedImages)for(let generatedImage of apiResponse.generatedImages)generatedImage&&generatedImage?.safetyAttributes&&((_a2=generatedImage?.safetyAttributes)===null||_a2===void 0?void 0:_a2.contentType)==="Positive Prompt"?positivePromptSafetyAttributes=generatedImage?.safetyAttributes:generatedImages.push(generatedImage);let response;return positivePromptSafetyAttributes?
1365
- response={generatedImages,positivePromptSafetyAttributes,sdkHttpResponse:apiResponse.sdkHttpResponse}:response={generatedImages,sdkHttpResponse:apiResponse.sdkHttpResponse},response})),this.list=async params=>{var _a2;let actualParams={config:Object.assign(Object.assign({},{queryBase:!0}),params?.config)};if(this.apiClient.isVertexAI()&&!actualParams.config.queryBase){if(!((_a2=actualParams.config)===null||_a2===void 0)&&_a2.filter)throw new Error("Filtering tuned models list is only supported i\
1366
- n Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");actualParams.config.filter="labels.tune-type:*"}return new Pager(PagedItem.PAGED_ITEM_MODELS,x=>this.listInternal(x),await this.listInternal(actualParams),actualParams)},this.editImage=async params=>{_Models.loggedEditImageWarning||(_Models.loggedEditImageWarning=!0,console.warn("The editImage method is deprecated and will be removed in the next major release (not before Jan. 1 2027). Please use the generateContent meth\
1367
- od with image models instead. See https://ai.google.dev/gemini-api/docs/deprecations#imagen-models and https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/capabilities/gemini-edit-images#edit-an-image"));let paramsInternal={model:params.model,prompt:params.prompt,referenceImages:[],config:params.config};return params.referenceImages&&params.referenceImages&&(paramsInternal.referenceImages=params.referenceImages.map(img=>img.toReferenceImageAPI())),await this.editImageInternal(paramsInternal)},
1368
- this.upscaleImage=async params=>{let apiConfig={numberOfImages:1,mode:"upscale"};params.config&&(apiConfig=Object.assign(Object.assign({},apiConfig),params.config));let apiParams={model:params.model,image:params.image,upscaleFactor:params.upscaleFactor,config:apiConfig};return await this.upscaleImageInternal(apiParams)},this.generateVideos=async params=>{var _a2,_b,_c,_d,_e,_f;if((params.prompt||params.image||params.video)&&params.source)throw new Error("Source and prompt/image/video are mutuall\
1369
- y exclusive. Please only use source.");return(params.prompt||params.image||params.video)&&(_Models.loggedGenerateVideosWarning||(_Models.loggedGenerateVideosWarning=!0,console.warn("The generateVideos method with prompt/image/video arguments is deprecated and will be removed in a future major release (not before 2026-07-31). Please use the source argument instead."))),this.apiClient.isVertexAI()||(!((_a2=params.video)===null||_a2===void 0)&&_a2.uri&&(!((_b=params.video)===null||_b===void 0)&&_b.
1370
- videoBytes)?params.video={uri:params.video.uri,mimeType:params.video.mimeType}:!((_d=(_c=params.source)===null||_c===void 0?void 0:_c.video)===null||_d===void 0)&&_d.uri&&(!((_f=(_e=params.source)===null||_e===void 0?void 0:_e.video)===null||_f===void 0)&&_f.videoBytes)&&(params.source.video={uri:params.source.video.uri,mimeType:params.source.video.mimeType})),await this.generateVideosInternal(params)}}async generateContentWithContinuation(params){let enableContinuation=shouldEnableAutomaticContinuation(
1371
- params.config,!0),continuationToken,responses=[];for(;responses.length===0||enableContinuation&&continuationToken;){let callConfig=prepareContinuationConfig(params.config,continuationToken),callParams=callConfig===params.config?params:Object.assign(Object.assign({},params),{config:callConfig}),response=await this.generateContentInternal(callParams);responses.push(response),continuationToken=shouldContinueGeneration(response)}return mergeContinuationResponses(responses)}async generateContentStreamWithContinuation(params){
1372
- let state=new StreamContinuation(params.config);state.startHop();let firstStream=await this.generateContentStreamInternal(params);return(function(models,initialParams,initialStream){return __asyncGenerator(this,arguments,function*(){var _a2,e_1,_b,_c;let openHop=async()=>initialStream;for(;;){let hopError;try{try{for(var _d=!0,_e=(e_1=void 0,__asyncValues(yield __await(openHop()))),_f;_f=yield __await(_e.next()),_a2=_f.done,!_a2;_d=!0){_c=_f.value,_d=!1;let chunk=_c;yield yield __await(state.observe(
1373
- chunk))}}catch(e_1_1){e_1={error:e_1_1}}finally{try{!_d&&!_a2&&(_b=_e.return)&&(yield __await(_b.call(_e)))}finally{if(e_1)throw e_1.error}}}catch(error){hopError={error}}if(!state.endHop(hopError))return yield __await(void 0);let callParams=Object.assign(Object.assign({},initialParams),{config:state.startHop()});openHop=()=>models.generateContentStreamInternal(callParams)}})})(this,params,firstStream)}maybeMoveToResponseJsonSchema(params){params.config&&params.config.responseSchema&&(params.config.
1374
- responseJsonSchema||Object.keys(params.config.responseSchema).includes("$schema")&&(params.config.responseJsonSchema=params.config.responseSchema,delete params.config.responseSchema))}async processParamsMaybeAddMcpUsage(params){var _a2,_b,_c;let tools=(_a2=params.config)===null||_a2===void 0?void 0:_a2.tools;if(!tools)return params;let transformedTools=await Promise.all(tools.map(async tool=>isCallableTool(tool)?await tool.tool():tool)),newParams={model:params.model,contents:params.contents,config:Object.
1375
- assign(Object.assign({},params.config),{tools:transformedTools})};if(newParams.config.tools=transformedTools,params.config&&params.config.tools&&hasMcpToolUsage(params.config.tools)){let headers=(_c=(_b=params.config.httpOptions)===null||_b===void 0?void 0:_b.headers)!==null&&_c!==void 0?_c:{},newHeaders=Object.assign({},headers);Object.keys(newHeaders).length===0&&(newHeaders=this.apiClient.getDefaultHeaders()),setMcpUsageHeader(newHeaders),newParams.config.httpOptions=Object.assign(Object.assign(
1376
- {},params.config.httpOptions),{headers:newHeaders})}return newParams}async initAfcToolsMap(params){var _a2,_b,_c;let afcTools=new Map;for(let tool of(_b=(_a2=params.config)===null||_a2===void 0?void 0:_a2.tools)!==null&&_b!==void 0?_b:[])if(isCallableTool(tool)){let callableTool=tool,toolDeclaration=await callableTool.tool();for(let declaration of(_c=toolDeclaration.functionDeclarations)!==null&&_c!==void 0?_c:[]){if(!declaration.name)throw new Error("Function declaration name is required.");if(afcTools.
1377
- has(declaration.name))throw new Error(`Duplicate tool declaration name: ${declaration.name}`);afcTools.set(declaration.name,callableTool)}}return afcTools}async processAfcStream(params){var _a2,_b,_c;let maxRemoteCalls=(_c=(_b=(_a2=params.config)===null||_a2===void 0?void 0:_a2.automaticFunctionCalling)===null||_b===void 0?void 0:_b.maximumRemoteCalls)!==null&&_c!==void 0?_c:DEFAULT_MAX_REMOTE_CALLS,wereFunctionsCalled=!1,remoteCallCount=0,afcToolsMap=await this.initAfcToolsMap(params);return(function(models,afcTools,params2){
1378
- return __asyncGenerator(this,arguments,function*(){for(var _a3,e_2,_b2,_c2,_d,_e;remoteCallCount<maxRemoteCalls;){wereFunctionsCalled&&(remoteCallCount++,wereFunctionsCalled=!1);let transformedParams=yield __await(models.processParamsMaybeAddMcpUsage(params2)),response=yield __await(models.generateContentStreamWithContinuation(transformedParams)),functionResponses=[],responseContents=[];try{for(var _f=!0,response_1=(e_2=void 0,__asyncValues(response)),response_1_1;response_1_1=yield __await(response_1.
1379
- next()),_a3=response_1_1.done,!_a3;_f=!0){_c2=response_1_1.value,_f=!1;let chunk=_c2;if(yield yield __await(chunk),chunk.candidates&&(!((_d=chunk.candidates[0])===null||_d===void 0)&&_d.content)){responseContents.push(chunk.candidates[0].content);for(let part of(_e=chunk.candidates[0].content.parts)!==null&&_e!==void 0?_e:[])if(remoteCallCount<maxRemoteCalls&&part.functionCall){if(!part.functionCall.name)throw new Error("Function call name was not returned by the model.");if(afcTools.has(part.functionCall.
1380
- name)){let responseParts=yield __await(afcTools.get(part.functionCall.name).callTool([part.functionCall]));functionResponses.push(...responseParts)}else throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${afcTools.keys()}, missing tool: ${part.functionCall.name}`)}}}}catch(e_2_1){e_2={error:e_2_1}}finally{try{!_f&&!_a3&&(_b2=response_1.return)&&(yield __await(_b2.call(response_1)))}finally{if(e_2)
1381
- throw e_2.error}}if(functionResponses.length>0){wereFunctionsCalled=!0;let typedResponseChunk=new GenerateContentResponse;typedResponseChunk.candidates=[{content:{role:"user",parts:functionResponses}}],yield yield __await(typedResponseChunk);let newContents=[];newContents.push(...responseContents),newContents.push({role:"user",parts:functionResponses});let updatedContents=tContents(params2.contents).concat(newContents);params2.contents=updatedContents}else break}})})(this,afcToolsMap,params)}async generateContentInternal(params){
1382
- var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=generateContentParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:generateContent",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:
1383
- _b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=generateContentResponseFromVertex(apiResponse),typedResp=new GenerateContentResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=generateContentParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:generateContent",body._url),queryParams=body._query,
1384
- delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=generateContentResponseFromMldev(
1385
- apiResponse),typedResp=new GenerateContentResponse;return Object.assign(typedResp,resp),typedResp})}}async generateContentStreamInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=generateContentParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:streamGenerateContent?alt=sse",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.requestStream({path:path2,queryParams,body:JSON.
1386
- stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}),response.then(function(apiResponse){return __asyncGenerator(this,arguments,function*(){var _a3,e_3,_b2,_c2;try{for(var _d2=!0,apiResponse_1=__asyncValues(apiResponse),apiResponse_1_1;apiResponse_1_1=yield __await(apiResponse_1.next()),_a3=apiResponse_1_1.done,!_a3;_d2=!0){_c2=apiResponse_1_1.value,_d2=!1;let chunk=_c2,
1387
- resp=generateContentResponseFromVertex(yield __await(chunk.json()),params);resp.sdkHttpResponse={headers:chunk.headers};let typedResp=new GenerateContentResponse;Object.assign(typedResp,resp),yield yield __await(typedResp)}}catch(e_3_1){e_3={error:e_3_1}}finally{try{!_d2&&!_a3&&(_b2=apiResponse_1.return)&&(yield __await(_b2.call(apiResponse_1)))}finally{if(e_3)throw e_3.error}}})})}else{let body=generateContentParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:streamGenerat\
1388
- eContent?alt=sse",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.requestStream({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}),response.then(function(apiResponse){return __asyncGenerator(this,arguments,function*(){var _a3,e_4,_b2,_c2;try{for(var _d2=!0,apiResponse_2=__asyncValues(apiResponse),
1389
- apiResponse_2_1;apiResponse_2_1=yield __await(apiResponse_2.next()),_a3=apiResponse_2_1.done,!_a3;_d2=!0){_c2=apiResponse_2_1.value,_d2=!1;let chunk=_c2,resp=generateContentResponseFromMldev(yield __await(chunk.json()),params);resp.sdkHttpResponse={headers:chunk.headers};let typedResp=new GenerateContentResponse;Object.assign(typedResp,resp),yield yield __await(typedResp)}}catch(e_4_1){e_4={error:e_4_1}}finally{try{!_d2&&!_a3&&(_b2=apiResponse_2.return)&&(yield __await(_b2.call(apiResponse_2)))}finally{
1390
- if(e_4)throw e_4.error}}})})}}async embedContentInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=embedContentParametersPrivateToVertex(this.apiClient,params,params),endpointUrl=tIsVertexEmbedContentModel(params.model)?"{model}:embedContent":"{model}:predict";return path2=formatMap(endpointUrl,body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(
1391
- body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=embedContentResponseFromVertex(apiResponse,params),typedResp=new EmbedContentResponse;return Object.assign(typedResp,resp),typedResp})}else{
1392
- let body=embedContentParametersPrivateToMldev(this.apiClient,params);return path2=formatMap("{model}:batchEmbedContents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;
1393
- return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=embedContentResponseFromMldev(apiResponse),typedResp=new EmbedContentResponse;return Object.assign(typedResp,resp),typedResp})}}async generateImagesInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=generateImagesParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:predict",body._url),queryParams=body._query,
1394
- delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=generateImagesResponseFromVertex(
1395
- apiResponse),typedResp=new GenerateImagesResponse;return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async editImageInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=editImageParametersInternalToVertex(this.apiClient,params);return path2=formatMap("{model}:predict",body._url),queryParams=body._query,delete body._url,delete body.
1396
- _query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=editImageResponseFromVertex(apiResponse),typedResp=new EditImageResponse;
1397
- return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async upscaleImageInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=upscaleImageAPIParametersInternalToVertex(this.apiClient,params);return path2=formatMap("{model}:predict",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.
1398
- request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=upscaleImageResponseFromVertex(apiResponse),typedResp=new UpscaleImageResponse;
1399
- return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async recontextImage(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=recontextImageParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:predict",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,
1400
- queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=recontextImageResponseFromVertex(apiResponse),typedResp=new RecontextImageResponse;return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported by the Gemini Enterprise Agent P\
1401
- latform (previously known as Vertex AI).")}async segmentImage(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=segmentImageParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:predict",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,
1402
- abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=segmentImageResponseFromVertex(apiResponse),typedResp=new SegmentImageResponse;return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async get(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){
1403
- let body=getModelParametersToVertex(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>modelFromVertex(apiResponse))}else{
1404
- let body=getModelParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>modelFromMldev(apiResponse))}}async listInternal(params){
1405
- var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=listModelsParametersToVertex(this.apiClient,params);return path2=formatMap("{models_url}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).
1406
- then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=listModelsResponseFromVertex(apiResponse),typedResp=new ListModelsResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=listModelsParametersToMldev(this.apiClient,params);return path2=formatMap("{models_url}",body._url),queryParams=body._query,delete body._url,delete body._query,response=
1407
- this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=listModelsResponseFromMldev(apiResponse),typedResp=new ListModelsResponse;
1408
- return Object.assign(typedResp,resp),typedResp})}}async update(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=updateModelParametersToVertex(this.apiClient,params);return path2=formatMap("{model}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"PATCH",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,
1409
- abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>modelFromVertex(apiResponse))}else{let body=updateModelParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"PATCH",httpOptions:(_c=params.config)===null||_c===void 0?void 0:
1410
- _c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>modelFromMldev(apiResponse))}}async delete(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=deleteModelParametersToVertex(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,
1411
- queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=deleteModelResponseFromVertex(apiResponse),typedResp=new DeleteModelResponse;return Object.
1412
- assign(typedResp,resp),typedResp})}else{let body=deleteModelParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{
1413
- let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=deleteModelResponseFromMldev(apiResponse),typedResp=new DeleteModelResponse;return Object.assign(typedResp,resp),typedResp})}}async countTokens(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=countTokensParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:countTokens",body._url),queryParams=
1414
- body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=countTokensResponseFromVertex(
1415
- apiResponse),typedResp=new CountTokensResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=countTokensParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:countTokens",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?
1416
- void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=countTokensResponseFromMldev(apiResponse),typedResp=new CountTokensResponse;return Object.assign(typedResp,resp),typedResp})}}async computeTokens(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=computeTokensParametersToVertex(this.
1417
- apiClient,params);return path2=formatMap("{model}:computeTokens",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse=
1418
- {headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=computeTokensResponseFromVertex(apiResponse),typedResp=new ComputeTokensResponse;return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async generateVideosInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=generateVideosParametersToVertex(
1419
- this.apiClient,params);return path2=formatMap("{model}:predictLongRunning",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=generateVideosOperationFromVertex(
1420
- apiResponse),typedResp=new GenerateVideosOperation;return Object.assign(typedResp,resp),typedResp})}else{let body=generateVideosParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:predictLongRunning",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||
1421
- _d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=generateVideosOperationFromMldev(apiResponse),typedResp=new GenerateVideosOperation;return Object.assign(typedResp,resp),typedResp})}}};Models.loggedGenerateImagesWarning=!1;Models.loggedEditImageWarning=!1;Models.loggedGenerateVideosWarning=!1;var Operations=class extends BaseModule{constructor(apiClient){super(),this.apiClient=apiClient}async getVideosOperation(parameters){let operation=parameters.
1320
+ this.apiClient,params);this.conn.send(JSON.stringify(clientMessage))}sendContextUpdate(params){let clientMessage={};this.apiClient.isVertexAI()?clientMessage={contextUpdate:liveClientContextUpdateToVertex(params)}:clientMessage={contextUpdate:liveClientContextUpdateToMldev(params)},this.conn.send(JSON.stringify(clientMessage))}close(){this.conn.close()}};function headersToMap(headers){let headerMap={};return headers.forEach((value,key)=>{headerMap[key]=value}),headerMap}function mapToHeaders(map){
1321
+ let headers=new Headers;for(let[key,value]of Object.entries(map))headers.append(key,value);return headers}var DEFAULT_MAX_REMOTE_CALLS=10;function shouldDisableAfc(config){var _a2,_b,_c;if(!((_a2=config?.automaticFunctionCalling)===null||_a2===void 0)&&_a2.disable)return!0;let callableToolsPresent=!1;for(let tool of(_b=config?.tools)!==null&&_b!==void 0?_b:[])if(isCallableTool(tool)){callableToolsPresent=!0;break}if(!callableToolsPresent)return!0;let maxCalls=(_c=config?.automaticFunctionCalling)===
1322
+ null||_c===void 0?void 0:_c.maximumRemoteCalls;return maxCalls&&(maxCalls<0||!Number.isInteger(maxCalls))||maxCalls==0?(console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a valid integer value greater than 0. maximumRemoteCalls provided:",maxCalls),!0):!1}function isCallableTool(tool){return"callTool"in tool&&typeof tool.callTool=="function"}function hasCallableTools(params){var _a2,_b,_c;return(_c=(_b=(_a2=
1323
+ params.config)===null||_a2===void 0?void 0:_a2.tools)===null||_b===void 0?void 0:_b.some(tool=>isCallableTool(tool)))!==null&&_c!==void 0?_c:!1}function findAfcIncompatibleToolIndexes(params){var _a2;let afcIncompatibleToolIndexes=[];return!((_a2=params?.config)===null||_a2===void 0)&&_a2.tools&&params.config.tools.forEach((tool,index)=>{if(isCallableTool(tool))return;let geminiTool=tool;geminiTool.functionDeclarations&&geminiTool.functionDeclarations.length>0&&afcIncompatibleToolIndexes.push(index)}),
1324
+ afcIncompatibleToolIndexes}function shouldAppendAfcHistory(config){var _a2;return!(!((_a2=config?.automaticFunctionCalling)===null||_a2===void 0)&&_a2.ignoreCallHistory)}function shouldEnableAutomaticContinuation(config,defaultEnabled=!0){return!config||config.automaticContinuation===void 0||config.automaticContinuation===null?defaultEnabled:!!config.automaticContinuation}function isResumableFinishReason(finishReason){return finishReason===void 0||finishReason===FinishReason.CONTINUATION}function canResumeStream(enableContinuation,continuationToken,finishReason,hasPromptFeedback=!1){
1325
+ return enableContinuation&&!hasPromptFeedback&&!!continuationToken&&isResumableFinishReason(finishReason)}var MAX_STREAM_RECONNECTS_WITHOUT_PROGRESS=3;function clearIntermediateFinishReason(chunk,enableContinuation,continuationToken){var _a2;let firstCandidate=(_a2=chunk.candidates)===null||_a2===void 0?void 0:_a2[0];firstCandidate?.finishReason!==void 0&&canResumeStream(enableContinuation,continuationToken,firstCandidate.finishReason)&&(firstCandidate.finishReason=void 0)}function isStreamAborted(err,config){
1326
+ var _a2;return!!(!((_a2=config?.abortSignal)===null||_a2===void 0)&&_a2.aborted)||err instanceof Error&&err.name==="AbortError"}var StreamContinuation=class{constructor(config){this.config=config,this.reconnectsWithoutProgress=0,this.hop=newStreamHop(void 0),this.enableContinuation=shouldEnableAutomaticContinuation(config,!0)}startHop(){return this.hop=newStreamHop(this.resumeToken),prepareContinuationConfig(this.config,this.resumeToken)}observe(chunk){var _a2,_b;let hop=this.hop;if(hop.receivedAnyChunk=
1327
+ !0,chunk.promptFeedback!==void 0&&chunk.promptFeedback!==null&&(hop.hasPromptFeedback=!0),chunk.usageMetadata)if(this.accumulatedUsageAcrossHops){let mergedUsage=mergeUsageMetadata(this.accumulatedUsageAcrossHops,chunk.usageMetadata);chunk=Object.assign(new GenerateContentResponse,chunk,{usageMetadata:mergedUsage}),hop.usage=mergedUsage}else attachInitialPromptTokenCount(chunk.usageMetadata),hop.usage=chunk.usageMetadata;let firstCandidate=(_a2=chunk.candidates)===null||_a2===void 0?void 0:_a2[0];
1328
+ return firstCandidate&&(!((_b=firstCandidate.content)===null||_b===void 0)&&_b.parts&&firstCandidate.content.parts.length>0&&(hop.hasYieldedContent=!0),firstCandidate.finishReason!==void 0&&(hop.finishReason=firstCandidate.finishReason),firstCandidate.continuationToken?hop.token=firstCandidate.continuationToken:firstCandidate.finishReason!==void 0&&!isResumableFinishReason(firstCandidate.finishReason)&&(hop.token=void 0),clearIntermediateFinishReason(chunk,this.enableContinuation,hop.token)),chunk}endHop(hopError){
1329
+ let hop=this.hop;if(hop.usage&&(this.accumulatedUsageAcrossHops=hop.usage),hopError&&(isStreamAborted(hopError.error,this.config)||hopError.error instanceof ApiError&&!hop.receivedAnyChunk))throw hopError.error;let madeProgress=hop.hasYieldedContent||!!hop.token&&hop.token!==hop.startToken;if(hopError?this.lastError=hopError:madeProgress&&(this.lastError=void 0),[this.resumeToken,this.reconnectsWithoutProgress]=this.nextResumeToken(),canResumeStream(this.enableContinuation,this.resumeToken,hop.finishReason,
1330
+ hop.hasPromptFeedback))return!0;if(hopError)throw hopError.error;if(hop.finishReason===void 0&&!hop.hasPromptFeedback&&this.lastError)throw this.lastError.error;return!1}nextResumeToken(){let hop=this.hop,reconnects=this.reconnectsWithoutProgress;return hop.finishReason!==void 0||hop.hasPromptFeedback?hop.finishReason===FinishReason.CONTINUATION&&!hop.hasPromptFeedback&&hop.token&&hop.token!==hop.startToken?[hop.token,0]:[void 0,0]:hop.token&&hop.token!==hop.startToken?[hop.token,0]:hop.hasYieldedContent||
1331
+ reconnects>=MAX_STREAM_RECONNECTS_WITHOUT_PROGRESS?[void 0,reconnects]:[hop.startToken,reconnects+1]}};function newStreamHop(startToken){return{startToken,hasPromptFeedback:!1,hasYieldedContent:!1,receivedAnyChunk:!1}}function shouldContinueGeneration(response){var _a2;let candidate=(_a2=response?.candidates)===null||_a2===void 0?void 0:_a2[0];if(candidate?.continuationToken&&isResumableFinishReason(candidate.finishReason))return candidate.continuationToken}function prepareContinuationConfig(baseConfig,continuationToken,clearAutomaticContinuation=!1){
1332
+ let hasAutoCont=baseConfig?.automaticContinuation!==void 0&&baseConfig?.automaticContinuation!==null,needClearAutoCont=clearAutomaticContinuation&&hasAutoCont;if(!continuationToken&&!needClearAutoCont)return baseConfig;if(!baseConfig)return continuationToken?{continuationToken}:void 0;let copied=Object.assign({},baseConfig);return continuationToken&&(copied.continuationToken=continuationToken),needClearAutoCont&&delete copied.automaticContinuation,copied}function mergeModalityTokenCounts(prevList,currList){
1333
+ var _a2,_b;let countsByModality=new Map,order=[];for(let item of[...prevList,...currList]){let modality=item.modality;countsByModality.has(modality)||(countsByModality.set(modality,0),order.push(modality)),countsByModality.set(modality,((_a2=countsByModality.get(modality))!==null&&_a2!==void 0?_a2:0)+((_b=item.tokenCount)!==null&&_b!==void 0?_b:0))}return order.map(modality=>{var _a3;return{modality,tokenCount:(_a3=countsByModality.get(modality))!==null&&_a3!==void 0?_a3:0}})}function mergeSafetyRatings(prevList,currList){
1334
+ let byCategory=new Map,order=[];for(let rating of[...prevList,...currList]){let category=rating.category;byCategory.has(category)||order.push(category),byCategory.set(category,rating)}return order.map(cat=>byCategory.get(cat))}function isMergeableObject(val){if(typeof val!="object"||val===null||Array.isArray(val)||val instanceof HttpResponse)return!1;let proto=Object.getPrototypeOf(val);return proto===null||proto===Object.prototype||val instanceof GenerateContentResponse||val instanceof GenerateContentResponsePromptFeedback||
1335
+ val instanceof GenerateContentResponseUsageMetadata}function isModalityTokenCountArray(fieldName,arr){return fieldName.endsWith("TokensDetails")?!0:arr.length>0&&typeof arr[0]=="object"&&arr[0]!==null&&"modality"in arr[0]}function mergeCandidates(prevCandidates,currCandidates){if(prevCandidates.length===0)return currCandidates;if(currCandidates.length===0)return prevCandidates.map(prevCandidate=>mergeResponseObjects(prevCandidate,{},!0,!1));let merged=[],minLen=Math.min(prevCandidates.length,currCandidates.
1336
+ length);for(let i=0;i<minLen;i++)merged.push(mergeResponseObjects(prevCandidates[i],currCandidates[i],!0,!1));return prevCandidates.length>minLen&&merged.push(...prevCandidates.slice(minLen)),currCandidates.length>minLen&&merged.push(...currCandidates.slice(minLen)),merged}function getInitialPromptTokenCount(usage){var _a2;if(usage)return(_a2=usage._initialPromptTokenCount)!==null&&_a2!==void 0?_a2:usage.promptTokenCount}function attachInitialPromptTokenCount(usage,initialPromptTokenCount){let resolved=initialPromptTokenCount??
1337
+ getInitialPromptTokenCount(usage);return resolved!==void 0&&Object.defineProperty(usage,"_initialPromptTokenCount",{value:resolved,enumerable:!1,configurable:!0,writable:!0}),!(usage instanceof GenerateContentResponseUsageMetadata)&&!Object.prototype.hasOwnProperty.call(usage,"initialPromptTokenCount")&&Object.defineProperty(usage,"initialPromptTokenCount",{get(){return getInitialPromptTokenCount(this)},enumerable:!1,configurable:!0}),usage}function mergeUsageMetadata(prev,curr){var _a2;if(!curr)
1338
+ return prev&&attachInitialPromptTokenCount(prev);if(!prev)return attachInitialPromptTokenCount(curr);let initialPrompt=(_a2=getInitialPromptTokenCount(prev))!==null&&_a2!==void 0?_a2:getInitialPromptTokenCount(curr),merged=mergeResponseObjects(prev,curr,!1,!0);return attachInitialPromptTokenCount(merged,initialPrompt)}function shiftCandidateGroundingSupports(prev,curr){let currGm=curr.groundingMetadata,currSupports=currGm?.groundingSupports;if(!Array.isArray(currSupports)||currSupports.length===
1339
+ 0)return curr;let prevContent=prev.content,partOffset=Array.isArray(prevContent?.parts)?prevContent.parts.length:0,prevGm=prev.groundingMetadata,chunkOffset=Array.isArray(prevGm?.groundingChunks)?prevGm.groundingChunks.length:0;if(partOffset===0&&chunkOffset===0)return curr;let shiftedSupports=currSupports.map(support=>{var _a2;if(!support||typeof support!="object")return support;let nextSupport=Object.assign({},support);return chunkOffset>0&&Array.isArray(support.groundingChunkIndices)&&support.
1340
+ groundingChunkIndices.length>0&&(nextSupport.groundingChunkIndices=support.groundingChunkIndices.map(idx=>idx+chunkOffset)),partOffset>0&&support.segment&&typeof support.segment=="object"&&(nextSupport.segment=Object.assign(Object.assign({},support.segment),{partIndex:((_a2=support.segment.partIndex)!==null&&_a2!==void 0?_a2:0)+partOffset})),nextSupport});return Object.assign(Object.assign({},curr),{groundingMetadata:Object.assign(Object.assign({},currGm),{groundingSupports:shiftedSupports})})}function mergeResponseObjects(prev,curr,isCandidate=!1,isUsageMetadata=!1){
1341
+ isCandidate&&(curr=shiftCandidateGroundingSupports(prev,curr));let mergedData={},keys=new Set([...Object.keys(prev),...Object.keys(curr)]);for(let fieldName of keys){let prevVal=prev[fieldName],currVal=curr[fieldName];if(isCandidate&&(fieldName==="continuationToken"||fieldName==="finishReason"||fieldName==="finishMessage")){currVal!==void 0&&(mergedData[fieldName]=currVal);continue}if(!isCandidate&&!isUsageMetadata&&fieldName==="candidates"&&Array.isArray(prevVal)){mergedData[fieldName]=mergeCandidates(
1342
+ prevVal,Array.isArray(currVal)?currVal:[]);continue}if(fieldName==="usageMetadata"){let mergedUsage=mergeUsageMetadata(prevVal,currVal);mergedUsage!==void 0&&(mergedData[fieldName]=mergedUsage);continue}currVal==null?prevVal!==void 0&&(mergedData[fieldName]=prevVal):prevVal==null?mergedData[fieldName]=currVal:typeof prevVal=="number"&&typeof currVal=="number"&&(isUsageMetadata||fieldName==="tokenCount"||fieldName.endsWith("TokenCount")||fieldName.endsWith("Count")||fieldName.endsWith("Sum"))?mergedData[fieldName]=
1343
+ prevVal+currVal:Array.isArray(prevVal)&&Array.isArray(currVal)?isModalityTokenCountArray(fieldName,prevVal)||isModalityTokenCountArray(fieldName,currVal)?mergedData[fieldName]=mergeModalityTokenCounts(prevVal,currVal):fieldName==="safetyRatings"?mergedData[fieldName]=mergeSafetyRatings(prevVal,currVal):mergedData[fieldName]=[...prevVal,...currVal]:isMergeableObject(prevVal)&&isMergeableObject(currVal)?mergedData[fieldName]=mergeResponseObjects(prevVal,currVal,!1,fieldName==="usageMetadata"||isUsageMetadata):
1344
+ mergedData[fieldName]=currVal}return mergedData}function mergeContinuationResponses(responses){if(responses.length===0)return new GenerateContentResponse;if(responses.length===1)return responses[0].usageMetadata&&attachInitialPromptTokenCount(responses[0].usageMetadata),responses[0];let mergedRecord=responses[0];for(let i=1;i<responses.length;i++)mergedRecord=mergeResponseObjects(mergedRecord,responses[i],!1,!1);let mergedResponse=new GenerateContentResponse;return Object.assign(mergedResponse,mergedRecord),
1345
+ mergedResponse}var Models=class _Models extends BaseModule{constructor(apiClient){super(),this.apiClient=apiClient,this.embedContent=async params=>{if(!this.apiClient.isVertexAI())return params.model.includes("gemini-embedding-2")&&(params.contents=tContents(params.contents)),await this.embedContentInternal(params);if(params.model.includes("gemini")&&params.model!=="gemini-embedding-001"||params.model.includes("maas")){let contents=tContents(params.contents);if(contents.length>1)throw new Error(
1346
+ "The embedContent API for this model only supports one content at a time.");let paramsPrivate=Object.assign(Object.assign({},params),{content:contents[0],embeddingApiType:EmbeddingApiType.EMBED_CONTENT});return await this.embedContentInternal(paramsPrivate)}else{let paramsPrivate=Object.assign(Object.assign({},params),{embeddingApiType:EmbeddingApiType.PREDICT});return await this.embedContentInternal(paramsPrivate)}},this.generateContent=async params=>{var _a2,_b,_c,_d,_e;let transformedParams=await this.
1347
+ processParamsMaybeAddMcpUsage(params);if(this.maybeMoveToResponseJsonSchema(params),!hasCallableTools(params)||shouldDisableAfc(params.config))return shouldEnableAutomaticContinuation(params.config,!0)?await this.generateContentWithContinuation(transformedParams):await this.generateContentInternal(transformedParams);let incompatibleToolIndexes=findAfcIncompatibleToolIndexes(params);if(incompatibleToolIndexes.length>0){let formattedIndexes=incompatibleToolIndexes.map(index=>`tools[${index}]`).join(
1348
+ ", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${formattedIndexes}.`)}let response,functionResponseContent,automaticFunctionCallingHistory=tContents(transformedParams.contents),maxRemoteCalls=(_c=(_b=(_a2=transformedParams.config)===null||_a2===void 0?void 0:_a2.automaticFunctionCalling)===null||_b===void 0?void 0:_b.maximumRemoteCalls)!==null&&_c!==void 0?_c:DEFAULT_MAX_REMOTE_CALLS,
1349
+ remoteCalls=0;for(;remoteCalls<maxRemoteCalls&&(response=await this.generateContentWithContinuation(transformedParams),!(!response.functionCalls||response.functionCalls.length===0));){let responseContent=response.candidates[0].content,functionResponseParts=[];for(let tool of(_e=(_d=params.config)===null||_d===void 0?void 0:_d.tools)!==null&&_e!==void 0?_e:[])if(isCallableTool(tool)){let parts=await tool.callTool(response.functionCalls);functionResponseParts.push(...parts)}remoteCalls++,functionResponseContent=
1350
+ {role:"user",parts:functionResponseParts},transformedParams.contents=tContents(transformedParams.contents),transformedParams.contents.push(responseContent),transformedParams.contents.push(functionResponseContent),shouldAppendAfcHistory(transformedParams.config)&&(automaticFunctionCallingHistory.push(responseContent),automaticFunctionCallingHistory.push(functionResponseContent))}return shouldAppendAfcHistory(transformedParams.config)&&(response.automaticFunctionCallingHistory=automaticFunctionCallingHistory),
1351
+ response},this.generateContentStream=async params=>{var _a2,_b,_c,_d,_e;if(this.maybeMoveToResponseJsonSchema(params),shouldDisableAfc(params.config)){let transformedParams=await this.processParamsMaybeAddMcpUsage(params);return shouldEnableAutomaticContinuation(params.config,!0)?await this.generateContentStreamWithContinuation(transformedParams):await this.generateContentStreamInternal(transformedParams)}let incompatibleToolIndexes=findAfcIncompatibleToolIndexes(params);if(incompatibleToolIndexes.
1352
+ length>0){let formattedIndexes=incompatibleToolIndexes.map(index=>`tools[${index}]`).join(", ");throw new Error(`Incompatible tools found at ${formattedIndexes}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}let streamFunctionCall=(_c=(_b=(_a2=params?.config)===null||_a2===void 0?void 0:_a2.toolConfig)===null||_b===void 0?void 0:_b.functionCallingConfig)===null||_c===void 0?void 0:_c.streamFunctionCallArguments,disableAfc=(_e=
1353
+ (_d=params?.config)===null||_d===void 0?void 0:_d.automaticFunctionCalling)===null||_e===void 0?void 0:_e.disable;if(streamFunctionCall&&!disableAfc)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disa\
1354
+ ble streaming function call arguments feature.");return await this.processAfcStream(params)},this.generateImages=async params=>(_Models.loggedGenerateImagesWarning||(_Models.loggedGenerateImagesWarning=!0,console.warn("The generateImages method is deprecated and will be removed in the next major release (not before Jan. 1 2027). Please use the generateContent method with image models instead. See https://ai.google.dev/gemini-api/docs/deprecations#imagen-models and https://docs.cloud.google.com/g\
1355
+ emini-enterprise-agent-platform/models/capabilities/image-generation#generate-images")),await this.generateImagesInternal(params).then(apiResponse=>{var _a2;let positivePromptSafetyAttributes,generatedImages=[];if(apiResponse?.generatedImages)for(let generatedImage of apiResponse.generatedImages)generatedImage&&generatedImage?.safetyAttributes&&((_a2=generatedImage?.safetyAttributes)===null||_a2===void 0?void 0:_a2.contentType)==="Positive Prompt"?positivePromptSafetyAttributes=generatedImage?.safetyAttributes:
1356
+ generatedImages.push(generatedImage);let response;return positivePromptSafetyAttributes?response={generatedImages,positivePromptSafetyAttributes,sdkHttpResponse:apiResponse.sdkHttpResponse}:response={generatedImages,sdkHttpResponse:apiResponse.sdkHttpResponse},response})),this.list=async params=>{var _a2;let actualParams={config:Object.assign(Object.assign({},{queryBase:!0}),params?.config)};if(this.apiClient.isVertexAI()&&!actualParams.config.queryBase){if(!((_a2=actualParams.config)===null||_a2===
1357
+ void 0)&&_a2.filter)throw new Error("Filtering tuned models list is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");actualParams.config.filter="labels.tune-type:*"}return new Pager(PagedItem.PAGED_ITEM_MODELS,x=>this.listInternal(x),await this.listInternal(actualParams),actualParams)},this.editImage=async params=>{_Models.loggedEditImageWarning||(_Models.loggedEditImageWarning=!0,console.warn("The editImage method is deprecated and will be removed in \
1358
+ the next major release (not before Jan. 1 2027). Please use the generateContent method with image models instead. See https://ai.google.dev/gemini-api/docs/deprecations#imagen-models and https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/capabilities/gemini-edit-images#edit-an-image"));let paramsInternal={model:params.model,prompt:params.prompt,referenceImages:[],config:params.config};return params.referenceImages&&params.referenceImages&&(paramsInternal.referenceImages=params.
1359
+ referenceImages.map(img=>img.toReferenceImageAPI())),await this.editImageInternal(paramsInternal)},this.upscaleImage=async params=>{let apiConfig={numberOfImages:1,mode:"upscale"};params.config&&(apiConfig=Object.assign(Object.assign({},apiConfig),params.config));let apiParams={model:params.model,image:params.image,upscaleFactor:params.upscaleFactor,config:apiConfig};return await this.upscaleImageInternal(apiParams)},this.generateVideos=async params=>{var _a2,_b,_c,_d,_e,_f;if((params.prompt||params.
1360
+ image||params.video)&&params.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return(params.prompt||params.image||params.video)&&(_Models.loggedGenerateVideosWarning||(_Models.loggedGenerateVideosWarning=!0,console.warn("The generateVideos method with prompt/image/video arguments is deprecated and will be removed in a future major release (not before 2026-07-31). Please use the source argument instead."))),this.apiClient.isVertexAI()||(!((_a2=
1361
+ params.video)===null||_a2===void 0)&&_a2.uri&&(!((_b=params.video)===null||_b===void 0)&&_b.videoBytes)?params.video={uri:params.video.uri,mimeType:params.video.mimeType}:!((_d=(_c=params.source)===null||_c===void 0?void 0:_c.video)===null||_d===void 0)&&_d.uri&&(!((_f=(_e=params.source)===null||_e===void 0?void 0:_e.video)===null||_f===void 0)&&_f.videoBytes)&&(params.source.video={uri:params.source.video.uri,mimeType:params.source.video.mimeType})),await this.generateVideosInternal(params)}}async generateContentWithContinuation(params){
1362
+ let enableContinuation=shouldEnableAutomaticContinuation(params.config,!0),continuationToken,responses=[];for(;responses.length===0||enableContinuation&&continuationToken;){let callConfig=prepareContinuationConfig(params.config,continuationToken),callParams=callConfig===params.config?params:Object.assign(Object.assign({},params),{config:callConfig}),response=await this.generateContentInternal(callParams);responses.push(response),continuationToken=shouldContinueGeneration(response)}return mergeContinuationResponses(
1363
+ responses)}async generateContentStreamWithContinuation(params){let state=new StreamContinuation(params.config);state.startHop();let firstStream=await this.generateContentStreamInternal(params);return(function(models,initialParams,initialStream){return __asyncGenerator(this,arguments,function*(){var _a2,e_1,_b,_c;let openHop=async()=>initialStream;for(;;){let hopError;try{try{for(var _d=!0,_e=(e_1=void 0,__asyncValues(yield __await(openHop()))),_f;_f=yield __await(_e.next()),_a2=_f.done,!_a2;_d=!0){
1364
+ _c=_f.value,_d=!1;let chunk=_c;yield yield __await(state.observe(chunk))}}catch(e_1_1){e_1={error:e_1_1}}finally{try{!_d&&!_a2&&(_b=_e.return)&&(yield __await(_b.call(_e)))}finally{if(e_1)throw e_1.error}}}catch(error){hopError={error}}if(!state.endHop(hopError))return yield __await(void 0);let callParams=Object.assign(Object.assign({},initialParams),{config:state.startHop()});openHop=()=>models.generateContentStreamInternal(callParams)}})})(this,params,firstStream)}maybeMoveToResponseJsonSchema(params){
1365
+ params.config&&params.config.responseSchema&&(params.config.responseJsonSchema||Object.keys(params.config.responseSchema).includes("$schema")&&(params.config.responseJsonSchema=params.config.responseSchema,delete params.config.responseSchema))}async processParamsMaybeAddMcpUsage(params){var _a2,_b,_c;let tools=(_a2=params.config)===null||_a2===void 0?void 0:_a2.tools;if(!tools)return params;let transformedTools=await Promise.all(tools.map(async tool=>isCallableTool(tool)?await tool.tool():tool)),
1366
+ newParams={model:params.model,contents:params.contents,config:Object.assign(Object.assign({},params.config),{tools:transformedTools})};if(newParams.config.tools=transformedTools,params.config&&params.config.tools&&hasMcpToolUsage(params.config.tools)){let headers=(_c=(_b=params.config.httpOptions)===null||_b===void 0?void 0:_b.headers)!==null&&_c!==void 0?_c:{},newHeaders=Object.assign({},headers);Object.keys(newHeaders).length===0&&(newHeaders=this.apiClient.getDefaultHeaders()),setMcpUsageHeader(
1367
+ newHeaders),newParams.config.httpOptions=Object.assign(Object.assign({},params.config.httpOptions),{headers:newHeaders})}return newParams}async initAfcToolsMap(params){var _a2,_b,_c;let afcTools=new Map;for(let tool of(_b=(_a2=params.config)===null||_a2===void 0?void 0:_a2.tools)!==null&&_b!==void 0?_b:[])if(isCallableTool(tool)){let callableTool=tool,toolDeclaration=await callableTool.tool();for(let declaration of(_c=toolDeclaration.functionDeclarations)!==null&&_c!==void 0?_c:[]){if(!declaration.
1368
+ name)throw new Error("Function declaration name is required.");if(afcTools.has(declaration.name))throw new Error(`Duplicate tool declaration name: ${declaration.name}`);afcTools.set(declaration.name,callableTool)}}return afcTools}async processAfcStream(params){var _a2,_b,_c;let maxRemoteCalls=(_c=(_b=(_a2=params.config)===null||_a2===void 0?void 0:_a2.automaticFunctionCalling)===null||_b===void 0?void 0:_b.maximumRemoteCalls)!==null&&_c!==void 0?_c:DEFAULT_MAX_REMOTE_CALLS,wereFunctionsCalled=!1,
1369
+ remoteCallCount=0,afcToolsMap=await this.initAfcToolsMap(params);return(function(models,afcTools,params2){return __asyncGenerator(this,arguments,function*(){for(var _a3,e_2,_b2,_c2,_d,_e;remoteCallCount<maxRemoteCalls;){wereFunctionsCalled&&(remoteCallCount++,wereFunctionsCalled=!1);let transformedParams=yield __await(models.processParamsMaybeAddMcpUsage(params2)),response=yield __await(models.generateContentStreamWithContinuation(transformedParams)),functionResponses=[],responseContents=[];try{
1370
+ for(var _f=!0,response_1=(e_2=void 0,__asyncValues(response)),response_1_1;response_1_1=yield __await(response_1.next()),_a3=response_1_1.done,!_a3;_f=!0){_c2=response_1_1.value,_f=!1;let chunk=_c2;if(yield yield __await(chunk),chunk.candidates&&(!((_d=chunk.candidates[0])===null||_d===void 0)&&_d.content)){responseContents.push(chunk.candidates[0].content);for(let part of(_e=chunk.candidates[0].content.parts)!==null&&_e!==void 0?_e:[])if(remoteCallCount<maxRemoteCalls&&part.functionCall){if(!part.
1371
+ functionCall.name)throw new Error("Function call name was not returned by the model.");if(afcTools.has(part.functionCall.name)){let responseParts=yield __await(afcTools.get(part.functionCall.name).callTool([part.functionCall]));functionResponses.push(...responseParts)}else throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${afcTools.keys()}, missing tool: ${part.functionCall.name}`)}}}}catch(e_2_1){
1372
+ e_2={error:e_2_1}}finally{try{!_f&&!_a3&&(_b2=response_1.return)&&(yield __await(_b2.call(response_1)))}finally{if(e_2)throw e_2.error}}if(functionResponses.length>0){wereFunctionsCalled=!0;let typedResponseChunk=new GenerateContentResponse;typedResponseChunk.candidates=[{content:{role:"user",parts:functionResponses}}],yield yield __await(typedResponseChunk);let newContents=[];newContents.push(...responseContents),newContents.push({role:"user",parts:functionResponses});let updatedContents=tContents(
1373
+ params2.contents).concat(newContents);params2.contents=updatedContents}else break}})})(this,afcToolsMap,params)}async generateContentInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=generateContentParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:generateContent",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),
1374
+ httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=generateContentResponseFromVertex(apiResponse),typedResp=new GenerateContentResponse;return Object.assign(typedResp,resp),typedResp})}else{
1375
+ let body=generateContentParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:generateContent",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;
1376
+ return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=generateContentResponseFromMldev(apiResponse),typedResp=new GenerateContentResponse;return Object.assign(typedResp,resp),typedResp})}}async generateContentStreamInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=generateContentParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:streamGenerateContent?al\
1377
+ t=sse",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.requestStream({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}),response.then(function(apiResponse){return __asyncGenerator(this,arguments,function*(){var _a3,e_3,_b2,_c2;try{for(var _d2=!0,apiResponse_1=__asyncValues(apiResponse),
1378
+ apiResponse_1_1;apiResponse_1_1=yield __await(apiResponse_1.next()),_a3=apiResponse_1_1.done,!_a3;_d2=!0){_c2=apiResponse_1_1.value,_d2=!1;let chunk=_c2,resp=generateContentResponseFromVertex(yield __await(chunk.json()),params);resp.sdkHttpResponse={headers:chunk.headers};let typedResp=new GenerateContentResponse;Object.assign(typedResp,resp),yield yield __await(typedResp)}}catch(e_3_1){e_3={error:e_3_1}}finally{try{!_d2&&!_a3&&(_b2=apiResponse_1.return)&&(yield __await(_b2.call(apiResponse_1)))}finally{
1379
+ if(e_3)throw e_3.error}}})})}else{let body=generateContentParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:streamGenerateContent?alt=sse",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.requestStream({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}),response.then(
1380
+ function(apiResponse){return __asyncGenerator(this,arguments,function*(){var _a3,e_4,_b2,_c2;try{for(var _d2=!0,apiResponse_2=__asyncValues(apiResponse),apiResponse_2_1;apiResponse_2_1=yield __await(apiResponse_2.next()),_a3=apiResponse_2_1.done,!_a3;_d2=!0){_c2=apiResponse_2_1.value,_d2=!1;let chunk=_c2,resp=generateContentResponseFromMldev(yield __await(chunk.json()),params);resp.sdkHttpResponse={headers:chunk.headers};let typedResp=new GenerateContentResponse;Object.assign(typedResp,resp),yield yield __await(
1381
+ typedResp)}}catch(e_4_1){e_4={error:e_4_1}}finally{try{!_d2&&!_a3&&(_b2=apiResponse_2.return)&&(yield __await(_b2.call(apiResponse_2)))}finally{if(e_4)throw e_4.error}}})})}}async embedContentInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=embedContentParametersPrivateToVertex(this.apiClient,params,params),endpointUrl=tIsVertexEmbedContentModel(params.model)?"{model}:embedContent":"{model}:predict";return path2=formatMap(endpointUrl,
1382
+ body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{
1383
+ let resp=embedContentResponseFromVertex(apiResponse,params),typedResp=new EmbedContentResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=embedContentParametersPrivateToMldev(this.apiClient,params);return path2=formatMap("{model}:batchEmbedContents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.
1384
+ httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=embedContentResponseFromMldev(apiResponse),typedResp=new EmbedContentResponse;return Object.assign(typedResp,resp),typedResp})}}async generateImagesInternal(params){var _a2,_b;let response,path2="",queryParams={};
1385
+ if(this.apiClient.isVertexAI()){let body=generateImagesParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:predict",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(
1386
+ jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=generateImagesResponseFromVertex(apiResponse),typedResp=new GenerateImagesResponse;return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async editImageInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.
1387
+ apiClient.isVertexAI()){let body=editImageParametersInternalToVertex(this.apiClient,params);return path2=formatMap("{model}:predict",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{
1388
+ let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=editImageResponseFromVertex(apiResponse),typedResp=new EditImageResponse;return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async upscaleImageInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){
1389
+ let body=upscaleImageAPIParametersInternalToVertex(this.apiClient,params);return path2=formatMap("{model}:predict",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;
1390
+ return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=upscaleImageResponseFromVertex(apiResponse),typedResp=new UpscaleImageResponse;return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async recontextImage(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=recontextImageParametersToVertex(
1391
+ this.apiClient,params);return path2=formatMap("{model}:predict",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=recontextImageResponseFromVertex(apiResponse),
1392
+ typedResp=new RecontextImageResponse;return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async segmentImage(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=segmentImageParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:predict",body._url),queryParams=body._query,delete body._url,delete body._query,response=
1393
+ this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=segmentImageResponseFromVertex(apiResponse),typedResp=new SegmentImageResponse;return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported b\
1394
+ y the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async get(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=getModelParametersToVertex(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.
1395
+ httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>modelFromVertex(apiResponse))}else{let body=getModelParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?
1396
+ void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>modelFromMldev(apiResponse))}}async listInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=listModelsParametersToVertex(this.apiClient,params);return path2=formatMap("{models_url}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.
1397
+ request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=listModelsResponseFromVertex(apiResponse),typedResp=new ListModelsResponse;
1398
+ return Object.assign(typedResp,resp),typedResp})}else{let body=listModelsParametersToMldev(this.apiClient,params);return path2=formatMap("{models_url}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.
1399
+ json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=listModelsResponseFromMldev(apiResponse),typedResp=new ListModelsResponse;return Object.assign(typedResp,resp),typedResp})}}async update(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=updateModelParametersToVertex(this.apiClient,params);return path2=formatMap("{model}",body._url),
1400
+ queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"PATCH",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>modelFromVertex(apiResponse))}else{let body=updateModelParametersToMldev(this.apiClient,params);return path2=formatMap("{\
1401
+ name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"PATCH",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>modelFromMldev(apiResponse))}}async delete(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.
1402
+ apiClient.isVertexAI()){let body=deleteModelParametersToVertex(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{
1403
+ let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=deleteModelResponseFromVertex(apiResponse),typedResp=new DeleteModelResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=deleteModelParametersToMldev(this.apiClient,params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.
1404
+ stringify(body),httpMethod:"DELETE",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=deleteModelResponseFromMldev(apiResponse),typedResp=new DeleteModelResponse;return Object.assign(typedResp,resp),typedResp})}}async countTokens(params){
1405
+ var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=countTokensParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:countTokens",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.
1406
+ abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=countTokensResponseFromVertex(apiResponse),typedResp=new CountTokensResponse;return Object.assign(typedResp,resp),typedResp})}else{let body=countTokensParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:countTokens",body._url),queryParams=body._query,delete body._url,
1407
+ delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=countTokensResponseFromMldev(apiResponse),
1408
+ typedResp=new CountTokensResponse;return Object.assign(typedResp,resp),typedResp})}}async computeTokens(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=computeTokensParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:computeTokens",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===
1409
+ null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json().then(jsonResponse=>{let response2=jsonResponse;return response2.sdkHttpResponse={headers:httpResponse.headers},response2})),response.then(apiResponse=>{let resp=computeTokensResponseFromVertex(apiResponse),typedResp=new ComputeTokensResponse;return Object.assign(typedResp,resp),typedResp})}else throw new Error("This method is only supported b\
1410
+ y the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async generateVideosInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=generateVideosParametersToVertex(this.apiClient,params);return path2=formatMap("{model}:predictLongRunning",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=
1411
+ params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=generateVideosOperationFromVertex(apiResponse),typedResp=new GenerateVideosOperation;return Object.assign(typedResp,resp),typedResp})}else{let body=generateVideosParametersToMldev(this.apiClient,params);return path2=formatMap("{model}:predictLongRunning",body._url),queryParams=body._query,
1412
+ delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=generateVideosOperationFromMldev(apiResponse),typedResp=new GenerateVideosOperation;return Object.assign(typedResp,resp),typedResp})}}};Models.
1413
+ loggedGenerateImagesWarning=!1;Models.loggedEditImageWarning=!1;Models.loggedGenerateVideosWarning=!1;var Operations=class extends BaseModule{constructor(apiClient){super(),this.apiClient=apiClient}async getVideosOperation(parameters){let operation=parameters.operation,config=parameters.config;if(operation.name===void 0||operation.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){let resourceName2=operation.name.split("/operations/")[0],httpOptions;config&&
1414
+ "httpOptions"in config&&(httpOptions=config.httpOptions);let rawOperation=await this.fetchPredictVideosOperationInternal({operationName:operation.name,resourceName:resourceName2,config:{httpOptions}});return operation._fromAPIResponse({apiResponse:rawOperation,_isVertexAI:!0})}else{let rawOperation=await this.getVideosOperationInternal({operationName:operation.name,config});return operation._fromAPIResponse({apiResponse:rawOperation,_isVertexAI:!1})}}async get(parameters){let operation=parameters.
1422
1415
  operation,config=parameters.config;if(operation.name===void 0||operation.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){let resourceName2=operation.name.split("/operations/")[0],httpOptions;config&&"httpOptions"in config&&(httpOptions=config.httpOptions);let rawOperation=await this.fetchPredictVideosOperationInternal({operationName:operation.name,resourceName:resourceName2,config:{httpOptions}});return operation._fromAPIResponse({apiResponse:rawOperation,
1423
- _isVertexAI:!0})}else{let rawOperation=await this.getVideosOperationInternal({operationName:operation.name,config});return operation._fromAPIResponse({apiResponse:rawOperation,_isVertexAI:!1})}}async get(parameters){let operation=parameters.operation,config=parameters.config;if(operation.name===void 0||operation.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){let resourceName2=operation.name.split("/operations/")[0],httpOptions;config&&"httpOptions"in config&&
1424
- (httpOptions=config.httpOptions);let rawOperation=await this.fetchPredictVideosOperationInternal({operationName:operation.name,resourceName:resourceName2,config:{httpOptions}});return operation._fromAPIResponse({apiResponse:rawOperation,_isVertexAI:!0})}else{let rawOperation=await this.getVideosOperationInternal({operationName:operation.name,config});return operation._fromAPIResponse({apiResponse:rawOperation,_isVertexAI:!1})}}async getVideosOperationInternal(params){var _a2,_b,_c,_d;let response,
1425
- path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=getOperationParametersToVertex(params);return path2=formatMap("{operationName}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),
1426
- response}else{let body=getOperationParametersToMldev(params);return path2=formatMap("{operationName}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response}}async fetchPredictVideosOperationInternal(params){
1427
- var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=fetchPredictOperationParametersToVertex(params);return path2=formatMap("{resourceName}:fetchPredictOperation",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:
1428
- _b.abortSignal}).then(httpResponse=>httpResponse.json()),response}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}};function authConfigToMldev(fromObject){let toObject={},fromApiKey=getValueByPath(fromObject,["apiKey"]);if(fromApiKey!=null&&setValueByPath(toObject,["apiKey"],fromApiKey),getValueByPath(fromObject,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is only supported in Gemini Enterprise A\
1429
- gent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["authType"])!==void 0)throw new Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["httpBasic\
1430
- AuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["oauthConfig"])!==void 0)throw new Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platfor\
1431
- m mode, not in Gemini Developer API mode.");return toObject}function contentToMldev(fromObject){let toObject={},fromParts=getValueByPath(fromObject,["parts"]);if(fromParts!=null){let transformedList=fromParts;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>partToMldev(item))),setValueByPath(toObject,["parts"],transformedList)}let fromRole=getValueByPath(fromObject,["role"]);return fromRole!=null&&setValueByPath(toObject,["role"],fromRole),toObject}function createAuthTokenConfigToMldev(apiClient,fromObject,parentObject){
1432
- let toObject={},fromExpireTime=getValueByPath(fromObject,["expireTime"]);parentObject!==void 0&&fromExpireTime!=null&&setValueByPath(parentObject,["expireTime"],fromExpireTime);let fromNewSessionExpireTime=getValueByPath(fromObject,["newSessionExpireTime"]);parentObject!==void 0&&fromNewSessionExpireTime!=null&&setValueByPath(parentObject,["newSessionExpireTime"],fromNewSessionExpireTime);let fromUses=getValueByPath(fromObject,["uses"]);parentObject!==void 0&&fromUses!=null&&setValueByPath(parentObject,
1433
- ["uses"],fromUses);let fromLiveConnectConstraints=getValueByPath(fromObject,["liveConnectConstraints"]);parentObject!==void 0&&fromLiveConnectConstraints!=null&&setValueByPath(parentObject,["bidiGenerateContentSetup"],liveConnectConstraintsToMldev(apiClient,fromLiveConnectConstraints));let fromLockAdditionalFields=getValueByPath(fromObject,["lockAdditionalFields"]);return parentObject!==void 0&&fromLockAdditionalFields!=null&&setValueByPath(parentObject,["fieldMask"],fromLockAdditionalFields),toObject}
1434
- function createAuthTokenParametersToMldev(apiClient,fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["config"],createAuthTokenConfigToMldev(apiClient,fromConfig,toObject)),toObject}function functionCallToMldev(fromObject){let toObject={},fromArgs=getValueByPath(fromObject,["args"]);fromArgs!=null&&setValueByPath(toObject,["args"],fromArgs);let fromId=getValueByPath(fromObject,["id"]);fromId!=null&&setValueByPath(toObject,
1435
- ["id"],fromId);let fromName=getValueByPath(fromObject,["name"]);if(fromName!=null&&setValueByPath(toObject,["name"],fromName),getValueByPath(fromObject,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["willContinue"])!==void 0)throw new Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mod\
1436
- e.");return toObject}function googleMapsToMldev(fromObject){let toObject={},fromAuthConfig=getValueByPath(fromObject,["authConfig"]);fromAuthConfig!=null&&setValueByPath(toObject,["authConfig"],authConfigToMldev(fromAuthConfig));let fromEnableWidget=getValueByPath(fromObject,["enableWidget"]);if(fromEnableWidget!=null&&setValueByPath(toObject,["enableWidget"],fromEnableWidget),getValueByPath(fromObject,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Ge\
1437
- mini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function googleSearchToMldev(fromObject){let toObject={};if(getValueByPath(fromObject,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platf\
1438
- orm mode, not in Gemini Developer API mode.");let fromSearchTypes=getValueByPath(fromObject,["searchTypes"]);fromSearchTypes!=null&&setValueByPath(toObject,["searchTypes"],fromSearchTypes);let fromTimeRangeFilter=getValueByPath(fromObject,["timeRangeFilter"]);return fromTimeRangeFilter!=null&&setValueByPath(toObject,["timeRangeFilter"],fromTimeRangeFilter),toObject}function liveConnectConfigToMldev(fromObject,parentObject){let toObject={},fromGenerationConfig=getValueByPath(fromObject,["generati\
1439
- onConfig"]);parentObject!==void 0&&fromGenerationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig"],fromGenerationConfig);let fromResponseModalities=getValueByPath(fromObject,["responseModalities"]);parentObject!==void 0&&fromResponseModalities!=null&&setValueByPath(parentObject,["setup","generationConfig","responseModalities"],fromResponseModalities);let fromTemperature=getValueByPath(fromObject,["temperature"]);parentObject!==void 0&&fromTemperature!=null&&setValueByPath(parentObject,
1440
- ["setup","generationConfig","temperature"],fromTemperature);let fromTopP=getValueByPath(fromObject,["topP"]);parentObject!==void 0&&fromTopP!=null&&setValueByPath(parentObject,["setup","generationConfig","topP"],fromTopP);let fromTopK=getValueByPath(fromObject,["topK"]);parentObject!==void 0&&fromTopK!=null&&setValueByPath(parentObject,["setup","generationConfig","topK"],fromTopK);let fromMaxOutputTokens=getValueByPath(fromObject,["maxOutputTokens"]);parentObject!==void 0&&fromMaxOutputTokens!=null&&
1441
- setValueByPath(parentObject,["setup","generationConfig","maxOutputTokens"],fromMaxOutputTokens);let fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);parentObject!==void 0&&fromMediaResolution!=null&&setValueByPath(parentObject,["setup","generationConfig","mediaResolution"],fromMediaResolution);let fromSeed=getValueByPath(fromObject,["seed"]);parentObject!==void 0&&fromSeed!=null&&setValueByPath(parentObject,["setup","generationConfig","seed"],fromSeed);let fromSpeechConfig=getValueByPath(
1442
- fromObject,["speechConfig"]);parentObject!==void 0&&fromSpeechConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","speechConfig"],tLiveSpeechConfig(fromSpeechConfig));let fromThinkingConfig=getValueByPath(fromObject,["thinkingConfig"]);parentObject!==void 0&&fromThinkingConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","thinkingConfig"],fromThinkingConfig);let fromEnableAffectiveDialog=getValueByPath(fromObject,["enableAffectiveDialog"]);parentObject!==void 0&&
1443
- fromEnableAffectiveDialog!=null&&setValueByPath(parentObject,["setup","generationConfig","enableAffectiveDialog"],fromEnableAffectiveDialog);let fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);parentObject!==void 0&&fromSystemInstruction!=null&&setValueByPath(parentObject,["setup","systemInstruction"],contentToMldev(tContent(fromSystemInstruction)));let fromTools=getValueByPath(fromObject,["tools"]);if(parentObject!==void 0&&fromTools!=null){let transformedList=tTools(fromTools);
1444
- Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToMldev(tTool(item)))),setValueByPath(parentObject,["setup","tools"],transformedList)}let fromSessionResumption=getValueByPath(fromObject,["sessionResumption"]);parentObject!==void 0&&fromSessionResumption!=null&&setValueByPath(parentObject,["setup","sessionResumption"],sessionResumptionConfigToMldev(fromSessionResumption));let fromInputAudioTranscription=getValueByPath(fromObject,["inputAudioTranscription"]);parentObject!==
1445
- void 0&&fromInputAudioTranscription!=null&&setValueByPath(parentObject,["setup","inputAudioTranscription"],fromInputAudioTranscription);let fromOutputAudioTranscription=getValueByPath(fromObject,["outputAudioTranscription"]);parentObject!==void 0&&fromOutputAudioTranscription!=null&&setValueByPath(parentObject,["setup","outputAudioTranscription"],fromOutputAudioTranscription);let fromRealtimeInputConfig=getValueByPath(fromObject,["realtimeInputConfig"]);parentObject!==void 0&&fromRealtimeInputConfig!=
1446
- null&&setValueByPath(parentObject,["setup","realtimeInputConfig"],fromRealtimeInputConfig);let fromContextWindowCompression=getValueByPath(fromObject,["contextWindowCompression"]);parentObject!==void 0&&fromContextWindowCompression!=null&&setValueByPath(parentObject,["setup","contextWindowCompression"],fromContextWindowCompression);let fromProactivity=getValueByPath(fromObject,["proactivity"]);if(parentObject!==void 0&&fromProactivity!=null&&setValueByPath(parentObject,["setup","proactivity"],fromProactivity),
1447
- getValueByPath(fromObject,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromAvatarConfig=getValueByPath(fromObject,["avatarConfig"]);parentObject!==void 0&&fromAvatarConfig!=null&&setValueByPath(parentObject,["setup","avatarConfig"],fromAvatarConfig);let fromSafetySettings=getValueByPath(fromObject,["safetySettings"]);if(parentObject!==void 0&&fromSafetySettings!=null){
1448
- let transformedList=fromSafetySettings;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>safetySettingToMldev(item))),setValueByPath(parentObject,["setup","safetySettings"],transformedList)}let fromTranslationConfig=getValueByPath(fromObject,["translationConfig"]);return parentObject!==void 0&&fromTranslationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","translationConfig"],fromTranslationConfig),toObject}function liveConnectConstraintsToMldev(apiClient,fromObject){
1449
- let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(toObject,["setup","model"],tModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["config"],liveConnectConfigToMldev(fromConfig,toObject)),toObject}function partToMldev(fromObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolu\
1450
- tion"],fromMediaResolution);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=null&&setValueByPath(toObject,["toolCall"],fromToolCall);let fromToolResponse=getValueByPath(fromObject,["toolResponse"]);fromToolResponse!=null&&setValueByPath(toObject,["toolResponse"],fromToolResponse);let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(
1451
- fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=
1452
- null&&setValueByPath(toObject,["functionCall"],functionCallToMldev(fromFunctionCall));let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);
1453
- let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata);let fromPartMetadata=getValueByPath(fromObject,["partMet\
1454
- adata"]);fromPartMetadata!=null&&setValueByPath(toObject,["partMetadata"],fromPartMetadata);let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function safetySettingToMldev(fromObject){let toObject={},fromCategory=getValueByPath(
1455
- fromObject,["category"]);if(fromCategory!=null&&setValueByPath(toObject,["category"],fromCategory),getValueByPath(fromObject,["method"])!==void 0)throw new Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromThreshold=getValueByPath(fromObject,["threshold"]);return fromThreshold!=null&&setValueByPath(toObject,["threshold"],fromThreshold),toObject}function sessionResumptionConfigToMldev(fromObject){let toObject={},fromHandle=getValueByPath(
1456
- fromObject,["handle"]);if(fromHandle!=null&&setValueByPath(toObject,["handle"],fromHandle),getValueByPath(fromObject,["transparent"])!==void 0)throw new Error("transparent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function toolToMldev(fromObject){let toObject={};if(getValueByPath(fromObject,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in \
1457
- Gemini Developer API mode.");let fromGoogleMaps=getValueByPath(fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],googleMapsToMldev(fromGoogleMaps));let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["codeE\
1458
- xecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);if(fromComputerUse!=null&&setValueByPath(toObject,["computerUse"],fromComputerUse),getValueByPath(fromObject,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["exaAiSearch"])!==void 0)
1459
- throw new Error("exaAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromFunctionDeclarations=getValueByPath(fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functionDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleS\
1460
- earch"]);fromGoogleSearch!=null&&setValueByPath(toObject,["googleSearch"],googleSearchToMldev(fromGoogleSearch));let fromGoogleSearchRetrieval=getValueByPath(fromObject,["googleSearchRetrieval"]);if(fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval),getValueByPath(fromObject,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mo\
1461
- de.");let fromUrlContext=getValueByPath(fromObject,["urlContext"]);fromUrlContext!=null&&setValueByPath(toObject,["urlContext"],fromUrlContext);let fromFileSearch=getValueByPath(fromObject,["fileSearch"]);return fromFileSearch!=null&&setValueByPath(toObject,["fileSearch"],fromFileSearch),toObject}function getFieldMasks(setup){let fields=[];for(let key in setup)if(Object.prototype.hasOwnProperty.call(setup,key)){let value=setup[key];if(typeof value=="object"&&value!=null&&Object.keys(value).length>
1462
- 0){let field=Object.keys(value).map(kk=>`${key}.${kk}`);fields.push(...field)}else fields.push(key)}return fields.join(",")}function convertBidiSetupToTokenSetup(requestDict,config){let setupForMaskGeneration=null,bidiGenerateContentSetupValue=requestDict.bidiGenerateContentSetup;if(typeof bidiGenerateContentSetupValue=="object"&&bidiGenerateContentSetupValue!==null&&"setup"in bidiGenerateContentSetupValue){let innerSetup=bidiGenerateContentSetupValue.setup;typeof innerSetup=="object"&&innerSetup!==
1463
- null?(requestDict.bidiGenerateContentSetup=innerSetup,setupForMaskGeneration=innerSetup):delete requestDict.bidiGenerateContentSetup}else bidiGenerateContentSetupValue!==void 0&&delete requestDict.bidiGenerateContentSetup;let preExistingFieldMask=requestDict.fieldMask;if(setupForMaskGeneration){let generatedMaskFromBidi=getFieldMasks(setupForMaskGeneration);if(Array.isArray(config?.lockAdditionalFields)&&config?.lockAdditionalFields.length===0)generatedMaskFromBidi?requestDict.fieldMask=generatedMaskFromBidi:
1464
- delete requestDict.fieldMask;else if(config?.lockAdditionalFields&&config.lockAdditionalFields.length>0&&preExistingFieldMask!==null&&Array.isArray(preExistingFieldMask)&&preExistingFieldMask.length>0){let generationConfigFields=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"],mappedFieldsFromPreExisting=[];preExistingFieldMask.length>0&&(mappedFieldsFromPreExisting=preExistingFieldMask.map(field=>generationConfigFields.includes(field)?`generationConfig.${field}`:
1465
- field));let finalMaskParts=[];generatedMaskFromBidi&&finalMaskParts.push(generatedMaskFromBidi),mappedFieldsFromPreExisting.length>0&&finalMaskParts.push(...mappedFieldsFromPreExisting),finalMaskParts.length>0?requestDict.fieldMask=finalMaskParts.join(","):delete requestDict.fieldMask}else delete requestDict.fieldMask}else preExistingFieldMask!==null&&Array.isArray(preExistingFieldMask)&&preExistingFieldMask.length>0?requestDict.fieldMask=preExistingFieldMask.join(","):delete requestDict.fieldMask;
1466
- return requestDict}var Tokens=class extends BaseModule{constructor(apiClient){super(),this.apiClient=apiClient}async create(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{let body=createAuthTokenParametersToMldev(this.apiClient,params);path2=formatMap("auth_tokens",body._url),queryParams=body._query,delete body.config,delete body._url,delete body._query;let transformedBody=convertBidiSetupToTokenSetup(
1467
- body,params.config);return response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(transformedBody),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}};function deleteDocumentConfigToMldev(fromObject,parentObject){let toObject={},fromForce=getValueByPath(fromObject,["force"]);return parentObject!==
1468
- void 0&&fromForce!=null&&setValueByPath(parentObject,["_query","force"],fromForce),toObject}function deleteDocumentParametersToMldev(fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["_url","name"],fromName);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&deleteDocumentConfigToMldev(fromConfig,toObject),toObject}function getDocumentParametersToMldev(fromObject){let toObject={},fromName=getValueByPath(fromObject,
1469
- ["name"]);return fromName!=null&&setValueByPath(toObject,["_url","name"],fromName),toObject}function listDocumentsConfigToMldev(fromObject,parentObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);return parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken),
1470
- toObject}function listDocumentsParametersToMldev(fromObject){let toObject={},fromParent=getValueByPath(fromObject,["parent"]);fromParent!=null&&setValueByPath(toObject,["_url","parent"],fromParent);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listDocumentsConfigToMldev(fromConfig,toObject),toObject}function listDocumentsResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(
1471
- toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromDocuments=getValueByPath(fromObject,["documents"]);if(fromDocuments!=null){let transformedList=fromDocuments;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["documents"],transformedList)}return toObject}var Documents=class extends BaseModule{constructor(apiClient){
1472
- super(),this.apiClient=apiClient,this.list=async params=>new Pager(PagedItem.PAGED_ITEM_DOCUMENTS,x=>this.listInternal({parent:params.parent,config:x.config}),await this.listInternal(params),params)}async get(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=getDocumentParametersToMldev(params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body.
1473
- _url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async delete(params){var _a2,_b;let path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Develop\
1474
- er API.");{let body=deleteDocumentParametersToMldev(params);path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,await this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal})}}async listInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.
1475
- isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=listDocumentsParametersToMldev(params);return path2=formatMap("{parent}/documents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).
1476
- then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=listDocumentsResponseFromMldev(apiResponse),typedResp=new ListDocumentsResponse;return Object.assign(typedResp,resp),typedResp})}}};var FileSearchStores=class extends BaseModule{constructor(apiClient,documents=new Documents(apiClient)){super(),this.apiClient=apiClient,this.documents=documents,this.list=async(params={})=>new Pager(PagedItem.PAGED_ITEM_FILE_SEARCH_STORES,x=>this.listInternal(x),await this.listInternal(params),
1477
- params)}async uploadToFileSearchStore(params){if(this.apiClient.isVertexAI())throw new Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(params.fileSearchStoreName,params.file,params.config)}async downloadMedia(uri,config){if(this.apiClient.isVertexAI())throw new Error("This method is only supported in the Gemini Developer client.");let parsedUri=new URL(uri,"http://\
1478
- dummy.com"),pathname=parsedUri.pathname;if(pathname.startsWith("/")&&(pathname=pathname.slice(1)),!pathname.includes("/media/"))throw new Error(`Invalid uri format: ${uri}. Expected to contain /media/`);let queryParams={};parsedUri.searchParams.forEach((value,key)=>{queryParams[key]=value}),queryParams.alt="media";let httpOptions=Object.assign({},config?.httpOptions),response=await this.apiClient.request({path:pathname,httpMethod:"GET",queryParams,httpOptions});if(response instanceof HttpResponse){
1479
- let arrayBuffer=await response.responseInternal.arrayBuffer();return new Uint8Array(arrayBuffer)}else throw new Error("Unexpected response type from downloadMedia")}async create(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=createFileSearchStoreParametersToMldev(this.apiClient,params);return path2=formatMap("fileSearchStores",body._url),queryParams=body._query,delete body.
1480
- _url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async get(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini \
1481
- Developer API.");{let body=getFileSearchStoreParametersToMldev(params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async delete(params){
1482
- var _a2,_b;let path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=deleteFileSearchStoreParametersToMldev(params);path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,await this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===
1483
- null||_b===void 0?void 0:_b.abortSignal})}}async listInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=listFileSearchStoresParametersToMldev(params);return path2=formatMap("fileSearchStores",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=
1484
- params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=listFileSearchStoresResponseFromMldev(apiResponse),typedResp=new ListFileSearchStoresResponse;return Object.assign(typedResp,resp),typedResp})}}async uploadToFileSearchStoreInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("Thi\
1485
- s method is only supported by the Gemini Developer API.");{let body=uploadToFileSearchStoreParametersToMldev(params);return path2=formatMap("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?
1486
- void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=uploadToFileSearchStoreResumableResponseFromMldev(apiResponse),typedResp=new UploadToFileSearchStoreResumableResponse;return Object.assign(typedResp,resp),typedResp})}}async importFile(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=importFileParametersToMldev(params);return path2=
1487
- formatMap("{file_search_store_name}:importFile",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=importFileOperationFromMldev(apiResponse),typedResp=new ImportFileOperation;
1488
- return Object.assign(typedResp,resp),typedResp})}}};function isDeno(){return"Deno"in globalThis}var envMemo;function env(){var _a2,_b,_c,_d,_e,_f;if(envMemo)return envMemo;let globals=globalThis,envObject={};return isDeno()?envObject=(_d=(_c=(_b=(_a2=globals.Deno)===null||_a2===void 0?void 0:_a2.env)===null||_b===void 0?void 0:_b.toObject)===null||_c===void 0?void 0:_c.call(_b))!==null&&_d!==void 0?_d:{}:envObject=(_f=(_e=globals.process)===null||_e===void 0?void 0:_e.env)!==null&&_f!==void 0?_f:
1489
- {},envMemo=envObject,envMemo}function fillGlobals(options){var _a2,_b;let clone=Object.assign({},options),envVars=env();return typeof envVars.GOOGLE_GENAI_API_VERSION<"u"&&((_a2=clone.api_version)!==null&&_a2!==void 0||(clone.api_version=envVars.GOOGLE_GENAI_API_VERSION)),typeof envVars.GOOGLE_GENAI_USER_PROJECT<"u"&&((_b=clone.user_project)!==null&&_b!==void 0||(clone.user_project=envVars.GOOGLE_GENAI_USER_PROJECT)),clone}var UNDICI_GLOBAL_DISPATCHER_SYMBOL=Symbol.for("undici.globalDispatcher.1"),
1490
- GoogleGenAISecurityProvider=class{constructor(options){this.options=options}getDefaultHeaders(){return this.options.defaultHeaders}async resolveGoogleGenAISecurity(url){return securityFromHeaders(await this.options.getAuthHeaders(url))}},GoogleGenAIAuthHook=class{beforeCreateRequest(hookCtx,input){var _a2;let options=Object.assign({},(_a2=input.options)!==null&&_a2!==void 0?_a2:{});return isNodeRuntime()&&!hasCustomHttpClient(hookCtx.options.http_client)&&!("dispatcher"in options)&&(options.dispatcher=
1491
- createUndiciNoTimeoutDispatcher()),Object.assign(Object.assign({},input),{url:decodeSDKLevelAPIVersionPath(input.url),options})}async beforeRequest(hookCtx,request){if(applyDefaultHeaders(request.headers,getStaticDefaultHeaders(hookCtx.security_source)),applyUserProject(hookCtx,request.headers),hasAuthHeaders(request.headers))return request;let security=await resolveSecurity$1(hookCtx.security_source,request.url);return applyDefaultHeaders(request.headers,security?.default_headers),applyAuth(request.
1492
- headers,security),request}};function decodeSDKLevelAPIVersionPath(url){let[,apiVersion,...rest]=url.pathname.split("/");if(!apiVersion)return url;let decodedAPIVersion=decodeURIComponent(apiVersion);if(!decodedAPIVersion.includes("/"))return url;let nextURL=new URL(url);return nextURL.pathname=`/${decodedAPIVersion}/${rest.join("/")}`,nextURL}async function resolveSecurity$1(securitySource,requestURL){if(isSecurityResolver(securitySource))return securitySource.resolveGoogleGenAISecurity(requestURL);
1493
- let security=typeof securitySource=="function"?await securitySource():securitySource;return isSecurity(security)?withEnvSecurity(security):withEnvSecurity(void 0)}function getStaticDefaultHeaders(securitySource){var _a2,_b;if(isSecurityResolver(securitySource))return(_b=(_a2=securitySource.getDefaultHeaders)===null||_a2===void 0?void 0:_a2.call(securitySource))!==null&&_b!==void 0?_b:securitySource.defaultHeaders;if(isSecurity(securitySource))return securitySource.default_headers}function withEnvSecurity(security){
1494
- var _a2,_b;let envVars=env(),nextSecurity=Object.assign(Object.assign({},security),{api_key:(_a2=security?.api_key)!==null&&_a2!==void 0?_a2:envVars.GOOGLE_GENAI_API_KEY,access_token:(_b=security?.access_token)!==null&&_b!==void 0?_b:envVars.GOOGLE_GENAI_ACCESS_TOKEN});return hasSecurityValue(nextSecurity)?nextSecurity:void 0}function securityFromHeaders(headers){var _a2,_b;let defaultHeaders={};for(let[key,value]of headers){let lowerKey=key.toLowerCase();lowerKey!=="authorization"&&lowerKey!=="\
1495
- x-goog-api-key"&&(defaultHeaders[key]=value)}let security={access_token:(_a2=headers.get("authorization"))!==null&&_a2!==void 0?_a2:void 0,api_key:(_b=headers.get("x-goog-api-key"))!==null&&_b!==void 0?_b:void 0,default_headers:Object.keys(defaultHeaders).length?defaultHeaders:void 0};return hasSecurityValue(security)?security:void 0}function applyDefaultHeaders(target,source){if(source)for(let[key,value]of new Headers(source))target.get(key)===null&&target.set(key,value)}function applyUserProject(hookCtx,headers){
1496
- hookCtx.options.user_project!==void 0&&headers.get("x-goog-user-project")===null&&headers.set("x-goog-user-project",hookCtx.options.user_project)}function applyAuth(headers,security){if(security){if(security.api_key){headers.set("x-goog-api-key",security.api_key);return}security.access_token&&headers.set("Authorization",bearer(security.access_token))}}function hasAuthHeaders(headers){return headers.get("authorization")!==null||headers.get("x-goog-api-key")!==null}function bearer(token){return token.
1497
- slice(0,7).toLowerCase()==="bearer "?token:`Bearer ${token}`}function isSecurity(value){return typeof value=="object"&&value!==null}function isSecurityResolver(value){return typeof value=="object"&&value!==null&&"resolveGoogleGenAISecurity"in value&&typeof value.resolveGoogleGenAISecurity=="function"}function hasSecurityValue(security){return security.api_key!==void 0||security.access_token!==void 0||security.default_headers!==void 0}function isNodeRuntime(){var _a2,_b;return typeof((_b=(_a2=globalThis.
1498
- process)===null||_a2===void 0?void 0:_a2.versions)===null||_b===void 0?void 0:_b.node)=="string"}function hasCustomHttpClient(httpClient){if(!httpClient||typeof httpClient!="object")return!1;if("options"in httpClient){let opts=httpClient.options;return!!opts?.fetcher}return!0}function createUndiciNoTimeoutDispatcher(){return{dispatch(opts,handler){let globalDispatcher=globalThis[UNDICI_GLOBAL_DISPATCHER_SYMBOL];if(!globalDispatcher||typeof globalDispatcher.dispatch!="function")throw new TypeError(
1499
- "Undici globalDispatcher is not available in this Node.js runtime.");return globalDispatcher.dispatch(Object.assign(Object.assign({},opts),{headersTimeout:0,bodyTimeout:0}),handler)}}}var HTTPClientError=class extends Error{constructor(message,opts){let msg=message;opts?.cause&&(msg+=`: ${opts.cause}`),super(msg,opts),this.name="HTTPClientError",typeof this.cause>"u"&&(this.cause=opts?.cause)}},UnexpectedClientError=class extends HTTPClientError{constructor(){super(...arguments),this.name="Unexp\
1500
- ectedClientError"}},InvalidRequestError=class extends HTTPClientError{constructor(){super(...arguments),this.name="InvalidRequestError"}},RequestAbortedError=class extends HTTPClientError{constructor(){super(...arguments),this.name="RequestAbortedError"}},RequestTimeoutError=class extends HTTPClientError{constructor(){super(...arguments),this.name="RequestTimeoutError"}},ConnectionError=class extends HTTPClientError{constructor(){super(...arguments),this.name="ConnectionError"}};var GoogleGenAiError=class extends Error{constructor(message,httpMeta){
1501
- var _a2,_b,_c,_d;super(message),this.statusCode=(_a2=httpMeta?.response)===null||_a2===void 0?void 0:_a2.status,this.body=(_b=httpMeta?.body)!==null&&_b!==void 0?_b:"",this.headers=(_c=httpMeta?.response)===null||_c===void 0?void 0:_c.headers,this.contentType=((_d=httpMeta?.response)===null||_d===void 0?void 0:_d.headers.get("content-type"))||"",this.rawResponse=httpMeta?.response,this.name="GoogleGenAiError"}};var GeminiNextGenAPIClientError=class extends Error{},APIError=class _APIError extends GeminiNextGenAPIClientError{constructor(status,error,message,headers){
1416
+ _isVertexAI:!0})}else{let rawOperation=await this.getVideosOperationInternal({operationName:operation.name,config});return operation._fromAPIResponse({apiResponse:rawOperation,_isVertexAI:!1})}}async getVideosOperationInternal(params){var _a2,_b,_c,_d;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=getOperationParametersToVertex(params);return path2=formatMap("{operationName}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.
1417
+ request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response}else{let body=getOperationParametersToMldev(params);return path2=formatMap("{operationName}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.
1418
+ stringify(body),httpMethod:"GET",httpOptions:(_c=params.config)===null||_c===void 0?void 0:_c.httpOptions,abortSignal:(_d=params.config)===null||_d===void 0?void 0:_d.abortSignal}).then(httpResponse=>httpResponse.json()),response}}async fetchPredictVideosOperationInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI()){let body=fetchPredictOperationParametersToVertex(params);return path2=formatMap("{resourceName}:fetchPredictOperation",body._url),queryParams=
1419
+ body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response}else throw new Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}};function authConfigToMldev(fromObject){
1420
+ let toObject={},fromApiKey=getValueByPath(fromObject,["apiKey"]);if(fromApiKey!=null&&setValueByPath(toObject,["apiKey"],fromApiKey),getValueByPath(fromObject,["apiKeyConfig"])!==void 0)throw new Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["authType"])!==void 0)throw new Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mo\
1421
+ de.");if(getValueByPath(fromObject,["googleServiceAccountConfig"])!==void 0)throw new Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["httpBasicAuthConfig"])!==void 0)throw new Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["oauthConfig"])!==void 0)throw new Error(
1422
+ "oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["oidcConfig"])!==void 0)throw new Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function contentToMldev(fromObject){let toObject={},fromParts=getValueByPath(fromObject,["parts"]);if(fromParts!=null){let transformedList=fromParts;Array.isArray(transformedList)&&
1423
+ (transformedList=transformedList.map(item=>partToMldev(item))),setValueByPath(toObject,["parts"],transformedList)}let fromRole=getValueByPath(fromObject,["role"]);return fromRole!=null&&setValueByPath(toObject,["role"],fromRole),toObject}function createAuthTokenConfigToMldev(apiClient,fromObject,parentObject){let toObject={},fromExpireTime=getValueByPath(fromObject,["expireTime"]);parentObject!==void 0&&fromExpireTime!=null&&setValueByPath(parentObject,["expireTime"],fromExpireTime);let fromNewSessionExpireTime=getValueByPath(
1424
+ fromObject,["newSessionExpireTime"]);parentObject!==void 0&&fromNewSessionExpireTime!=null&&setValueByPath(parentObject,["newSessionExpireTime"],fromNewSessionExpireTime);let fromUses=getValueByPath(fromObject,["uses"]);parentObject!==void 0&&fromUses!=null&&setValueByPath(parentObject,["uses"],fromUses);let fromLiveConnectConstraints=getValueByPath(fromObject,["liveConnectConstraints"]);parentObject!==void 0&&fromLiveConnectConstraints!=null&&setValueByPath(parentObject,["bidiGenerateContentSet\
1425
+ up"],liveConnectConstraintsToMldev(apiClient,fromLiveConnectConstraints));let fromLockAdditionalFields=getValueByPath(fromObject,["lockAdditionalFields"]);return parentObject!==void 0&&fromLockAdditionalFields!=null&&setValueByPath(parentObject,["fieldMask"],fromLockAdditionalFields),toObject}function createAuthTokenParametersToMldev(apiClient,fromObject){let toObject={},fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["config"],createAuthTokenConfigToMldev(
1426
+ apiClient,fromConfig,toObject)),toObject}function functionCallToMldev(fromObject){let toObject={},fromArgs=getValueByPath(fromObject,["args"]);fromArgs!=null&&setValueByPath(toObject,["args"],fromArgs);let fromId=getValueByPath(fromObject,["id"]);fromId!=null&&setValueByPath(toObject,["id"],fromId);let fromName=getValueByPath(fromObject,["name"]);if(fromName!=null&&setValueByPath(toObject,["name"],fromName),getValueByPath(fromObject,["partialArgs"])!==void 0)throw new Error("partialArgs paramete\
1427
+ r is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["willContinue"])!==void 0)throw new Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function googleMapsToMldev(fromObject){let toObject={},fromAuthConfig=getValueByPath(fromObject,["authConfig"]);fromAuthConfig!=null&&setValueByPath(toObject,["authConfig"],authConfigToMldev(fromAuthConfig));
1428
+ let fromEnableWidget=getValueByPath(fromObject,["enableWidget"]);if(fromEnableWidget!=null&&setValueByPath(toObject,["enableWidget"],fromEnableWidget),getValueByPath(fromObject,["groundingTypes"])!==void 0)throw new Error("groundingTypes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function googleSearchToMldev(fromObject){let toObject={};if(getValueByPath(fromObject,["blockingConfidence"])!==void 0)throw new Error("bloc\
1429
+ kingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromSearchTypes=getValueByPath(fromObject,["searchTypes"]);fromSearchTypes!=null&&setValueByPath(toObject,["searchTypes"],fromSearchTypes);let fromTimeRangeFilter=getValueByPath(fromObject,
1430
+ ["timeRangeFilter"]);return fromTimeRangeFilter!=null&&setValueByPath(toObject,["timeRangeFilter"],fromTimeRangeFilter),toObject}function liveConnectConfigToMldev(fromObject,parentObject){let toObject={},fromGenerationConfig=getValueByPath(fromObject,["generationConfig"]);parentObject!==void 0&&fromGenerationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig"],fromGenerationConfig);let fromResponseModalities=getValueByPath(fromObject,["responseModalities"]);parentObject!==void 0&&
1431
+ fromResponseModalities!=null&&setValueByPath(parentObject,["setup","generationConfig","responseModalities"],fromResponseModalities);let fromTemperature=getValueByPath(fromObject,["temperature"]);parentObject!==void 0&&fromTemperature!=null&&setValueByPath(parentObject,["setup","generationConfig","temperature"],fromTemperature);let fromTopP=getValueByPath(fromObject,["topP"]);parentObject!==void 0&&fromTopP!=null&&setValueByPath(parentObject,["setup","generationConfig","topP"],fromTopP);let fromTopK=getValueByPath(
1432
+ fromObject,["topK"]);parentObject!==void 0&&fromTopK!=null&&setValueByPath(parentObject,["setup","generationConfig","topK"],fromTopK);let fromMaxOutputTokens=getValueByPath(fromObject,["maxOutputTokens"]);parentObject!==void 0&&fromMaxOutputTokens!=null&&setValueByPath(parentObject,["setup","generationConfig","maxOutputTokens"],fromMaxOutputTokens);let fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);parentObject!==void 0&&fromMediaResolution!=null&&setValueByPath(parentObject,
1433
+ ["setup","generationConfig","mediaResolution"],fromMediaResolution);let fromSeed=getValueByPath(fromObject,["seed"]);parentObject!==void 0&&fromSeed!=null&&setValueByPath(parentObject,["setup","generationConfig","seed"],fromSeed);let fromSpeechConfig=getValueByPath(fromObject,["speechConfig"]);parentObject!==void 0&&fromSpeechConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","speechConfig"],tLiveSpeechConfig(fromSpeechConfig));let fromThinkingConfig=getValueByPath(fromObject,
1434
+ ["thinkingConfig"]);parentObject!==void 0&&fromThinkingConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","thinkingConfig"],fromThinkingConfig);let fromEnableAffectiveDialog=getValueByPath(fromObject,["enableAffectiveDialog"]);parentObject!==void 0&&fromEnableAffectiveDialog!=null&&setValueByPath(parentObject,["setup","generationConfig","enableAffectiveDialog"],fromEnableAffectiveDialog);let fromSystemInstruction=getValueByPath(fromObject,["systemInstruction"]);parentObject!==
1435
+ void 0&&fromSystemInstruction!=null&&setValueByPath(parentObject,["setup","systemInstruction"],contentToMldev(tContent(fromSystemInstruction)));let fromTools=getValueByPath(fromObject,["tools"]);if(parentObject!==void 0&&fromTools!=null){let transformedList=tTools(fromTools);Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>toolToMldev(tTool(item)))),setValueByPath(parentObject,["setup","tools"],transformedList)}let fromSessionResumption=getValueByPath(fromObject,["sessi\
1436
+ onResumption"]);parentObject!==void 0&&fromSessionResumption!=null&&setValueByPath(parentObject,["setup","sessionResumption"],sessionResumptionConfigToMldev(fromSessionResumption));let fromInputAudioTranscription=getValueByPath(fromObject,["inputAudioTranscription"]);parentObject!==void 0&&fromInputAudioTranscription!=null&&setValueByPath(parentObject,["setup","inputAudioTranscription"],fromInputAudioTranscription);let fromOutputAudioTranscription=getValueByPath(fromObject,["outputAudioTranscrip\
1437
+ tion"]);parentObject!==void 0&&fromOutputAudioTranscription!=null&&setValueByPath(parentObject,["setup","outputAudioTranscription"],fromOutputAudioTranscription);let fromRealtimeInputConfig=getValueByPath(fromObject,["realtimeInputConfig"]);parentObject!==void 0&&fromRealtimeInputConfig!=null&&setValueByPath(parentObject,["setup","realtimeInputConfig"],fromRealtimeInputConfig);let fromContextWindowCompression=getValueByPath(fromObject,["contextWindowCompression"]);parentObject!==void 0&&fromContextWindowCompression!=
1438
+ null&&setValueByPath(parentObject,["setup","contextWindowCompression"],fromContextWindowCompression);let fromProactivity=getValueByPath(fromObject,["proactivity"]);if(parentObject!==void 0&&fromProactivity!=null&&setValueByPath(parentObject,["setup","proactivity"],fromProactivity),getValueByPath(fromObject,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromAvatarConfig=getValueByPath(
1439
+ fromObject,["avatarConfig"]);parentObject!==void 0&&fromAvatarConfig!=null&&setValueByPath(parentObject,["setup","avatarConfig"],fromAvatarConfig);let fromSafetySettings=getValueByPath(fromObject,["safetySettings"]);if(parentObject!==void 0&&fromSafetySettings!=null){let transformedList=fromSafetySettings;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>safetySettingToMldev(item))),setValueByPath(parentObject,["setup","safetySettings"],transformedList)}let fromTranslationConfig=getValueByPath(
1440
+ fromObject,["translationConfig"]);parentObject!==void 0&&fromTranslationConfig!=null&&setValueByPath(parentObject,["setup","generationConfig","translationConfig"],fromTranslationConfig);let fromLabels=getValueByPath(fromObject,["labels"]);return parentObject!==void 0&&fromLabels!=null&&setValueByPath(parentObject,["setup","labels"],fromLabels),toObject}function liveConnectConstraintsToMldev(apiClient,fromObject){let toObject={},fromModel=getValueByPath(fromObject,["model"]);fromModel!=null&&setValueByPath(
1441
+ toObject,["setup","model"],tModel(apiClient,fromModel));let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&setValueByPath(toObject,["config"],liveConnectConfigToMldev(fromConfig,toObject)),toObject}function partToMldev(fromObject){let toObject={},fromMediaResolution=getValueByPath(fromObject,["mediaResolution"]);fromMediaResolution!=null&&setValueByPath(toObject,["mediaResolution"],fromMediaResolution);let fromToolCall=getValueByPath(fromObject,["toolCall"]);fromToolCall!=
1442
+ null&&setValueByPath(toObject,["toolCall"],fromToolCall);let fromToolResponse=getValueByPath(fromObject,["toolResponse"]);fromToolResponse!=null&&setValueByPath(toObject,["toolResponse"],fromToolResponse);let fromAudioTranscription=getValueByPath(fromObject,["audioTranscription"]);fromAudioTranscription!=null&&setValueByPath(toObject,["audioTranscription"],fromAudioTranscription);let fromCodeExecutionResult=getValueByPath(fromObject,["codeExecutionResult"]);fromCodeExecutionResult!=null&&setValueByPath(
1443
+ toObject,["codeExecutionResult"],fromCodeExecutionResult);let fromExecutableCode=getValueByPath(fromObject,["executableCode"]);fromExecutableCode!=null&&setValueByPath(toObject,["executableCode"],fromExecutableCode);let fromFileData=getValueByPath(fromObject,["fileData"]);fromFileData!=null&&setValueByPath(toObject,["fileData"],fromFileData);let fromFunctionCall=getValueByPath(fromObject,["functionCall"]);fromFunctionCall!=null&&setValueByPath(toObject,["functionCall"],functionCallToMldev(fromFunctionCall));
1444
+ let fromFunctionResponse=getValueByPath(fromObject,["functionResponse"]);fromFunctionResponse!=null&&setValueByPath(toObject,["functionResponse"],fromFunctionResponse);let fromInlineData=getValueByPath(fromObject,["inlineData"]);fromInlineData!=null&&setValueByPath(toObject,["inlineData"],fromInlineData);let fromText=getValueByPath(fromObject,["text"]);fromText!=null&&setValueByPath(toObject,["text"],fromText);let fromThought=getValueByPath(fromObject,["thought"]);fromThought!=null&&setValueByPath(
1445
+ toObject,["thought"],fromThought);let fromThoughtSignature=getValueByPath(fromObject,["thoughtSignature"]);fromThoughtSignature!=null&&setValueByPath(toObject,["thoughtSignature"],fromThoughtSignature);let fromVideoMetadata=getValueByPath(fromObject,["videoMetadata"]);fromVideoMetadata!=null&&setValueByPath(toObject,["videoMetadata"],fromVideoMetadata);let fromPartMetadata=getValueByPath(fromObject,["partMetadata"]);fromPartMetadata!=null&&setValueByPath(toObject,["partMetadata"],fromPartMetadata);
1446
+ let fromMediaProcessing=getValueByPath(fromObject,["mediaProcessing"]);fromMediaProcessing!=null&&setValueByPath(toObject,["mediaProcessing"],fromMediaProcessing);let fromSpeechMetadata=getValueByPath(fromObject,["speechMetadata"]);return fromSpeechMetadata!=null&&setValueByPath(toObject,["speechMetadata"],fromSpeechMetadata),toObject}function safetySettingToMldev(fromObject){let toObject={},fromCategory=getValueByPath(fromObject,["category"]);if(fromCategory!=null&&setValueByPath(toObject,["cat\
1447
+ egory"],fromCategory),getValueByPath(fromObject,["method"])!==void 0)throw new Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromThreshold=getValueByPath(fromObject,["threshold"]);return fromThreshold!=null&&setValueByPath(toObject,["threshold"],fromThreshold),toObject}function sessionResumptionConfigToMldev(fromObject){let toObject={},fromHandle=getValueByPath(fromObject,["handle"]);if(fromHandle!=null&&setValueByPath(
1448
+ toObject,["handle"],fromHandle),getValueByPath(fromObject,["transparent"])!==void 0)throw new Error("transparent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return toObject}function toolToMldev(fromObject){let toObject={};if(getValueByPath(fromObject,["retrieval"])!==void 0)throw new Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromGoogleMaps=getValueByPath(
1449
+ fromObject,["googleMaps"]);fromGoogleMaps!=null&&setValueByPath(toObject,["googleMaps"],googleMapsToMldev(fromGoogleMaps));let fromMcpServers=getValueByPath(fromObject,["mcpServers"]);if(fromMcpServers!=null){let transformedList=fromMcpServers;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["mcpServers"],transformedList)}let fromCodeExecution=getValueByPath(fromObject,["codeExecution"]);fromCodeExecution!=null&&setValueByPath(toObject,["\
1450
+ codeExecution"],fromCodeExecution);let fromComputerUse=getValueByPath(fromObject,["computerUse"]);if(fromComputerUse!=null&&setValueByPath(toObject,["computerUse"],fromComputerUse),getValueByPath(fromObject,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(getValueByPath(fromObject,["exaAiSearch"])!==void 0)throw new Error("exaAiSearch parameter is only supported in G\
1451
+ emini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromFunctionDeclarations=getValueByPath(fromObject,["functionDeclarations"]);if(fromFunctionDeclarations!=null){let transformedList=fromFunctionDeclarations;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["functionDeclarations"],transformedList)}let fromGoogleSearch=getValueByPath(fromObject,["googleSearch"]);fromGoogleSearch!=null&&setValueByPath(toObject,["go\
1452
+ ogleSearch"],googleSearchToMldev(fromGoogleSearch));let fromGoogleSearchRetrieval=getValueByPath(fromObject,["googleSearchRetrieval"]);if(fromGoogleSearchRetrieval!=null&&setValueByPath(toObject,["googleSearchRetrieval"],fromGoogleSearchRetrieval),getValueByPath(fromObject,["parallelAiSearch"])!==void 0)throw new Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let fromUrlContext=getValueByPath(fromObject,["urlConte\
1453
+ xt"]);fromUrlContext!=null&&setValueByPath(toObject,["urlContext"],fromUrlContext);let fromFileSearch=getValueByPath(fromObject,["fileSearch"]);return fromFileSearch!=null&&setValueByPath(toObject,["fileSearch"],fromFileSearch),toObject}function getFieldMasks(setup){let fields=[];for(let key in setup)if(Object.prototype.hasOwnProperty.call(setup,key)){let value=setup[key];if(typeof value=="object"&&value!=null&&Object.keys(value).length>0){let field=Object.keys(value).map(kk=>`${key}.${kk}`);fields.
1454
+ push(...field)}else fields.push(key)}return fields.join(",")}function convertBidiSetupToTokenSetup(requestDict,config){let setupForMaskGeneration=null,bidiGenerateContentSetupValue=requestDict.bidiGenerateContentSetup;if(typeof bidiGenerateContentSetupValue=="object"&&bidiGenerateContentSetupValue!==null&&"setup"in bidiGenerateContentSetupValue){let innerSetup=bidiGenerateContentSetupValue.setup;typeof innerSetup=="object"&&innerSetup!==null?(requestDict.bidiGenerateContentSetup=innerSetup,setupForMaskGeneration=
1455
+ innerSetup):delete requestDict.bidiGenerateContentSetup}else bidiGenerateContentSetupValue!==void 0&&delete requestDict.bidiGenerateContentSetup;let preExistingFieldMask=requestDict.fieldMask;if(setupForMaskGeneration){let generatedMaskFromBidi=getFieldMasks(setupForMaskGeneration);if(Array.isArray(config?.lockAdditionalFields)&&config?.lockAdditionalFields.length===0)generatedMaskFromBidi?requestDict.fieldMask=generatedMaskFromBidi:delete requestDict.fieldMask;else if(config?.lockAdditionalFields&&
1456
+ config.lockAdditionalFields.length>0&&preExistingFieldMask!==null&&Array.isArray(preExistingFieldMask)&&preExistingFieldMask.length>0){let generationConfigFields=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"],mappedFieldsFromPreExisting=[];preExistingFieldMask.length>0&&(mappedFieldsFromPreExisting=preExistingFieldMask.map(field=>generationConfigFields.includes(field)?`generationConfig.${field}`:field));let finalMaskParts=[];generatedMaskFromBidi&&finalMaskParts.
1457
+ push(generatedMaskFromBidi),mappedFieldsFromPreExisting.length>0&&finalMaskParts.push(...mappedFieldsFromPreExisting),finalMaskParts.length>0?requestDict.fieldMask=finalMaskParts.join(","):delete requestDict.fieldMask}else delete requestDict.fieldMask}else preExistingFieldMask!==null&&Array.isArray(preExistingFieldMask)&&preExistingFieldMask.length>0?requestDict.fieldMask=preExistingFieldMask.join(","):delete requestDict.fieldMask;return requestDict}var Tokens=class extends BaseModule{constructor(apiClient){
1458
+ super(),this.apiClient=apiClient}async create(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{let body=createAuthTokenParametersToMldev(this.apiClient,params);path2=formatMap("auth_tokens",body._url),queryParams=body._query,delete body.config,delete body._url,delete body._query;let transformedBody=convertBidiSetupToTokenSetup(body,params.config);return response=
1459
+ this.apiClient.request({path:path2,queryParams,body:JSON.stringify(transformedBody),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}};function deleteDocumentConfigToMldev(fromObject,parentObject){let toObject={},fromForce=getValueByPath(fromObject,["force"]);return parentObject!==void 0&&fromForce!=null&&setValueByPath(
1460
+ parentObject,["_query","force"],fromForce),toObject}function deleteDocumentParametersToMldev(fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);fromName!=null&&setValueByPath(toObject,["_url","name"],fromName);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&deleteDocumentConfigToMldev(fromConfig,toObject),toObject}function getDocumentParametersToMldev(fromObject){let toObject={},fromName=getValueByPath(fromObject,["name"]);return fromName!=null&&
1461
+ setValueByPath(toObject,["_url","name"],fromName),toObject}function listDocumentsConfigToMldev(fromObject,parentObject){let toObject={},fromPageSize=getValueByPath(fromObject,["pageSize"]);parentObject!==void 0&&fromPageSize!=null&&setValueByPath(parentObject,["_query","pageSize"],fromPageSize);let fromPageToken=getValueByPath(fromObject,["pageToken"]);return parentObject!==void 0&&fromPageToken!=null&&setValueByPath(parentObject,["_query","pageToken"],fromPageToken),toObject}function listDocumentsParametersToMldev(fromObject){
1462
+ let toObject={},fromParent=getValueByPath(fromObject,["parent"]);fromParent!=null&&setValueByPath(toObject,["_url","parent"],fromParent);let fromConfig=getValueByPath(fromObject,["config"]);return fromConfig!=null&&listDocumentsConfigToMldev(fromConfig,toObject),toObject}function listDocumentsResponseFromMldev(fromObject){let toObject={},fromSdkHttpResponse=getValueByPath(fromObject,["sdkHttpResponse"]);fromSdkHttpResponse!=null&&setValueByPath(toObject,["sdkHttpResponse"],fromSdkHttpResponse);let fromNextPageToken=getValueByPath(
1463
+ fromObject,["nextPageToken"]);fromNextPageToken!=null&&setValueByPath(toObject,["nextPageToken"],fromNextPageToken);let fromDocuments=getValueByPath(fromObject,["documents"]);if(fromDocuments!=null){let transformedList=fromDocuments;Array.isArray(transformedList)&&(transformedList=transformedList.map(item=>item)),setValueByPath(toObject,["documents"],transformedList)}return toObject}var Documents=class extends BaseModule{constructor(apiClient){super(),this.apiClient=apiClient,this.list=async params=>new Pager(
1464
+ PagedItem.PAGED_ITEM_DOCUMENTS,x=>this.listInternal({parent:params.parent,config:x.config}),await this.listInternal(params),params)}async get(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=getDocumentParametersToMldev(params);return path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,
1465
+ queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async delete(params){var _a2,_b;let path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=deleteDocumentParametersToMldev(params);path2=formatMap(
1466
+ "{name}",body._url),queryParams=body._query,delete body._url,delete body._query,await this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal})}}async listInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini De\
1467
+ veloper API.");{let body=listDocumentsParametersToMldev(params);return path2=formatMap("{parent}/documents",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=listDocumentsResponseFromMldev(
1468
+ apiResponse),typedResp=new ListDocumentsResponse;return Object.assign(typedResp,resp),typedResp})}}};var FileSearchStores=class extends BaseModule{constructor(apiClient,documents=new Documents(apiClient)){super(),this.apiClient=apiClient,this.documents=documents,this.list=async(params={})=>new Pager(PagedItem.PAGED_ITEM_FILE_SEARCH_STORES,x=>this.listInternal(x),await this.listInternal(params),params)}async uploadToFileSearchStore(params){if(this.apiClient.isVertexAI())throw new Error("Gemini En\
1469
+ terprise Agent Platform (previously known as Vertex AI) does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(params.fileSearchStoreName,params.file,params.config)}async downloadMedia(uri,config){if(this.apiClient.isVertexAI())throw new Error("This method is only supported in the Gemini Developer client.");let parsedUri=new URL(uri,"http://dummy.com"),pathname=parsedUri.pathname;if(pathname.startsWith("/")&&(pathname=pathname.slice(1)),!pathname.
1470
+ includes("/media/"))throw new Error(`Invalid uri format: ${uri}. Expected to contain /media/`);let queryParams={};parsedUri.searchParams.forEach((value,key)=>{queryParams[key]=value}),queryParams.alt="media";let httpOptions=Object.assign({},config?.httpOptions),response=await this.apiClient.request({path:pathname,httpMethod:"GET",queryParams,httpOptions});if(response instanceof HttpResponse){let arrayBuffer=await response.responseInternal.arrayBuffer();return new Uint8Array(arrayBuffer)}else throw new Error(
1471
+ "Unexpected response type from downloadMedia")}async create(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=createFileSearchStoreParametersToMldev(this.apiClient,params);return path2=formatMap("fileSearchStores",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"\
1472
+ POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async get(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=getFileSearchStoreParametersToMldev(params);return path2=formatMap("{name}",body._url),queryParams=
1473
+ body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(resp=>resp)}}async delete(params){var _a2,_b;let path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only support\
1474
+ ed by the Gemini Developer API.");{let body=deleteFileSearchStoreParametersToMldev(params);path2=formatMap("{name}",body._url),queryParams=body._query,delete body._url,delete body._query,await this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"DELETE",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal})}}async listInternal(params){var _a2,_b;let response,path2="",queryParams={};
1475
+ if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=listFileSearchStoresParametersToMldev(params);return path2=formatMap("fileSearchStores",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"GET",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?
1476
+ void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=listFileSearchStoresResponseFromMldev(apiResponse),typedResp=new ListFileSearchStoresResponse;return Object.assign(typedResp,resp),typedResp})}}async uploadToFileSearchStoreInternal(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=uploadToFileSearchStoreParametersToMldev(params);
1477
+ return path2=formatMap("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=uploadToFileSearchStoreResumableResponseFromMldev(
1478
+ apiResponse),typedResp=new UploadToFileSearchStoreResumableResponse;return Object.assign(typedResp,resp),typedResp})}}async importFile(params){var _a2,_b;let response,path2="",queryParams={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let body=importFileParametersToMldev(params);return path2=formatMap("{file_search_store_name}:importFile",body._url),queryParams=body._query,delete body._url,delete body._query,response=this.apiClient.
1479
+ request({path:path2,queryParams,body:JSON.stringify(body),httpMethod:"POST",httpOptions:(_a2=params.config)===null||_a2===void 0?void 0:_a2.httpOptions,abortSignal:(_b=params.config)===null||_b===void 0?void 0:_b.abortSignal}).then(httpResponse=>httpResponse.json()),response.then(apiResponse=>{let resp=importFileOperationFromMldev(apiResponse),typedResp=new ImportFileOperation;return Object.assign(typedResp,resp),typedResp})}}};function isDeno(){return"Deno"in globalThis}var envMemo;function env(){
1480
+ var _a2,_b,_c,_d,_e,_f;if(envMemo)return envMemo;let globals=globalThis,envObject={};return isDeno()?envObject=(_d=(_c=(_b=(_a2=globals.Deno)===null||_a2===void 0?void 0:_a2.env)===null||_b===void 0?void 0:_b.toObject)===null||_c===void 0?void 0:_c.call(_b))!==null&&_d!==void 0?_d:{}:envObject=(_f=(_e=globals.process)===null||_e===void 0?void 0:_e.env)!==null&&_f!==void 0?_f:{},envMemo=envObject,envMemo}function fillGlobals(options){var _a2,_b;let clone=Object.assign({},options),envVars=env();return typeof envVars.
1481
+ GOOGLE_GENAI_API_VERSION<"u"&&((_a2=clone.api_version)!==null&&_a2!==void 0||(clone.api_version=envVars.GOOGLE_GENAI_API_VERSION)),typeof envVars.GOOGLE_GENAI_USER_PROJECT<"u"&&((_b=clone.user_project)!==null&&_b!==void 0||(clone.user_project=envVars.GOOGLE_GENAI_USER_PROJECT)),clone}var UNDICI_GLOBAL_DISPATCHER_SYMBOL=Symbol.for("undici.globalDispatcher.1"),GoogleGenAISecurityProvider=class{constructor(options){this.options=options}getDefaultHeaders(){return this.options.defaultHeaders}async resolveGoogleGenAISecurity(url){
1482
+ return securityFromHeaders(await this.options.getAuthHeaders(url))}},GoogleGenAIAuthHook=class{beforeCreateRequest(hookCtx,input){var _a2;let options=Object.assign({},(_a2=input.options)!==null&&_a2!==void 0?_a2:{});return isNodeRuntime()&&!hasCustomHttpClient(hookCtx.options.http_client)&&!("dispatcher"in options)&&(options.dispatcher=createUndiciNoTimeoutDispatcher()),Object.assign(Object.assign({},input),{url:decodeSDKLevelAPIVersionPath(input.url),options})}async beforeRequest(hookCtx,request){
1483
+ if(applyDefaultHeaders(request.headers,getStaticDefaultHeaders(hookCtx.security_source)),applyUserProject(hookCtx,request.headers),hasAuthHeaders(request.headers))return request;let security=await resolveSecurity$1(hookCtx.security_source,request.url);return applyDefaultHeaders(request.headers,security?.default_headers),applyAuth(request.headers,security),request}};function decodeSDKLevelAPIVersionPath(url){let[,apiVersion,...rest]=url.pathname.split("/");if(!apiVersion)return url;let decodedAPIVersion=decodeURIComponent(
1484
+ apiVersion);if(!decodedAPIVersion.includes("/"))return url;let nextURL=new URL(url);return nextURL.pathname=`/${decodedAPIVersion}/${rest.join("/")}`,nextURL}async function resolveSecurity$1(securitySource,requestURL){if(isSecurityResolver(securitySource))return securitySource.resolveGoogleGenAISecurity(requestURL);let security=typeof securitySource=="function"?await securitySource():securitySource;return isSecurity(security)?withEnvSecurity(security):withEnvSecurity(void 0)}function getStaticDefaultHeaders(securitySource){
1485
+ var _a2,_b;if(isSecurityResolver(securitySource))return(_b=(_a2=securitySource.getDefaultHeaders)===null||_a2===void 0?void 0:_a2.call(securitySource))!==null&&_b!==void 0?_b:securitySource.defaultHeaders;if(isSecurity(securitySource))return securitySource.default_headers}function withEnvSecurity(security){var _a2,_b;let envVars=env(),nextSecurity=Object.assign(Object.assign({},security),{api_key:(_a2=security?.api_key)!==null&&_a2!==void 0?_a2:envVars.GOOGLE_GENAI_API_KEY,access_token:(_b=security?.
1486
+ access_token)!==null&&_b!==void 0?_b:envVars.GOOGLE_GENAI_ACCESS_TOKEN});return hasSecurityValue(nextSecurity)?nextSecurity:void 0}function securityFromHeaders(headers){var _a2,_b;let defaultHeaders={};for(let[key,value]of headers){let lowerKey=key.toLowerCase();lowerKey!=="authorization"&&lowerKey!=="x-goog-api-key"&&(defaultHeaders[key]=value)}let security={access_token:(_a2=headers.get("authorization"))!==null&&_a2!==void 0?_a2:void 0,api_key:(_b=headers.get("x-goog-api-key"))!==null&&_b!==void 0?
1487
+ _b:void 0,default_headers:Object.keys(defaultHeaders).length?defaultHeaders:void 0};return hasSecurityValue(security)?security:void 0}function applyDefaultHeaders(target,source){if(source)for(let[key,value]of new Headers(source))target.get(key)===null&&target.set(key,value)}function applyUserProject(hookCtx,headers){hookCtx.options.user_project!==void 0&&headers.get("x-goog-user-project")===null&&headers.set("x-goog-user-project",hookCtx.options.user_project)}function applyAuth(headers,security){
1488
+ if(security){if(security.api_key){headers.set("x-goog-api-key",security.api_key);return}security.access_token&&headers.set("Authorization",bearer(security.access_token))}}function hasAuthHeaders(headers){return headers.get("authorization")!==null||headers.get("x-goog-api-key")!==null}function bearer(token){return token.slice(0,7).toLowerCase()==="bearer "?token:`Bearer ${token}`}function isSecurity(value){return typeof value=="object"&&value!==null}function isSecurityResolver(value){return typeof value==
1489
+ "object"&&value!==null&&"resolveGoogleGenAISecurity"in value&&typeof value.resolveGoogleGenAISecurity=="function"}function hasSecurityValue(security){return security.api_key!==void 0||security.access_token!==void 0||security.default_headers!==void 0}function isNodeRuntime(){var _a2,_b;return typeof((_b=(_a2=globalThis.process)===null||_a2===void 0?void 0:_a2.versions)===null||_b===void 0?void 0:_b.node)=="string"}function hasCustomHttpClient(httpClient){if(!httpClient||typeof httpClient!="object")
1490
+ return!1;if("options"in httpClient){let opts=httpClient.options;return!!opts?.fetcher}return!0}function createUndiciNoTimeoutDispatcher(){return{dispatch(opts,handler){let globalDispatcher=globalThis[UNDICI_GLOBAL_DISPATCHER_SYMBOL];if(!globalDispatcher||typeof globalDispatcher.dispatch!="function")throw new TypeError("Undici globalDispatcher is not available in this Node.js runtime.");return globalDispatcher.dispatch(Object.assign(Object.assign({},opts),{headersTimeout:0,bodyTimeout:0}),handler)}}}
1491
+ var HTTPClientError=class extends Error{constructor(message,opts){let msg=message;opts?.cause&&(msg+=`: ${opts.cause}`),super(msg,opts),this.name="HTTPClientError",typeof this.cause>"u"&&(this.cause=opts?.cause)}},UnexpectedClientError=class extends HTTPClientError{constructor(){super(...arguments),this.name="UnexpectedClientError"}},InvalidRequestError=class extends HTTPClientError{constructor(){super(...arguments),this.name="InvalidRequestError"}},RequestAbortedError=class extends HTTPClientError{constructor(){
1492
+ super(...arguments),this.name="RequestAbortedError"}},RequestTimeoutError=class extends HTTPClientError{constructor(){super(...arguments),this.name="RequestTimeoutError"}},ConnectionError=class extends HTTPClientError{constructor(){super(...arguments),this.name="ConnectionError"}};var GoogleGenAiError=class extends Error{constructor(message,httpMeta){var _a2,_b,_c,_d;super(message),this.statusCode=(_a2=httpMeta?.response)===null||_a2===void 0?void 0:_a2.status,this.body=(_b=httpMeta?.body)!==null&&
1493
+ _b!==void 0?_b:"",this.headers=(_c=httpMeta?.response)===null||_c===void 0?void 0:_c.headers,this.contentType=((_d=httpMeta?.response)===null||_d===void 0?void 0:_d.headers.get("content-type"))||"",this.rawResponse=httpMeta?.response,this.name="GoogleGenAiError",Object.setPrototypeOf(this,new.target.prototype)}};var GeminiNextGenAPIClientError=class extends Error{constructor(message){super(message),this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}},APIError=class _APIError extends GeminiNextGenAPIClientError{constructor(status,error,message,headers){
1502
1494
  super(_APIError.makeMessage(status,error,message)),this.status=status,this.headers=headers,this.error=error,this.statusCode=status,this.body=stringifyErrorBody(error),this.contentType=headers?.get("content-type")||"",this.rawResponse=void 0,this.cause=void 0,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}static makeMessage(status,error,message){var _a2;let errorMessage=error&&isPlainObject$2(error)&&typeof error.message=="string"?error.message:void 0,errorBody=stringifyErrorBody(
1503
1495
  error),msg=(_a2=errorMessage??message)!==null&&_a2!==void 0?_a2:errorBody||"An error occurred";return`${status?`${status} `:""}${msg}`}static generate(status,errorResponse,message,headers){return!status||!headers?new APIConnectionError({message,cause:errorResponse instanceof Error?errorResponse:void 0}):status===400?new BadRequestError(status,errorResponse,message,headers):status===401?new AuthenticationError(status,errorResponse,message,headers):status===403?new PermissionDeniedError(status,errorResponse,
1504
1496
  message,headers):status===404?new NotFoundError(status,errorResponse,message,headers):status===409?new ConflictError(status,errorResponse,message,headers):status===422?new UnprocessableEntityError(status,errorResponse,message,headers):status===429?new RateLimitError(status,errorResponse,message,headers):status>=500?new InternalServerError(status,errorResponse,message,headers):new _APIError(status,errorResponse,message,headers)}},APIUserAbortError=class extends APIError{constructor({message}={}){
1505
1497
  super(void 0,void 0,message||"Request was aborted.",void 0)}},APIConnectionError=class extends APIError{constructor({message,cause}){super(void 0,void 0,message||"Connection error.",void 0),this.cause=cause}},APIConnectionTimeoutError=class extends APIConnectionError{constructor({message}={}){super({message:message||"Request timed out. This is a client-side timeout. You can increase the timeout by setting the `timeout` argument in your request or client http options."})}},BadRequestError=class extends APIError{},
1506
- AuthenticationError=class extends APIError{},PermissionDeniedError=class extends APIError{},NotFoundError=class extends APIError{},ConflictError=class extends APIError{},UnprocessableEntityError=class extends APIError{},RateLimitError=class extends APIError{},InternalServerError=class extends APIError{};function wrapSDKError(error){return isCompatAPIErrorInstance(error)?error:error instanceof GoogleGenAiError?wrapAPIError(error):error instanceof HTTPClientError?wrapHTTPClientError(error):error}function wrapAPIError(error){
1507
- let errorPayload=getErrorPayload(error),wrapped=APIError.generate(error.statusCode,errorPayload,error.message,error.headers);return defineReadonly(wrapped,"body",error.body),defineReadonly(wrapped,"contentType",error.contentType),defineReadonly(wrapped,"rawResponse",error.rawResponse),defineReadonly(wrapped,"statusCode",error.statusCode),defineReadonly(wrapped,"cause",error),wrapped}function wrapHTTPClientError(error){return error instanceof RequestTimeoutError?new APIConnectionTimeoutError({message:error.
1508
- message}):error instanceof RequestAbortedError?new APIUserAbortError({message:error.message}):error instanceof ConnectionError?new APIConnectionError({message:error.message,cause:error}):new APIConnectionError({message:error.message,cause:error})}function getErrorPayload(error){let data=getObjectProperty(error,"data$");if(data&&typeof data=="object")return data;try{let parsed=JSON.parse(error.body);if(parsed&&typeof parsed=="object")return parsed}catch{}let dataError=getObjectProperty(error,"err\
1509
- or");return dataError&&typeof dataError=="object"?dataError:void 0}function getObjectProperty(value,key){return value&&typeof value=="object"?value[key]:void 0}function stringifyErrorBody(error){if(!error)return"";try{return JSON.stringify(error)}catch{return String(error)}}function isPlainObject$2(value){return value!==null&&typeof value=="object"&&!Array.isArray(value)}function isCompatAPIErrorInstance(value){return typeof value=="object"&&value!==null?APIError.prototype.isPrototypeOf(value):!1}
1510
- function defineReadonly(target,key,value){Object.defineProperty(target,key,{configurable:!0,enumerable:!0,value,writable:!1})}var DEFAULT_FETCHER=(input,init)=>init==null?fetch(input):fetch(input,init),HTTPClient=class _HTTPClient{constructor(options={}){this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.options=options,this.fetcher=options.fetcher||DEFAULT_FETCHER}async request(request){let req=request;for(let hook of this.requestHooks){let nextRequest=await hook(req);nextRequest&&
1511
- (req=nextRequest)}try{let res=await this.fetcher(req);for(let hook of this.responseHooks)await hook(res,req);return res}catch(err){for(let hook of this.requestErrorHooks)await hook(err,req);throw err}}addHook(...args){if(args[0]==="beforeRequest")this.requestHooks.push(args[1]);else if(args[0]==="requestError")this.requestErrorHooks.push(args[1]);else if(args[0]==="response")this.responseHooks.push(args[1]);else throw new Error(`Invalid hook type: ${args[0]}`);return this}removeHook(...args){let target;
1512
- if(args[0]==="beforeRequest")target=this.requestHooks;else if(args[0]==="requestError")target=this.requestErrorHooks;else if(args[0]==="response")target=this.responseHooks;else throw new Error(`Invalid hook type: ${args[0]}`);let index=target.findIndex(v=>v===args[1]);return index>=0&&target.splice(index,1),this}clone(){let child=new _HTTPClient(this.options);return child.requestHooks=this.requestHooks.slice(),child.requestErrorHooks=this.requestErrorHooks.slice(),child.responseHooks=this.responseHooks.
1513
- slice(),child}},mediaParamSeparator=/\s*;\s*/g;function matchContentType(response,pattern){var _a2;if(pattern==="*")return!0;let contentType=((_a2=response.headers.get("content-type"))===null||_a2===void 0?void 0:_a2.trim())||"application/octet-stream";contentType=contentType.toLowerCase();let wantParts=pattern.toLowerCase().trim().split(mediaParamSeparator),[wantType="",...wantParams]=wantParts;if(wantType.split("/").length!==2)return!1;let gotParts=contentType.split(mediaParamSeparator),[gotType="",
1514
- ...gotParams]=gotParts,[type="",subtype=""]=gotType.split("/");if(!type||!subtype||wantType!=="*/*"&&gotType!==wantType&&`${type}/*`!==wantType&&`*/${subtype}`!==wantType||gotParams.length<wantParams.length)return!1;let params=new Set(gotParams);for(let wantParam of wantParams)if(!params.has(wantParam))return!1;return!0}var codeRangeRE$1=new RegExp("^[0-9]xx$","i");function matchStatusCode(response,codes){let actual=`${response.status}`,expectedCodes=Array.isArray(codes)?codes:[codes];return expectedCodes.
1515
- length?expectedCodes.some(ec=>{let code=`${ec}`;if(code==="default")return!0;if(!codeRangeRE$1.test(`${code}`))return code===actual;let expectFamily=code.charAt(0);if(!expectFamily)throw new Error("Invalid status code range");let actualFamily=actual.charAt(0);if(!actualFamily)throw new Error(`Invalid response status code: ${actual}`);return actualFamily===expectFamily}):!1}function matchResponse(response,code,contentTypePattern){return matchStatusCode(response,code)&&matchContentType(response,contentTypePattern)}
1516
- function isConnectionError(err){if(typeof err!="object"||err==null)return!1;let isBrowserErr=err instanceof TypeError&&err.message.toLowerCase().startsWith("failed to fetch"),isNodeErr=err instanceof TypeError&&err.message.toLowerCase().startsWith("fetch failed"),isBunErr="name"in err&&err.name==="ConnectionError",isGenericErr="code"in err&&typeof err.code=="string"&&err.code.toLowerCase()==="econnreset";return isBrowserErr||isNodeErr||isGenericErr||isBunErr}function isTimeoutError(err){if(typeof err!=
1517
- "object"||err==null)return!1;let isNative="name"in err&&err.name==="TimeoutError",isLegacyNative="code"in err&&err.code===23,isGenericErr="code"in err&&typeof err.code=="string"&&err.code.toLowerCase()==="econnaborted";return isNative||isLegacyNative||isGenericErr}function isAbortError(err){if(typeof err!="object"||err==null)return!1;let isNative="name"in err&&err.name==="AbortError",isLegacyNative="code"in err&&err.code===20,isGenericErr="code"in err&&typeof err.code=="string"&&err.code.toLowerCase()===
1518
- "econnaborted";return isNative||isLegacyNative||isGenericErr}function initHooks(hooks){let googleGenAIAuthHook=new GoogleGenAIAuthHook;hooks.registerBeforeCreateRequestHook(googleGenAIAuthHook),hooks.registerBeforeRequestHook(googleGenAIAuthHook)}var SDKHooks=class{constructor(){this.sdkInitHooks=[],this.beforeCreateRequestHooks=[],this.beforeRequestHooks=[],this.afterSuccessHooks=[],this.afterErrorHooks=[];let presetHooks=[];for(let hook of presetHooks)"sdkInit"in hook&&this.registerSDKInitHook(
1519
- hook),"beforeCreateRequest"in hook&&this.registerBeforeCreateRequestHook(hook),"beforeRequest"in hook&&this.registerBeforeRequestHook(hook),"afterSuccess"in hook&&this.registerAfterSuccessHook(hook),"afterError"in hook&&this.registerAfterErrorHook(hook);initHooks(this)}registerSDKInitHook(hook){this.sdkInitHooks.push(hook)}registerBeforeCreateRequestHook(hook){this.beforeCreateRequestHooks.push(hook)}registerBeforeRequestHook(hook){this.beforeRequestHooks.push(hook)}registerAfterSuccessHook(hook){
1520
- this.afterSuccessHooks.push(hook)}registerAfterErrorHook(hook){this.afterErrorHooks.push(hook)}sdkInit(opts){return this.sdkInitHooks.reduce((opts2,hook)=>hook.sdkInit(opts2),opts)}beforeCreateRequest(hookCtx,input){let inp=input;for(let hook of this.beforeCreateRequestHooks)inp=hook.beforeCreateRequest(hookCtx,inp);return inp}async beforeRequest(hookCtx,request){let req=request;for(let hook of this.beforeRequestHooks)req=await hook.beforeRequest(hookCtx,req);return req}async afterSuccess(hookCtx,response){
1521
- let res=response;for(let hook of this.afterSuccessHooks)res=await hook.afterSuccess(hookCtx,res);return res}async afterError(hookCtx,response,error){let res=response,err=error;for(let hook of this.afterErrorHooks){let result=await hook.afterError(hookCtx,res,err);res=result.response,err=result.error}return{response:res,error:err}}};function OK(value){return{ok:!0,value}}function ERR(error){return{ok:!1,error}}function bytesToBase64(u8arr){return btoa(String.fromCodePoint(...u8arr))}function stringToBytes(str){
1522
- return new TextEncoder().encode(str)}function stringToBase64(str){return bytesToBase64(stringToBytes(str))}var hasOwn=Object.prototype.hasOwnProperty;function pathToFunc(pathPattern,options){let paramRE=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(params={}){return pathPattern.replace(paramRE,function(_,placeholder){if(!hasOwn.call(params,placeholder))throw new Error(`Parameter '${placeholder}' is required`);let value=params[placeholder];if(typeof value!="string"&&typeof value!="number")
1523
- throw new Error(`Parameter '${placeholder}' must be a string or number`);return`${value}`}).replace(/^\/+/,"")}}var ServerList=["https://generativelanguage.googleapis.com"];function serverURLFromOptions(options){var _a2;let serverURL=options.server_url,params={};if(!serverURL){let serverIdx=(_a2=options.server_idx)!==null&&_a2!==void 0?_a2:0;if(serverIdx<0||serverIdx>=ServerList.length)throw new Error(`Invalid server index ${serverIdx}`);serverURL=ServerList[serverIdx]||""}let u=pathToFunc(serverURL)(
1524
- params);return new URL(u)}var SDK_METADATA={userAgent:"speakeasy-sdk/typescript 2.4.1-preview.4 internal v1beta @google/genai"};function combineSignals(...signals){let filtered=[];for(let signal of signals)signal&&filtered.push(signal);switch(filtered.length){case 0:case 1:return filtered[0]||null;default:return"any"in AbortSignal&&typeof AbortSignal.any=="function"?AbortSignal.any(filtered):abortSignalAny(filtered)}}function abortSignalAny(signals){let controller=new AbortController,result=controller.
1525
- signal;if(!signals.length)return controller.signal;if(signals.length===1)return signals[0]||controller.signal;for(let signal of signals)if(signal.aborted)return signal;function abort(){controller.abort(this.reason),clean()}let signalRefs=[];function clean(){for(let signalRef of signalRefs){let signal=signalRef.deref();signal&&signal.removeEventListener("abort",abort)}}for(let signal of signals)signalRefs.push(new WeakRef(signal)),signal.addEventListener("abort",abort);return result}function compactMap(values){
1526
- let out={};for(let[k,v]of Object.entries(values))typeof v<"u"&&(out[k]=v);return out}function isPlainObject$1(value){if(value===null||typeof value!="object"||Object.prototype.toString.call(value)!=="[object Object]")return!1;let proto=Object.getPrototypeOf(value);if(proto===null||proto===Object.prototype)return!0;try{return Object.getPrototypeOf(proto)===null}catch{return!1}}var reservedEscapes=/%(2[346bcf]|3[abdf]|40|5[bd])/gi;function encodeKeyChars(v,charEncoding){return encodeChars(v,charEncoding===
1527
- "percentExceptReserved"?"percent":charEncoding)}function encodeChars(v,charEncoding){switch(charEncoding){case"percent":return encodeURIComponent(v);case"percentExceptReserved":return encodeURIComponent(v).replace(reservedEscapes,m=>decodeURIComponent(m));default:return v}}function formEncoder(sep){return(key,value,options)=>{let out="",pairs=options?.explode?explode(key,value):[[key,value]];if(pairs.every(([_,v])=>v==null))return;let encodeString=v=>encodeChars(v,options?.charEncoding),encodeValue=v=>encodeString(
1528
- serializeValue(v)),encodedSep=encodeString(sep);return pairs.forEach(([pk,pv])=>{var _a2,_b;let tmp="",encValue=null;pv!=null&&(Array.isArray(pv)?encValue=(_a2=mapDefined(pv,v=>`${encodeValue(v)}`))===null||_a2===void 0?void 0:_a2.join(encodedSep):isPlainObject$1(pv)?encValue=(_b=mapDefinedEntries(Object.entries(pv),([k,v])=>`${encodeString(k)}${encodedSep}${encodeValue(v)}`))===null||_b===void 0?void 0:_b.join(encodedSep):encValue=`${encodeValue(pv)}`,encValue!=null&&(tmp=`${encodeKeyChars(pk,options?.
1529
- charEncoding)}=${encValue}`,!(!tmp||tmp==="=")&&(out+=`&${tmp}`)))}),out.slice(1)}}var encodeForm=formEncoder(",");function encodeJSON(key,value,options){if(typeof value>"u")return;let encVal=(v=>encodeChars(v,options?.charEncoding))(JSON.stringify(value,jsonReplacer));return options?.explode?encVal:`${encodeKeyChars(key,options?.charEncoding)}=${encVal}`}var encodeSimple=(key,value,options)=>{let out="",pairs=options?.explode?explode(key,value):[[key,value]];if(pairs.every(([_,v])=>v==null))return;
1530
- let encodeString=v=>encodeChars(v,options?.charEncoding),encodeValue=v=>encodeString(serializeValue(v));return pairs.forEach(([pk,pv])=>{var _a2;let tmp="";if(pv!=null){if(Array.isArray(pv))tmp=(_a2=mapDefined(pv,v=>`${encodeValue(v)}`))===null||_a2===void 0?void 0:_a2.join(",");else if(isPlainObject$1(pv)){let mapped=mapDefinedEntries(Object.entries(pv),([k,v])=>`,${encodeString(k)},${encodeValue(v)}`);tmp=mapped?.join("").slice(1)}else tmp=`${options?.explode&&isPlainObject$1(value)?`${pk}=`:""}${encodeValue(
1531
- pv)}`;out+=tmp?`,${tmp}`:""}}),out.slice(1)};function explode(key,value){return Array.isArray(value)?value.map(v=>[key,v]):isPlainObject$1(value)?Object.entries(value??{}).map(([k,v])=>[k,v]):[[key,value]]}function serializeValue(value){return value==null?"":value instanceof Date?value.toISOString():value instanceof Uint8Array?bytesToBase64(value):typeof value=="object"?JSON.stringify(value,jsonReplacer):`${value}`}function jsonReplacer(_,value){return value instanceof Uint8Array?bytesToBase64(value):
1532
- value}function mapDefined(inp,mapper){let res=inp.reduce((acc,v)=>{if(v==null)return acc;let m=mapper(v);return m==null||acc.push(m),acc},[]);return res.length?res:null}function mapDefinedEntries(inp,mapper){let acc=[];for(let[k,v]of inp){if(v==null)continue;let m=mapper([k,v]);m!=null&&acc.push(m)}return acc.length?acc:null}function queryJoin(...args){return args.filter(Boolean).join("&")}function queryEncoder(f){return function(values,options){var _a2,_b,_c;let opts=Object.assign(Object.assign(
1533
- {},options),{explode:(_a2=options?.explode)!==null&&_a2!==void 0?_a2:!0,charEncoding:(_b=options?.charEncoding)!==null&&_b!==void 0?_b:"percent"}),allowEmptySet=new Set((_c=options?.allowEmptyValue)!==null&&_c!==void 0?_c:[]),encoded=Object.entries(values).map(([key,value])=>allowEmptySet.has(key)&&(value==null||value===""||Array.isArray(value)&&value.length===0)?`${encodeURIComponent(key)}=`:f(key,value,opts));return queryJoin(...encoded)}}var encodeFormQuery=queryEncoder(encodeForm);var defaultBackoff={
1534
- initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},PermanentError=class _PermanentError extends Error{constructor(message,options){let msg=message;options?.cause&&(msg+=`: ${options.cause}`),super(msg,options),this.name="PermanentError",typeof this.cause>"u"&&(this.cause=options?.cause),Object.setPrototypeOf(this,_PermanentError.prototype)}},TemporaryError=class _TemporaryError extends Error{constructor(message,response){super(message),this.response=response,this.name="Tempora\
1535
- ryError",Object.setPrototypeOf(this,_TemporaryError.prototype)}};async function retry(fetchFn,options){var _a2;switch(options.config.strategy){case"backoff":return retryBackoff(wrapFetcher(fetchFn,{statusCodes:options.statusCodes,retryConnectionErrors:!!options.config.retryConnectionErrors}),(_a2=options.config.backoff)!==null&&_a2!==void 0?_a2:defaultBackoff);case"attempt-count-backoff":return retryAttemptCountBackoff(wrapFetcher(fetchFn,{statusCodes:options.statusCodes,retryConnectionErrors:!!options.
1536
- config.retryConnectionErrors}),Object.assign(Object.assign({},defaultBackoff),options.config.backoff),options.config);default:return await fetchFn(0)}}function wrapFetcher(fn,options){return async attempt=>{try{let res=await fn(attempt);if(isRetryableResponse(res,options.statusCodes))throw new TemporaryError("Response failed with retryable status code",res);return res}catch(err){throw err instanceof TemporaryError||options.retryConnectionErrors&&(isTimeoutError(err)||isConnectionError(err))?err:
1537
- new PermanentError("Permanent error",{cause:err})}}}var codeRangeRE=new RegExp("^[0-9]xx$","i");function isRetryableResponse(res,statusCodes){let actual=`${res.status}`;return statusCodes.some(code=>{if(!codeRangeRE.test(code))return code===actual;let expectFamily=code.charAt(0);if(!expectFamily)throw new Error("Invalid status code range");let actualFamily=actual.charAt(0);if(!actualFamily)throw new Error(`Invalid response status code: ${actual}`);return actualFamily===expectFamily})}async function retryBackoff(fn,strategy){
1538
- let{maxElapsedTime,initialInterval,exponent,maxInterval}=strategy,start=Date.now(),x=0;for(;;)try{return await fn(x)}catch(err){if(err instanceof PermanentError)throw err.cause;if(Date.now()-start>maxElapsedTime){if(err instanceof TemporaryError)return err.response;throw err}let retryInterval=0;err instanceof TemporaryError&&(retryInterval=retryIntervalFromResponse(err.response)),retryInterval<=0&&(retryInterval=initialInterval*Math.pow(x,exponent)+Math.random()*1e3);let d=Math.min(retryInterval,
1539
- maxInterval);await delay(d),x++}}async function retryAttemptCountBackoff(fn,strategy,config){let attempt=0;for(;;)try{return await fn(attempt)}catch(err){if(err instanceof PermanentError)throw err.cause;if(attempt>=config.maxRetries){if(err instanceof TemporaryError)return err.response;throw err}let retryInterval=0;err instanceof TemporaryError&&(retryInterval=retryIntervalFromResponse(err.response)),retryInterval<=0&&(retryInterval=strategy.initialInterval*Math.pow(strategy.exponent,attempt)*(1-
1540
- Math.random()*.25));let d=Math.min(retryInterval,strategy.maxInterval);await delay(d),attempt++}}function retryIntervalFromResponse(res){let retryAfterMsVal=res.headers.get("retry-after-ms");if(retryAfterMsVal){let parsedMs=Number(retryAfterMsVal);if(Number.isFinite(parsedMs)&&parsedMs>=0)return parsedMs}let retryVal=res.headers.get("retry-after")||"";if(!retryVal)return 0;let parsedNumber=Number(retryVal);if(Number.isInteger(parsedNumber))return parsedNumber*1e3;let parsedDate=Date.parse(retryVal);
1541
- if(Number.isInteger(parsedDate)){let deltaMS=parsedDate-Date.now();return deltaMS>0?Math.ceil(deltaMS):0}return 0}async function delay(delay2){return new Promise(resolve=>setTimeout(resolve,delay2))}var gt=typeof globalThis>"u"?null:globalThis,webWorkerLike=typeof gt=="object"&&gt!=null&&"importScripts"in gt&&typeof gt.importScripts=="function",isBrowserLike=webWorkerLike||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",ClientSDK=class{constructor(options={}){
1542
- let opt=options;typeof opt=="object"&&opt!=null&&"hooks"in opt&&opt.hooks instanceof SDKHooks?this._hooks=opt.hooks:this._hooks=new SDKHooks;let defaultHttpClient=new HTTPClient;options.http_client=options.http_client||defaultHttpClient,options=this._hooks.sdkInit(options);let url=serverURLFromOptions(options);url&&(url.pathname=url.pathname.replace(/\/+$/,"")+"/"),this._baseURL=url,this._httpClient=options.http_client||defaultHttpClient,this._options=Object.assign(Object.assign({},fillGlobals(options)),
1543
- {hooks:this._hooks}),this._logger=this._options.debug_logger,!this._logger&&env().GOOGLE_GENAI_DEBUG&&(this._logger=console)}_createRequest(context,conf,options){var _a2,_b,_c,_d,_e;let{method,path:path2,query,headers:opHeaders,security}=conf,base=(_a2=conf.baseURL)!==null&&_a2!==void 0?_a2:this._baseURL;if(!base)return ERR(new InvalidRequestError("No base URL provided for operation"));let baseURL=new URL(base),reqURL;path2?(baseURL.pathname=baseURL.pathname.replace(/\/+$/,"")+"/",reqURL=new URL(
1544
- path2,baseURL),!reqURL.search&&baseURL.search&&(reqURL.search=baseURL.search)):reqURL=baseURL,reqURL.hash="";let mergeQuery=(current,additions)=>{if(!additions)return current;let additionKeys=new Set(additions.split("&").filter(pair=>pair!=="").map(pair=>{var _a3;return(_a3=pair.split("=")[0])!==null&&_a3!==void 0?_a3:""}));return[...current.split("&").filter(pair=>{var _a3;return pair!==""&&!additionKeys.has((_a3=pair.split("=")[0])!==null&&_a3!==void 0?_a3:"")}),additions].join("&")},encodeQueryRecord=record=>Object.
1545
- entries(record).map(([k,v])=>{if(v==null)return;let value=isPlainObject$1(v)?JSON.stringify(v):v;return encodeForm(k,value,{explode:Array.isArray(value),charEncoding:"percent"})}).filter(pair=>typeof pair<"u").join("&"),finalQuery=[query||"",encodeQueryRecord(options?.extra_query||{}),encodeQueryRecord(security?.queryParams||{})].reduce(mergeQuery,reqURL.search.slice(1));finalQuery&&(reqURL.search=`?${finalQuery}`);let headers=new Headers(opHeaders),username=security?.basic.username,password=security?.
1546
- basic.password;if(username!=null||password!=null){let encoded=stringToBase64([username||"",password||""].join(":"));headers.set("Authorization",`Basic ${encoded}`)}let securityHeaders=new Headers(security?.headers||{});for(let[k,v]of securityHeaders)headers.set(k,v);let cookie=headers.get("cookie")||"";for(let[k,v]of Object.entries(security?.cookies||{}))cookie+=`; ${k}=${v}`;cookie=cookie.startsWith("; ")?cookie.slice(2):cookie,headers.set("cookie",cookie);let userHeaders=new Headers((_b=options?.
1547
- headers)!==null&&_b!==void 0?_b:(_c=options?.fetch_options)===null||_c===void 0?void 0:_c.headers);for(let[k,v]of userHeaders)headers.set(k,v);isBrowserLike||headers.set((_d=conf.uaHeader)!==null&&_d!==void 0?_d:"user-agent",(_e=conf.userAgent)!==null&&_e!==void 0?_e:SDK_METADATA.userAgent);let reqBody=conf.body,extraBody=Object.fromEntries(Object.entries(options?.extra_body||{}).filter(([,v])=>typeof v<"u"));if(Object.keys(extraBody).length>0){let contentType=new Headers(opHeaders).get("content\
1548
- -type")||"";if(!/^(application|text)\/([^+]+\+)*json/.test(contentType)||typeof reqBody!="string"&&reqBody!=null)return ERR(new InvalidRequestError("extra_body can only be merged into JSON object request bodies"));let parsedBody;try{parsedBody=reqBody?JSON.parse(reqBody):{}}catch(err){return ERR(new InvalidRequestError("extra_body can only be merged into JSON object request bodies",{cause:err}))}if(!isPlainObject$1(parsedBody))return ERR(new InvalidRequestError("extra_body can only be merged int\
1549
- o JSON object request bodies"));reqBody=JSON.stringify(Object.assign(Object.assign({},parsedBody),extraBody)),headers.delete("content-length")}let fetchOptions=Object.assign(Object.assign({},options?.fetch_options),options);!fetchOptions?.signal&&conf.timeout_ms!=null&&conf.timeout_ms>0&&(context.timeout_ms=conf.timeout_ms),conf.body instanceof ReadableStream&&Object.assign(fetchOptions,{duplex:"half"});let input;try{input=this._hooks.beforeCreateRequest(context,{url:reqURL,options:Object.assign(
1550
- Object.assign({},fetchOptions),{body:reqBody??null,headers,method})})}catch(err){return ERR(new UnexpectedClientError("Create request hook failed to execute",{cause:err}))}return OK(new Request(input.url,input.options))}async _do(request,options){let{context,isErrorStatusCode}=options,timeout_ms=context.timeout_ms;return retry(async()=>{var _a2;let cloned=request.clone(),attempt=cloned;if(timeout_ms!=null&&timeout_ms>0){let timeoutSignal=AbortSignal.timeout(timeout_ms),combined=(_a2=combineSignals(
1551
- cloned.signal,timeoutSignal))!==null&&_a2!==void 0?_a2:timeoutSignal;attempt=new Request(cloned,{signal:combined})}let req=await this._hooks.beforeRequest(context,attempt);await logRequest(this._logger,req).catch(e=>{var _a3;return(_a3=this._logger)===null||_a3===void 0?void 0:_a3.log("Failed to log request:",e)});let response=await this._httpClient.request(req);try{if(isErrorStatusCode(response.status)){let result=await this._hooks.afterError(context,response,null);if(result.error)throw result.
1552
- error;response=result.response||response}else response=await this._hooks.afterSuccess(context,response)}finally{await logResponse(this._logger,response,req).catch(e=>{var _a3;return(_a3=this._logger)===null||_a3===void 0?void 0:_a3.log("Failed to log response:",e)})}return response},{config:options.retryConfig,statusCodes:options.retryCodes}).then(r=>OK(r),err=>{switch(!0){case isAbortError(err):return ERR(new RequestAbortedError("Request aborted by client",{cause:err}));case isTimeoutError(err):
1553
- return ERR(new RequestTimeoutError("Request timed out",{cause:err}));case isConnectionError(err):return ERR(new ConnectionError("Unable to make request",{cause:err}));default:return ERR(new UnexpectedClientError("Unexpected HTTP client error",{cause:err}))}})}},jsonLikeContentTypeRE=/^(application|text)\/([^+]+\+)*json.*/,jsonlLikeContentTypeRE=/^(application|text)\/([^+]+\+)*(jsonl|x-ndjson)\b.*/;async function logRequest(logger,req){if(!logger)return;let contentType=req.headers.get("content-ty\
1554
- pe"),ct=contentType?.split(";")[0]||"";logger.group(`> Request: ${req.method} ${req.url}`),logger.group("Headers:");for(let[k,v]of req.headers.entries())logger.log(`${k}: ${v}`);switch(logger.groupEnd(),logger.group("Body:"),!0){case jsonLikeContentTypeRE.test(ct):logger.log(await req.clone().json());break;case ct.startsWith("text/"):logger.log(await req.clone().text());break;case ct==="multipart/form-data":{let body=await req.clone().formData();for(let[k,v]of body){let vlabel=v instanceof Blob?
1555
- "<Blob>":v;logger.log(`${k}: ${vlabel}`)}break}default:logger.log(`<${contentType}>`);break}logger.groupEnd(),logger.groupEnd()}async function logResponse(logger,res,req){if(!logger)return;let contentType=res.headers.get("content-type"),ct=contentType?.split(";")[0]||"";logger.group(`< Response: ${req.method} ${req.url}`),logger.log("Status Code:",res.status,res.statusText),logger.group("Headers:");for(let[k,v]of res.headers.entries())logger.log(`${k}: ${v}`);switch(logger.groupEnd(),logger.group(
1556
- "Body:"),!0){case(matchContentType(res,"application/json")||jsonLikeContentTypeRE.test(ct)&&!jsonlLikeContentTypeRE.test(ct)):logger.log(await res.clone().json());break;case(matchContentType(res,"application/jsonl")||jsonlLikeContentTypeRE.test(ct)):case matchContentType(res,"text/event-stream"):logger.log(`<${contentType}>`);break;case matchContentType(res,"text/*"):logger.log(await res.clone().text());break;case matchContentType(res,"multipart/form-data"):{let body=await res.clone().formData();
1557
- for(let[k,v]of body){let vlabel=v instanceof Blob?"<Blob>":v;logger.log(`${k}: ${vlabel}`)}break}default:logger.log(`<${contentType}>`);break}logger.groupEnd(),logger.groupEnd()}var GoogleGenAiDefaultError=class extends GoogleGenAiError{constructor(message,httpMeta){message&&(message+=": "),message+=`Status ${httpMeta.response.status}`;let contentType=httpMeta.response.headers.get("content-type")||'""';contentType!=="application/json"&&(message+=` Content-Type ${contentType.includes(" ")?`"${contentType}\
1558
- "`:contentType}`);let body=httpMeta.body||'""';message+=body.length>100?`
1559
- `:". ";let bodyDisplay=body;if(body.length>1e4){let truncated=body.substring(0,1e4),remaining=body.length-1e4;bodyDisplay=`${truncated}...and ${remaining} more chars`}message+=`Body: ${bodyDisplay}`,message=message.trim(),super(message,httpMeta),this.name="GoogleGenAiDefaultError"}};function tryParseJson(s){try{return JSON.parse(s)}catch{return s}}function wrapEventStreamResponse(body,opts={}){var _a2,_b;let flattened=opts.flattened===!0,sentinel=(_a2=opts.sentinel)!==null&&_a2!==void 0?_a2:"";return new Stream(
1560
- body,rawEvent=>sentinel!==""&&rawEvent.data===sentinel?{done:!0,value:void 0}:flattened?{done:!1,value:rawEvent.data==null?void 0:tryParseJson(rawEvent.data)}:{done:!1,value:Object.assign(Object.assign({},rawEvent),{data:rawEvent.data==null?rawEvent.data:tryParseJson(rawEvent.data)})},{dataRequired:(_b=opts.dataRequired)!==null&&_b!==void 0?_b:!0})}var Stream=class extends ReadableStream{constructor(responseBody,parse,opts){var _a2;let upstream=responseBody.getReader(),buffer=new Uint8Array(4096),
1561
- bufferLen=0,searchStart=0,state={eventId:void 0},dataRequired=(_a2=opts?.dataRequired)!==null&&_a2!==void 0?_a2:!0;super({async pull(downstream){try{for(;;){let match2=findBoundary(buffer,bufferLen,searchStart);if(!match2){searchStart=Math.max(0,bufferLen-MAX_BOUNDARY_LEN+1);let chunk=await upstream.read();if(chunk.done)return downstream.close();if(bufferLen+chunk.value.length>buffer.length){let grown=new Uint8Array(Math.max(buffer.length*2,bufferLen+chunk.value.length));grown.set(buffer.subarray(
1562
- 0,bufferLen)),buffer=grown}buffer.set(chunk.value,bufferLen),bufferLen+=chunk.value.length;continue}let message=buffer.slice(0,match2.index);if(buffer.copyWithin(0,match2.index+match2.length,bufferLen),bufferLen-=match2.index+match2.length,buffer.length>4096&&bufferLen<=buffer.length>>2){let shrunk=new Uint8Array(Math.max(4096,bufferLen*2));shrunk.set(buffer.subarray(0,bufferLen)),buffer=shrunk}searchStart=0;let item=parseMessage(message,parse,state,dataRequired);if(item&&!item.done)return downstream.
1563
- enqueue(item.value);if(item?.done)return await upstream.cancel("done"),downstream.close()}}catch(e){downstream.error(e),await upstream.cancel(e)}},cancel:reason=>upstream.cancel(reason)})}[Symbol.asyncIterator](options){let fn=ReadableStream.prototype[Symbol.asyncIterator];if(typeof fn=="function")return fn.call(this,options);let reader=this.getReader(),iterator={next:async()=>{let r=await reader.read();return r.done?(reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:r.value}},throw:async e=>(await reader.
1564
- cancel(e),reader.releaseLock(),{done:!0,value:void 0}),return:async()=>(await reader.cancel("done"),reader.releaseLock(),{done:!0,value:void 0}),[Symbol.asyncIterator](){return this}},asyncDispose=Symbol.asyncDispose;return asyncDispose&&(iterator[asyncDispose]=async()=>{var _a2;await((_a2=iterator.return)===null||_a2===void 0?void 0:_a2.call(iterator))}),iterator}values(options){return this[Symbol.asyncIterator](options)}},CR=13,LF=10,BOUNDARIES=[[CR,LF,CR,LF],[CR,LF,CR],[CR,LF,LF],[CR,CR,LF],[
1565
- LF,CR,LF],[CR,CR],[LF,CR],[LF,LF]],MAX_BOUNDARY_LEN=BOUNDARIES.reduce((m,b)=>Math.max(m,b.length),0);function findBoundary(buf,len,from){for(let i=from;i<len;i++)if(!(buf[i]!==CR&&buf[i]!==LF))for(let boundary of BOUNDARIES){if(i+boundary.length>len)continue;let match2=!0;for(let j=0;j<boundary.length;j++)if(buf[i+j]!==boundary[j]){match2=!1;break}if(match2)return{index:i,length:boundary.length}}return null}function parseMessage(chunk,parse,state,dataRequired){let lines=new TextDecoder().decode(
1566
- chunk).split(/\r\n|\r|\n/),dataLines=[],ret={},ignore=!0;for(let line of lines){if(!line||line.startsWith(":"))continue;ignore=!1;let i=line.indexOf(":"),field=line,value="";i>0&&(field=line.slice(0,i),value=line[i+1]===" "?line.slice(i+2):line.slice(i+1)),field==="data"?dataLines.push(value):field==="event"?ret.event=value:field==="id"&&!value.includes("\0")?state.eventId=value:field==="retry"&&/^\d+$/.test(value)&&(ret.retry=Number(value))}if(!ignore){if(ret.id=state.eventId,dataLines.length)ret.
1567
- data=dataLines.join(`
1498
+ AuthenticationError=class extends APIError{},PermissionDeniedError=class extends APIError{},NotFoundError=class extends APIError{},ConflictError=class extends APIError{},UnprocessableEntityError=class extends APIError{},RateLimitError=class extends APIError{},InternalServerError=class extends APIError{};function wrapSDKError(error){return isCompatAPIErrorInstance(error)?error:isGoogleGenAiErrorInstance(error)?wrapAPIError(error):error instanceof HTTPClientError?wrapHTTPClientError(error):error}function isGoogleGenAiErrorInstance(value){
1499
+ return value instanceof GoogleGenAiError?!0:value instanceof Error&&typeof value.statusCode=="number"&&typeof value.body=="string"}function wrapAPIError(error){let errorPayload=getErrorPayload(error),wrapped=APIError.generate(error.statusCode,errorPayload,error.message,error.headers);return defineReadonly(wrapped,"body",error.body),defineReadonly(wrapped,"contentType",error.contentType),defineReadonly(wrapped,"rawResponse",error.rawResponse),defineReadonly(wrapped,"statusCode",error.statusCode),
1500
+ defineReadonly(wrapped,"cause",error),wrapped}function wrapHTTPClientError(error){return error instanceof RequestTimeoutError?new APIConnectionTimeoutError({message:error.message}):error instanceof RequestAbortedError?new APIUserAbortError({message:error.message}):error instanceof ConnectionError?new APIConnectionError({message:error.message,cause:error}):new APIConnectionError({message:error.message,cause:error})}function getErrorPayload(error){let data=getObjectProperty(error,"data$");if(data&&
1501
+ typeof data=="object")return data;try{let parsed=JSON.parse(error.body);if(parsed&&typeof parsed=="object")return parsed}catch{}let dataError=getObjectProperty(error,"error");return dataError&&typeof dataError=="object"?dataError:void 0}function getObjectProperty(value,key){return value&&typeof value=="object"?value[key]:void 0}function stringifyErrorBody(error){if(!error)return"";try{return JSON.stringify(error)}catch{return String(error)}}function isPlainObject$2(value){return value!==null&&typeof value==
1502
+ "object"&&!Array.isArray(value)}function isCompatAPIErrorInstance(value){return typeof value=="object"&&value!==null?APIError.prototype.isPrototypeOf(value):!1}function defineReadonly(target,key,value){Object.defineProperty(target,key,{configurable:!0,enumerable:!0,value,writable:!1})}var DEFAULT_FETCHER=(input,init)=>init==null?fetch(input):fetch(input,init),HTTPClient=class _HTTPClient{constructor(options={}){this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.options=options,
1503
+ this.fetcher=options.fetcher||DEFAULT_FETCHER}async request(request){let req=request;for(let hook of this.requestHooks){let nextRequest=await hook(req);nextRequest&&(req=nextRequest)}try{let res=await this.fetcher(req);for(let hook of this.responseHooks)await hook(res,req);return res}catch(err){for(let hook of this.requestErrorHooks)await hook(err,req);throw err}}addHook(...args){if(args[0]==="beforeRequest")this.requestHooks.push(args[1]);else if(args[0]==="requestError")this.requestErrorHooks.
1504
+ push(args[1]);else if(args[0]==="response")this.responseHooks.push(args[1]);else throw new Error(`Invalid hook type: ${args[0]}`);return this}removeHook(...args){let target;if(args[0]==="beforeRequest")target=this.requestHooks;else if(args[0]==="requestError")target=this.requestErrorHooks;else if(args[0]==="response")target=this.responseHooks;else throw new Error(`Invalid hook type: ${args[0]}`);let index=target.findIndex(v=>v===args[1]);return index>=0&&target.splice(index,1),this}clone(){let child=new _HTTPClient(
1505
+ this.options);return child.requestHooks=this.requestHooks.slice(),child.requestErrorHooks=this.requestErrorHooks.slice(),child.responseHooks=this.responseHooks.slice(),child}},mediaParamSeparator=/\s*;\s*/g;function matchContentType(response,pattern){var _a2;if(pattern==="*")return!0;let contentType=((_a2=response.headers.get("content-type"))===null||_a2===void 0?void 0:_a2.trim())||"application/octet-stream";contentType=contentType.toLowerCase();let wantParts=pattern.toLowerCase().trim().split(
1506
+ mediaParamSeparator),[wantType="",...wantParams]=wantParts;if(wantType.split("/").length!==2)return!1;let gotParts=contentType.split(mediaParamSeparator),[gotType="",...gotParams]=gotParts,[type="",subtype=""]=gotType.split("/");if(!type||!subtype||wantType!=="*/*"&&gotType!==wantType&&`${type}/*`!==wantType&&`*/${subtype}`!==wantType||gotParams.length<wantParams.length)return!1;let params=new Set(gotParams);for(let wantParam of wantParams)if(!params.has(wantParam))return!1;return!0}var codeRangeRE$1=new RegExp(
1507
+ "^[0-9]xx$","i");function matchStatusCode(response,codes){let actual=`${response.status}`,expectedCodes=Array.isArray(codes)?codes:[codes];return expectedCodes.length?expectedCodes.some(ec=>{let code=`${ec}`;if(code==="default")return!0;if(!codeRangeRE$1.test(`${code}`))return code===actual;let expectFamily=code.charAt(0);if(!expectFamily)throw new Error("Invalid status code range");let actualFamily=actual.charAt(0);if(!actualFamily)throw new Error(`Invalid response status code: ${actual}`);return actualFamily===
1508
+ expectFamily}):!1}function matchResponse(response,code,contentTypePattern){return matchStatusCode(response,code)&&matchContentType(response,contentTypePattern)}function isConnectionError(err){if(typeof err!="object"||err==null)return!1;let isBrowserErr=err instanceof TypeError&&err.message.toLowerCase().startsWith("failed to fetch"),isNodeErr=err instanceof TypeError&&err.message.toLowerCase().startsWith("fetch failed"),isBunErr="name"in err&&err.name==="ConnectionError",isGenericErr="code"in err&&
1509
+ typeof err.code=="string"&&err.code.toLowerCase()==="econnreset";return isBrowserErr||isNodeErr||isGenericErr||isBunErr}function isTimeoutError(err){if(typeof err!="object"||err==null)return!1;let isNative="name"in err&&err.name==="TimeoutError",isLegacyNative="code"in err&&err.code===23,isGenericErr="code"in err&&typeof err.code=="string"&&err.code.toLowerCase()==="econnaborted";return isNative||isLegacyNative||isGenericErr}function isAbortError(err){if(typeof err!="object"||err==null)return!1;
1510
+ let isNative="name"in err&&err.name==="AbortError",isLegacyNative="code"in err&&err.code===20,isGenericErr="code"in err&&typeof err.code=="string"&&err.code.toLowerCase()==="econnaborted";return isNative||isLegacyNative||isGenericErr}function initHooks(hooks){let googleGenAIAuthHook=new GoogleGenAIAuthHook;hooks.registerBeforeCreateRequestHook(googleGenAIAuthHook),hooks.registerBeforeRequestHook(googleGenAIAuthHook)}var SDKHooks=class{constructor(){this.sdkInitHooks=[],this.beforeCreateRequestHooks=
1511
+ [],this.beforeRequestHooks=[],this.afterSuccessHooks=[],this.afterErrorHooks=[];let presetHooks=[];for(let hook of presetHooks)"sdkInit"in hook&&this.registerSDKInitHook(hook),"beforeCreateRequest"in hook&&this.registerBeforeCreateRequestHook(hook),"beforeRequest"in hook&&this.registerBeforeRequestHook(hook),"afterSuccess"in hook&&this.registerAfterSuccessHook(hook),"afterError"in hook&&this.registerAfterErrorHook(hook);initHooks(this)}registerSDKInitHook(hook){this.sdkInitHooks.push(hook)}registerBeforeCreateRequestHook(hook){
1512
+ this.beforeCreateRequestHooks.push(hook)}registerBeforeRequestHook(hook){this.beforeRequestHooks.push(hook)}registerAfterSuccessHook(hook){this.afterSuccessHooks.push(hook)}registerAfterErrorHook(hook){this.afterErrorHooks.push(hook)}sdkInit(opts){return this.sdkInitHooks.reduce((opts2,hook)=>hook.sdkInit(opts2),opts)}beforeCreateRequest(hookCtx,input){let inp=input;for(let hook of this.beforeCreateRequestHooks)inp=hook.beforeCreateRequest(hookCtx,inp);return inp}async beforeRequest(hookCtx,request){
1513
+ let req=request;for(let hook of this.beforeRequestHooks)req=await hook.beforeRequest(hookCtx,req);return req}async afterSuccess(hookCtx,response){let res=response;for(let hook of this.afterSuccessHooks)res=await hook.afterSuccess(hookCtx,res);return res}async afterError(hookCtx,response,error){let res=response,err=error;for(let hook of this.afterErrorHooks){let result=await hook.afterError(hookCtx,res,err);res=result.response,err=result.error}return{response:res,error:err}}};function OK(value){return{
1514
+ ok:!0,value}}function ERR(error){return{ok:!1,error}}function bytesToBase64(u8arr){return btoa(String.fromCodePoint(...u8arr))}function stringToBytes(str){return new TextEncoder().encode(str)}function stringToBase64(str){return bytesToBase64(stringToBytes(str))}var hasOwn=Object.prototype.hasOwnProperty;function pathToFunc(pathPattern,options){let paramRE=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(params={}){return pathPattern.replace(paramRE,function(_,placeholder){if(!hasOwn.call(params,
1515
+ placeholder))throw new Error(`Parameter '${placeholder}' is required`);let value=params[placeholder];if(typeof value!="string"&&typeof value!="number")throw new Error(`Parameter '${placeholder}' must be a string or number`);return`${value}`}).replace(/^\/+/,"")}}var ServerList=["https://generativelanguage.googleapis.com"];function serverURLFromOptions(options){var _a2;let serverURL=options.server_url,params={};if(!serverURL){let serverIdx=(_a2=options.server_idx)!==null&&_a2!==void 0?_a2:0;if(serverIdx<
1516
+ 0||serverIdx>=ServerList.length)throw new Error(`Invalid server index ${serverIdx}`);serverURL=ServerList[serverIdx]||""}let u=pathToFunc(serverURL)(params);return new URL(u)}var SDK_METADATA={userAgent:"speakeasy-sdk/typescript 2.4.1-preview.4 internal v1beta @google/genai"};function combineSignals(...signals){let filtered=[];for(let signal of signals)signal&&filtered.push(signal);switch(filtered.length){case 0:case 1:return filtered[0]||null;default:return"any"in AbortSignal&&typeof AbortSignal.
1517
+ any=="function"?AbortSignal.any(filtered):abortSignalAny(filtered)}}function abortSignalAny(signals){let controller=new AbortController,result=controller.signal;if(!signals.length)return controller.signal;if(signals.length===1)return signals[0]||controller.signal;for(let signal of signals)if(signal.aborted)return signal;function abort(){controller.abort(this.reason),clean()}let signalRefs=[];function clean(){for(let signalRef of signalRefs){let signal=signalRef.deref();signal&&signal.removeEventListener(
1518
+ "abort",abort)}}for(let signal of signals)signalRefs.push(new WeakRef(signal)),signal.addEventListener("abort",abort);return result}function compactMap(values){let out={};for(let[k,v]of Object.entries(values))typeof v<"u"&&(out[k]=v);return out}function isPlainObject$1(value){if(value===null||typeof value!="object"||Object.prototype.toString.call(value)!=="[object Object]")return!1;let proto=Object.getPrototypeOf(value);if(proto===null||proto===Object.prototype)return!0;try{return Object.getPrototypeOf(
1519
+ proto)===null}catch{return!1}}var reservedEscapes=/%(2[346bcf]|3[abdf]|40|5[bd])/gi;function encodeKeyChars(v,charEncoding){return encodeChars(v,charEncoding==="percentExceptReserved"?"percent":charEncoding)}function encodeChars(v,charEncoding){switch(charEncoding){case"percent":return encodeURIComponent(v);case"percentExceptReserved":return encodeURIComponent(v).replace(reservedEscapes,m=>decodeURIComponent(m));default:return v}}function formEncoder(sep){return(key,value,options)=>{let out="",pairs=options?.
1520
+ explode?explode(key,value):[[key,value]];if(pairs.every(([_,v])=>v==null))return;let encodeString=v=>encodeChars(v,options?.charEncoding),encodeValue=v=>encodeString(serializeValue(v)),encodedSep=encodeString(sep);return pairs.forEach(([pk,pv])=>{var _a2,_b;let tmp="",encValue=null;pv!=null&&(Array.isArray(pv)?encValue=(_a2=mapDefined(pv,v=>`${encodeValue(v)}`))===null||_a2===void 0?void 0:_a2.join(encodedSep):isPlainObject$1(pv)?encValue=(_b=mapDefinedEntries(Object.entries(pv),([k,v])=>`${encodeString(
1521
+ k)}${encodedSep}${encodeValue(v)}`))===null||_b===void 0?void 0:_b.join(encodedSep):encValue=`${encodeValue(pv)}`,encValue!=null&&(tmp=`${encodeKeyChars(pk,options?.charEncoding)}=${encValue}`,!(!tmp||tmp==="=")&&(out+=`&${tmp}`)))}),out.slice(1)}}var encodeForm=formEncoder(",");function encodeJSON(key,value,options){if(typeof value>"u")return;let encVal=(v=>encodeChars(v,options?.charEncoding))(JSON.stringify(value,jsonReplacer));return options?.explode?encVal:`${encodeKeyChars(key,options?.charEncoding)}\
1522
+ =${encVal}`}var encodeSimple=(key,value,options)=>{let out="",pairs=options?.explode?explode(key,value):[[key,value]];if(pairs.every(([_,v])=>v==null))return;let encodeString=v=>encodeChars(v,options?.charEncoding),encodeValue=v=>encodeString(serializeValue(v));return pairs.forEach(([pk,pv])=>{var _a2;let tmp="";if(pv!=null){if(Array.isArray(pv))tmp=(_a2=mapDefined(pv,v=>`${encodeValue(v)}`))===null||_a2===void 0?void 0:_a2.join(",");else if(isPlainObject$1(pv)){let mapped=mapDefinedEntries(Object.
1523
+ entries(pv),([k,v])=>`,${encodeString(k)},${encodeValue(v)}`);tmp=mapped?.join("").slice(1)}else tmp=`${options?.explode&&isPlainObject$1(value)?`${pk}=`:""}${encodeValue(pv)}`;out+=tmp?`,${tmp}`:""}}),out.slice(1)};function explode(key,value){return Array.isArray(value)?value.map(v=>[key,v]):isPlainObject$1(value)?Object.entries(value??{}).map(([k,v])=>[k,v]):[[key,value]]}function serializeValue(value){return value==null?"":value instanceof Date?value.toISOString():value instanceof Uint8Array?
1524
+ bytesToBase64(value):typeof value=="object"?JSON.stringify(value,jsonReplacer):`${value}`}function jsonReplacer(_,value){return value instanceof Uint8Array?bytesToBase64(value):value}function mapDefined(inp,mapper){let res=inp.reduce((acc,v)=>{if(v==null)return acc;let m=mapper(v);return m==null||acc.push(m),acc},[]);return res.length?res:null}function mapDefinedEntries(inp,mapper){let acc=[];for(let[k,v]of inp){if(v==null)continue;let m=mapper([k,v]);m!=null&&acc.push(m)}return acc.length?acc:null}
1525
+ function queryJoin(...args){return args.filter(Boolean).join("&")}function queryEncoder(f){return function(values,options){var _a2,_b,_c;let opts=Object.assign(Object.assign({},options),{explode:(_a2=options?.explode)!==null&&_a2!==void 0?_a2:!0,charEncoding:(_b=options?.charEncoding)!==null&&_b!==void 0?_b:"percent"}),allowEmptySet=new Set((_c=options?.allowEmptyValue)!==null&&_c!==void 0?_c:[]),encoded=Object.entries(values).map(([key,value])=>allowEmptySet.has(key)&&(value==null||value===""||
1526
+ Array.isArray(value)&&value.length===0)?`${encodeURIComponent(key)}=`:f(key,value,opts));return queryJoin(...encoded)}}var encodeFormQuery=queryEncoder(encodeForm);var defaultBackoff={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},PermanentError=class _PermanentError extends Error{constructor(message,options){let msg=message;options?.cause&&(msg+=`: ${options.cause}`),super(msg,options),this.name="PermanentError",typeof this.cause>"u"&&(this.cause=options?.cause),Object.setPrototypeOf(
1527
+ this,_PermanentError.prototype)}},TemporaryError=class _TemporaryError extends Error{constructor(message,response){super(message),this.response=response,this.name="TemporaryError",Object.setPrototypeOf(this,_TemporaryError.prototype)}};async function retry(fetchFn,options){var _a2;switch(options.config.strategy){case"backoff":return retryBackoff(wrapFetcher(fetchFn,{statusCodes:options.statusCodes,retryConnectionErrors:!!options.config.retryConnectionErrors}),(_a2=options.config.backoff)!==null&&
1528
+ _a2!==void 0?_a2:defaultBackoff);case"attempt-count-backoff":return retryAttemptCountBackoff(wrapFetcher(fetchFn,{statusCodes:options.statusCodes,retryConnectionErrors:!!options.config.retryConnectionErrors}),Object.assign(Object.assign({},defaultBackoff),options.config.backoff),options.config);default:return await fetchFn(0)}}function wrapFetcher(fn,options){return async attempt=>{try{let res=await fn(attempt);if(isRetryableResponse(res,options.statusCodes))throw new TemporaryError("Response fa\
1529
+ iled with retryable status code",res);return res}catch(err){throw err instanceof TemporaryError||options.retryConnectionErrors&&(isTimeoutError(err)||isConnectionError(err))?err:new PermanentError("Permanent error",{cause:err})}}}var codeRangeRE=new RegExp("^[0-9]xx$","i");function isRetryableResponse(res,statusCodes){let actual=`${res.status}`;return statusCodes.some(code=>{if(!codeRangeRE.test(code))return code===actual;let expectFamily=code.charAt(0);if(!expectFamily)throw new Error("Invalid \
1530
+ status code range");let actualFamily=actual.charAt(0);if(!actualFamily)throw new Error(`Invalid response status code: ${actual}`);return actualFamily===expectFamily})}async function retryBackoff(fn,strategy){let{maxElapsedTime,initialInterval,exponent,maxInterval}=strategy,start=Date.now(),x=0;for(;;)try{return await fn(x)}catch(err){if(err instanceof PermanentError)throw err.cause;if(Date.now()-start>maxElapsedTime){if(err instanceof TemporaryError)return err.response;throw err}let retryInterval=0;
1531
+ err instanceof TemporaryError&&(retryInterval=retryIntervalFromResponse(err.response)),retryInterval<=0&&(retryInterval=initialInterval*Math.pow(x,exponent)+Math.random()*1e3);let d=Math.min(retryInterval,maxInterval);await delay(d),x++}}async function retryAttemptCountBackoff(fn,strategy,config){let attempt=0;for(;;)try{return await fn(attempt)}catch(err){if(err instanceof PermanentError)throw err.cause;if(attempt>=config.maxRetries){if(err instanceof TemporaryError)return err.response;throw err}
1532
+ let retryInterval=0;err instanceof TemporaryError&&(retryInterval=retryIntervalFromResponse(err.response)),retryInterval<=0&&(retryInterval=strategy.initialInterval*Math.pow(strategy.exponent,attempt)*(1-Math.random()*.25));let d=Math.min(retryInterval,strategy.maxInterval);await delay(d),attempt++}}function retryIntervalFromResponse(res){let retryAfterMsVal=res.headers.get("retry-after-ms");if(retryAfterMsVal){let parsedMs=Number(retryAfterMsVal);if(Number.isFinite(parsedMs)&&parsedMs>=0)return parsedMs}
1533
+ let retryVal=res.headers.get("retry-after")||"";if(!retryVal)return 0;let parsedNumber=Number(retryVal);if(Number.isInteger(parsedNumber))return parsedNumber*1e3;let parsedDate=Date.parse(retryVal);if(Number.isInteger(parsedDate)){let deltaMS=parsedDate-Date.now();return deltaMS>0?Math.ceil(deltaMS):0}return 0}async function delay(delay2){return new Promise(resolve=>setTimeout(resolve,delay2))}var gt=typeof globalThis>"u"?null:globalThis,webWorkerLike=typeof gt=="object"&&gt!=null&&"importScript\
1534
+ s"in gt&&typeof gt.importScripts=="function",isBrowserLike=webWorkerLike||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",ClientSDK=class{constructor(options={}){let opt=options;typeof opt=="object"&&opt!=null&&"hooks"in opt&&opt.hooks instanceof SDKHooks?this._hooks=opt.hooks:this._hooks=new SDKHooks;let defaultHttpClient=new HTTPClient;options.http_client=options.http_client||defaultHttpClient,options=this._hooks.sdkInit(options);let url=serverURLFromOptions(
1535
+ options);url&&(url.pathname=url.pathname.replace(/\/+$/,"")+"/"),this._baseURL=url,this._httpClient=options.http_client||defaultHttpClient,this._options=Object.assign(Object.assign({},fillGlobals(options)),{hooks:this._hooks}),this._logger=this._options.debug_logger,!this._logger&&env().GOOGLE_GENAI_DEBUG&&(this._logger=console)}_createRequest(context,conf,options){var _a2,_b,_c,_d,_e;let{method,path:path2,query,headers:opHeaders,security}=conf,base=(_a2=conf.baseURL)!==null&&_a2!==void 0?_a2:this.
1536
+ _baseURL;if(!base)return ERR(new InvalidRequestError("No base URL provided for operation"));let baseURL=new URL(base),reqURL;path2?(baseURL.pathname=baseURL.pathname.replace(/\/+$/,"")+"/",reqURL=new URL(path2,baseURL),!reqURL.search&&baseURL.search&&(reqURL.search=baseURL.search)):reqURL=baseURL,reqURL.hash="";let mergeQuery=(current,additions)=>{if(!additions)return current;let additionKeys=new Set(additions.split("&").filter(pair=>pair!=="").map(pair=>{var _a3;return(_a3=pair.split("=")[0])!==
1537
+ null&&_a3!==void 0?_a3:""}));return[...current.split("&").filter(pair=>{var _a3;return pair!==""&&!additionKeys.has((_a3=pair.split("=")[0])!==null&&_a3!==void 0?_a3:"")}),additions].join("&")},encodeQueryRecord=record=>Object.entries(record).map(([k,v])=>{if(v==null)return;let value=isPlainObject$1(v)?JSON.stringify(v):v;return encodeForm(k,value,{explode:Array.isArray(value),charEncoding:"percent"})}).filter(pair=>typeof pair<"u").join("&"),finalQuery=[query||"",encodeQueryRecord(options?.extra_query||
1538
+ {}),encodeQueryRecord(security?.queryParams||{})].reduce(mergeQuery,reqURL.search.slice(1));finalQuery&&(reqURL.search=`?${finalQuery}`);let headers=new Headers(opHeaders),username=security?.basic.username,password=security?.basic.password;if(username!=null||password!=null){let encoded=stringToBase64([username||"",password||""].join(":"));headers.set("Authorization",`Basic ${encoded}`)}let securityHeaders=new Headers(security?.headers||{});for(let[k,v]of securityHeaders)headers.set(k,v);let cookie=headers.
1539
+ get("cookie")||"";for(let[k,v]of Object.entries(security?.cookies||{}))cookie+=`; ${k}=${v}`;cookie=cookie.startsWith("; ")?cookie.slice(2):cookie,headers.set("cookie",cookie);let userHeaders=new Headers((_b=options?.headers)!==null&&_b!==void 0?_b:(_c=options?.fetch_options)===null||_c===void 0?void 0:_c.headers);for(let[k,v]of userHeaders)headers.set(k,v);isBrowserLike||headers.set((_d=conf.uaHeader)!==null&&_d!==void 0?_d:"user-agent",(_e=conf.userAgent)!==null&&_e!==void 0?_e:SDK_METADATA.userAgent);
1540
+ let reqBody=conf.body,extraBody=Object.fromEntries(Object.entries(options?.extra_body||{}).filter(([,v])=>typeof v<"u"));if(Object.keys(extraBody).length>0){let contentType=new Headers(opHeaders).get("content-type")||"";if(!/^(application|text)\/([^+]+\+)*json/.test(contentType)||typeof reqBody!="string"&&reqBody!=null)return ERR(new InvalidRequestError("extra_body can only be merged into JSON object request bodies"));let parsedBody;try{parsedBody=reqBody?JSON.parse(reqBody):{}}catch(err){return ERR(
1541
+ new InvalidRequestError("extra_body can only be merged into JSON object request bodies",{cause:err}))}if(!isPlainObject$1(parsedBody))return ERR(new InvalidRequestError("extra_body can only be merged into JSON object request bodies"));reqBody=JSON.stringify(Object.assign(Object.assign({},parsedBody),extraBody)),headers.delete("content-length")}let fetchOptions=Object.assign(Object.assign({},options?.fetch_options),options);!fetchOptions?.signal&&conf.timeout_ms!=null&&conf.timeout_ms>0&&(context.
1542
+ timeout_ms=conf.timeout_ms),conf.body instanceof ReadableStream&&Object.assign(fetchOptions,{duplex:"half"});let input;try{input=this._hooks.beforeCreateRequest(context,{url:reqURL,options:Object.assign(Object.assign({},fetchOptions),{body:reqBody??null,headers,method})})}catch(err){return ERR(new UnexpectedClientError("Create request hook failed to execute",{cause:err}))}return OK(new Request(input.url,input.options))}async _do(request,options){let{context,isErrorStatusCode}=options,timeout_ms=context.
1543
+ timeout_ms;return retry(async()=>{var _a2;let cloned=request.clone(),attempt=cloned;if(timeout_ms!=null&&timeout_ms>0){let timeoutSignal=AbortSignal.timeout(timeout_ms),combined=(_a2=combineSignals(cloned.signal,timeoutSignal))!==null&&_a2!==void 0?_a2:timeoutSignal;attempt=new Request(cloned,{signal:combined})}let req=await this._hooks.beforeRequest(context,attempt);await logRequest(this._logger,req).catch(e=>{var _a3;return(_a3=this._logger)===null||_a3===void 0?void 0:_a3.log("Failed to log r\
1544
+ equest:",e)});let response=await this._httpClient.request(req);try{if(isErrorStatusCode(response.status)){let result=await this._hooks.afterError(context,response,null);if(result.error)throw result.error;response=result.response||response}else response=await this._hooks.afterSuccess(context,response)}finally{await logResponse(this._logger,response,req).catch(e=>{var _a3;return(_a3=this._logger)===null||_a3===void 0?void 0:_a3.log("Failed to log response:",e)})}return response},{config:options.retryConfig,
1545
+ statusCodes:options.retryCodes}).then(r=>OK(r),err=>{switch(!0){case isAbortError(err):return ERR(new RequestAbortedError("Request aborted by client",{cause:err}));case isTimeoutError(err):return ERR(new RequestTimeoutError("Request timed out",{cause:err}));case isConnectionError(err):return ERR(new ConnectionError("Unable to make request",{cause:err}));default:return ERR(new UnexpectedClientError("Unexpected HTTP client error",{cause:err}))}})}},jsonLikeContentTypeRE=/^(application|text)\/([^+]+\+)*json.*/,
1546
+ jsonlLikeContentTypeRE=/^(application|text)\/([^+]+\+)*(jsonl|x-ndjson)\b.*/;async function logRequest(logger,req){if(!logger)return;let contentType=req.headers.get("content-type"),ct=contentType?.split(";")[0]||"";logger.group(`> Request: ${req.method} ${req.url}`),logger.group("Headers:");for(let[k,v]of req.headers.entries())logger.log(`${k}: ${v}`);switch(logger.groupEnd(),logger.group("Body:"),!0){case jsonLikeContentTypeRE.test(ct):logger.log(await req.clone().json());break;case ct.startsWith(
1547
+ "text/"):logger.log(await req.clone().text());break;case ct==="multipart/form-data":{let body=await req.clone().formData();for(let[k,v]of body){let vlabel=v instanceof Blob?"<Blob>":v;logger.log(`${k}: ${vlabel}`)}break}default:logger.log(`<${contentType}>`);break}logger.groupEnd(),logger.groupEnd()}async function logResponse(logger,res,req){if(!logger)return;let contentType=res.headers.get("content-type"),ct=contentType?.split(";")[0]||"";logger.group(`< Response: ${req.method} ${req.url}`),logger.
1548
+ log("Status Code:",res.status,res.statusText),logger.group("Headers:");for(let[k,v]of res.headers.entries())logger.log(`${k}: ${v}`);switch(logger.groupEnd(),logger.group("Body:"),!0){case(matchContentType(res,"application/json")||jsonLikeContentTypeRE.test(ct)&&!jsonlLikeContentTypeRE.test(ct)):logger.log(await res.clone().json());break;case(matchContentType(res,"application/jsonl")||jsonlLikeContentTypeRE.test(ct)):case matchContentType(res,"text/event-stream"):logger.log(`<${contentType}>`);break;case matchContentType(
1549
+ res,"text/*"):logger.log(await res.clone().text());break;case matchContentType(res,"multipart/form-data"):{let body=await res.clone().formData();for(let[k,v]of body){let vlabel=v instanceof Blob?"<Blob>":v;logger.log(`${k}: ${vlabel}`)}break}default:logger.log(`<${contentType}>`);break}logger.groupEnd(),logger.groupEnd()}var GoogleGenAiDefaultError=class extends GoogleGenAiError{constructor(message,httpMeta){message&&(message+=": "),message+=`Status ${httpMeta.response.status}`;let contentType=httpMeta.
1550
+ response.headers.get("content-type")||'""';contentType!=="application/json"&&(message+=` Content-Type ${contentType.includes(" ")?`"${contentType}"`:contentType}`);let body=httpMeta.body||'""';message+=body.length>100?`
1551
+ `:". ";let bodyDisplay=body;if(body.length>1e4){let truncated=body.substring(0,1e4),remaining=body.length-1e4;bodyDisplay=`${truncated}...and ${remaining} more chars`}message+=`Body: ${bodyDisplay}`,message=message.trim(),super(message,httpMeta),this.name="GoogleGenAiDefaultError",Object.setPrototypeOf(this,new.target.prototype)}};function tryParseJson(s){try{return JSON.parse(s)}catch{return s}}function wrapEventStreamResponse(body,opts={}){var _a2,_b;let flattened=opts.flattened===!0,sentinel=(_a2=
1552
+ opts.sentinel)!==null&&_a2!==void 0?_a2:"";return new Stream(body,rawEvent=>sentinel!==""&&rawEvent.data===sentinel?{done:!0,value:void 0}:flattened?{done:!1,value:rawEvent.data==null?void 0:tryParseJson(rawEvent.data)}:{done:!1,value:Object.assign(Object.assign({},rawEvent),{data:rawEvent.data==null?rawEvent.data:tryParseJson(rawEvent.data)})},{dataRequired:(_b=opts.dataRequired)!==null&&_b!==void 0?_b:!0})}var Stream=class extends ReadableStream{constructor(responseBody,parse,opts){var _a2;let upstream=responseBody.
1553
+ getReader(),buffer=new Uint8Array(4096),bufferLen=0,searchStart=0,state={eventId:void 0},dataRequired=(_a2=opts?.dataRequired)!==null&&_a2!==void 0?_a2:!0;super({async pull(downstream){try{for(;;){let match2=findBoundary(buffer,bufferLen,searchStart);if(!match2){searchStart=Math.max(0,bufferLen-MAX_BOUNDARY_LEN+1);let chunk=await upstream.read();if(chunk.done)return downstream.close();if(bufferLen+chunk.value.length>buffer.length){let grown=new Uint8Array(Math.max(buffer.length*2,bufferLen+chunk.
1554
+ value.length));grown.set(buffer.subarray(0,bufferLen)),buffer=grown}buffer.set(chunk.value,bufferLen),bufferLen+=chunk.value.length;continue}let message=buffer.slice(0,match2.index);if(buffer.copyWithin(0,match2.index+match2.length,bufferLen),bufferLen-=match2.index+match2.length,buffer.length>4096&&bufferLen<=buffer.length>>2){let shrunk=new Uint8Array(Math.max(4096,bufferLen*2));shrunk.set(buffer.subarray(0,bufferLen)),buffer=shrunk}searchStart=0;let item=parseMessage(message,parse,state,dataRequired);
1555
+ if(item&&!item.done)return downstream.enqueue(item.value);if(item?.done)return await upstream.cancel("done"),downstream.close()}}catch(e){downstream.error(e),await upstream.cancel(e)}},cancel:reason=>upstream.cancel(reason)})}[Symbol.asyncIterator](options){let fn=ReadableStream.prototype[Symbol.asyncIterator];if(typeof fn=="function")return fn.call(this,options);let reader=this.getReader(),iterator={next:async()=>{let r=await reader.read();return r.done?(reader.releaseLock(),{done:!0,value:void 0}):
1556
+ {done:!1,value:r.value}},throw:async e=>(await reader.cancel(e),reader.releaseLock(),{done:!0,value:void 0}),return:async()=>(await reader.cancel("done"),reader.releaseLock(),{done:!0,value:void 0}),[Symbol.asyncIterator](){return this}},asyncDispose=Symbol.asyncDispose;return asyncDispose&&(iterator[asyncDispose]=async()=>{var _a2;await((_a2=iterator.return)===null||_a2===void 0?void 0:_a2.call(iterator))}),iterator}values(options){return this[Symbol.asyncIterator](options)}},CR=13,LF=10,BOUNDARIES=[
1557
+ [CR,LF,CR,LF],[CR,LF,CR],[CR,LF,LF],[CR,CR,LF],[LF,CR,LF],[CR,CR],[LF,CR],[LF,LF]],MAX_BOUNDARY_LEN=BOUNDARIES.reduce((m,b)=>Math.max(m,b.length),0);function findBoundary(buf,len,from){for(let i=from;i<len;i++)if(!(buf[i]!==CR&&buf[i]!==LF))for(let boundary of BOUNDARIES){if(i+boundary.length>len)continue;let match2=!0;for(let j=0;j<boundary.length;j++)if(buf[i+j]!==boundary[j]){match2=!1;break}if(match2)return{index:i,length:boundary.length}}return null}function parseMessage(chunk,parse,state,dataRequired){
1558
+ let lines=new TextDecoder().decode(chunk).split(/\r\n|\r|\n/),dataLines=[],ret={},ignore=!0;for(let line of lines){if(!line||line.startsWith(":"))continue;ignore=!1;let i=line.indexOf(":"),field=line,value="";i>0&&(field=line.slice(0,i),value=line[i+1]===" "?line.slice(i+2):line.slice(i+1)),field==="data"?dataLines.push(value):field==="event"?ret.event=value:field==="id"&&!value.includes("\0")?state.eventId=value:field==="retry"&&/^\d+$/.test(value)&&(ret.retry=Number(value))}if(!ignore){if(ret.
1559
+ id=state.eventId,dataLines.length)ret.data=dataLines.join(`
1568
1560
  `);else if(dataRequired)return;return parse(ret)}}var DEFAULT_CONTENT_TYPES={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function jsonErr(codes,errorClass,options){return Object.assign(Object.assign({},options),{err:!0,enc:"json",codes,errorClass})}function json(codes,options){return Object.assign(Object.assign({},options),{enc:"json",codes})}function sse(codes,sse2,options){
1569
1561
  return Object.assign(Object.assign(Object.assign({},options),{enc:"sse",codes}),sse2?{sse:sse2}:{})}function nil(codes,options){return Object.assign(Object.assign({},options),{enc:"nil",codes})}function fail(codes){return{enc:"fail",codes}}function match(...matchers){return async function(response,request,options){let raw,matcher;for(let match2 of matchers){let{codes}=match2,ctpattern="ctype"in match2?match2.ctype:DEFAULT_CONTENT_TYPES[match2.enc];if(ctpattern&&matchResponse(response,codes,ctpattern)){
1570
1562
  matcher=match2;break}else if(!ctpattern&&matchStatusCode(response,codes)){matcher=match2;break}}if(!matcher)return[{ok:!1,error:new GoogleGenAiDefaultError("Unexpected Status or Content-Type",{response,request,body:await response.text().catch(()=>"")})},raw];let encoding=matcher.enc,body="";switch(encoding){case"json":body=await response.text();try{raw=JSON.parse(body)}catch(err){if(!("err"in matcher))throw err;raw=body}break;case"jsonl":raw=response.body;break;case"bytes":raw=new Uint8Array(await response.