keating 0.3.8 → 0.3.10

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 (404) hide show
  1. package/dist/src/core/benchmark.js +37 -31
  2. package/dist/src/core/pi-agent.js +1 -1
  3. package/dist/src/pi/hyperteacher-extension.js +30 -4
  4. package/dist/src/runtime/pi.js +4 -3
  5. package/package.json +4 -3
  6. package/web/.output/nitro.json +17 -0
  7. package/web/.output/public/.well-known/llms.txt +44 -0
  8. package/web/.output/public/apple-touch-icon.svg +10 -0
  9. package/web/.output/public/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  10. package/web/.output/public/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  11. package/web/.output/public/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  12. package/web/.output/public/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  13. package/web/.output/public/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  14. package/web/.output/public/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  15. package/web/.output/public/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  16. package/web/.output/public/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  17. package/web/.output/public/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  18. package/web/.output/public/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  19. package/web/.output/public/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  20. package/web/.output/public/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  21. package/web/.output/public/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  22. package/web/.output/public/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  23. package/web/.output/public/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  24. package/web/.output/public/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  25. package/web/.output/public/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  26. package/web/.output/public/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  27. package/web/.output/public/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  28. package/web/.output/public/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  29. package/web/.output/public/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  30. package/web/.output/public/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  31. package/web/.output/public/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  32. package/web/.output/public/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  33. package/web/.output/public/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  34. package/web/.output/public/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  35. package/web/.output/public/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  36. package/web/.output/public/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  37. package/web/.output/public/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  38. package/web/.output/public/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  39. package/web/.output/public/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  40. package/web/.output/public/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  41. package/web/.output/public/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  42. package/web/.output/public/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  43. package/web/.output/public/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  44. package/web/.output/public/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  45. package/web/.output/public/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  46. package/web/.output/public/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  47. package/web/.output/public/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  48. package/web/.output/public/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  49. package/web/.output/public/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  50. package/web/.output/public/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  51. package/web/.output/public/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  52. package/web/.output/public/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  53. package/web/.output/public/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  54. package/web/.output/public/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  55. package/web/.output/public/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  56. package/web/.output/public/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  57. package/web/.output/public/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  58. package/web/.output/public/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  59. package/web/.output/public/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  60. package/web/.output/public/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  61. package/web/.output/public/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  62. package/web/.output/public/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  63. package/web/.output/public/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  64. package/web/.output/public/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  65. package/web/.output/public/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  66. package/web/.output/public/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  67. package/web/.output/public/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  68. package/web/.output/public/assets/anthropic-D8J8em9_.js +39 -0
  69. package/web/{dist/assets/arc-BgYOxBdg.js → .output/public/assets/arc-oTgBOc9h.js} +1 -1
  70. package/web/.output/public/assets/architecture-YZFGNWBL-DZ_Ec0kf.js +1 -0
  71. package/web/{dist/assets/architectureDiagram-Q4EWVU46-Yh6i8NsV.js → .output/public/assets/architectureDiagram-Q4EWVU46-BkX3k5GJ.js} +1 -1
  72. package/web/.output/public/assets/azure-openai-responses-BllE29wk.js +1 -0
  73. package/web/{dist/assets/band-mY0qgSES.js → .output/public/assets/band-w5KgYWOj.js} +1 -1
  74. package/web/{dist/assets/blockDiagram-DXYQGD6D-DUOEnS09.js → .output/public/assets/blockDiagram-DXYQGD6D-DQcL9Ujg.js} +1 -1
  75. package/web/{dist/assets/c4Diagram-AHTNJAMY-XzNOUnLt.js → .output/public/assets/c4Diagram-AHTNJAMY-D-IePZqI.js} +1 -1
  76. package/web/.output/public/assets/channel-CYyKOAtV.js +1 -0
  77. package/web/{dist/assets/chunk-2KRD3SAO-mLbXjVje.js → .output/public/assets/chunk-2KRD3SAO-B6zL3K_-.js} +1 -1
  78. package/web/{dist/assets/chunk-336JU56O-CQcnUKNW.js → .output/public/assets/chunk-336JU56O-c7e9XQL0.js} +2 -2
  79. package/web/.output/public/assets/chunk-426QAEUC-BjSoaXb2.js +1 -0
  80. package/web/{dist/assets/chunk-4BX2VUAB-DRZjGMDM.js → .output/public/assets/chunk-4BX2VUAB-C-QwaF8o.js} +1 -1
  81. package/web/{dist/assets/chunk-4TB4RGXK-CAwQq2uM.js → .output/public/assets/chunk-4TB4RGXK-BPHoxzPs.js} +1 -1
  82. package/web/{dist/assets/chunk-55IACEB6-C19HKnvd.js → .output/public/assets/chunk-55IACEB6-B1zv33Gi.js} +1 -1
  83. package/web/{dist/assets/chunk-5FUZZQ4R-Bw3BFJJs.js → .output/public/assets/chunk-5FUZZQ4R-Ca04rGKU.js} +1 -1
  84. package/web/{dist/assets/chunk-5PVQY5BW-Ciel-YVc.js → .output/public/assets/chunk-5PVQY5BW-B-37rcM6.js} +1 -1
  85. package/web/{dist/assets/chunk-67CJDMHE-DNZKE79k.js → .output/public/assets/chunk-67CJDMHE-HdGQv4Jx.js} +1 -1
  86. package/web/{dist/assets/chunk-7N4EOEYR-BGZXIfBD.js → .output/public/assets/chunk-7N4EOEYR-DqXAO0Gi.js} +1 -1
  87. package/web/{dist/assets/chunk-AA7GKIK3-CLWjm_Gk.js → .output/public/assets/chunk-AA7GKIK3-DDm8EH48.js} +1 -1
  88. package/web/{dist/assets/chunk-BSJP7CBP-DwT1eVSc.js → .output/public/assets/chunk-BSJP7CBP-c6iSgQvG.js} +1 -1
  89. package/web/.output/public/assets/chunk-Bj-mKKzh.js +1 -0
  90. package/web/{dist/assets/chunk-CIAEETIT-DaQsGVwH.js → .output/public/assets/chunk-CIAEETIT-CJ1fnWwS.js} +1 -1
  91. package/web/{dist/assets/chunk-EDXVE4YY-DNeRJTiS.js → .output/public/assets/chunk-EDXVE4YY-BAD3qlf8.js} +1 -1
  92. package/web/{dist/assets/chunk-ENJZ2VHE-Crfow0Ab.js → .output/public/assets/chunk-ENJZ2VHE-CygEaEHK.js} +1 -1
  93. package/web/{dist/assets/chunk-FMBD7UC4-BWSstEYx.js → .output/public/assets/chunk-FMBD7UC4-DtK74FNN.js} +1 -1
  94. package/web/{dist/assets/chunk-FOC6F5B3-BrTsf5ix.js → .output/public/assets/chunk-FOC6F5B3-B1tJYVCE.js} +1 -1
  95. package/web/{dist/assets/chunk-ICPOFSXX-C04NFfJk.js → .output/public/assets/chunk-ICPOFSXX-Cx8pjnoR.js} +3 -3
  96. package/web/{dist/assets/chunk-K5T4RW27-C6ErEFB0.js → .output/public/assets/chunk-K5T4RW27-BwFJlMGX.js} +1 -1
  97. package/web/{dist/assets/chunk-KGLVRYIC-DWgMrjZr.js → .output/public/assets/chunk-KGLVRYIC-mZuEP_SX.js} +1 -1
  98. package/web/{dist/assets/chunk-LIHQZDEY-D3DWGnJT.js → .output/public/assets/chunk-LIHQZDEY-kAIrsC_z.js} +1 -1
  99. package/web/{dist/assets/chunk-ORNJ4GCN-D0nhq27e.js → .output/public/assets/chunk-ORNJ4GCN-B5sPpxPr.js} +1 -1
  100. package/web/{dist/assets/chunk-OYMX7WX6-CQLx0cU3.js → .output/public/assets/chunk-OYMX7WX6-793CQBwp.js} +1 -1
  101. package/web/.output/public/assets/chunk-QZHKN3VN-BeLnIYwL.js +1 -0
  102. package/web/{dist/assets/chunk-U2HBQHQK-FqDOW_Dq.js → .output/public/assets/chunk-U2HBQHQK-ffKeXnV6.js} +1 -1
  103. package/web/{dist/assets/chunk-X2U36JSP-DiSftNGg.js → .output/public/assets/chunk-X2U36JSP-DntoY71A.js} +1 -1
  104. package/web/{dist/assets/chunk-XPW4576I-CTCFDURY.js → .output/public/assets/chunk-XPW4576I-DuNk6l5T.js} +1 -1
  105. package/web/{dist/assets/chunk-YZCP3GAM-BhxShnp0.js → .output/public/assets/chunk-YZCP3GAM-C6cD67UW.js} +1 -1
  106. package/web/{dist/assets/chunk-ZZ45TVLE-DMfGJuPz.js → .output/public/assets/chunk-ZZ45TVLE-C-NXiDgG.js} +1 -1
  107. package/web/.output/public/assets/classDiagram-6PBFFD2Q-B0p5BvS5.js +1 -0
  108. package/web/.output/public/assets/classDiagram-v2-HSJHXN6E-CNV1kogp.js +1 -0
  109. package/web/.output/public/assets/clone-t_jPG6Vp.js +1 -0
  110. package/web/{dist/assets/cose-bilkent-S5V4N54A-BWrDpSLZ.js → .output/public/assets/cose-bilkent-S5V4N54A-B_r8CGOq.js} +1 -1
  111. package/web/{dist/assets/custom-tts-DA7XkgNJ.js → .output/public/assets/custom-tts-6caJdeJH.js} +1 -1
  112. package/web/{dist/assets/dagre-C_Y5Jrtl.js → .output/public/assets/dagre-B6LvKZOC.js} +1 -1
  113. package/web/{dist/assets/dagre-KV5264BT-DcrvRRX1.js → .output/public/assets/dagre-KV5264BT-kmbpW2Qa.js} +1 -1
  114. package/web/.output/public/assets/diagnostics-Dir03GES.js +1 -0
  115. package/web/{dist/assets/diagram-5BDNPKRD-BsChRck6.js → .output/public/assets/diagram-5BDNPKRD-jScdzoma.js} +1 -1
  116. package/web/{dist/assets/diagram-G4DWMVQ6-raeAsgoe.js → .output/public/assets/diagram-G4DWMVQ6-DpX26eSz.js} +1 -1
  117. package/web/{dist/assets/diagram-MMDJMWI5-CuKsP84I.js → .output/public/assets/diagram-MMDJMWI5-C9dVTkG7.js} +1 -1
  118. package/web/{dist/assets/diagram-TYMM5635-T7ILcS3d.js → .output/public/assets/diagram-TYMM5635-DRTAOPO-.js} +1 -1
  119. package/web/{dist/assets/dist-oYdMaa1U.js → .output/public/assets/dist-mae6wHLp.js} +3 -3
  120. package/web/.output/public/assets/env-api-keys-7u9jMM5_.js +1 -0
  121. package/web/{dist/assets/erDiagram-SMLLAGMA-C9z6kYxH.js → .output/public/assets/erDiagram-SMLLAGMA-Coj28jXq.js} +1 -1
  122. package/web/.output/public/assets/event-stream-DcqAlaOm.js +1 -0
  123. package/web/{dist/assets/flatten-n72VCU_F.js → .output/public/assets/flatten-U6HPKYck.js} +1 -1
  124. package/web/{dist/assets/flowDiagram-DWJPFMVM-BA3HBIvp.js → .output/public/assets/flowDiagram-DWJPFMVM-CrvcpZkH.js} +1 -1
  125. package/web/{dist/assets/ganttDiagram-T4ZO3ILL-BXKKRsbk.js → .output/public/assets/ganttDiagram-T4ZO3ILL-C_IKmfo1.js} +1 -1
  126. package/web/.output/public/assets/gemini-live-yGyuxMZL.js +2 -0
  127. package/web/.output/public/assets/gitGraph-7Q5UKJZL-CqSUwktU.js +1 -0
  128. package/web/{dist/assets/gitGraphDiagram-UUTBAWPF-CfGAccI8.js → .output/public/assets/gitGraphDiagram-UUTBAWPF-BI4Z-mQ2.js} +1 -1
  129. package/web/.output/public/assets/github-copilot-headers-B6Fvsk-Y.js +1 -0
  130. package/web/.output/public/assets/google-Nkegp1GZ.js +1 -0
  131. package/web/.output/public/assets/google-shared-DGeOO0KQ.js +11 -0
  132. package/web/.output/public/assets/google-vertex-g5NuaSdk.js +1 -0
  133. package/web/{dist/assets/graphlib-sK54_wxh.js → .output/public/assets/graphlib-5VtJ2oig.js} +1 -1
  134. package/web/.output/public/assets/headers-DkHU-pcw.js +1 -0
  135. package/web/{dist/assets/index-B_MGHHww.js → .output/public/assets/index-BqQW1iWw.js} +807 -775
  136. package/web/.output/public/assets/index-CGn8E70R.css +2 -0
  137. package/web/.output/public/assets/info-OMHHGYJF-CuBqqD0E.js +1 -0
  138. package/web/{dist/assets/infoDiagram-42DDH7IO-CXoykyfr.js → .output/public/assets/infoDiagram-42DDH7IO-DJwPib2w.js} +1 -1
  139. package/web/{dist/assets/isEmpty-Lz_aOZWI.js → .output/public/assets/isEmpty-Bz-lCaCA.js} +1 -1
  140. package/web/{dist/assets/ishikawaDiagram-UXIWVN3A-BJieXVMt.js → .output/public/assets/ishikawaDiagram-UXIWVN3A-Bm0Zg0-C.js} +1 -1
  141. package/web/{dist/assets/journeyDiagram-VCZTEJTY-CwCyrnqT.js → .output/public/assets/journeyDiagram-VCZTEJTY-7KIiN_Ei.js} +1 -1
  142. package/web/{dist/assets/json-parse-C6tSeIxX.js → .output/public/assets/json-parse-MTOUHjU0.js} +2 -1
  143. package/web/{dist/assets/kanban-definition-6JOO6SKY-8ACmDHsl.js → .output/public/assets/kanban-definition-6JOO6SKY-CWSQfP5S.js} +1 -1
  144. package/web/{dist/assets/line-BqZCcbso.js → .output/public/assets/line-DrNncrSe.js} +1 -1
  145. package/web/{dist/assets/linear-CXf5Bx3D.js → .output/public/assets/linear-BwflsB10.js} +1 -1
  146. package/web/{dist/assets/mermaid-parser.core-C8ylgsWV.js → .output/public/assets/mermaid-parser.core-DMxe11ol.js} +2 -2
  147. package/web/{dist/assets/mermaid.core-BHCT6V24.js → .output/public/assets/mermaid.core-CzgDa8OF.js} +3 -3
  148. package/web/{dist/assets/mindmap-definition-QFDTVHPH-DrDAZL9Q.js → .output/public/assets/mindmap-definition-QFDTVHPH-D-lNkDnE.js} +1 -1
  149. package/web/.output/public/assets/mistral-Ba31w8rV.js +69 -0
  150. package/web/.output/public/assets/openai-codex-responses-X5oqdT0v.js +7 -0
  151. package/web/.output/public/assets/openai-completions-DYxG7eWy.js +5 -0
  152. package/web/.output/public/assets/openai-prompt-cache-9tCK10l1.js +1 -0
  153. package/web/{dist/assets/openai-realtime-BCZmIToJ.js → .output/public/assets/openai-realtime-D1gbzEEc.js} +1 -1
  154. package/web/.output/public/assets/openai-responses-BzceW3eb.js +1 -0
  155. package/web/.output/public/assets/openai-responses-shared-B9_LiyEY.js +12 -0
  156. package/web/{dist/assets/openai-tts-BRg2goic.js → .output/public/assets/openai-tts-DG5Ys3k9.js} +1 -1
  157. package/web/.output/public/assets/openrouter-C9VgLw1K.js +1 -0
  158. package/web/{dist/assets/ordinal-CHOvK70a.js → .output/public/assets/ordinal-Cw77dVkR.js} +1 -1
  159. package/web/.output/public/assets/ort-wasm-simd-threaded.jsep-B0T3yYHD.wasm +0 -0
  160. package/web/.output/public/assets/p-retry-mEzMPax9.js +1 -0
  161. package/web/.output/public/assets/packet-4T2RLAQJ-D2x4nN0-.js +1 -0
  162. package/web/.output/public/assets/pdf.worker.min-Cpi8b8z3.mjs +28 -0
  163. package/web/.output/public/assets/pie-ZZUOXDRM-kWPr2BJV.js +1 -0
  164. package/web/{dist/assets/pieDiagram-DEJITSTG-CSnulv9o.js → .output/public/assets/pieDiagram-DEJITSTG-C7FwzQS5.js} +1 -1
  165. package/web/.output/public/assets/preload-helper-DSXbuxSR.js +1 -0
  166. package/web/{dist/assets/quadrantDiagram-34T5L4WZ-DiM-1bw4.js → .output/public/assets/quadrantDiagram-34T5L4WZ-CY7HoVD8.js} +1 -1
  167. package/web/.output/public/assets/radar-PYXPWWZC-C95fU_MN.js +1 -0
  168. package/web/{dist/assets/reduce-r7gP4wdg.js → .output/public/assets/reduce-DQIdC_mC.js} +1 -1
  169. package/web/{dist/assets/renderer-BHoCfdWO-BFpsm4dw.js → .output/public/assets/renderer-BHoCfdWO-COcEnbx-.js} +1 -1
  170. package/web/{dist/assets/requirementDiagram-MS252O5E-CunJUnIN.js → .output/public/assets/requirementDiagram-MS252O5E-paEmPBuX.js} +1 -1
  171. package/web/.output/public/assets/sanitize-unicode-BD2XKRoV.js +1 -0
  172. package/web/{dist/assets/sankeyDiagram-XADWPNL6-DaA_56zq.js → .output/public/assets/sankeyDiagram-XADWPNL6-Ext_g4Ox.js} +1 -1
  173. package/web/{dist/assets/sequenceDiagram-FGHM5R23-CG_SeqVO.js → .output/public/assets/sequenceDiagram-FGHM5R23-CTLnxFUj.js} +1 -1
  174. package/web/{dist/assets/speech-ZNExxXBR.js → .output/public/assets/speech-D3C-KRDP.js} +2 -2
  175. package/web/{dist/assets/src-BfaOho0B.js → .output/public/assets/src-BOZISNbw.js} +1 -1
  176. package/web/{dist/assets/stateDiagram-FHFEXIEX-CSUigMtP.js → .output/public/assets/stateDiagram-FHFEXIEX-B3an23Pn.js} +1 -1
  177. package/web/.output/public/assets/stateDiagram-v2-QKLJ7IA2-D_cYSwJU.js +1 -0
  178. package/web/{dist/assets/supertonic-hDdNdgtO.js → .output/public/assets/supertonic-DzwILFbx.js} +2 -2
  179. package/web/{dist/assets/time-DaCo2z7n.js → .output/public/assets/time-HnfVL2-O.js} +1 -1
  180. package/web/{dist/assets/timeline-definition-GMOUNBTQ-DcMiH-gG.js → .output/public/assets/timeline-definition-GMOUNBTQ-D_chE-0s.js} +1 -1
  181. package/web/.output/public/assets/transform-messages-BQ4ruKay.js +1 -0
  182. package/web/{dist/assets/transformers.web-R9eWI1xg.js → .output/public/assets/transformers.web-Bopumv3I.js} +1 -1
  183. package/web/.output/public/assets/treeView-SZITEDCU-BaJsJYGU.js +1 -0
  184. package/web/.output/public/assets/treemap-W4RFUUIX-CZyrM93a.js +1 -0
  185. package/web/{dist/assets/vennDiagram-DHZGUBPP-C6A75Q3q.js → .output/public/assets/vennDiagram-DHZGUBPP-CVDiEdUR.js} +1 -1
  186. package/web/.output/public/assets/wardley-RL74JXVD-CF0AcTcr.js +1 -0
  187. package/web/{dist/assets/wardleyDiagram-NUSXRM2D-XmYD0oYm.js → .output/public/assets/wardleyDiagram-NUSXRM2D-CroPrw7r.js} +1 -1
  188. package/web/.output/public/assets/web-CVLwkmjx.js +10 -0
  189. package/web/{dist/assets/xychartDiagram-5P7HB3ND-BgSoKcS9.js → .output/public/assets/xychartDiagram-5P7HB3ND-C0_hkOEJ.js} +1 -1
  190. package/web/.output/public/assets/zodToJsonSchema-CS8B3iBY.js +3 -0
  191. package/web/.output/public/favicon.svg +10 -0
  192. package/web/.output/public/index.html +118 -0
  193. package/web/.output/public/keating-metaharness.pdf +10557 -3
  194. package/web/.output/public/llms.txt +44 -0
  195. package/web/.output/public/logo.png +0 -0
  196. package/web/.output/public/manifest.webmanifest +1 -0
  197. package/web/.output/public/og-image.png +0 -0
  198. package/web/.output/public/pwa-192x192.svg +10 -0
  199. package/web/.output/public/pwa-512x512.svg +10 -0
  200. package/web/.output/public/registerSW.js +1 -0
  201. package/web/.output/public/robots.txt +8 -0
  202. package/web/.output/public/sitemap.xml +39 -0
  203. package/web/.output/public/sw.js +665 -0
  204. package/web/.output/public/tapes/doctor.mp4 +0 -0
  205. package/web/.output/public/tapes/feedback-flow.mp4 +0 -0
  206. package/web/.output/public/tapes/improve-flow.mp4 +0 -0
  207. package/web/.output/public/tapes/intro.mp4 +0 -0
  208. package/web/.output/public/tapes/learning-flow.mp4 +0 -0
  209. package/web/.output/public/tapes/session-flow.mp4 +0 -0
  210. package/web/.output/public/tapes/teacher-flow.mp4 +0 -0
  211. package/web/.output/public/tapes/tests.mp4 +0 -0
  212. package/web/.output/public/workbox-2ae722a1.js +4390 -0
  213. package/web/.output/server/_chunks/renderer-template.mjs +10 -0
  214. package/web/.output/server/_libs/h3+rou3+srvx.mjs +1383 -0
  215. package/web/.output/server/_libs/hookable.mjs +41 -0
  216. package/web/.output/server/_libs/ufo.mjs +64 -0
  217. package/web/.output/server/index.mjs +2095 -0
  218. package/web/dist/assets/_baseFor-B4pl5CmD.js +1 -0
  219. package/web/dist/assets/anthropic-D8J8em9_.js +39 -0
  220. package/web/dist/assets/arc-oTgBOc9h.js +1 -0
  221. package/web/dist/assets/architecture-YZFGNWBL-DZ_Ec0kf.js +1 -0
  222. package/web/dist/assets/architectureDiagram-Q4EWVU46-BkX3k5GJ.js +36 -0
  223. package/web/dist/assets/array-DKReyB4R.js +1 -0
  224. package/web/dist/assets/azure-openai-responses-BllE29wk.js +1 -0
  225. package/web/dist/assets/band-w5KgYWOj.js +1 -0
  226. package/web/dist/assets/blockDiagram-DXYQGD6D-DQcL9Ujg.js +132 -0
  227. package/web/dist/assets/c4Diagram-AHTNJAMY-D-IePZqI.js +10 -0
  228. package/web/dist/assets/channel-CYyKOAtV.js +1 -0
  229. package/web/dist/assets/chunk-2KRD3SAO-B6zL3K_-.js +1 -0
  230. package/web/dist/assets/chunk-336JU56O-c7e9XQL0.js +2 -0
  231. package/web/dist/assets/chunk-426QAEUC-BjSoaXb2.js +1 -0
  232. package/web/dist/assets/chunk-4BX2VUAB-C-QwaF8o.js +1 -0
  233. package/web/dist/assets/chunk-4TB4RGXK-BPHoxzPs.js +206 -0
  234. package/web/dist/assets/chunk-55IACEB6-B1zv33Gi.js +1 -0
  235. package/web/dist/assets/chunk-5FUZZQ4R-Ca04rGKU.js +62 -0
  236. package/web/dist/assets/chunk-5PVQY5BW-B-37rcM6.js +2 -0
  237. package/web/dist/assets/chunk-67CJDMHE-HdGQv4Jx.js +1 -0
  238. package/web/dist/assets/chunk-7N4EOEYR-DqXAO0Gi.js +1 -0
  239. package/web/dist/assets/chunk-AA7GKIK3-DDm8EH48.js +1 -0
  240. package/web/dist/assets/chunk-BSJP7CBP-c6iSgQvG.js +1 -0
  241. package/web/dist/assets/chunk-CIAEETIT-CJ1fnWwS.js +1 -0
  242. package/web/dist/assets/chunk-EDXVE4YY-BAD3qlf8.js +1 -0
  243. package/web/dist/assets/chunk-ENJZ2VHE-CygEaEHK.js +10 -0
  244. package/web/dist/assets/chunk-FMBD7UC4-DtK74FNN.js +15 -0
  245. package/web/dist/assets/chunk-FOC6F5B3-B1tJYVCE.js +1 -0
  246. package/web/dist/assets/chunk-ICPOFSXX-Cx8pjnoR.js +123 -0
  247. package/web/dist/assets/chunk-K5T4RW27-BwFJlMGX.js +94 -0
  248. package/web/dist/assets/chunk-KGLVRYIC-mZuEP_SX.js +1 -0
  249. package/web/dist/assets/chunk-LIHQZDEY-kAIrsC_z.js +1 -0
  250. package/web/dist/assets/chunk-ORNJ4GCN-B5sPpxPr.js +1 -0
  251. package/web/dist/assets/chunk-OYMX7WX6-793CQBwp.js +231 -0
  252. package/web/dist/assets/chunk-QZHKN3VN-BeLnIYwL.js +1 -0
  253. package/web/dist/assets/chunk-U2HBQHQK-ffKeXnV6.js +70 -0
  254. package/web/dist/assets/chunk-X2U36JSP-DntoY71A.js +1 -0
  255. package/web/dist/assets/chunk-XPW4576I-DuNk6l5T.js +32 -0
  256. package/web/dist/assets/chunk-YZCP3GAM-C6cD67UW.js +1 -0
  257. package/web/dist/assets/chunk-ZZ45TVLE-C-NXiDgG.js +1 -0
  258. package/web/dist/assets/classDiagram-6PBFFD2Q-B0p5BvS5.js +1 -0
  259. package/web/dist/assets/classDiagram-v2-HSJHXN6E-CNV1kogp.js +1 -0
  260. package/web/dist/assets/clone-t_jPG6Vp.js +1 -0
  261. package/web/dist/assets/cose-bilkent-S5V4N54A-B_r8CGOq.js +1 -0
  262. package/web/dist/assets/custom-tts-6caJdeJH.js +1 -0
  263. package/web/dist/assets/cytoscape.esm-CIAhqqev.js +321 -0
  264. package/web/dist/assets/dagre-B6LvKZOC.js +1 -0
  265. package/web/dist/assets/dagre-KV5264BT-kmbpW2Qa.js +4 -0
  266. package/web/dist/assets/defaultLocale-CzQOUpbn.js +1 -0
  267. package/web/dist/assets/diagnostics-Dir03GES.js +1 -0
  268. package/web/dist/assets/diagram-5BDNPKRD-jScdzoma.js +10 -0
  269. package/web/dist/assets/diagram-G4DWMVQ6-DpX26eSz.js +24 -0
  270. package/web/dist/assets/diagram-MMDJMWI5-C9dVTkG7.js +43 -0
  271. package/web/dist/assets/diagram-TYMM5635-DRTAOPO-.js +24 -0
  272. package/web/dist/assets/dist-DzRHszr6.js +1 -0
  273. package/web/dist/assets/dist-mae6wHLp.js +10 -0
  274. package/web/dist/assets/env-api-keys-7u9jMM5_.js +1 -0
  275. package/web/dist/assets/erDiagram-SMLLAGMA-Coj28jXq.js +85 -0
  276. package/web/dist/assets/event-stream-DcqAlaOm.js +1 -0
  277. package/web/dist/assets/flatten-U6HPKYck.js +1 -0
  278. package/web/dist/assets/flowDiagram-DWJPFMVM-CrvcpZkH.js +162 -0
  279. package/web/dist/assets/ganttDiagram-T4ZO3ILL-C_IKmfo1.js +292 -0
  280. package/web/dist/assets/gemini-live-yGyuxMZL.js +2 -0
  281. package/web/dist/assets/gitGraph-7Q5UKJZL-CqSUwktU.js +1 -0
  282. package/web/dist/assets/gitGraphDiagram-UUTBAWPF-BI4Z-mQ2.js +106 -0
  283. package/web/dist/assets/github-copilot-headers-B6Fvsk-Y.js +1 -0
  284. package/web/dist/assets/google-Nkegp1GZ.js +1 -0
  285. package/web/dist/assets/google-shared-DGeOO0KQ.js +11 -0
  286. package/web/dist/assets/google-vertex-g5NuaSdk.js +1 -0
  287. package/web/dist/assets/graphlib-5VtJ2oig.js +1 -0
  288. package/web/dist/assets/hash-K0cSe8jy.js +1 -0
  289. package/web/dist/assets/headers-DkHU-pcw.js +1 -0
  290. package/web/dist/assets/index-BqQW1iWw.js +3219 -0
  291. package/web/dist/assets/index-CGn8E70R.css +2 -0
  292. package/web/dist/assets/info-OMHHGYJF-CuBqqD0E.js +1 -0
  293. package/web/dist/assets/infoDiagram-42DDH7IO-DJwPib2w.js +2 -0
  294. package/web/dist/assets/init-BPUAOWDF.js +1 -0
  295. package/web/dist/assets/isEmpty-Bz-lCaCA.js +1 -0
  296. package/web/dist/assets/ishikawaDiagram-UXIWVN3A-Bm0Zg0-C.js +70 -0
  297. package/web/dist/assets/journeyDiagram-VCZTEJTY-7KIiN_Ei.js +139 -0
  298. package/web/dist/assets/json-parse-MTOUHjU0.js +3 -0
  299. package/web/dist/assets/kanban-definition-6JOO6SKY-CWSQfP5S.js +89 -0
  300. package/web/dist/assets/katex-C_VFEy8p.js +265 -0
  301. package/web/dist/assets/line-DrNncrSe.js +1 -0
  302. package/web/dist/assets/linear-BwflsB10.js +1 -0
  303. package/web/dist/assets/math-CqsWNv0u.js +1 -0
  304. package/web/dist/assets/mermaid-parser.core-DMxe11ol.js +4 -0
  305. package/web/dist/assets/mermaid.core-CzgDa8OF.js +11 -0
  306. package/web/dist/assets/mindmap-definition-QFDTVHPH-D-lNkDnE.js +96 -0
  307. package/web/dist/assets/mistral-Ba31w8rV.js +69 -0
  308. package/web/dist/assets/openai-DAtqabcb.js +16 -0
  309. package/web/dist/assets/openai-codex-responses-X5oqdT0v.js +7 -0
  310. package/web/dist/assets/openai-completions-DYxG7eWy.js +5 -0
  311. package/web/dist/assets/openai-prompt-cache-9tCK10l1.js +1 -0
  312. package/web/dist/assets/openai-realtime-D1gbzEEc.js +1 -0
  313. package/web/dist/assets/openai-responses-BzceW3eb.js +1 -0
  314. package/web/dist/assets/openai-responses-shared-B9_LiyEY.js +12 -0
  315. package/web/dist/assets/openai-tts-DG5Ys3k9.js +1 -0
  316. package/web/dist/assets/openrouter-C9VgLw1K.js +1 -0
  317. package/web/dist/assets/ordinal-Cw77dVkR.js +1 -0
  318. package/web/dist/assets/ort.bundle.min-CE4lKfUe.js +2805 -0
  319. package/web/dist/assets/p-retry-mEzMPax9.js +1 -0
  320. package/web/dist/assets/packet-4T2RLAQJ-D2x4nN0-.js +1 -0
  321. package/web/dist/assets/path-DceIr1s7.js +1 -0
  322. package/web/dist/assets/pie-ZZUOXDRM-kWPr2BJV.js +1 -0
  323. package/web/dist/assets/pieDiagram-DEJITSTG-C7FwzQS5.js +30 -0
  324. package/web/dist/assets/quadrantDiagram-34T5L4WZ-CY7HoVD8.js +7 -0
  325. package/web/dist/assets/radar-PYXPWWZC-C95fU_MN.js +1 -0
  326. package/web/dist/assets/reduce-DQIdC_mC.js +1 -0
  327. package/web/dist/assets/renderer-BHoCfdWO-COcEnbx-.js +1 -0
  328. package/web/dist/assets/requirementDiagram-MS252O5E-paEmPBuX.js +84 -0
  329. package/web/dist/assets/rough.esm-zabqYs6f.js +1 -0
  330. package/web/dist/assets/sanitize-unicode-BD2XKRoV.js +1 -0
  331. package/web/dist/assets/sankeyDiagram-XADWPNL6-Ext_g4Ox.js +10 -0
  332. package/web/dist/assets/sequenceDiagram-FGHM5R23-CTLnxFUj.js +157 -0
  333. package/web/dist/assets/speech-D3C-KRDP.js +2 -0
  334. package/web/dist/assets/src-BOZISNbw.js +1 -0
  335. package/web/dist/assets/state-CrA0YVPh-CbRahjhd.js +27 -0
  336. package/web/dist/assets/stateDiagram-FHFEXIEX-B3an23Pn.js +1 -0
  337. package/web/dist/assets/stateDiagram-v2-QKLJ7IA2-D_cYSwJU.js +1 -0
  338. package/web/dist/assets/step-Dm9As71j.js +1 -0
  339. package/web/dist/assets/string-DAtruGuJ.js +1 -0
  340. package/web/dist/assets/supertonic-DzwILFbx.js +2 -0
  341. package/web/dist/assets/time-HnfVL2-O.js +1 -0
  342. package/web/dist/assets/timeline-definition-GMOUNBTQ-D_chE-0s.js +120 -0
  343. package/web/dist/assets/transform-messages-BQ4ruKay.js +1 -0
  344. package/web/dist/assets/transformers.web-Bopumv3I.js +14 -0
  345. package/web/dist/assets/treeView-SZITEDCU-BaJsJYGU.js +1 -0
  346. package/web/dist/assets/treemap-W4RFUUIX-CZyrM93a.js +1 -0
  347. package/web/dist/assets/vennDiagram-DHZGUBPP-CVDiEdUR.js +34 -0
  348. package/web/dist/assets/wardley-RL74JXVD-CF0AcTcr.js +1 -0
  349. package/web/dist/assets/wardleyDiagram-NUSXRM2D-CroPrw7r.js +20 -0
  350. package/web/dist/assets/web-CVLwkmjx.js +10 -0
  351. package/web/dist/assets/xychartDiagram-5P7HB3ND-C0_hkOEJ.js +7 -0
  352. package/web/dist/assets/zodToJsonSchema-CS8B3iBY.js +3 -0
  353. package/web/dist/index.html +21 -20
  354. package/web/dist/sw.js +148 -130
  355. package/web/dist/assets/anthropic-mDOoXVZn.js +0 -36
  356. package/web/dist/assets/architecture-YZFGNWBL-MLoSDt-a.js +0 -1
  357. package/web/dist/assets/azure-openai-responses-lDjfaDoj.js +0 -1
  358. package/web/dist/assets/channel-BumC_1wb.js +0 -1
  359. package/web/dist/assets/chunk-426QAEUC-AjoT_j_q.js +0 -1
  360. package/web/dist/assets/chunk-QZHKN3VN-X2zPgEFk.js +0 -1
  361. package/web/dist/assets/classDiagram-6PBFFD2Q-qESk_xyE.js +0 -1
  362. package/web/dist/assets/classDiagram-v2-HSJHXN6E-BM1nmtfm.js +0 -1
  363. package/web/dist/assets/clone-CVy2b825.js +0 -1
  364. package/web/dist/assets/env-api-keys-BNlMKqxw.js +0 -1
  365. package/web/dist/assets/event-stream-D33K9rpL.js +0 -1
  366. package/web/dist/assets/gemini-live-dK40vCc5.js +0 -2
  367. package/web/dist/assets/gitGraph-7Q5UKJZL-Cy0KloCM.js +0 -1
  368. package/web/dist/assets/github-copilot-headers-BuUn5v2j.js +0 -1
  369. package/web/dist/assets/google-BdS4iTyC.js +0 -1
  370. package/web/dist/assets/google-gemini-cli-ECA0sP3z.js +0 -2
  371. package/web/dist/assets/google-shared-DFv4ubOG.js +0 -2
  372. package/web/dist/assets/google-vertex-Duei77qD.js +0 -1
  373. package/web/dist/assets/index-C_k9n6xi.css +0 -2
  374. package/web/dist/assets/info-OMHHGYJF-DiTlPM51.js +0 -1
  375. package/web/dist/assets/mistral-BCIirCkW.js +0 -7
  376. package/web/dist/assets/openai-codex-responses-BgRTWVD_.js +0 -7
  377. package/web/dist/assets/openai-completions-D5AUQEua.js +0 -5
  378. package/web/dist/assets/openai-responses-CTlQ1a-G.js +0 -1
  379. package/web/dist/assets/openai-responses-shared-CLzQyVyy.js +0 -10
  380. package/web/dist/assets/packet-4T2RLAQJ-EXgAtQjm.js +0 -1
  381. package/web/dist/assets/pie-ZZUOXDRM-dKU8mzlj.js +0 -1
  382. package/web/dist/assets/radar-PYXPWWZC-B4d2wh2H.js +0 -1
  383. package/web/dist/assets/stateDiagram-v2-QKLJ7IA2-CgpYzp7D.js +0 -1
  384. package/web/dist/assets/transform-messages-DXDWLrnO.js +0 -1
  385. package/web/dist/assets/treeView-SZITEDCU-V29H5f16.js +0 -1
  386. package/web/dist/assets/treemap-W4RFUUIX-DsAU74TP.js +0 -1
  387. package/web/dist/assets/wardley-RL74JXVD-lGAI4Cps.js +0 -1
  388. package/web/dist/assets/web-jLdm8a1-.js +0 -10
  389. /package/web/{dist/assets/_baseFor-2QgQJAzW.js → .output/public/assets/_baseFor-B4pl5CmD.js} +0 -0
  390. /package/web/{dist/assets/array-B4O_ir3H.js → .output/public/assets/array-DKReyB4R.js} +0 -0
  391. /package/web/{dist/assets/cytoscape.esm-CdzdaUMP.js → .output/public/assets/cytoscape.esm-CIAhqqev.js} +0 -0
  392. /package/web/{dist/assets/defaultLocale-Bhb3osZR.js → .output/public/assets/defaultLocale-CzQOUpbn.js} +0 -0
  393. /package/web/{dist/assets/dist-DQ41Rxbw.js → .output/public/assets/dist-DzRHszr6.js} +0 -0
  394. /package/web/{dist/assets/hash-CQjDwcjR.js → .output/public/assets/hash-K0cSe8jy.js} +0 -0
  395. /package/web/{dist/assets/init-DugVGdkd.js → .output/public/assets/init-BPUAOWDF.js} +0 -0
  396. /package/web/{dist/assets/katex-CyM-5LlM.js → .output/public/assets/katex-C_VFEy8p.js} +0 -0
  397. /package/web/{dist/assets/math-Csj_9zpx.js → .output/public/assets/math-CqsWNv0u.js} +0 -0
  398. /package/web/{dist/assets/openai-CRGaNv9i.js → .output/public/assets/openai-DAtqabcb.js} +0 -0
  399. /package/web/{dist/assets/ort.bundle.min-Drf2fDrC.js → .output/public/assets/ort.bundle.min-CE4lKfUe.js} +0 -0
  400. /package/web/{dist/assets/path-BVVvcbiy.js → .output/public/assets/path-DceIr1s7.js} +0 -0
  401. /package/web/{dist/assets/rough.esm-D5NinLFK.js → .output/public/assets/rough.esm-zabqYs6f.js} +0 -0
  402. /package/web/{dist/assets/state-CrA0YVPh-wJ4Rmm6M.js → .output/public/assets/state-CrA0YVPh-CbRahjhd.js} +0 -0
  403. /package/web/{dist/assets/step-qalMyYGy.js → .output/public/assets/step-Dm9As71j.js} +0 -0
  404. /package/web/{dist/assets/string-DPssBiak.js → .output/public/assets/string-DAtruGuJ.js} +0 -0
@@ -0,0 +1,10 @@
1
+ import{s as e}from"./chunk-Bj-mKKzh.js";import{t}from"./p-retry-mEzMPax9.js";var n=e(t(),1),r=void 0,i=void 0;function a(){return{geminiUrl:r,vertexUrl:i}}function o(e,t,n,r){if(!e?.baseUrl){let e=a();return t?e.vertexUrl??n:e.geminiUrl??r}return e.baseUrl}var s=class{};function c(e,t){return e.replace(/\{([^}]+)\}/g,(e,n)=>{if(Object.prototype.hasOwnProperty.call(t,n)){let e=t[n];return e==null?``:String(e)}else throw Error(`Key '${n}' not found in valueMap.`)})}function l(e,t,n){for(let r=0;r<t.length-1;r++){let i=t[r];if(i.endsWith(`[]`)){let a=i.slice(0,-2);if(!(a in e))if(Array.isArray(n))e[a]=Array.from({length:n.length},()=>({}));else throw Error(`Value must be a list given an array path ${i}`);if(Array.isArray(e[a])){let i=e[a];if(Array.isArray(n))for(let e=0;e<i.length;e++){let a=i[e];l(a,t.slice(r+1),n[e])}else for(let e of i)l(e,t.slice(r+1),n)}return}else if(i.endsWith(`[0]`)){let a=i.slice(0,-3);a in e||(e[a]=[{}]);let o=e[a];l(o[0],t.slice(r+1),n);return}(!e[i]||typeof e[i]!=`object`)&&(e[i]={}),e=e[i]}let r=t[t.length-1],i=e[r];if(i!==void 0){if(!n||typeof n==`object`&&Object.keys(n).length===0||n===i)return;if(typeof i==`object`&&typeof n==`object`&&i!==null&&n!==null)Object.assign(i,n);else throw Error(`Cannot set value for an existing key. Key: ${r}`)}else r===`_self`&&typeof n==`object`&&n&&!Array.isArray(n)?Object.assign(e,n):e[r]=n}function u(e,t,n=void 0){try{if(t.length===1&&t[0]===`_self`)return e;for(let r=0;r<t.length;r++){if(typeof e!=`object`||!e)return n;let i=t[r];if(i.endsWith(`[]`)){let a=i.slice(0,-2);if(a in e){let i=e[a];return Array.isArray(i)?i.map(e=>u(e,t.slice(r+1),n)):n}else return n}else e=e[i]}return e}catch(e){if(e instanceof TypeError)return n;throw e}}function d(e,t){for(let[n,r]of Object.entries(t)){let t=n.split(`.`),i=r.split(`.`),a=new Set,o=-1;for(let e=0;e<t.length;e++)if(t[e]===`*`){o=e;break}if(o!==-1&&i.length>o)for(let e=o;e<i.length;e++){let t=i[e];t!==`*`&&!t.endsWith(`[]`)&&!t.endsWith(`[0]`)&&a.add(t)}f(e,t,i,0,a)}}function f(e,t,n,r,i){if(r>=t.length||typeof e!=`object`||!e)return;let a=t[r];if(a.endsWith(`[]`)){let o=a.slice(0,-2),s=e;if(o in s&&Array.isArray(s[o]))for(let e of s[o])f(e,t,n,r+1,i)}else if(a===`*`){if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e,a=Object.keys(t).filter(e=>!e.startsWith(`_`)&&!i.has(e)),o={};for(let e of a)o[e]=t[e];for(let[e,i]of Object.entries(o)){let a=[];for(let t of n.slice(r))t===`*`?a.push(e):a.push(t);l(t,a,i)}for(let e of a)delete t[e]}}else{let o=e;a in o&&f(o[a],t,n,r+1,i)}}function p(e){if(typeof e!=`string`)throw Error(`fromImageBytes must be a string`);return e}function m(e){let t={},n=u(e,[`operationName`]);n!=null&&l(t,[`operationName`],n);let r=u(e,[`resourceName`]);return r!=null&&l(t,[`_url`,`resourceName`],r),t}function h(e){let t={},n=u(e,[`name`]);n!=null&&l(t,[`name`],n);let r=u(e,[`metadata`]);r!=null&&l(t,[`metadata`],r);let i=u(e,[`done`]);i!=null&&l(t,[`done`],i);let a=u(e,[`error`]);a!=null&&l(t,[`error`],a);let o=u(e,[`response`,`generateVideoResponse`]);return o!=null&&l(t,[`response`],_(o)),t}function g(e){let t={},n=u(e,[`name`]);n!=null&&l(t,[`name`],n);let r=u(e,[`metadata`]);r!=null&&l(t,[`metadata`],r);let i=u(e,[`done`]);i!=null&&l(t,[`done`],i);let a=u(e,[`error`]);a!=null&&l(t,[`error`],a);let o=u(e,[`response`]);return o!=null&&l(t,[`response`],v(o)),t}function _(e){let t={},n=u(e,[`generatedSamples`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>y(e))),l(t,[`generatedVideos`],e)}let r=u(e,[`raiMediaFilteredCount`]);r!=null&&l(t,[`raiMediaFilteredCount`],r);let i=u(e,[`raiMediaFilteredReasons`]);return i!=null&&l(t,[`raiMediaFilteredReasons`],i),t}function v(e){let t={},n=u(e,[`videos`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>b(e))),l(t,[`generatedVideos`],e)}let r=u(e,[`raiMediaFilteredCount`]);r!=null&&l(t,[`raiMediaFilteredCount`],r);let i=u(e,[`raiMediaFilteredReasons`]);return i!=null&&l(t,[`raiMediaFilteredReasons`],i),t}function y(e){let t={},n=u(e,[`video`]);return n!=null&&l(t,[`video`],D(n)),t}function b(e){let t={},n=u(e,[`_self`]);return n!=null&&l(t,[`video`],O(n)),t}function x(e){let t={},n=u(e,[`operationName`]);return n!=null&&l(t,[`_url`,`operationName`],n),t}function S(e){let t={},n=u(e,[`operationName`]);return n!=null&&l(t,[`_url`,`operationName`],n),t}function C(e){let t={},n=u(e,[`name`]);n!=null&&l(t,[`name`],n);let r=u(e,[`metadata`]);r!=null&&l(t,[`metadata`],r);let i=u(e,[`done`]);i!=null&&l(t,[`done`],i);let a=u(e,[`error`]);a!=null&&l(t,[`error`],a);let o=u(e,[`response`]);return o!=null&&l(t,[`response`],w(o)),t}function w(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`parent`]);r!=null&&l(t,[`parent`],r);let i=u(e,[`documentName`]);return i!=null&&l(t,[`documentName`],i),t}function T(e){let t={},n=u(e,[`name`]);n!=null&&l(t,[`name`],n);let r=u(e,[`metadata`]);r!=null&&l(t,[`metadata`],r);let i=u(e,[`done`]);i!=null&&l(t,[`done`],i);let a=u(e,[`error`]);a!=null&&l(t,[`error`],a);let o=u(e,[`response`]);return o!=null&&l(t,[`response`],E(o)),t}function E(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`parent`]);r!=null&&l(t,[`parent`],r);let i=u(e,[`documentName`]);return i!=null&&l(t,[`documentName`],i),t}function D(e){let t={},n=u(e,[`uri`]);n!=null&&l(t,[`uri`],n);let r=u(e,[`encodedVideo`]);r!=null&&l(t,[`videoBytes`],p(r));let i=u(e,[`encoding`]);return i!=null&&l(t,[`mimeType`],i),t}function O(e){let t={},n=u(e,[`gcsUri`]);n!=null&&l(t,[`uri`],n);let r=u(e,[`bytesBase64Encoded`]);r!=null&&l(t,[`videoBytes`],p(r));let i=u(e,[`mimeType`]);return i!=null&&l(t,[`mimeType`],i),t}var k;(function(e){e.LANGUAGE_UNSPECIFIED=`LANGUAGE_UNSPECIFIED`,e.PYTHON=`PYTHON`})(k||={});var A;(function(e){e.OUTCOME_UNSPECIFIED=`OUTCOME_UNSPECIFIED`,e.OUTCOME_OK=`OUTCOME_OK`,e.OUTCOME_FAILED=`OUTCOME_FAILED`,e.OUTCOME_DEADLINE_EXCEEDED=`OUTCOME_DEADLINE_EXCEEDED`})(A||={});var j;(function(e){e.SCHEDULING_UNSPECIFIED=`SCHEDULING_UNSPECIFIED`,e.SILENT=`SILENT`,e.WHEN_IDLE=`WHEN_IDLE`,e.INTERRUPT=`INTERRUPT`})(j||={});var M;(function(e){e.TYPE_UNSPECIFIED=`TYPE_UNSPECIFIED`,e.STRING=`STRING`,e.NUMBER=`NUMBER`,e.INTEGER=`INTEGER`,e.BOOLEAN=`BOOLEAN`,e.ARRAY=`ARRAY`,e.OBJECT=`OBJECT`,e.NULL=`NULL`})(M||={});var ee;(function(e){e.ENVIRONMENT_UNSPECIFIED=`ENVIRONMENT_UNSPECIFIED`,e.ENVIRONMENT_BROWSER=`ENVIRONMENT_BROWSER`})(ee||={});var te;(function(e){e.AUTH_TYPE_UNSPECIFIED=`AUTH_TYPE_UNSPECIFIED`,e.NO_AUTH=`NO_AUTH`,e.API_KEY_AUTH=`API_KEY_AUTH`,e.HTTP_BASIC_AUTH=`HTTP_BASIC_AUTH`,e.GOOGLE_SERVICE_ACCOUNT_AUTH=`GOOGLE_SERVICE_ACCOUNT_AUTH`,e.OAUTH=`OAUTH`,e.OIDC_AUTH=`OIDC_AUTH`})(te||={});var ne;(function(e){e.HTTP_IN_UNSPECIFIED=`HTTP_IN_UNSPECIFIED`,e.HTTP_IN_QUERY=`HTTP_IN_QUERY`,e.HTTP_IN_HEADER=`HTTP_IN_HEADER`,e.HTTP_IN_PATH=`HTTP_IN_PATH`,e.HTTP_IN_BODY=`HTTP_IN_BODY`,e.HTTP_IN_COOKIE=`HTTP_IN_COOKIE`})(ne||={});var re;(function(e){e.API_SPEC_UNSPECIFIED=`API_SPEC_UNSPECIFIED`,e.SIMPLE_SEARCH=`SIMPLE_SEARCH`,e.ELASTIC_SEARCH=`ELASTIC_SEARCH`})(re||={});var ie;(function(e){e.PHISH_BLOCK_THRESHOLD_UNSPECIFIED=`PHISH_BLOCK_THRESHOLD_UNSPECIFIED`,e.BLOCK_LOW_AND_ABOVE=`BLOCK_LOW_AND_ABOVE`,e.BLOCK_MEDIUM_AND_ABOVE=`BLOCK_MEDIUM_AND_ABOVE`,e.BLOCK_HIGH_AND_ABOVE=`BLOCK_HIGH_AND_ABOVE`,e.BLOCK_HIGHER_AND_ABOVE=`BLOCK_HIGHER_AND_ABOVE`,e.BLOCK_VERY_HIGH_AND_ABOVE=`BLOCK_VERY_HIGH_AND_ABOVE`,e.BLOCK_ONLY_EXTREMELY_HIGH=`BLOCK_ONLY_EXTREMELY_HIGH`})(ie||={});var ae;(function(e){e.UNSPECIFIED=`UNSPECIFIED`,e.BLOCKING=`BLOCKING`,e.NON_BLOCKING=`NON_BLOCKING`})(ae||={});var oe;(function(e){e.MODE_UNSPECIFIED=`MODE_UNSPECIFIED`,e.MODE_DYNAMIC=`MODE_DYNAMIC`})(oe||={});var se;(function(e){e.MODE_UNSPECIFIED=`MODE_UNSPECIFIED`,e.AUTO=`AUTO`,e.ANY=`ANY`,e.NONE=`NONE`,e.VALIDATED=`VALIDATED`})(se||={});var ce;(function(e){e.THINKING_LEVEL_UNSPECIFIED=`THINKING_LEVEL_UNSPECIFIED`,e.MINIMAL=`MINIMAL`,e.LOW=`LOW`,e.MEDIUM=`MEDIUM`,e.HIGH=`HIGH`})(ce||={});var le;(function(e){e.DONT_ALLOW=`DONT_ALLOW`,e.ALLOW_ADULT=`ALLOW_ADULT`,e.ALLOW_ALL=`ALLOW_ALL`})(le||={});var ue;(function(e){e.PROMINENT_PEOPLE_UNSPECIFIED=`PROMINENT_PEOPLE_UNSPECIFIED`,e.ALLOW_PROMINENT_PEOPLE=`ALLOW_PROMINENT_PEOPLE`,e.BLOCK_PROMINENT_PEOPLE=`BLOCK_PROMINENT_PEOPLE`})(ue||={});var de;(function(e){e.HARM_CATEGORY_UNSPECIFIED=`HARM_CATEGORY_UNSPECIFIED`,e.HARM_CATEGORY_HARASSMENT=`HARM_CATEGORY_HARASSMENT`,e.HARM_CATEGORY_HATE_SPEECH=`HARM_CATEGORY_HATE_SPEECH`,e.HARM_CATEGORY_SEXUALLY_EXPLICIT=`HARM_CATEGORY_SEXUALLY_EXPLICIT`,e.HARM_CATEGORY_DANGEROUS_CONTENT=`HARM_CATEGORY_DANGEROUS_CONTENT`,e.HARM_CATEGORY_CIVIC_INTEGRITY=`HARM_CATEGORY_CIVIC_INTEGRITY`,e.HARM_CATEGORY_IMAGE_HATE=`HARM_CATEGORY_IMAGE_HATE`,e.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT=`HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT`,e.HARM_CATEGORY_IMAGE_HARASSMENT=`HARM_CATEGORY_IMAGE_HARASSMENT`,e.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT=`HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT`,e.HARM_CATEGORY_JAILBREAK=`HARM_CATEGORY_JAILBREAK`})(de||={});var fe;(function(e){e.HARM_BLOCK_METHOD_UNSPECIFIED=`HARM_BLOCK_METHOD_UNSPECIFIED`,e.SEVERITY=`SEVERITY`,e.PROBABILITY=`PROBABILITY`})(fe||={});var pe;(function(e){e.HARM_BLOCK_THRESHOLD_UNSPECIFIED=`HARM_BLOCK_THRESHOLD_UNSPECIFIED`,e.BLOCK_LOW_AND_ABOVE=`BLOCK_LOW_AND_ABOVE`,e.BLOCK_MEDIUM_AND_ABOVE=`BLOCK_MEDIUM_AND_ABOVE`,e.BLOCK_ONLY_HIGH=`BLOCK_ONLY_HIGH`,e.BLOCK_NONE=`BLOCK_NONE`,e.OFF=`OFF`})(pe||={});var me;(function(e){e.FINISH_REASON_UNSPECIFIED=`FINISH_REASON_UNSPECIFIED`,e.STOP=`STOP`,e.MAX_TOKENS=`MAX_TOKENS`,e.SAFETY=`SAFETY`,e.RECITATION=`RECITATION`,e.LANGUAGE=`LANGUAGE`,e.OTHER=`OTHER`,e.BLOCKLIST=`BLOCKLIST`,e.PROHIBITED_CONTENT=`PROHIBITED_CONTENT`,e.SPII=`SPII`,e.MALFORMED_FUNCTION_CALL=`MALFORMED_FUNCTION_CALL`,e.IMAGE_SAFETY=`IMAGE_SAFETY`,e.UNEXPECTED_TOOL_CALL=`UNEXPECTED_TOOL_CALL`,e.IMAGE_PROHIBITED_CONTENT=`IMAGE_PROHIBITED_CONTENT`,e.NO_IMAGE=`NO_IMAGE`,e.IMAGE_RECITATION=`IMAGE_RECITATION`,e.IMAGE_OTHER=`IMAGE_OTHER`})(me||={});var he;(function(e){e.HARM_PROBABILITY_UNSPECIFIED=`HARM_PROBABILITY_UNSPECIFIED`,e.NEGLIGIBLE=`NEGLIGIBLE`,e.LOW=`LOW`,e.MEDIUM=`MEDIUM`,e.HIGH=`HIGH`})(he||={});var ge;(function(e){e.HARM_SEVERITY_UNSPECIFIED=`HARM_SEVERITY_UNSPECIFIED`,e.HARM_SEVERITY_NEGLIGIBLE=`HARM_SEVERITY_NEGLIGIBLE`,e.HARM_SEVERITY_LOW=`HARM_SEVERITY_LOW`,e.HARM_SEVERITY_MEDIUM=`HARM_SEVERITY_MEDIUM`,e.HARM_SEVERITY_HIGH=`HARM_SEVERITY_HIGH`})(ge||={});var _e;(function(e){e.URL_RETRIEVAL_STATUS_UNSPECIFIED=`URL_RETRIEVAL_STATUS_UNSPECIFIED`,e.URL_RETRIEVAL_STATUS_SUCCESS=`URL_RETRIEVAL_STATUS_SUCCESS`,e.URL_RETRIEVAL_STATUS_ERROR=`URL_RETRIEVAL_STATUS_ERROR`,e.URL_RETRIEVAL_STATUS_PAYWALL=`URL_RETRIEVAL_STATUS_PAYWALL`,e.URL_RETRIEVAL_STATUS_UNSAFE=`URL_RETRIEVAL_STATUS_UNSAFE`})(_e||={});var ve;(function(e){e.BLOCKED_REASON_UNSPECIFIED=`BLOCKED_REASON_UNSPECIFIED`,e.SAFETY=`SAFETY`,e.OTHER=`OTHER`,e.BLOCKLIST=`BLOCKLIST`,e.PROHIBITED_CONTENT=`PROHIBITED_CONTENT`,e.IMAGE_SAFETY=`IMAGE_SAFETY`,e.MODEL_ARMOR=`MODEL_ARMOR`,e.JAILBREAK=`JAILBREAK`})(ve||={});var ye;(function(e){e.TRAFFIC_TYPE_UNSPECIFIED=`TRAFFIC_TYPE_UNSPECIFIED`,e.ON_DEMAND=`ON_DEMAND`,e.ON_DEMAND_PRIORITY=`ON_DEMAND_PRIORITY`,e.ON_DEMAND_FLEX=`ON_DEMAND_FLEX`,e.PROVISIONED_THROUGHPUT=`PROVISIONED_THROUGHPUT`})(ye||={});var be;(function(e){e.MODALITY_UNSPECIFIED=`MODALITY_UNSPECIFIED`,e.TEXT=`TEXT`,e.IMAGE=`IMAGE`,e.AUDIO=`AUDIO`})(be||={});var xe;(function(e){e.MODEL_STAGE_UNSPECIFIED=`MODEL_STAGE_UNSPECIFIED`,e.UNSTABLE_EXPERIMENTAL=`UNSTABLE_EXPERIMENTAL`,e.EXPERIMENTAL=`EXPERIMENTAL`,e.PREVIEW=`PREVIEW`,e.STABLE=`STABLE`,e.LEGACY=`LEGACY`,e.DEPRECATED=`DEPRECATED`,e.RETIRED=`RETIRED`})(xe||={});var Se;(function(e){e.MEDIA_RESOLUTION_UNSPECIFIED=`MEDIA_RESOLUTION_UNSPECIFIED`,e.MEDIA_RESOLUTION_LOW=`MEDIA_RESOLUTION_LOW`,e.MEDIA_RESOLUTION_MEDIUM=`MEDIA_RESOLUTION_MEDIUM`,e.MEDIA_RESOLUTION_HIGH=`MEDIA_RESOLUTION_HIGH`})(Se||={});var Ce;(function(e){e.TUNING_MODE_UNSPECIFIED=`TUNING_MODE_UNSPECIFIED`,e.TUNING_MODE_FULL=`TUNING_MODE_FULL`,e.TUNING_MODE_PEFT_ADAPTER=`TUNING_MODE_PEFT_ADAPTER`})(Ce||={});var we;(function(e){e.ADAPTER_SIZE_UNSPECIFIED=`ADAPTER_SIZE_UNSPECIFIED`,e.ADAPTER_SIZE_ONE=`ADAPTER_SIZE_ONE`,e.ADAPTER_SIZE_TWO=`ADAPTER_SIZE_TWO`,e.ADAPTER_SIZE_FOUR=`ADAPTER_SIZE_FOUR`,e.ADAPTER_SIZE_EIGHT=`ADAPTER_SIZE_EIGHT`,e.ADAPTER_SIZE_SIXTEEN=`ADAPTER_SIZE_SIXTEEN`,e.ADAPTER_SIZE_THIRTY_TWO=`ADAPTER_SIZE_THIRTY_TWO`})(we||={});var Te;(function(e){e.JOB_STATE_UNSPECIFIED=`JOB_STATE_UNSPECIFIED`,e.JOB_STATE_QUEUED=`JOB_STATE_QUEUED`,e.JOB_STATE_PENDING=`JOB_STATE_PENDING`,e.JOB_STATE_RUNNING=`JOB_STATE_RUNNING`,e.JOB_STATE_SUCCEEDED=`JOB_STATE_SUCCEEDED`,e.JOB_STATE_FAILED=`JOB_STATE_FAILED`,e.JOB_STATE_CANCELLING=`JOB_STATE_CANCELLING`,e.JOB_STATE_CANCELLED=`JOB_STATE_CANCELLED`,e.JOB_STATE_PAUSED=`JOB_STATE_PAUSED`,e.JOB_STATE_EXPIRED=`JOB_STATE_EXPIRED`,e.JOB_STATE_UPDATING=`JOB_STATE_UPDATING`,e.JOB_STATE_PARTIALLY_SUCCEEDED=`JOB_STATE_PARTIALLY_SUCCEEDED`})(Te||={});var Ee;(function(e){e.TUNING_JOB_STATE_UNSPECIFIED=`TUNING_JOB_STATE_UNSPECIFIED`,e.TUNING_JOB_STATE_WAITING_FOR_QUOTA=`TUNING_JOB_STATE_WAITING_FOR_QUOTA`,e.TUNING_JOB_STATE_PROCESSING_DATASET=`TUNING_JOB_STATE_PROCESSING_DATASET`,e.TUNING_JOB_STATE_WAITING_FOR_CAPACITY=`TUNING_JOB_STATE_WAITING_FOR_CAPACITY`,e.TUNING_JOB_STATE_TUNING=`TUNING_JOB_STATE_TUNING`,e.TUNING_JOB_STATE_POST_PROCESSING=`TUNING_JOB_STATE_POST_PROCESSING`})(Ee||={});var De;(function(e){e.AGGREGATION_METRIC_UNSPECIFIED=`AGGREGATION_METRIC_UNSPECIFIED`,e.AVERAGE=`AVERAGE`,e.MODE=`MODE`,e.STANDARD_DEVIATION=`STANDARD_DEVIATION`,e.VARIANCE=`VARIANCE`,e.MINIMUM=`MINIMUM`,e.MAXIMUM=`MAXIMUM`,e.MEDIAN=`MEDIAN`,e.PERCENTILE_P90=`PERCENTILE_P90`,e.PERCENTILE_P95=`PERCENTILE_P95`,e.PERCENTILE_P99=`PERCENTILE_P99`})(De||={});var Oe;(function(e){e.PAIRWISE_CHOICE_UNSPECIFIED=`PAIRWISE_CHOICE_UNSPECIFIED`,e.BASELINE=`BASELINE`,e.CANDIDATE=`CANDIDATE`,e.TIE=`TIE`})(Oe||={});var ke;(function(e){e.TUNING_TASK_UNSPECIFIED=`TUNING_TASK_UNSPECIFIED`,e.TUNING_TASK_I2V=`TUNING_TASK_I2V`,e.TUNING_TASK_T2V=`TUNING_TASK_T2V`,e.TUNING_TASK_R2V=`TUNING_TASK_R2V`})(ke||={});var Ae;(function(e){e.STATE_UNSPECIFIED=`STATE_UNSPECIFIED`,e.STATE_PENDING=`STATE_PENDING`,e.STATE_ACTIVE=`STATE_ACTIVE`,e.STATE_FAILED=`STATE_FAILED`})(Ae||={});var je;(function(e){e.MEDIA_RESOLUTION_UNSPECIFIED=`MEDIA_RESOLUTION_UNSPECIFIED`,e.MEDIA_RESOLUTION_LOW=`MEDIA_RESOLUTION_LOW`,e.MEDIA_RESOLUTION_MEDIUM=`MEDIA_RESOLUTION_MEDIUM`,e.MEDIA_RESOLUTION_HIGH=`MEDIA_RESOLUTION_HIGH`,e.MEDIA_RESOLUTION_ULTRA_HIGH=`MEDIA_RESOLUTION_ULTRA_HIGH`})(je||={});var Me;(function(e){e.TOOL_TYPE_UNSPECIFIED=`TOOL_TYPE_UNSPECIFIED`,e.GOOGLE_SEARCH_WEB=`GOOGLE_SEARCH_WEB`,e.GOOGLE_SEARCH_IMAGE=`GOOGLE_SEARCH_IMAGE`,e.URL_CONTEXT=`URL_CONTEXT`,e.GOOGLE_MAPS=`GOOGLE_MAPS`,e.FILE_SEARCH=`FILE_SEARCH`})(Me||={});var Ne;(function(e){e.COLLECTION=`COLLECTION`})(Ne||={});var Pe;(function(e){e.UNSPECIFIED=`unspecified`,e.FLEX=`flex`,e.STANDARD=`standard`,e.PRIORITY=`priority`})(Pe||={});var Fe;(function(e){e.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED=`FEATURE_SELECTION_PREFERENCE_UNSPECIFIED`,e.PRIORITIZE_QUALITY=`PRIORITIZE_QUALITY`,e.BALANCED=`BALANCED`,e.PRIORITIZE_COST=`PRIORITIZE_COST`})(Fe||={});var Ie;(function(e){e.PREDICT=`PREDICT`,e.EMBED_CONTENT=`EMBED_CONTENT`})(Ie||={});var Le;(function(e){e.BLOCK_LOW_AND_ABOVE=`BLOCK_LOW_AND_ABOVE`,e.BLOCK_MEDIUM_AND_ABOVE=`BLOCK_MEDIUM_AND_ABOVE`,e.BLOCK_ONLY_HIGH=`BLOCK_ONLY_HIGH`,e.BLOCK_NONE=`BLOCK_NONE`})(Le||={});var Re;(function(e){e.auto=`auto`,e.en=`en`,e.ja=`ja`,e.ko=`ko`,e.hi=`hi`,e.zh=`zh`,e.pt=`pt`,e.es=`es`})(Re||={});var ze;(function(e){e.MASK_MODE_DEFAULT=`MASK_MODE_DEFAULT`,e.MASK_MODE_USER_PROVIDED=`MASK_MODE_USER_PROVIDED`,e.MASK_MODE_BACKGROUND=`MASK_MODE_BACKGROUND`,e.MASK_MODE_FOREGROUND=`MASK_MODE_FOREGROUND`,e.MASK_MODE_SEMANTIC=`MASK_MODE_SEMANTIC`})(ze||={});var Be;(function(e){e.CONTROL_TYPE_DEFAULT=`CONTROL_TYPE_DEFAULT`,e.CONTROL_TYPE_CANNY=`CONTROL_TYPE_CANNY`,e.CONTROL_TYPE_SCRIBBLE=`CONTROL_TYPE_SCRIBBLE`,e.CONTROL_TYPE_FACE_MESH=`CONTROL_TYPE_FACE_MESH`})(Be||={});var Ve;(function(e){e.SUBJECT_TYPE_DEFAULT=`SUBJECT_TYPE_DEFAULT`,e.SUBJECT_TYPE_PERSON=`SUBJECT_TYPE_PERSON`,e.SUBJECT_TYPE_ANIMAL=`SUBJECT_TYPE_ANIMAL`,e.SUBJECT_TYPE_PRODUCT=`SUBJECT_TYPE_PRODUCT`})(Ve||={});var He;(function(e){e.EDIT_MODE_DEFAULT=`EDIT_MODE_DEFAULT`,e.EDIT_MODE_INPAINT_REMOVAL=`EDIT_MODE_INPAINT_REMOVAL`,e.EDIT_MODE_INPAINT_INSERTION=`EDIT_MODE_INPAINT_INSERTION`,e.EDIT_MODE_OUTPAINT=`EDIT_MODE_OUTPAINT`,e.EDIT_MODE_CONTROLLED_EDITING=`EDIT_MODE_CONTROLLED_EDITING`,e.EDIT_MODE_STYLE=`EDIT_MODE_STYLE`,e.EDIT_MODE_BGSWAP=`EDIT_MODE_BGSWAP`,e.EDIT_MODE_PRODUCT_IMAGE=`EDIT_MODE_PRODUCT_IMAGE`})(He||={});var Ue;(function(e){e.FOREGROUND=`FOREGROUND`,e.BACKGROUND=`BACKGROUND`,e.PROMPT=`PROMPT`,e.SEMANTIC=`SEMANTIC`,e.INTERACTIVE=`INTERACTIVE`})(Ue||={});var We;(function(e){e.ASSET=`ASSET`,e.STYLE=`STYLE`})(We||={});var Ge;(function(e){e.INSERT=`INSERT`,e.REMOVE=`REMOVE`,e.REMOVE_STATIC=`REMOVE_STATIC`,e.OUTPAINT=`OUTPAINT`})(Ge||={});var Ke;(function(e){e.OPTIMIZED=`OPTIMIZED`,e.LOSSLESS=`LOSSLESS`})(Ke||={});var qe;(function(e){e.SUPERVISED_FINE_TUNING=`SUPERVISED_FINE_TUNING`,e.PREFERENCE_TUNING=`PREFERENCE_TUNING`,e.DISTILLATION=`DISTILLATION`})(qe||={});var Je;(function(e){e.STATE_UNSPECIFIED=`STATE_UNSPECIFIED`,e.PROCESSING=`PROCESSING`,e.ACTIVE=`ACTIVE`,e.FAILED=`FAILED`})(Je||={});var Ye;(function(e){e.SOURCE_UNSPECIFIED=`SOURCE_UNSPECIFIED`,e.UPLOADED=`UPLOADED`,e.GENERATED=`GENERATED`,e.REGISTERED=`REGISTERED`})(Ye||={});var Xe;(function(e){e.TURN_COMPLETE_REASON_UNSPECIFIED=`TURN_COMPLETE_REASON_UNSPECIFIED`,e.MALFORMED_FUNCTION_CALL=`MALFORMED_FUNCTION_CALL`,e.RESPONSE_REJECTED=`RESPONSE_REJECTED`,e.NEED_MORE_INPUT=`NEED_MORE_INPUT`})(Xe||={});var Ze;(function(e){e.MODALITY_UNSPECIFIED=`MODALITY_UNSPECIFIED`,e.TEXT=`TEXT`,e.IMAGE=`IMAGE`,e.VIDEO=`VIDEO`,e.AUDIO=`AUDIO`,e.DOCUMENT=`DOCUMENT`})(Ze||={});var Qe;(function(e){e.VAD_SIGNAL_TYPE_UNSPECIFIED=`VAD_SIGNAL_TYPE_UNSPECIFIED`,e.VAD_SIGNAL_TYPE_SOS=`VAD_SIGNAL_TYPE_SOS`,e.VAD_SIGNAL_TYPE_EOS=`VAD_SIGNAL_TYPE_EOS`})(Qe||={});var $e;(function(e){e.TYPE_UNSPECIFIED=`TYPE_UNSPECIFIED`,e.ACTIVITY_START=`ACTIVITY_START`,e.ACTIVITY_END=`ACTIVITY_END`})($e||={});var et;(function(e){e.START_SENSITIVITY_UNSPECIFIED=`START_SENSITIVITY_UNSPECIFIED`,e.START_SENSITIVITY_HIGH=`START_SENSITIVITY_HIGH`,e.START_SENSITIVITY_LOW=`START_SENSITIVITY_LOW`})(et||={});var tt;(function(e){e.END_SENSITIVITY_UNSPECIFIED=`END_SENSITIVITY_UNSPECIFIED`,e.END_SENSITIVITY_HIGH=`END_SENSITIVITY_HIGH`,e.END_SENSITIVITY_LOW=`END_SENSITIVITY_LOW`})(tt||={});var nt;(function(e){e.ACTIVITY_HANDLING_UNSPECIFIED=`ACTIVITY_HANDLING_UNSPECIFIED`,e.START_OF_ACTIVITY_INTERRUPTS=`START_OF_ACTIVITY_INTERRUPTS`,e.NO_INTERRUPTION=`NO_INTERRUPTION`})(nt||={});var rt;(function(e){e.TURN_COVERAGE_UNSPECIFIED=`TURN_COVERAGE_UNSPECIFIED`,e.TURN_INCLUDES_ONLY_ACTIVITY=`TURN_INCLUDES_ONLY_ACTIVITY`,e.TURN_INCLUDES_ALL_INPUT=`TURN_INCLUDES_ALL_INPUT`,e.TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO=`TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO`})(rt||={});var it;(function(e){e.SCALE_UNSPECIFIED=`SCALE_UNSPECIFIED`,e.C_MAJOR_A_MINOR=`C_MAJOR_A_MINOR`,e.D_FLAT_MAJOR_B_FLAT_MINOR=`D_FLAT_MAJOR_B_FLAT_MINOR`,e.D_MAJOR_B_MINOR=`D_MAJOR_B_MINOR`,e.E_FLAT_MAJOR_C_MINOR=`E_FLAT_MAJOR_C_MINOR`,e.E_MAJOR_D_FLAT_MINOR=`E_MAJOR_D_FLAT_MINOR`,e.F_MAJOR_D_MINOR=`F_MAJOR_D_MINOR`,e.G_FLAT_MAJOR_E_FLAT_MINOR=`G_FLAT_MAJOR_E_FLAT_MINOR`,e.G_MAJOR_E_MINOR=`G_MAJOR_E_MINOR`,e.A_FLAT_MAJOR_F_MINOR=`A_FLAT_MAJOR_F_MINOR`,e.A_MAJOR_G_FLAT_MINOR=`A_MAJOR_G_FLAT_MINOR`,e.B_FLAT_MAJOR_G_MINOR=`B_FLAT_MAJOR_G_MINOR`,e.B_MAJOR_A_FLAT_MINOR=`B_MAJOR_A_FLAT_MINOR`})(it||={});var at;(function(e){e.MUSIC_GENERATION_MODE_UNSPECIFIED=`MUSIC_GENERATION_MODE_UNSPECIFIED`,e.QUALITY=`QUALITY`,e.DIVERSITY=`DIVERSITY`,e.VOCALIZATION=`VOCALIZATION`})(at||={});var ot;(function(e){e.PLAYBACK_CONTROL_UNSPECIFIED=`PLAYBACK_CONTROL_UNSPECIFIED`,e.PLAY=`PLAY`,e.PAUSE=`PAUSE`,e.STOP=`STOP`,e.RESET_CONTEXT=`RESET_CONTEXT`})(ot||={});var st=class{constructor(e){let t={};for(let n of e.headers.entries())t[n[0]]=n[1];this.headers=t,this.responseInternal=e}json(){return this.responseInternal.json()}},ct=class{get text(){if(this.candidates?.[0]?.content?.parts?.length===0)return;this.candidates&&this.candidates.length>1&&console.warn(`there are multiple candidates in the response, returning text from the first one.`);let e=``,t=!1,n=[];for(let r of this.candidates?.[0]?.content?.parts??[]){for(let[e,t]of Object.entries(r))e!==`text`&&e!==`thought`&&e!==`thoughtSignature`&&(t!==null||t!==void 0)&&n.push(e);if(typeof r.text==`string`){if(typeof r.thought==`boolean`&&r.thought)continue;t=!0,e+=r.text}}return n.length>0&&console.warn(`there are non-text parts ${n} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),t?e:void 0}get data(){if(this.candidates?.[0]?.content?.parts?.length===0)return;this.candidates&&this.candidates.length>1&&console.warn(`there are multiple candidates in the response, returning data from the first one.`);let e=``,t=[];for(let n of this.candidates?.[0]?.content?.parts??[]){for(let[e,r]of Object.entries(n))e!==`inlineData`&&(r!==null||r!==void 0)&&t.push(e);n.inlineData&&typeof n.inlineData.data==`string`&&(e+=atob(n.inlineData.data))}return t.length>0&&console.warn(`there are non-data parts ${t} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),e.length>0?btoa(e):void 0}get functionCalls(){if(this.candidates?.[0]?.content?.parts?.length===0)return;this.candidates&&this.candidates.length>1&&console.warn(`there are multiple candidates in the response, returning function calls from the first one.`);let e=(this.candidates?.[0]?.content?.parts)?.filter(e=>e.functionCall).map(e=>e.functionCall).filter(e=>e!==void 0);if(e?.length!==0)return e}get executableCode(){if(this.candidates?.[0]?.content?.parts?.length===0)return;this.candidates&&this.candidates.length>1&&console.warn(`there are multiple candidates in the response, returning executable code from the first one.`);let e=(this.candidates?.[0]?.content?.parts)?.filter(e=>e.executableCode).map(e=>e.executableCode).filter(e=>e!==void 0);if(e?.length!==0)return e?.[0]?.code}get codeExecutionResult(){if(this.candidates?.[0]?.content?.parts?.length===0)return;this.candidates&&this.candidates.length>1&&console.warn(`there are multiple candidates in the response, returning code execution result from the first one.`);let e=(this.candidates?.[0]?.content?.parts)?.filter(e=>e.codeExecutionResult).map(e=>e.codeExecutionResult).filter(e=>e!==void 0);if(e?.length!==0)return e?.[0]?.output}},lt=class{},ut=class{},dt=class{},ft=class{},pt=class{},mt=class{},ht=class{},gt=class{},_t=class{},vt=class{},yt=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){let r=new e,i,a=t;return i=n?g(a):h(a),Object.assign(r,i),r}},bt=class{},xt=class{},St=class{},Ct=class{},wt=class{},Tt=class{},Et=class{},Dt=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){let r=new e,i=C(t);return Object.assign(r,i),r}},Ot=class{},kt=class{},At=class{},jt=class{},Mt=class{},Nt=class{get text(){let e=``,t=!1,n=[];for(let r of this.serverContent?.modelTurn?.parts??[]){for(let[e,t]of Object.entries(r))e!==`text`&&e!==`thought`&&t!==null&&n.push(e);if(typeof r.text==`string`){if(typeof r.thought==`boolean`&&r.thought)continue;t=!0,e+=r.text}}return n.length>0&&console.warn(`there are non-text parts ${n} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),t?e:void 0}get data(){let e=``,t=[];for(let n of this.serverContent?.modelTurn?.parts??[]){for(let[e,r]of Object.entries(n))e!==`inlineData`&&r!==null&&t.push(e);n.inlineData&&typeof n.inlineData.data==`string`&&(e+=atob(n.inlineData.data))}return t.length>0&&console.warn(`there are non-data parts ${t} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),e.length>0?btoa(e):void 0}},Pt=class{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}},Ft=class e{_fromAPIResponse({apiResponse:t,_isVertexAI:n}){let r=new e,i=T(t);return Object.assign(r,i),r}};function N(e,t){if(!t||typeof t!=`string`)throw Error(`model is required and must be a string`);if(t.includes(`..`)||t.includes(`?`)||t.includes(`&`))throw Error(`invalid model parameter`);if(e.isVertexAI()){if(t.startsWith(`publishers/`)||t.startsWith(`projects/`)||t.startsWith(`models/`))return t;if(t.indexOf(`/`)>=0){let e=t.split(`/`,2);return`publishers/${e[0]}/models/${e[1]}`}else return`publishers/google/models/${t}`}else if(t.startsWith(`models/`)||t.startsWith(`tunedModels/`))return t;else return`models/${t}`}function It(e,t){let n=N(e,t);return n?n.startsWith(`publishers/`)&&e.isVertexAI()?`projects/${e.getProject()}/locations/${e.getLocation()}/${n}`:n.startsWith(`models/`)&&e.isVertexAI()?`projects/${e.getProject()}/locations/${e.getLocation()}/publishers/google/${n}`:n:``}function Lt(e){return Array.isArray(e)?e.map(e=>Rt(e)):[Rt(e)]}function Rt(e){if(typeof e==`object`&&e)return e;throw Error(`Could not parse input as Blob. Unsupported blob type: ${typeof e}`)}function zt(e){let t=Rt(e);if(t.mimeType&&t.mimeType.startsWith(`image/`))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function Bt(e){let t=Rt(e);if(t.mimeType&&t.mimeType.startsWith(`audio/`))return t;throw Error(`Unsupported mime type: ${t.mimeType}`)}function Vt(e){if(e==null)throw Error(`PartUnion is required`);if(typeof e==`object`)return e;if(typeof e==`string`)return{text:e};throw Error(`Unsupported part type: ${typeof e}`)}function Ht(e){if(e==null||Array.isArray(e)&&e.length===0)throw Error(`PartListUnion is required`);return Array.isArray(e)?e.map(e=>Vt(e)):[Vt(e)]}function Ut(e){return typeof e==`object`&&!!e&&`parts`in e&&Array.isArray(e.parts)}function Wt(e){return typeof e==`object`&&!!e&&`functionCall`in e}function Gt(e){return typeof e==`object`&&!!e&&`functionResponse`in e}function P(e){if(e==null)throw Error(`ContentUnion is required`);return Ut(e)?e:{role:`user`,parts:Ht(e)}}function Kt(e,t){if(!t)return[];if(e.isVertexAI()&&Array.isArray(t))return t.flatMap(e=>{let t=P(e);return t.parts&&t.parts.length>0&&t.parts[0].text!==void 0?[t.parts[0].text]:[]});if(e.isVertexAI()){let e=P(t);return e.parts&&e.parts.length>0&&e.parts[0].text!==void 0?[e.parts[0].text]:[]}return Array.isArray(t)?t.map(e=>P(e)):[P(t)]}function F(e){if(e==null||Array.isArray(e)&&e.length===0)throw Error(`contents are required`);if(!Array.isArray(e)){if(Wt(e)||Gt(e))throw Error(`To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them`);return[P(e)]}let t=[],n=[],r=Ut(e[0]);for(let i of e){let e=Ut(i);if(e!=r)throw Error(`Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them`);if(e)t.push(i);else if(Wt(i)||Gt(i))throw Error(`To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them`);else n.push(i)}return r||t.push({role:`user`,parts:Ht(n)}),t}function qt(e,t){e.includes(`null`)&&(t.nullable=!0);let n=e.filter(e=>e!==`null`);if(n.length===1)t.type=Object.values(M).includes(n[0].toUpperCase())?n[0].toUpperCase():M.TYPE_UNSPECIFIED;else{t.anyOf=[];for(let e of n)t.anyOf.push({type:Object.values(M).includes(e.toUpperCase())?e.toUpperCase():M.TYPE_UNSPECIFIED})}}function I(e){let t={},n=[`items`],r=[`anyOf`],i=[`properties`];if(e.type&&e.anyOf)throw Error(`type and anyOf cannot be both populated.`);let a=e.anyOf;a!=null&&a.length==2&&(a[0].type===`null`?(t.nullable=!0,e=a[1]):a[1].type===`null`&&(t.nullable=!0,e=a[0])),e.type instanceof Array&&qt(e.type,t);for(let[a,o]of Object.entries(e))if(o!=null)if(a==`type`){if(o===`null`)throw Error(`type: null can not be the only possible type for the field.`);if(o instanceof Array)continue;t.type=Object.values(M).includes(o.toUpperCase())?o.toUpperCase():M.TYPE_UNSPECIFIED}else if(n.includes(a))t[a]=I(o);else if(r.includes(a)){let e=[];for(let n of o){if(n.type==`null`){t.nullable=!0;continue}e.push(I(n))}t[a]=e}else if(i.includes(a)){let e={};for(let[t,n]of Object.entries(o))e[t]=I(n);t[a]=e}else{if(a===`additionalProperties`)continue;t[a]=o}return t}function Jt(e){return I(e)}function Yt(e){if(typeof e==`object`)return e;if(typeof e==`string`)return{voiceConfig:{prebuiltVoiceConfig:{voiceName:e}}};throw Error(`Unsupported speechConfig type: ${typeof e}`)}function Xt(e){if(`multiSpeakerVoiceConfig`in e)throw Error(`multiSpeakerVoiceConfig is not supported in the live API.`);return e}function L(e){if(e.functionDeclarations)for(let t of e.functionDeclarations)t.parameters&&(Object.keys(t.parameters).includes(`$schema`)?t.parametersJsonSchema||(t.parametersJsonSchema=t.parameters,delete t.parameters):t.parameters=I(t.parameters)),t.response&&(Object.keys(t.response).includes(`$schema`)?t.responseJsonSchema||(t.responseJsonSchema=t.response,delete t.response):t.response=I(t.response));return e}function R(e){if(e==null)throw Error(`tools is required`);if(!Array.isArray(e))throw Error(`tools is required and must be an array of Tools`);let t=[];for(let n of e)t.push(n);return t}function Zt(e,t,n,r=1){let i=!t.startsWith(`${n}/`)&&t.split(`/`).length===r;return e.isVertexAI()?t.startsWith(`projects/`)?t:t.startsWith(`locations/`)?`projects/${e.getProject()}/${t}`:t.startsWith(`${n}/`)?`projects/${e.getProject()}/locations/${e.getLocation()}/${t}`:i?`projects/${e.getProject()}/locations/${e.getLocation()}/${n}/${t}`:t:i?`${n}/${t}`:t}function z(e,t){if(typeof t!=`string`)throw Error(`name must be a string`);return Zt(e,t,`cachedContents`)}function Qt(e){switch(e){case`STATE_UNSPECIFIED`:return`JOB_STATE_UNSPECIFIED`;case`CREATING`:return`JOB_STATE_RUNNING`;case`ACTIVE`:return`JOB_STATE_SUCCEEDED`;case`FAILED`:return`JOB_STATE_FAILED`;default:return e}}function B(e){return p(e)}function $t(e){return typeof e==`object`&&!!e&&`name`in e}function en(e){return typeof e==`object`&&!!e&&`video`in e}function tn(e){return typeof e==`object`&&!!e&&`uri`in e}function nn(e){let t;if($t(e)&&(t=e.name),!(tn(e)&&(t=e.uri,t===void 0))&&!(en(e)&&(t=e.video?.uri,t===void 0))){if(typeof e==`string`&&(t=e),t===void 0)throw Error(`Could not extract file name from the provided input.`);if(t.startsWith(`https://`)){let e=t.split(`files/`)[1].match(/[a-z0-9]+/);if(e===null)throw Error(`Could not extract file name from URI ${t}`);t=e[0]}else t.startsWith(`files/`)&&(t=t.split(`files/`)[1]);return t}}function rn(e,t){let n;return n=e.isVertexAI()?t?`publishers/google/models`:`models`:t?`models`:`tunedModels`,n}function an(e){for(let t of[`models`,`tunedModels`,`publisherModels`])if(on(e,t))return e[t];return[]}function on(e,t){return typeof e==`object`&&!!e&&t in e}function sn(e,t={}){let n=e,r={name:n.name,description:n.description,parametersJsonSchema:n.inputSchema};return n.outputSchema&&(r.responseJsonSchema=n.outputSchema),t.behavior&&(r.behavior=t.behavior),{functionDeclarations:[r]}}function cn(e,t={}){let n=[],r=new Set;for(let i of e){let e=i.name;if(r.has(e))throw Error(`Duplicate function name ${e} found in MCP tools. Please ensure function names are unique.`);r.add(e);let a=sn(i,t);a.functionDeclarations&&n.push(...a.functionDeclarations)}return{functionDeclarations:n}}function ln(e,t){let n;if(typeof t==`string`)if(e.isVertexAI())if(t.startsWith(`gs://`))n={format:`jsonl`,gcsUri:[t]};else if(t.startsWith(`bq://`))n={format:`bigquery`,bigqueryUri:t};else throw Error(`Unsupported string source for Vertex AI: ${t}`);else if(t.startsWith(`files/`))n={fileName:t};else throw Error(`Unsupported string source for Gemini API: ${t}`);else if(Array.isArray(t)){if(e.isVertexAI())throw Error(`InlinedRequest[] is not supported in Vertex AI.`);n={inlinedRequests:t}}else n=t;let r=[n.gcsUri,n.bigqueryUri].filter(Boolean).length,i=[n.inlinedRequests,n.fileName].filter(Boolean).length;if(e.isVertexAI()){if(i>0||r!==1)throw Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(r>0||i!==1)throw Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return n}function un(e){if(typeof e!=`string`)return e;let t=e;if(t.startsWith(`gs://`))return{format:`jsonl`,gcsUri:t};if(t.startsWith(`bq://`))return{format:`bigquery`,bigqueryUri:t};throw Error(`Unsupported destination: ${t}`)}function dn(e){if(typeof e!=`object`||!e)return{};let t=e,n=t.inlinedResponses;if(typeof n!=`object`||!n)return e;let r=n.inlinedResponses;if(!Array.isArray(r)||r.length===0)return e;let i=!1;for(let e of r){if(typeof e!=`object`||!e)continue;let t=e.response;if(!(typeof t!=`object`||!t)&&t.embedding!==void 0){i=!0;break}}return i&&(t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses),e}function V(e,t){let n=t;if(!e.isVertexAI()){if(/batches\/[^/]+$/.test(n))return n.split(`/`).pop();throw Error(`Invalid batch job name: ${n}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(n))return n.split(`/`).pop();if(/^\d+$/.test(n))return n;throw Error(`Invalid batch job name: ${n}.`)}function fn(e){let t=e;return t===`BATCH_STATE_UNSPECIFIED`?`JOB_STATE_UNSPECIFIED`:t===`BATCH_STATE_PENDING`?`JOB_STATE_PENDING`:t===`BATCH_STATE_RUNNING`?`JOB_STATE_RUNNING`:t===`BATCH_STATE_SUCCEEDED`?`JOB_STATE_SUCCEEDED`:t===`BATCH_STATE_FAILED`?`JOB_STATE_FAILED`:t===`BATCH_STATE_CANCELLED`?`JOB_STATE_CANCELLED`:t===`BATCH_STATE_EXPIRED`?`JOB_STATE_EXPIRED`:t}function pn(e){return e.includes(`gemini`)&&e!==`gemini-embedding-001`||e.includes(`maas`)}function mn(e){let t={},n=u(e,[`apiKey`]);if(n!=null&&l(t,[`apiKey`],n),u(e,[`apiKeyConfig`])!==void 0)throw Error(`apiKeyConfig parameter is not supported in Gemini API.`);if(u(e,[`authType`])!==void 0)throw Error(`authType parameter is not supported in Gemini API.`);if(u(e,[`googleServiceAccountConfig`])!==void 0)throw Error(`googleServiceAccountConfig parameter is not supported in Gemini API.`);if(u(e,[`httpBasicAuthConfig`])!==void 0)throw Error(`httpBasicAuthConfig parameter is not supported in Gemini API.`);if(u(e,[`oauthConfig`])!==void 0)throw Error(`oauthConfig parameter is not supported in Gemini API.`);if(u(e,[`oidcConfig`])!==void 0)throw Error(`oidcConfig parameter is not supported in Gemini API.`);return t}function hn(e){let t={},n=u(e,[`responsesFile`]);n!=null&&l(t,[`fileName`],n);let r=u(e,[`inlinedResponses`,`inlinedResponses`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>$n(e))),l(t,[`inlinedResponses`],e)}let i=u(e,[`inlinedEmbedContentResponses`,`inlinedResponses`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`inlinedEmbedContentResponses`],e)}return t}function gn(e){let t={},n=u(e,[`predictionsFormat`]);n!=null&&l(t,[`format`],n);let r=u(e,[`gcsDestination`,`outputUriPrefix`]);r!=null&&l(t,[`gcsUri`],r);let i=u(e,[`bigqueryDestination`,`outputUri`]);return i!=null&&l(t,[`bigqueryUri`],i),t}function _n(e){let t={},n=u(e,[`format`]);n!=null&&l(t,[`predictionsFormat`],n);let r=u(e,[`gcsUri`]);r!=null&&l(t,[`gcsDestination`,`outputUriPrefix`],r);let i=u(e,[`bigqueryUri`]);if(i!=null&&l(t,[`bigqueryDestination`,`outputUri`],i),u(e,[`fileName`])!==void 0)throw Error(`fileName parameter is not supported in Vertex AI.`);if(u(e,[`inlinedResponses`])!==void 0)throw Error(`inlinedResponses parameter is not supported in Vertex AI.`);if(u(e,[`inlinedEmbedContentResponses`])!==void 0)throw Error(`inlinedEmbedContentResponses parameter is not supported in Vertex AI.`);return t}function vn(e){let t={},n=u(e,[`name`]);n!=null&&l(t,[`name`],n);let r=u(e,[`metadata`,`displayName`]);r!=null&&l(t,[`displayName`],r);let i=u(e,[`metadata`,`state`]);i!=null&&l(t,[`state`],fn(i));let a=u(e,[`metadata`,`createTime`]);a!=null&&l(t,[`createTime`],a);let o=u(e,[`metadata`,`endTime`]);o!=null&&l(t,[`endTime`],o);let s=u(e,[`metadata`,`updateTime`]);s!=null&&l(t,[`updateTime`],s);let c=u(e,[`metadata`,`model`]);c!=null&&l(t,[`model`],c);let d=u(e,[`metadata`,`output`]);return d!=null&&l(t,[`dest`],hn(dn(d))),t}function yn(e){let t={},n=u(e,[`name`]);n!=null&&l(t,[`name`],n);let r=u(e,[`displayName`]);r!=null&&l(t,[`displayName`],r);let i=u(e,[`state`]);i!=null&&l(t,[`state`],fn(i));let a=u(e,[`error`]);a!=null&&l(t,[`error`],a);let o=u(e,[`createTime`]);o!=null&&l(t,[`createTime`],o);let s=u(e,[`startTime`]);s!=null&&l(t,[`startTime`],s);let c=u(e,[`endTime`]);c!=null&&l(t,[`endTime`],c);let d=u(e,[`updateTime`]);d!=null&&l(t,[`updateTime`],d);let f=u(e,[`model`]);f!=null&&l(t,[`model`],f);let p=u(e,[`inputConfig`]);p!=null&&l(t,[`src`],bn(p));let m=u(e,[`outputConfig`]);m!=null&&l(t,[`dest`],gn(dn(m)));let h=u(e,[`completionStats`]);return h!=null&&l(t,[`completionStats`],h),t}function bn(e){let t={},n=u(e,[`instancesFormat`]);n!=null&&l(t,[`format`],n);let r=u(e,[`gcsSource`,`uris`]);r!=null&&l(t,[`gcsUri`],r);let i=u(e,[`bigquerySource`,`inputUri`]);return i!=null&&l(t,[`bigqueryUri`],i),t}function xn(e,t){let n={};if(u(t,[`format`])!==void 0)throw Error(`format parameter is not supported in Gemini API.`);if(u(t,[`gcsUri`])!==void 0)throw Error(`gcsUri parameter is not supported in Gemini API.`);if(u(t,[`bigqueryUri`])!==void 0)throw Error(`bigqueryUri parameter is not supported in Gemini API.`);let r=u(t,[`fileName`]);r!=null&&l(n,[`fileName`],r);let i=u(t,[`inlinedRequests`]);if(i!=null){let t=i;Array.isArray(t)&&(t=t.map(t=>Qn(e,t))),l(n,[`requests`,`requests`],t)}return n}function Sn(e){let t={},n=u(e,[`format`]);n!=null&&l(t,[`instancesFormat`],n);let r=u(e,[`gcsUri`]);r!=null&&l(t,[`gcsSource`,`uris`],r);let i=u(e,[`bigqueryUri`]);if(i!=null&&l(t,[`bigquerySource`,`inputUri`],i),u(e,[`fileName`])!==void 0)throw Error(`fileName parameter is not supported in Vertex AI.`);if(u(e,[`inlinedRequests`])!==void 0)throw Error(`inlinedRequests parameter is not supported in Vertex AI.`);return t}function Cn(e){let t={},n=u(e,[`data`]);if(n!=null&&l(t,[`data`],n),u(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=u(e,[`mimeType`]);return r!=null&&l(t,[`mimeType`],r),t}function wn(e,t){let n={},r=u(t,[`name`]);return r!=null&&l(n,[`_url`,`name`],V(e,r)),n}function Tn(e,t){let n={},r=u(t,[`name`]);return r!=null&&l(n,[`_url`,`name`],V(e,r)),n}function En(e){let t={},n=u(e,[`content`]);n!=null&&l(t,[`content`],n);let r=u(e,[`citationMetadata`]);r!=null&&l(t,[`citationMetadata`],Dn(r));let i=u(e,[`tokenCount`]);i!=null&&l(t,[`tokenCount`],i);let a=u(e,[`finishReason`]);a!=null&&l(t,[`finishReason`],a);let o=u(e,[`groundingMetadata`]);o!=null&&l(t,[`groundingMetadata`],o);let s=u(e,[`avgLogprobs`]);s!=null&&l(t,[`avgLogprobs`],s);let c=u(e,[`index`]);c!=null&&l(t,[`index`],c);let d=u(e,[`logprobsResult`]);d!=null&&l(t,[`logprobsResult`],d);let f=u(e,[`safetyRatings`]);if(f!=null){let e=f;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`safetyRatings`],e)}let p=u(e,[`urlContextMetadata`]);return p!=null&&l(t,[`urlContextMetadata`],p),t}function Dn(e){let t={},n=u(e,[`citationSources`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`citations`],e)}return t}function On(e){let t={},n=u(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>or(e))),l(t,[`parts`],e)}let r=u(e,[`role`]);return r!=null&&l(t,[`role`],r),t}function kn(e,t){let n={},r=u(e,[`displayName`]);if(t!==void 0&&r!=null&&l(t,[`batch`,`displayName`],r),u(e,[`dest`])!==void 0)throw Error(`dest parameter is not supported in Gemini API.`);return n}function An(e,t){let n={},r=u(e,[`displayName`]);t!==void 0&&r!=null&&l(t,[`displayName`],r);let i=u(e,[`dest`]);return t!==void 0&&i!=null&&l(t,[`outputConfig`],_n(un(i))),n}function jn(e,t){let n={},r=u(t,[`model`]);r!=null&&l(n,[`_url`,`model`],N(e,r));let i=u(t,[`src`]);i!=null&&l(n,[`batch`,`inputConfig`],xn(e,ln(e,i)));let a=u(t,[`config`]);return a!=null&&kn(a,n),n}function Mn(e,t){let n={},r=u(t,[`model`]);r!=null&&l(n,[`model`],N(e,r));let i=u(t,[`src`]);i!=null&&l(n,[`inputConfig`],Sn(ln(e,i)));let a=u(t,[`config`]);return a!=null&&An(a,n),n}function Nn(e,t){let n={},r=u(e,[`displayName`]);return t!==void 0&&r!=null&&l(t,[`batch`,`displayName`],r),n}function Pn(e,t){let n={},r=u(t,[`model`]);r!=null&&l(n,[`_url`,`model`],N(e,r));let i=u(t,[`src`]);i!=null&&l(n,[`batch`,`inputConfig`],Vn(e,i));let a=u(t,[`config`]);return a!=null&&Nn(a,n),n}function Fn(e,t){let n={},r=u(t,[`name`]);return r!=null&&l(n,[`_url`,`name`],V(e,r)),n}function In(e,t){let n={},r=u(t,[`name`]);return r!=null&&l(n,[`_url`,`name`],V(e,r)),n}function Ln(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`name`]);r!=null&&l(t,[`name`],r);let i=u(e,[`done`]);i!=null&&l(t,[`done`],i);let a=u(e,[`error`]);return a!=null&&l(t,[`error`],a),t}function Rn(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`name`]);r!=null&&l(t,[`name`],r);let i=u(e,[`done`]);i!=null&&l(t,[`done`],i);let a=u(e,[`error`]);return a!=null&&l(t,[`error`],a),t}function zn(e,t){let n={},r=u(t,[`contents`]);if(r!=null){let t=Kt(e,r);Array.isArray(t)&&(t=t.map(e=>e)),l(n,[`requests[]`,`request`,`content`],t)}let i=u(t,[`config`]);return i!=null&&(l(n,[`_self`],Bn(i,n)),d(n,{"requests[].*":`requests[].request.*`})),n}function Bn(e,t){let n={},r=u(e,[`taskType`]);t!==void 0&&r!=null&&l(t,[`requests[]`,`taskType`],r);let i=u(e,[`title`]);t!==void 0&&i!=null&&l(t,[`requests[]`,`title`],i);let a=u(e,[`outputDimensionality`]);if(t!==void 0&&a!=null&&l(t,[`requests[]`,`outputDimensionality`],a),u(e,[`mimeType`])!==void 0)throw Error(`mimeType parameter is not supported in Gemini API.`);if(u(e,[`autoTruncate`])!==void 0)throw Error(`autoTruncate parameter is not supported in Gemini API.`);return n}function Vn(e,t){let n={},r=u(t,[`fileName`]);r!=null&&l(n,[`file_name`],r);let i=u(t,[`inlinedRequests`]);return i!=null&&l(n,[`requests`],zn(e,i)),n}function Hn(e){let t={};if(u(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let n=u(e,[`fileUri`]);n!=null&&l(t,[`fileUri`],n);let r=u(e,[`mimeType`]);return r!=null&&l(t,[`mimeType`],r),t}function Un(e){let t={},n=u(e,[`id`]);n!=null&&l(t,[`id`],n);let r=u(e,[`args`]);r!=null&&l(t,[`args`],r);let i=u(e,[`name`]);if(i!=null&&l(t,[`name`],i),u(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(u(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return t}function Wn(e){let t={},n=u(e,[`allowedFunctionNames`]);n!=null&&l(t,[`allowedFunctionNames`],n);let r=u(e,[`mode`]);if(r!=null&&l(t,[`mode`],r),u(e,[`streamFunctionCallArguments`])!==void 0)throw Error(`streamFunctionCallArguments parameter is not supported in Gemini API.`);return t}function Gn(e,t,n){let r={},i=u(t,[`systemInstruction`]);n!==void 0&&i!=null&&l(n,[`systemInstruction`],On(P(i)));let a=u(t,[`temperature`]);a!=null&&l(r,[`temperature`],a);let o=u(t,[`topP`]);o!=null&&l(r,[`topP`],o);let s=u(t,[`topK`]);s!=null&&l(r,[`topK`],s);let c=u(t,[`candidateCount`]);c!=null&&l(r,[`candidateCount`],c);let d=u(t,[`maxOutputTokens`]);d!=null&&l(r,[`maxOutputTokens`],d);let f=u(t,[`stopSequences`]);f!=null&&l(r,[`stopSequences`],f);let p=u(t,[`responseLogprobs`]);p!=null&&l(r,[`responseLogprobs`],p);let m=u(t,[`logprobs`]);m!=null&&l(r,[`logprobs`],m);let h=u(t,[`presencePenalty`]);h!=null&&l(r,[`presencePenalty`],h);let g=u(t,[`frequencyPenalty`]);g!=null&&l(r,[`frequencyPenalty`],g);let _=u(t,[`seed`]);_!=null&&l(r,[`seed`],_);let v=u(t,[`responseMimeType`]);v!=null&&l(r,[`responseMimeType`],v);let y=u(t,[`responseSchema`]);y!=null&&l(r,[`responseSchema`],Jt(y));let b=u(t,[`responseJsonSchema`]);if(b!=null&&l(r,[`responseJsonSchema`],b),u(t,[`routingConfig`])!==void 0)throw Error(`routingConfig parameter is not supported in Gemini API.`);if(u(t,[`modelSelectionConfig`])!==void 0)throw Error(`modelSelectionConfig parameter is not supported in Gemini API.`);let x=u(t,[`safetySettings`]);if(n!==void 0&&x!=null){let e=x;Array.isArray(e)&&(e=e.map(e=>sr(e))),l(n,[`safetySettings`],e)}let S=u(t,[`tools`]);if(n!==void 0&&S!=null){let e=R(S);Array.isArray(e)&&(e=e.map(e=>lr(L(e)))),l(n,[`tools`],e)}let C=u(t,[`toolConfig`]);if(n!==void 0&&C!=null&&l(n,[`toolConfig`],cr(C)),u(t,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);let w=u(t,[`cachedContent`]);n!==void 0&&w!=null&&l(n,[`cachedContent`],z(e,w));let T=u(t,[`responseModalities`]);T!=null&&l(r,[`responseModalities`],T);let E=u(t,[`mediaResolution`]);E!=null&&l(r,[`mediaResolution`],E);let D=u(t,[`speechConfig`]);if(D!=null&&l(r,[`speechConfig`],Yt(D)),u(t,[`audioTimestamp`])!==void 0)throw Error(`audioTimestamp parameter is not supported in Gemini API.`);let O=u(t,[`thinkingConfig`]);O!=null&&l(r,[`thinkingConfig`],O);let k=u(t,[`imageConfig`]);k!=null&&l(r,[`imageConfig`],Zn(k));let A=u(t,[`enableEnhancedCivicAnswers`]);if(A!=null&&l(r,[`enableEnhancedCivicAnswers`],A),u(t,[`modelArmorConfig`])!==void 0)throw Error(`modelArmorConfig parameter is not supported in Gemini API.`);let j=u(t,[`serviceTier`]);return n!==void 0&&j!=null&&l(n,[`serviceTier`],j),r}function Kn(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`candidates`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>En(e))),l(t,[`candidates`],e)}let i=u(e,[`modelVersion`]);i!=null&&l(t,[`modelVersion`],i);let a=u(e,[`promptFeedback`]);a!=null&&l(t,[`promptFeedback`],a);let o=u(e,[`responseId`]);o!=null&&l(t,[`responseId`],o);let s=u(e,[`usageMetadata`]);s!=null&&l(t,[`usageMetadata`],s);let c=u(e,[`modelStatus`]);return c!=null&&l(t,[`modelStatus`],c),t}function qn(e,t){let n={},r=u(t,[`name`]);return r!=null&&l(n,[`_url`,`name`],V(e,r)),n}function Jn(e,t){let n={},r=u(t,[`name`]);return r!=null&&l(n,[`_url`,`name`],V(e,r)),n}function Yn(e){let t={},n=u(e,[`authConfig`]);n!=null&&l(t,[`authConfig`],mn(n));let r=u(e,[`enableWidget`]);return r!=null&&l(t,[`enableWidget`],r),t}function Xn(e){let t={},n=u(e,[`searchTypes`]);if(n!=null&&l(t,[`searchTypes`],n),u(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);if(u(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);let r=u(e,[`timeRangeFilter`]);return r!=null&&l(t,[`timeRangeFilter`],r),t}function Zn(e){let t={},n=u(e,[`aspectRatio`]);n!=null&&l(t,[`aspectRatio`],n);let r=u(e,[`imageSize`]);if(r!=null&&l(t,[`imageSize`],r),u(e,[`personGeneration`])!==void 0)throw Error(`personGeneration parameter is not supported in Gemini API.`);if(u(e,[`prominentPeople`])!==void 0)throw Error(`prominentPeople parameter is not supported in Gemini API.`);if(u(e,[`outputMimeType`])!==void 0)throw Error(`outputMimeType parameter is not supported in Gemini API.`);if(u(e,[`outputCompressionQuality`])!==void 0)throw Error(`outputCompressionQuality parameter is not supported in Gemini API.`);if(u(e,[`imageOutputOptions`])!==void 0)throw Error(`imageOutputOptions parameter is not supported in Gemini API.`);return t}function Qn(e,t){let n={},r=u(t,[`model`]);r!=null&&l(n,[`request`,`model`],N(e,r));let i=u(t,[`contents`]);if(i!=null){let e=F(i);Array.isArray(e)&&(e=e.map(e=>On(e))),l(n,[`request`,`contents`],e)}let a=u(t,[`metadata`]);a!=null&&l(n,[`metadata`],a);let o=u(t,[`config`]);return o!=null&&l(n,[`request`,`generationConfig`],Gn(e,o,u(n,[`request`],{}))),n}function $n(e){let t={},n=u(e,[`response`]);n!=null&&l(t,[`response`],Kn(n));let r=u(e,[`metadata`]);r!=null&&l(t,[`metadata`],r);let i=u(e,[`error`]);return i!=null&&l(t,[`error`],i),t}function er(e,t){let n={},r=u(e,[`pageSize`]);t!==void 0&&r!=null&&l(t,[`_query`,`pageSize`],r);let i=u(e,[`pageToken`]);if(t!==void 0&&i!=null&&l(t,[`_query`,`pageToken`],i),u(e,[`filter`])!==void 0)throw Error(`filter parameter is not supported in Gemini API.`);return n}function tr(e,t){let n={},r=u(e,[`pageSize`]);t!==void 0&&r!=null&&l(t,[`_query`,`pageSize`],r);let i=u(e,[`pageToken`]);t!==void 0&&i!=null&&l(t,[`_query`,`pageToken`],i);let a=u(e,[`filter`]);return t!==void 0&&a!=null&&l(t,[`_query`,`filter`],a),n}function nr(e){let t={},n=u(e,[`config`]);return n!=null&&er(n,t),t}function rr(e){let t={},n=u(e,[`config`]);return n!=null&&tr(n,t),t}function ir(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`nextPageToken`]);r!=null&&l(t,[`nextPageToken`],r);let i=u(e,[`operations`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>vn(e))),l(t,[`batchJobs`],e)}return t}function ar(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`nextPageToken`]);r!=null&&l(t,[`nextPageToken`],r);let i=u(e,[`batchPredictionJobs`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>yn(e))),l(t,[`batchJobs`],e)}return t}function or(e){let t={},n=u(e,[`mediaResolution`]);n!=null&&l(t,[`mediaResolution`],n);let r=u(e,[`codeExecutionResult`]);r!=null&&l(t,[`codeExecutionResult`],r);let i=u(e,[`executableCode`]);i!=null&&l(t,[`executableCode`],i);let a=u(e,[`fileData`]);a!=null&&l(t,[`fileData`],Hn(a));let o=u(e,[`functionCall`]);o!=null&&l(t,[`functionCall`],Un(o));let s=u(e,[`functionResponse`]);s!=null&&l(t,[`functionResponse`],s);let c=u(e,[`inlineData`]);c!=null&&l(t,[`inlineData`],Cn(c));let d=u(e,[`text`]);d!=null&&l(t,[`text`],d);let f=u(e,[`thought`]);f!=null&&l(t,[`thought`],f);let p=u(e,[`thoughtSignature`]);p!=null&&l(t,[`thoughtSignature`],p);let m=u(e,[`videoMetadata`]);m!=null&&l(t,[`videoMetadata`],m);let h=u(e,[`toolCall`]);h!=null&&l(t,[`toolCall`],h);let g=u(e,[`toolResponse`]);g!=null&&l(t,[`toolResponse`],g);let _=u(e,[`partMetadata`]);return _!=null&&l(t,[`partMetadata`],_),t}function sr(e){let t={},n=u(e,[`category`]);if(n!=null&&l(t,[`category`],n),u(e,[`method`])!==void 0)throw Error(`method parameter is not supported in Gemini API.`);let r=u(e,[`threshold`]);return r!=null&&l(t,[`threshold`],r),t}function cr(e){let t={},n=u(e,[`retrievalConfig`]);n!=null&&l(t,[`retrievalConfig`],n);let r=u(e,[`functionCallingConfig`]);r!=null&&l(t,[`functionCallingConfig`],Wn(r));let i=u(e,[`includeServerSideToolInvocations`]);return i!=null&&l(t,[`includeServerSideToolInvocations`],i),t}function lr(e){let t={};if(u(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let n=u(e,[`computerUse`]);n!=null&&l(t,[`computerUse`],n);let r=u(e,[`fileSearch`]);r!=null&&l(t,[`fileSearch`],r);let i=u(e,[`googleSearch`]);i!=null&&l(t,[`googleSearch`],Xn(i));let a=u(e,[`googleMaps`]);a!=null&&l(t,[`googleMaps`],Yn(a));let o=u(e,[`codeExecution`]);if(o!=null&&l(t,[`codeExecution`],o),u(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let s=u(e,[`functionDeclarations`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`functionDeclarations`],e)}let c=u(e,[`googleSearchRetrieval`]);if(c!=null&&l(t,[`googleSearchRetrieval`],c),u(e,[`parallelAiSearch`])!==void 0)throw Error(`parallelAiSearch parameter is not supported in Gemini API.`);let d=u(e,[`urlContext`]);d!=null&&l(t,[`urlContext`],d);let f=u(e,[`mcpServers`]);if(f!=null){let e=f;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`mcpServers`],e)}return t}var H;(function(e){e.PAGED_ITEM_BATCH_JOBS=`batchJobs`,e.PAGED_ITEM_MODELS=`models`,e.PAGED_ITEM_TUNING_JOBS=`tuningJobs`,e.PAGED_ITEM_FILES=`files`,e.PAGED_ITEM_CACHED_CONTENTS=`cachedContents`,e.PAGED_ITEM_FILE_SEARCH_STORES=`fileSearchStores`,e.PAGED_ITEM_DOCUMENTS=`documents`})(H||={});var U=class{constructor(e,t,n,r){this.pageInternal=[],this.paramsInternal={},this.requestInternal=t,this.init(e,n,r)}init(e,t,n){this.nameInternal=e,this.pageInternal=t[this.nameInternal]||[],this.sdkHttpResponseInternal=t?.sdkHttpResponse,this.idxInternal=0;let r={config:{}};r=!n||Object.keys(n).length===0?{config:{}}:typeof n==`object`?Object.assign({},n):n,r.config&&(r.config.pageToken=t.nextPageToken),this.paramsInternal=r,this.pageInternalSize=r.config?.pageSize??this.pageInternal.length}initNextPage(e){this.init(this.nameInternal,e,this.paramsInternal)}get page(){return this.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(e){return this.pageInternal[e]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};let e=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:e,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw Error(`No more pages to fetch.`);let e=await this.requestInternal(this.params);return this.initNextPage(e),this.page}hasNextPage(){return this.params.config?.pageToken!==void 0}},ur=class extends s{constructor(e){super(),this.apiClient=e,this.list=async(e={})=>new U(H.PAGED_ITEM_BATCH_JOBS,e=>this.listInternal(e),await this.listInternal(e),e),this.create=async e=>(this.apiClient.isVertexAI()&&(e.config=this.formatDestination(e.src,e.config)),this.createInternal(e)),this.createEmbeddings=async e=>{if(console.warn(`batches.createEmbeddings() is experimental and may change without notice.`),this.apiClient.isVertexAI())throw Error(`Vertex AI does not support batches.createEmbeddings.`);return this.createEmbeddingsInternal(e)}}createInlinedGenerateContentRequest(e){let t=jn(this.apiClient,e),n=t._url,r=c(`{model}:batchGenerateContent`,n),i=t.batch.inputConfig.requests,a=i.requests,o=[];for(let e of a){let t=Object.assign({},e);if(t.systemInstruction){let e=t.systemInstruction;delete t.systemInstruction;let n=t.request;n.systemInstruction=e,t.request=n}o.push(t)}return i.requests=o,delete t.config,delete t._url,delete t._query,{path:r,body:t}}getGcsUri(e){if(typeof e==`string`)return e.startsWith(`gs://`)?e:void 0;if(!Array.isArray(e)&&e.gcsUri&&e.gcsUri.length>0)return e.gcsUri[0]}getBigqueryUri(e){if(typeof e==`string`)return e.startsWith(`bq://`)?e:void 0;if(!Array.isArray(e))return e.bigqueryUri}formatDestination(e,t){let n=t?Object.assign({},t):{},r=Date.now().toString();if(n.displayName||=`genaiBatchJob_${r}`,n.dest===void 0){let t=this.getGcsUri(e),i=this.getBigqueryUri(e);if(t)t.endsWith(`.jsonl`)?n.dest=`${t.slice(0,-6)}/dest`:n.dest=`${t}_dest_${r}`;else if(i)n.dest=`${i}_dest_${r}`;else throw Error(`Unsupported source for Vertex AI: No GCS or BigQuery URI found.`)}return n}async createInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Mn(this.apiClient,e);return n=c(`batchPredictionJobs`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>yn(e))}else{let i=jn(this.apiClient,e);return n=c(`{model}:batchGenerateContent`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>vn(e))}}async createEmbeddingsInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=Pn(this.apiClient,e);return n=c(`{model}:asyncBatchEmbedContent`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>vn(e))}}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Jn(this.apiClient,e);return n=c(`batchPredictionJobs/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>yn(e))}else{let i=qn(this.apiClient,e);return n=c(`batches/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>vn(e))}}async cancel(e){let t=``,n={};if(this.apiClient.isVertexAI()){let r=Tn(this.apiClient,e);t=c(`batchPredictionJobs/{name}:cancel`,r._url),n=r._query,delete r._url,delete r._query,await this.apiClient.request({path:t,queryParams:n,body:JSON.stringify(r),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal})}else{let r=wn(this.apiClient,e);t=c(`batches/{name}:cancel`,r._url),n=r._query,delete r._url,delete r._query,await this.apiClient.request({path:t,queryParams:n,body:JSON.stringify(r),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal})}}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=rr(e);return n=c(`batchPredictionJobs`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ar(e),n=new Mt;return Object.assign(n,t),n})}else{let i=nr(e);return n=c(`batches`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ir(e),n=new Mt;return Object.assign(n,t),n})}}async delete(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=In(this.apiClient,e);return n=c(`batchPredictionJobs/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>Rn(e))}else{let i=Fn(this.apiClient,e);return n=c(`batches/{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>Ln(e))}}};function dr(e){let t={},n=u(e,[`apiKey`]);if(n!=null&&l(t,[`apiKey`],n),u(e,[`apiKeyConfig`])!==void 0)throw Error(`apiKeyConfig parameter is not supported in Gemini API.`);if(u(e,[`authType`])!==void 0)throw Error(`authType parameter is not supported in Gemini API.`);if(u(e,[`googleServiceAccountConfig`])!==void 0)throw Error(`googleServiceAccountConfig parameter is not supported in Gemini API.`);if(u(e,[`httpBasicAuthConfig`])!==void 0)throw Error(`httpBasicAuthConfig parameter is not supported in Gemini API.`);if(u(e,[`oauthConfig`])!==void 0)throw Error(`oauthConfig parameter is not supported in Gemini API.`);if(u(e,[`oidcConfig`])!==void 0)throw Error(`oidcConfig parameter is not supported in Gemini API.`);return t}function fr(e){let t={},n=u(e,[`data`]);if(n!=null&&l(t,[`data`],n),u(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=u(e,[`mimeType`]);return r!=null&&l(t,[`mimeType`],r),t}function pr(e){let t={},n=u(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>Lr(e))),l(t,[`parts`],e)}let r=u(e,[`role`]);return r!=null&&l(t,[`role`],r),t}function mr(e){let t={},n=u(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>Rr(e))),l(t,[`parts`],e)}let r=u(e,[`role`]);return r!=null&&l(t,[`role`],r),t}function hr(e,t){let n={},r=u(e,[`ttl`]);t!==void 0&&r!=null&&l(t,[`ttl`],r);let i=u(e,[`expireTime`]);t!==void 0&&i!=null&&l(t,[`expireTime`],i);let a=u(e,[`displayName`]);t!==void 0&&a!=null&&l(t,[`displayName`],a);let o=u(e,[`contents`]);if(t!==void 0&&o!=null){let e=F(o);Array.isArray(e)&&(e=e.map(e=>pr(e))),l(t,[`contents`],e)}let s=u(e,[`systemInstruction`]);t!==void 0&&s!=null&&l(t,[`systemInstruction`],pr(P(s)));let c=u(e,[`tools`]);if(t!==void 0&&c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>Vr(e))),l(t,[`tools`],e)}let d=u(e,[`toolConfig`]);if(t!==void 0&&d!=null&&l(t,[`toolConfig`],zr(d)),u(e,[`kmsKeyName`])!==void 0)throw Error(`kmsKeyName parameter is not supported in Gemini API.`);return n}function gr(e,t){let n={},r=u(e,[`ttl`]);t!==void 0&&r!=null&&l(t,[`ttl`],r);let i=u(e,[`expireTime`]);t!==void 0&&i!=null&&l(t,[`expireTime`],i);let a=u(e,[`displayName`]);t!==void 0&&a!=null&&l(t,[`displayName`],a);let o=u(e,[`contents`]);if(t!==void 0&&o!=null){let e=F(o);Array.isArray(e)&&(e=e.map(e=>mr(e))),l(t,[`contents`],e)}let s=u(e,[`systemInstruction`]);t!==void 0&&s!=null&&l(t,[`systemInstruction`],mr(P(s)));let c=u(e,[`tools`]);if(t!==void 0&&c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>Hr(e))),l(t,[`tools`],e)}let d=u(e,[`toolConfig`]);t!==void 0&&d!=null&&l(t,[`toolConfig`],Br(d));let f=u(e,[`kmsKeyName`]);return t!==void 0&&f!=null&&l(t,[`encryption_spec`,`kmsKeyName`],f),n}function _r(e,t){let n={},r=u(t,[`model`]);r!=null&&l(n,[`model`],It(e,r));let i=u(t,[`config`]);return i!=null&&hr(i,n),n}function vr(e,t){let n={},r=u(t,[`model`]);r!=null&&l(n,[`model`],It(e,r));let i=u(t,[`config`]);return i!=null&&gr(i,n),n}function yr(e,t){let n={},r=u(t,[`name`]);return r!=null&&l(n,[`_url`,`name`],z(e,r)),n}function br(e,t){let n={},r=u(t,[`name`]);return r!=null&&l(n,[`_url`,`name`],z(e,r)),n}function xr(e){let t={},n=u(e,[`sdkHttpResponse`]);return n!=null&&l(t,[`sdkHttpResponse`],n),t}function Sr(e){let t={},n=u(e,[`sdkHttpResponse`]);return n!=null&&l(t,[`sdkHttpResponse`],n),t}function Cr(e){let t={};if(u(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let n=u(e,[`fileUri`]);n!=null&&l(t,[`fileUri`],n);let r=u(e,[`mimeType`]);return r!=null&&l(t,[`mimeType`],r),t}function wr(e){let t={},n=u(e,[`id`]);n!=null&&l(t,[`id`],n);let r=u(e,[`args`]);r!=null&&l(t,[`args`],r);let i=u(e,[`name`]);if(i!=null&&l(t,[`name`],i),u(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(u(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return t}function Tr(e){let t={},n=u(e,[`allowedFunctionNames`]);n!=null&&l(t,[`allowedFunctionNames`],n);let r=u(e,[`mode`]);if(r!=null&&l(t,[`mode`],r),u(e,[`streamFunctionCallArguments`])!==void 0)throw Error(`streamFunctionCallArguments parameter is not supported in Gemini API.`);return t}function Er(e){let t={},n=u(e,[`description`]);n!=null&&l(t,[`description`],n);let r=u(e,[`name`]);r!=null&&l(t,[`name`],r);let i=u(e,[`parameters`]);i!=null&&l(t,[`parameters`],i);let a=u(e,[`parametersJsonSchema`]);a!=null&&l(t,[`parametersJsonSchema`],a);let o=u(e,[`response`]);o!=null&&l(t,[`response`],o);let s=u(e,[`responseJsonSchema`]);if(s!=null&&l(t,[`responseJsonSchema`],s),u(e,[`behavior`])!==void 0)throw Error(`behavior parameter is not supported in Vertex AI.`);return t}function Dr(e,t){let n={},r=u(t,[`name`]);return r!=null&&l(n,[`_url`,`name`],z(e,r)),n}function Or(e,t){let n={},r=u(t,[`name`]);return r!=null&&l(n,[`_url`,`name`],z(e,r)),n}function kr(e){let t={},n=u(e,[`authConfig`]);n!=null&&l(t,[`authConfig`],dr(n));let r=u(e,[`enableWidget`]);return r!=null&&l(t,[`enableWidget`],r),t}function Ar(e){let t={},n=u(e,[`searchTypes`]);if(n!=null&&l(t,[`searchTypes`],n),u(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);if(u(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);let r=u(e,[`timeRangeFilter`]);return r!=null&&l(t,[`timeRangeFilter`],r),t}function jr(e,t){let n={},r=u(e,[`pageSize`]);t!==void 0&&r!=null&&l(t,[`_query`,`pageSize`],r);let i=u(e,[`pageToken`]);return t!==void 0&&i!=null&&l(t,[`_query`,`pageToken`],i),n}function Mr(e,t){let n={},r=u(e,[`pageSize`]);t!==void 0&&r!=null&&l(t,[`_query`,`pageSize`],r);let i=u(e,[`pageToken`]);return t!==void 0&&i!=null&&l(t,[`_query`,`pageToken`],i),n}function Nr(e){let t={},n=u(e,[`config`]);return n!=null&&jr(n,t),t}function Pr(e){let t={},n=u(e,[`config`]);return n!=null&&Mr(n,t),t}function Fr(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`nextPageToken`]);r!=null&&l(t,[`nextPageToken`],r);let i=u(e,[`cachedContents`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`cachedContents`],e)}return t}function Ir(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`nextPageToken`]);r!=null&&l(t,[`nextPageToken`],r);let i=u(e,[`cachedContents`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`cachedContents`],e)}return t}function Lr(e){let t={},n=u(e,[`mediaResolution`]);n!=null&&l(t,[`mediaResolution`],n);let r=u(e,[`codeExecutionResult`]);r!=null&&l(t,[`codeExecutionResult`],r);let i=u(e,[`executableCode`]);i!=null&&l(t,[`executableCode`],i);let a=u(e,[`fileData`]);a!=null&&l(t,[`fileData`],Cr(a));let o=u(e,[`functionCall`]);o!=null&&l(t,[`functionCall`],wr(o));let s=u(e,[`functionResponse`]);s!=null&&l(t,[`functionResponse`],s);let c=u(e,[`inlineData`]);c!=null&&l(t,[`inlineData`],fr(c));let d=u(e,[`text`]);d!=null&&l(t,[`text`],d);let f=u(e,[`thought`]);f!=null&&l(t,[`thought`],f);let p=u(e,[`thoughtSignature`]);p!=null&&l(t,[`thoughtSignature`],p);let m=u(e,[`videoMetadata`]);m!=null&&l(t,[`videoMetadata`],m);let h=u(e,[`toolCall`]);h!=null&&l(t,[`toolCall`],h);let g=u(e,[`toolResponse`]);g!=null&&l(t,[`toolResponse`],g);let _=u(e,[`partMetadata`]);return _!=null&&l(t,[`partMetadata`],_),t}function Rr(e){let t={},n=u(e,[`mediaResolution`]);n!=null&&l(t,[`mediaResolution`],n);let r=u(e,[`codeExecutionResult`]);r!=null&&l(t,[`codeExecutionResult`],r);let i=u(e,[`executableCode`]);i!=null&&l(t,[`executableCode`],i);let a=u(e,[`fileData`]);a!=null&&l(t,[`fileData`],a);let o=u(e,[`functionCall`]);o!=null&&l(t,[`functionCall`],o);let s=u(e,[`functionResponse`]);s!=null&&l(t,[`functionResponse`],s);let c=u(e,[`inlineData`]);c!=null&&l(t,[`inlineData`],c);let d=u(e,[`text`]);d!=null&&l(t,[`text`],d);let f=u(e,[`thought`]);f!=null&&l(t,[`thought`],f);let p=u(e,[`thoughtSignature`]);p!=null&&l(t,[`thoughtSignature`],p);let m=u(e,[`videoMetadata`]);if(m!=null&&l(t,[`videoMetadata`],m),u(e,[`toolCall`])!==void 0)throw Error(`toolCall parameter is not supported in Vertex AI.`);if(u(e,[`toolResponse`])!==void 0)throw Error(`toolResponse parameter is not supported in Vertex AI.`);if(u(e,[`partMetadata`])!==void 0)throw Error(`partMetadata parameter is not supported in Vertex AI.`);return t}function zr(e){let t={},n=u(e,[`retrievalConfig`]);n!=null&&l(t,[`retrievalConfig`],n);let r=u(e,[`functionCallingConfig`]);r!=null&&l(t,[`functionCallingConfig`],Tr(r));let i=u(e,[`includeServerSideToolInvocations`]);return i!=null&&l(t,[`includeServerSideToolInvocations`],i),t}function Br(e){let t={},n=u(e,[`retrievalConfig`]);n!=null&&l(t,[`retrievalConfig`],n);let r=u(e,[`functionCallingConfig`]);if(r!=null&&l(t,[`functionCallingConfig`],r),u(e,[`includeServerSideToolInvocations`])!==void 0)throw Error(`includeServerSideToolInvocations parameter is not supported in Vertex AI.`);return t}function Vr(e){let t={};if(u(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let n=u(e,[`computerUse`]);n!=null&&l(t,[`computerUse`],n);let r=u(e,[`fileSearch`]);r!=null&&l(t,[`fileSearch`],r);let i=u(e,[`googleSearch`]);i!=null&&l(t,[`googleSearch`],Ar(i));let a=u(e,[`googleMaps`]);a!=null&&l(t,[`googleMaps`],kr(a));let o=u(e,[`codeExecution`]);if(o!=null&&l(t,[`codeExecution`],o),u(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let s=u(e,[`functionDeclarations`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`functionDeclarations`],e)}let c=u(e,[`googleSearchRetrieval`]);if(c!=null&&l(t,[`googleSearchRetrieval`],c),u(e,[`parallelAiSearch`])!==void 0)throw Error(`parallelAiSearch parameter is not supported in Gemini API.`);let d=u(e,[`urlContext`]);d!=null&&l(t,[`urlContext`],d);let f=u(e,[`mcpServers`]);if(f!=null){let e=f;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`mcpServers`],e)}return t}function Hr(e){let t={},n=u(e,[`retrieval`]);n!=null&&l(t,[`retrieval`],n);let r=u(e,[`computerUse`]);if(r!=null&&l(t,[`computerUse`],r),u(e,[`fileSearch`])!==void 0)throw Error(`fileSearch parameter is not supported in Vertex AI.`);let i=u(e,[`googleSearch`]);i!=null&&l(t,[`googleSearch`],i);let a=u(e,[`googleMaps`]);a!=null&&l(t,[`googleMaps`],a);let o=u(e,[`codeExecution`]);o!=null&&l(t,[`codeExecution`],o);let s=u(e,[`enterpriseWebSearch`]);s!=null&&l(t,[`enterpriseWebSearch`],s);let c=u(e,[`functionDeclarations`]);if(c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>Er(e))),l(t,[`functionDeclarations`],e)}let d=u(e,[`googleSearchRetrieval`]);d!=null&&l(t,[`googleSearchRetrieval`],d);let f=u(e,[`parallelAiSearch`]);f!=null&&l(t,[`parallelAiSearch`],f);let p=u(e,[`urlContext`]);if(p!=null&&l(t,[`urlContext`],p),u(e,[`mcpServers`])!==void 0)throw Error(`mcpServers parameter is not supported in Vertex AI.`);return t}function Ur(e,t){let n={},r=u(e,[`ttl`]);t!==void 0&&r!=null&&l(t,[`ttl`],r);let i=u(e,[`expireTime`]);return t!==void 0&&i!=null&&l(t,[`expireTime`],i),n}function Wr(e,t){let n={},r=u(e,[`ttl`]);t!==void 0&&r!=null&&l(t,[`ttl`],r);let i=u(e,[`expireTime`]);return t!==void 0&&i!=null&&l(t,[`expireTime`],i),n}function Gr(e,t){let n={},r=u(t,[`name`]);r!=null&&l(n,[`_url`,`name`],z(e,r));let i=u(t,[`config`]);return i!=null&&Ur(i,n),n}function Kr(e,t){let n={},r=u(t,[`name`]);r!=null&&l(n,[`_url`,`name`],z(e,r));let i=u(t,[`config`]);return i!=null&&Wr(i,n),n}var qr=class extends s{constructor(e){super(),this.apiClient=e,this.list=async(e={})=>new U(H.PAGED_ITEM_CACHED_CONTENTS,e=>this.listInternal(e),await this.listInternal(e),e)}async create(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=vr(this.apiClient,e);return n=c(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}else{let i=_r(this.apiClient,e);return n=c(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Or(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}else{let i=Dr(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async delete(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=br(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Sr(e),n=new St;return Object.assign(n,t),n})}else{let i=yr(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=xr(e),n=new St;return Object.assign(n,t),n})}}async update(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Kr(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`PATCH`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}else{let i=Gr(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`PATCH`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Pr(e);return n=c(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Ir(e),n=new Ct;return Object.assign(n,t),n})}else{let i=Nr(e);return n=c(`cachedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Fr(e),n=new Ct;return Object.assign(n,t),n})}}};function Jr(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Yr(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function W(e){return this instanceof W?(this.v=e,this):new W(e)}function G(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof W?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function K(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Yr==`function`?Yr(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Xr(e){if(e.candidates==null||e.candidates.length===0)return!1;let t=e.candidates[0]?.content;return t===void 0?!1:Zr(t)}function Zr(e){if(e.parts===void 0||e.parts.length===0)return!1;for(let t of e.parts)if(t===void 0||Object.keys(t).length===0)return!1;return!0}function Qr(e){if(e.length!==0){for(let t of e)if(t.role!==`user`&&t.role!==`model`)throw Error(`Role must be user or model, but got ${t.role}.`)}}function $r(e){if(e===void 0||e.length===0)return[];let t=[],n=e.length,r=0;for(;r<n;)if(e[r].role===`user`)t.push(e[r]),r++;else{let i=[],a=!0;for(;r<n&&e[r].role===`model`;)i.push(e[r]),a&&!Zr(e[r])&&(a=!1),r++;a?t.push(...i):t.pop()}return t}var ei=class{constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new ti(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}},ti=class{constructor(e,t,n,r={},i=[]){this.apiClient=e,this.modelsModule=t,this.model=n,this.config=r,this.history=i,this.sendPromise=Promise.resolve(),Qr(i)}async sendMessage(e){await this.sendPromise;let t=P(e.message),n=this.modelsModule.generateContent({model:this.model,contents:this.getHistory(!0).concat(t),config:e.config??this.config});return this.sendPromise=(async()=>{let e=await n,r=e.candidates?.[0]?.content,i=e.automaticFunctionCallingHistory,a=this.getHistory(!0).length,o=[];i!=null&&(o=i.slice(a)??[]);let s=r?[r]:[];this.recordHistory(t,s,o)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),n}async sendMessageStream(e){await this.sendPromise;let t=P(e.message),n=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(t),config:e.config??this.config});this.sendPromise=n.then(()=>void 0).catch(()=>void 0);let r=await n;return this.processStreamResponse(r,t)}getHistory(e=!1){let t=e?$r(this.history):this.history;return structuredClone(t)}processStreamResponse(e,t){return G(this,arguments,function*(){var n,r,i,a;let o=[];try{for(var s=!0,c=K(e),l;l=yield W(c.next()),n=l.done,!n;s=!0){a=l.value,s=!1;let e=a;if(Xr(e)){let t=e.candidates?.[0]?.content;t!==void 0&&o.push(t)}yield yield W(e)}}catch(e){r={error:e}}finally{try{!s&&!n&&(i=c.return)&&(yield W(i.call(c)))}finally{if(r)throw r.error}}this.recordHistory(t,o)})}recordHistory(e,t,n){let r=[];t.length>0&&t.every(e=>e.role!==void 0)?r=t:r.push({role:`model`,parts:[]}),n&&n.length>0?this.history.push(...$r(n)):this.history.push(e),this.history.push(...r)}},ni=class e extends Error{constructor(t){super(t.message),this.name=`ApiError`,this.status=t.status,Object.setPrototypeOf(this,e.prototype)}};function ri(e){let t={},n=u(e,[`file`]);return n!=null&&l(t,[`file`],n),t}function ii(e){let t={},n=u(e,[`sdkHttpResponse`]);return n!=null&&l(t,[`sdkHttpResponse`],n),t}function ai(e){let t={},n=u(e,[`name`]);return n!=null&&l(t,[`_url`,`file`],nn(n)),t}function oi(e){let t={},n=u(e,[`sdkHttpResponse`]);return n!=null&&l(t,[`sdkHttpResponse`],n),t}function si(e){let t={},n=u(e,[`name`]);return n!=null&&l(t,[`_url`,`file`],nn(n)),t}function ci(e){let t={},n=u(e,[`uris`]);return n!=null&&l(t,[`uris`],n),t}function li(e,t){let n={},r=u(e,[`pageSize`]);t!==void 0&&r!=null&&l(t,[`_query`,`pageSize`],r);let i=u(e,[`pageToken`]);return t!==void 0&&i!=null&&l(t,[`_query`,`pageToken`],i),n}function ui(e){let t={},n=u(e,[`config`]);return n!=null&&li(n,t),t}function di(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`nextPageToken`]);r!=null&&l(t,[`nextPageToken`],r);let i=u(e,[`files`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`files`],e)}return t}function fi(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`files`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`files`],e)}return t}var pi=class extends s{constructor(e){super(),this.apiClient=e,this.list=async(e={})=>new U(H.PAGED_ITEM_FILES,e=>this.listInternal(e),await this.listInternal(e),e)}async upload(e){if(this.apiClient.isVertexAI())throw Error(`Vertex AI does not support uploading files. You can share files through a GCS bucket.`);return this.apiClient.uploadFile(e.file,e.config).then(e=>e)}async download(e){await this.apiClient.downloadFile(e)}async registerFiles(e){throw Error(`registerFiles is only supported in Node.js environments.`)}async _registerFiles(e){return this.registerFilesInternal(e)}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ui(e);return n=c(`files`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=di(e),n=new Ot;return Object.assign(n,t),n})}}async createInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ri(e);return n=c(`upload/v1beta/files`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=ii(e),n=new kt;return Object.assign(n,t),n})}}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=si(e);return n=c(`files/{file}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async delete(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ai(e);return n=c(`files/{file}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=oi(e),n=new At;return Object.assign(n,t),n})}}async registerFilesInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ci(e);return n=c(`files:register`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=fi(e),n=new jt;return Object.assign(n,t),n})}}};function mi(e){let t={};if(u(e,[`languageCodes`])!==void 0)throw Error(`languageCodes parameter is not supported in Gemini API.`);return t}function hi(e){let t={},n=u(e,[`apiKey`]);if(n!=null&&l(t,[`apiKey`],n),u(e,[`apiKeyConfig`])!==void 0)throw Error(`apiKeyConfig parameter is not supported in Gemini API.`);if(u(e,[`authType`])!==void 0)throw Error(`authType parameter is not supported in Gemini API.`);if(u(e,[`googleServiceAccountConfig`])!==void 0)throw Error(`googleServiceAccountConfig parameter is not supported in Gemini API.`);if(u(e,[`httpBasicAuthConfig`])!==void 0)throw Error(`httpBasicAuthConfig parameter is not supported in Gemini API.`);if(u(e,[`oauthConfig`])!==void 0)throw Error(`oauthConfig parameter is not supported in Gemini API.`);if(u(e,[`oidcConfig`])!==void 0)throw Error(`oidcConfig parameter is not supported in Gemini API.`);return t}function gi(e){let t={},n=u(e,[`data`]);if(n!=null&&l(t,[`data`],n),u(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=u(e,[`mimeType`]);return r!=null&&l(t,[`mimeType`],r),t}function _i(e){let t={},n=u(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>Fi(e))),l(t,[`parts`],e)}let r=u(e,[`role`]);return r!=null&&l(t,[`role`],r),t}function vi(e){let t={},n=u(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>Ii(e))),l(t,[`parts`],e)}let r=u(e,[`role`]);return r!=null&&l(t,[`role`],r),t}function yi(e){let t={};if(u(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let n=u(e,[`fileUri`]);n!=null&&l(t,[`fileUri`],n);let r=u(e,[`mimeType`]);return r!=null&&l(t,[`mimeType`],r),t}function bi(e){let t={},n=u(e,[`id`]);n!=null&&l(t,[`id`],n);let r=u(e,[`args`]);r!=null&&l(t,[`args`],r);let i=u(e,[`name`]);if(i!=null&&l(t,[`name`],i),u(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(u(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return t}function xi(e){let t={},n=u(e,[`description`]);n!=null&&l(t,[`description`],n);let r=u(e,[`name`]);r!=null&&l(t,[`name`],r);let i=u(e,[`parameters`]);i!=null&&l(t,[`parameters`],i);let a=u(e,[`parametersJsonSchema`]);a!=null&&l(t,[`parametersJsonSchema`],a);let o=u(e,[`response`]);o!=null&&l(t,[`response`],o);let s=u(e,[`responseJsonSchema`]);if(s!=null&&l(t,[`responseJsonSchema`],s),u(e,[`behavior`])!==void 0)throw Error(`behavior parameter is not supported in Vertex AI.`);return t}function Si(e){let t={},n=u(e,[`modelSelectionConfig`]);n!=null&&l(t,[`modelConfig`],n);let r=u(e,[`responseJsonSchema`]);r!=null&&l(t,[`responseJsonSchema`],r);let i=u(e,[`audioTimestamp`]);i!=null&&l(t,[`audioTimestamp`],i);let a=u(e,[`candidateCount`]);a!=null&&l(t,[`candidateCount`],a);let o=u(e,[`enableAffectiveDialog`]);o!=null&&l(t,[`enableAffectiveDialog`],o);let s=u(e,[`frequencyPenalty`]);s!=null&&l(t,[`frequencyPenalty`],s);let c=u(e,[`logprobs`]);c!=null&&l(t,[`logprobs`],c);let d=u(e,[`maxOutputTokens`]);d!=null&&l(t,[`maxOutputTokens`],d);let f=u(e,[`mediaResolution`]);f!=null&&l(t,[`mediaResolution`],f);let p=u(e,[`presencePenalty`]);p!=null&&l(t,[`presencePenalty`],p);let m=u(e,[`responseLogprobs`]);m!=null&&l(t,[`responseLogprobs`],m);let h=u(e,[`responseMimeType`]);h!=null&&l(t,[`responseMimeType`],h);let g=u(e,[`responseModalities`]);g!=null&&l(t,[`responseModalities`],g);let _=u(e,[`responseSchema`]);_!=null&&l(t,[`responseSchema`],_);let v=u(e,[`routingConfig`]);v!=null&&l(t,[`routingConfig`],v);let y=u(e,[`seed`]);y!=null&&l(t,[`seed`],y);let b=u(e,[`speechConfig`]);b!=null&&l(t,[`speechConfig`],Bi(b));let x=u(e,[`stopSequences`]);x!=null&&l(t,[`stopSequences`],x);let S=u(e,[`temperature`]);S!=null&&l(t,[`temperature`],S);let C=u(e,[`thinkingConfig`]);C!=null&&l(t,[`thinkingConfig`],C);let w=u(e,[`topK`]);w!=null&&l(t,[`topK`],w);let T=u(e,[`topP`]);if(T!=null&&l(t,[`topP`],T),u(e,[`enableEnhancedCivicAnswers`])!==void 0)throw Error(`enableEnhancedCivicAnswers parameter is not supported in Vertex AI.`);return t}function Ci(e){let t={},n=u(e,[`authConfig`]);n!=null&&l(t,[`authConfig`],hi(n));let r=u(e,[`enableWidget`]);return r!=null&&l(t,[`enableWidget`],r),t}function wi(e){let t={},n=u(e,[`searchTypes`]);if(n!=null&&l(t,[`searchTypes`],n),u(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);if(u(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);let r=u(e,[`timeRangeFilter`]);return r!=null&&l(t,[`timeRangeFilter`],r),t}function Ti(e,t){let n={},r=u(e,[`generationConfig`]);t!==void 0&&r!=null&&l(t,[`setup`,`generationConfig`],r);let i=u(e,[`responseModalities`]);t!==void 0&&i!=null&&l(t,[`setup`,`generationConfig`,`responseModalities`],i);let a=u(e,[`temperature`]);t!==void 0&&a!=null&&l(t,[`setup`,`generationConfig`,`temperature`],a);let o=u(e,[`topP`]);t!==void 0&&o!=null&&l(t,[`setup`,`generationConfig`,`topP`],o);let s=u(e,[`topK`]);t!==void 0&&s!=null&&l(t,[`setup`,`generationConfig`,`topK`],s);let c=u(e,[`maxOutputTokens`]);t!==void 0&&c!=null&&l(t,[`setup`,`generationConfig`,`maxOutputTokens`],c);let d=u(e,[`mediaResolution`]);t!==void 0&&d!=null&&l(t,[`setup`,`generationConfig`,`mediaResolution`],d);let f=u(e,[`seed`]);t!==void 0&&f!=null&&l(t,[`setup`,`generationConfig`,`seed`],f);let p=u(e,[`speechConfig`]);t!==void 0&&p!=null&&l(t,[`setup`,`generationConfig`,`speechConfig`],Xt(p));let m=u(e,[`thinkingConfig`]);t!==void 0&&m!=null&&l(t,[`setup`,`generationConfig`,`thinkingConfig`],m);let h=u(e,[`enableAffectiveDialog`]);t!==void 0&&h!=null&&l(t,[`setup`,`generationConfig`,`enableAffectiveDialog`],h);let g=u(e,[`systemInstruction`]);t!==void 0&&g!=null&&l(t,[`setup`,`systemInstruction`],_i(P(g)));let _=u(e,[`tools`]);if(t!==void 0&&_!=null){let e=R(_);Array.isArray(e)&&(e=e.map(e=>Vi(L(e)))),l(t,[`setup`,`tools`],e)}let v=u(e,[`sessionResumption`]);t!==void 0&&v!=null&&l(t,[`setup`,`sessionResumption`],Ri(v));let y=u(e,[`inputAudioTranscription`]);t!==void 0&&y!=null&&l(t,[`setup`,`inputAudioTranscription`],mi(y));let b=u(e,[`outputAudioTranscription`]);t!==void 0&&b!=null&&l(t,[`setup`,`outputAudioTranscription`],mi(b));let x=u(e,[`realtimeInputConfig`]);t!==void 0&&x!=null&&l(t,[`setup`,`realtimeInputConfig`],x);let S=u(e,[`contextWindowCompression`]);t!==void 0&&S!=null&&l(t,[`setup`,`contextWindowCompression`],S);let C=u(e,[`proactivity`]);if(t!==void 0&&C!=null&&l(t,[`setup`,`proactivity`],C),u(e,[`explicitVadSignal`])!==void 0)throw Error(`explicitVadSignal parameter is not supported in Gemini API.`);return n}function Ei(e,t){let n={},r=u(e,[`generationConfig`]);t!==void 0&&r!=null&&l(t,[`setup`,`generationConfig`],Si(r));let i=u(e,[`responseModalities`]);t!==void 0&&i!=null&&l(t,[`setup`,`generationConfig`,`responseModalities`],i);let a=u(e,[`temperature`]);t!==void 0&&a!=null&&l(t,[`setup`,`generationConfig`,`temperature`],a);let o=u(e,[`topP`]);t!==void 0&&o!=null&&l(t,[`setup`,`generationConfig`,`topP`],o);let s=u(e,[`topK`]);t!==void 0&&s!=null&&l(t,[`setup`,`generationConfig`,`topK`],s);let c=u(e,[`maxOutputTokens`]);t!==void 0&&c!=null&&l(t,[`setup`,`generationConfig`,`maxOutputTokens`],c);let d=u(e,[`mediaResolution`]);t!==void 0&&d!=null&&l(t,[`setup`,`generationConfig`,`mediaResolution`],d);let f=u(e,[`seed`]);t!==void 0&&f!=null&&l(t,[`setup`,`generationConfig`,`seed`],f);let p=u(e,[`speechConfig`]);t!==void 0&&p!=null&&l(t,[`setup`,`generationConfig`,`speechConfig`],Bi(Xt(p)));let m=u(e,[`thinkingConfig`]);t!==void 0&&m!=null&&l(t,[`setup`,`generationConfig`,`thinkingConfig`],m);let h=u(e,[`enableAffectiveDialog`]);t!==void 0&&h!=null&&l(t,[`setup`,`generationConfig`,`enableAffectiveDialog`],h);let g=u(e,[`systemInstruction`]);t!==void 0&&g!=null&&l(t,[`setup`,`systemInstruction`],vi(P(g)));let _=u(e,[`tools`]);if(t!==void 0&&_!=null){let e=R(_);Array.isArray(e)&&(e=e.map(e=>Hi(L(e)))),l(t,[`setup`,`tools`],e)}let v=u(e,[`sessionResumption`]);t!==void 0&&v!=null&&l(t,[`setup`,`sessionResumption`],v);let y=u(e,[`inputAudioTranscription`]);t!==void 0&&y!=null&&l(t,[`setup`,`inputAudioTranscription`],y);let b=u(e,[`outputAudioTranscription`]);t!==void 0&&b!=null&&l(t,[`setup`,`outputAudioTranscription`],b);let x=u(e,[`realtimeInputConfig`]);t!==void 0&&x!=null&&l(t,[`setup`,`realtimeInputConfig`],x);let S=u(e,[`contextWindowCompression`]);t!==void 0&&S!=null&&l(t,[`setup`,`contextWindowCompression`],S);let C=u(e,[`proactivity`]);t!==void 0&&C!=null&&l(t,[`setup`,`proactivity`],C);let w=u(e,[`explicitVadSignal`]);return t!==void 0&&w!=null&&l(t,[`setup`,`explicitVadSignal`],w),n}function Di(e,t){let n={},r=u(t,[`model`]);r!=null&&l(n,[`setup`,`model`],N(e,r));let i=u(t,[`config`]);return i!=null&&l(n,[`config`],Ti(i,n)),n}function Oi(e,t){let n={},r=u(t,[`model`]);r!=null&&l(n,[`setup`,`model`],N(e,r));let i=u(t,[`config`]);return i!=null&&l(n,[`config`],Ei(i,n)),n}function ki(e){let t={},n=u(e,[`musicGenerationConfig`]);return n!=null&&l(t,[`musicGenerationConfig`],n),t}function Ai(e){let t={},n=u(e,[`weightedPrompts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`weightedPrompts`],e)}return t}function ji(e){let t={},n=u(e,[`media`]);if(n!=null){let e=Lt(n);Array.isArray(e)&&(e=e.map(e=>gi(e))),l(t,[`mediaChunks`],e)}let r=u(e,[`audio`]);r!=null&&l(t,[`audio`],gi(Bt(r)));let i=u(e,[`audioStreamEnd`]);i!=null&&l(t,[`audioStreamEnd`],i);let a=u(e,[`video`]);a!=null&&l(t,[`video`],gi(zt(a)));let o=u(e,[`text`]);o!=null&&l(t,[`text`],o);let s=u(e,[`activityStart`]);s!=null&&l(t,[`activityStart`],s);let c=u(e,[`activityEnd`]);return c!=null&&l(t,[`activityEnd`],c),t}function Mi(e){let t={},n=u(e,[`media`]);if(n!=null){let e=Lt(n);Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`mediaChunks`],e)}let r=u(e,[`audio`]);r!=null&&l(t,[`audio`],Bt(r));let i=u(e,[`audioStreamEnd`]);i!=null&&l(t,[`audioStreamEnd`],i);let a=u(e,[`video`]);a!=null&&l(t,[`video`],zt(a));let o=u(e,[`text`]);o!=null&&l(t,[`text`],o);let s=u(e,[`activityStart`]);s!=null&&l(t,[`activityStart`],s);let c=u(e,[`activityEnd`]);return c!=null&&l(t,[`activityEnd`],c),t}function Ni(e){let t={},n=u(e,[`setupComplete`]);n!=null&&l(t,[`setupComplete`],n);let r=u(e,[`serverContent`]);r!=null&&l(t,[`serverContent`],r);let i=u(e,[`toolCall`]);i!=null&&l(t,[`toolCall`],i);let a=u(e,[`toolCallCancellation`]);a!=null&&l(t,[`toolCallCancellation`],a);let o=u(e,[`usageMetadata`]);o!=null&&l(t,[`usageMetadata`],Ui(o));let s=u(e,[`goAway`]);s!=null&&l(t,[`goAway`],s);let c=u(e,[`sessionResumptionUpdate`]);c!=null&&l(t,[`sessionResumptionUpdate`],c);let d=u(e,[`voiceActivityDetectionSignal`]);d!=null&&l(t,[`voiceActivityDetectionSignal`],d);let f=u(e,[`voiceActivity`]);return f!=null&&l(t,[`voiceActivity`],Wi(f)),t}function Pi(e){let t={},n=u(e,[`speakerVoiceConfigs`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>zi(e))),l(t,[`speakerVoiceConfigs`],e)}return t}function Fi(e){let t={},n=u(e,[`mediaResolution`]);n!=null&&l(t,[`mediaResolution`],n);let r=u(e,[`codeExecutionResult`]);r!=null&&l(t,[`codeExecutionResult`],r);let i=u(e,[`executableCode`]);i!=null&&l(t,[`executableCode`],i);let a=u(e,[`fileData`]);a!=null&&l(t,[`fileData`],yi(a));let o=u(e,[`functionCall`]);o!=null&&l(t,[`functionCall`],bi(o));let s=u(e,[`functionResponse`]);s!=null&&l(t,[`functionResponse`],s);let c=u(e,[`inlineData`]);c!=null&&l(t,[`inlineData`],gi(c));let d=u(e,[`text`]);d!=null&&l(t,[`text`],d);let f=u(e,[`thought`]);f!=null&&l(t,[`thought`],f);let p=u(e,[`thoughtSignature`]);p!=null&&l(t,[`thoughtSignature`],p);let m=u(e,[`videoMetadata`]);m!=null&&l(t,[`videoMetadata`],m);let h=u(e,[`toolCall`]);h!=null&&l(t,[`toolCall`],h);let g=u(e,[`toolResponse`]);g!=null&&l(t,[`toolResponse`],g);let _=u(e,[`partMetadata`]);return _!=null&&l(t,[`partMetadata`],_),t}function Ii(e){let t={},n=u(e,[`mediaResolution`]);n!=null&&l(t,[`mediaResolution`],n);let r=u(e,[`codeExecutionResult`]);r!=null&&l(t,[`codeExecutionResult`],r);let i=u(e,[`executableCode`]);i!=null&&l(t,[`executableCode`],i);let a=u(e,[`fileData`]);a!=null&&l(t,[`fileData`],a);let o=u(e,[`functionCall`]);o!=null&&l(t,[`functionCall`],o);let s=u(e,[`functionResponse`]);s!=null&&l(t,[`functionResponse`],s);let c=u(e,[`inlineData`]);c!=null&&l(t,[`inlineData`],c);let d=u(e,[`text`]);d!=null&&l(t,[`text`],d);let f=u(e,[`thought`]);f!=null&&l(t,[`thought`],f);let p=u(e,[`thoughtSignature`]);p!=null&&l(t,[`thoughtSignature`],p);let m=u(e,[`videoMetadata`]);if(m!=null&&l(t,[`videoMetadata`],m),u(e,[`toolCall`])!==void 0)throw Error(`toolCall parameter is not supported in Vertex AI.`);if(u(e,[`toolResponse`])!==void 0)throw Error(`toolResponse parameter is not supported in Vertex AI.`);if(u(e,[`partMetadata`])!==void 0)throw Error(`partMetadata parameter is not supported in Vertex AI.`);return t}function Li(e){let t={},n=u(e,[`mimeType`]);n!=null&&l(t,[`mimeType`],n);let r=u(e,[`voiceSampleAudio`]);return r!=null&&l(t,[`voiceSampleAudio`],r),t}function Ri(e){let t={},n=u(e,[`handle`]);if(n!=null&&l(t,[`handle`],n),u(e,[`transparent`])!==void 0)throw Error(`transparent parameter is not supported in Gemini API.`);return t}function zi(e){let t={},n=u(e,[`speaker`]);n!=null&&l(t,[`speaker`],n);let r=u(e,[`voiceConfig`]);return r!=null&&l(t,[`voiceConfig`],Gi(r)),t}function Bi(e){let t={},n=u(e,[`voiceConfig`]);n!=null&&l(t,[`voiceConfig`],Gi(n));let r=u(e,[`languageCode`]);r!=null&&l(t,[`languageCode`],r);let i=u(e,[`multiSpeakerVoiceConfig`]);return i!=null&&l(t,[`multiSpeakerVoiceConfig`],Pi(i)),t}function Vi(e){let t={};if(u(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let n=u(e,[`computerUse`]);n!=null&&l(t,[`computerUse`],n);let r=u(e,[`fileSearch`]);r!=null&&l(t,[`fileSearch`],r);let i=u(e,[`googleSearch`]);i!=null&&l(t,[`googleSearch`],wi(i));let a=u(e,[`googleMaps`]);a!=null&&l(t,[`googleMaps`],Ci(a));let o=u(e,[`codeExecution`]);if(o!=null&&l(t,[`codeExecution`],o),u(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let s=u(e,[`functionDeclarations`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`functionDeclarations`],e)}let c=u(e,[`googleSearchRetrieval`]);if(c!=null&&l(t,[`googleSearchRetrieval`],c),u(e,[`parallelAiSearch`])!==void 0)throw Error(`parallelAiSearch parameter is not supported in Gemini API.`);let d=u(e,[`urlContext`]);d!=null&&l(t,[`urlContext`],d);let f=u(e,[`mcpServers`]);if(f!=null){let e=f;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`mcpServers`],e)}return t}function Hi(e){let t={},n=u(e,[`retrieval`]);n!=null&&l(t,[`retrieval`],n);let r=u(e,[`computerUse`]);if(r!=null&&l(t,[`computerUse`],r),u(e,[`fileSearch`])!==void 0)throw Error(`fileSearch parameter is not supported in Vertex AI.`);let i=u(e,[`googleSearch`]);i!=null&&l(t,[`googleSearch`],i);let a=u(e,[`googleMaps`]);a!=null&&l(t,[`googleMaps`],a);let o=u(e,[`codeExecution`]);o!=null&&l(t,[`codeExecution`],o);let s=u(e,[`enterpriseWebSearch`]);s!=null&&l(t,[`enterpriseWebSearch`],s);let c=u(e,[`functionDeclarations`]);if(c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>xi(e))),l(t,[`functionDeclarations`],e)}let d=u(e,[`googleSearchRetrieval`]);d!=null&&l(t,[`googleSearchRetrieval`],d);let f=u(e,[`parallelAiSearch`]);f!=null&&l(t,[`parallelAiSearch`],f);let p=u(e,[`urlContext`]);if(p!=null&&l(t,[`urlContext`],p),u(e,[`mcpServers`])!==void 0)throw Error(`mcpServers parameter is not supported in Vertex AI.`);return t}function Ui(e){let t={},n=u(e,[`promptTokenCount`]);n!=null&&l(t,[`promptTokenCount`],n);let r=u(e,[`cachedContentTokenCount`]);r!=null&&l(t,[`cachedContentTokenCount`],r);let i=u(e,[`candidatesTokenCount`]);i!=null&&l(t,[`responseTokenCount`],i);let a=u(e,[`toolUsePromptTokenCount`]);a!=null&&l(t,[`toolUsePromptTokenCount`],a);let o=u(e,[`thoughtsTokenCount`]);o!=null&&l(t,[`thoughtsTokenCount`],o);let s=u(e,[`totalTokenCount`]);s!=null&&l(t,[`totalTokenCount`],s);let c=u(e,[`promptTokensDetails`]);if(c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`promptTokensDetails`],e)}let d=u(e,[`cacheTokensDetails`]);if(d!=null){let e=d;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`cacheTokensDetails`],e)}let f=u(e,[`candidatesTokensDetails`]);if(f!=null){let e=f;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`responseTokensDetails`],e)}let p=u(e,[`toolUsePromptTokensDetails`]);if(p!=null){let e=p;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`toolUsePromptTokensDetails`],e)}let m=u(e,[`trafficType`]);return m!=null&&l(t,[`trafficType`],m),t}function Wi(e){let t={},n=u(e,[`type`]);return n!=null&&l(t,[`voiceActivityType`],n),t}function Gi(e){let t={},n=u(e,[`replicatedVoiceConfig`]);n!=null&&l(t,[`replicatedVoiceConfig`],Li(n));let r=u(e,[`prebuiltVoiceConfig`]);return r!=null&&l(t,[`prebuiltVoiceConfig`],r),t}function Ki(e,t){let n={},r=u(e,[`apiKey`]);if(r!=null&&l(n,[`apiKey`],r),u(e,[`apiKeyConfig`])!==void 0)throw Error(`apiKeyConfig parameter is not supported in Gemini API.`);if(u(e,[`authType`])!==void 0)throw Error(`authType parameter is not supported in Gemini API.`);if(u(e,[`googleServiceAccountConfig`])!==void 0)throw Error(`googleServiceAccountConfig parameter is not supported in Gemini API.`);if(u(e,[`httpBasicAuthConfig`])!==void 0)throw Error(`httpBasicAuthConfig parameter is not supported in Gemini API.`);if(u(e,[`oauthConfig`])!==void 0)throw Error(`oauthConfig parameter is not supported in Gemini API.`);if(u(e,[`oidcConfig`])!==void 0)throw Error(`oidcConfig parameter is not supported in Gemini API.`);return n}function qi(e,t){let n={},r=u(e,[`data`]);if(r!=null&&l(n,[`data`],r),u(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let i=u(e,[`mimeType`]);return i!=null&&l(n,[`mimeType`],i),n}function Ji(e,t){let n={},r=u(e,[`content`]);r!=null&&l(n,[`content`],r);let i=u(e,[`citationMetadata`]);i!=null&&l(n,[`citationMetadata`],Yi(i));let a=u(e,[`tokenCount`]);a!=null&&l(n,[`tokenCount`],a);let o=u(e,[`finishReason`]);o!=null&&l(n,[`finishReason`],o);let s=u(e,[`groundingMetadata`]);s!=null&&l(n,[`groundingMetadata`],s);let c=u(e,[`avgLogprobs`]);c!=null&&l(n,[`avgLogprobs`],c);let d=u(e,[`index`]);d!=null&&l(n,[`index`],d);let f=u(e,[`logprobsResult`]);f!=null&&l(n,[`logprobsResult`],f);let p=u(e,[`safetyRatings`]);if(p!=null){let e=p;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`safetyRatings`],e)}let m=u(e,[`urlContextMetadata`]);return m!=null&&l(n,[`urlContextMetadata`],m),n}function Yi(e,t){let n={},r=u(e,[`citationSources`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`citations`],e)}return n}function Xi(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>q(e))),l(r,[`contents`],e)}return r}function Zi(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`tokensInfo`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`tokensInfo`],e)}return n}function Qi(e,t){let n={},r=u(e,[`values`]);r!=null&&l(n,[`values`],r);let i=u(e,[`statistics`]);return i!=null&&l(n,[`statistics`],$i(i)),n}function $i(e,t){let n={},r=u(e,[`truncated`]);r!=null&&l(n,[`truncated`],r);let i=u(e,[`token_count`]);return i!=null&&l(n,[`tokenCount`],i),n}function ea(e,t){let n={},r=u(e,[`parts`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>bo(e))),l(n,[`parts`],e)}let i=u(e,[`role`]);return i!=null&&l(n,[`role`],i),n}function q(e,t){let n={},r=u(e,[`parts`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>xo(e))),l(n,[`parts`],e)}let i=u(e,[`role`]);return i!=null&&l(n,[`role`],i),n}function ta(e,t){let n={},r=u(e,[`controlType`]);r!=null&&l(n,[`controlType`],r);let i=u(e,[`enableControlImageComputation`]);return i!=null&&l(n,[`computeControl`],i),n}function na(e,t){let n={};if(u(e,[`systemInstruction`])!==void 0)throw Error(`systemInstruction parameter is not supported in Gemini API.`);if(u(e,[`tools`])!==void 0)throw Error(`tools parameter is not supported in Gemini API.`);if(u(e,[`generationConfig`])!==void 0)throw Error(`generationConfig parameter is not supported in Gemini API.`);return n}function ra(e,t,n){let r={},i=u(e,[`systemInstruction`]);t!==void 0&&i!=null&&l(t,[`systemInstruction`],q(P(i)));let a=u(e,[`tools`]);if(t!==void 0&&a!=null){let e=a;Array.isArray(e)&&(e=e.map(e=>Ho(e))),l(t,[`tools`],e)}let o=u(e,[`generationConfig`]);return t!==void 0&&o!=null&&l(t,[`generationConfig`],$a(o)),r}function ia(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>ea(e))),l(r,[`contents`],e)}let o=u(t,[`config`]);return o!=null&&na(o),r}function aa(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>q(e))),l(r,[`contents`],e)}let o=u(t,[`config`]);return o!=null&&ra(o,r),r}function oa(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`totalTokens`]);i!=null&&l(n,[`totalTokens`],i);let a=u(e,[`cachedContentTokenCount`]);return a!=null&&l(n,[`cachedContentTokenCount`],a),n}function sa(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`totalTokens`]);return i!=null&&l(n,[`totalTokens`],i),n}function ca(e,t,n){let r={},i=u(t,[`model`]);return i!=null&&l(r,[`_url`,`name`],N(e,i)),r}function la(e,t,n){let r={},i=u(t,[`model`]);return i!=null&&l(r,[`_url`,`name`],N(e,i)),r}function ua(e,t){let n={},r=u(e,[`sdkHttpResponse`]);return r!=null&&l(n,[`sdkHttpResponse`],r),n}function da(e,t){let n={},r=u(e,[`sdkHttpResponse`]);return r!=null&&l(n,[`sdkHttpResponse`],r),n}function fa(e,t,n){let r={},i=u(e,[`outputGcsUri`]);t!==void 0&&i!=null&&l(t,[`parameters`,`storageUri`],i);let a=u(e,[`negativePrompt`]);t!==void 0&&a!=null&&l(t,[`parameters`,`negativePrompt`],a);let o=u(e,[`numberOfImages`]);t!==void 0&&o!=null&&l(t,[`parameters`,`sampleCount`],o);let s=u(e,[`aspectRatio`]);t!==void 0&&s!=null&&l(t,[`parameters`,`aspectRatio`],s);let c=u(e,[`guidanceScale`]);t!==void 0&&c!=null&&l(t,[`parameters`,`guidanceScale`],c);let d=u(e,[`seed`]);t!==void 0&&d!=null&&l(t,[`parameters`,`seed`],d);let f=u(e,[`safetyFilterLevel`]);t!==void 0&&f!=null&&l(t,[`parameters`,`safetySetting`],f);let p=u(e,[`personGeneration`]);t!==void 0&&p!=null&&l(t,[`parameters`,`personGeneration`],p);let m=u(e,[`includeSafetyAttributes`]);t!==void 0&&m!=null&&l(t,[`parameters`,`includeSafetyAttributes`],m);let h=u(e,[`includeRaiReason`]);t!==void 0&&h!=null&&l(t,[`parameters`,`includeRaiReason`],h);let g=u(e,[`language`]);t!==void 0&&g!=null&&l(t,[`parameters`,`language`],g);let _=u(e,[`outputMimeType`]);t!==void 0&&_!=null&&l(t,[`parameters`,`outputOptions`,`mimeType`],_);let v=u(e,[`outputCompressionQuality`]);t!==void 0&&v!=null&&l(t,[`parameters`,`outputOptions`,`compressionQuality`],v);let y=u(e,[`addWatermark`]);t!==void 0&&y!=null&&l(t,[`parameters`,`addWatermark`],y);let b=u(e,[`labels`]);t!==void 0&&b!=null&&l(t,[`labels`],b);let x=u(e,[`editMode`]);t!==void 0&&x!=null&&l(t,[`parameters`,`editMode`],x);let S=u(e,[`baseSteps`]);return t!==void 0&&S!=null&&l(t,[`parameters`,`editConfig`,`baseSteps`],S),r}function pa(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`prompt`]);a!=null&&l(r,[`instances[0]`,`prompt`],a);let o=u(t,[`referenceImages`]);if(o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>Do(e))),l(r,[`instances[0]`,`referenceImages`],e)}let s=u(t,[`config`]);return s!=null&&fa(s,r),r}function ma(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Ya(e))),l(n,[`generatedImages`],e)}return n}function ha(e,t,n){let r={},i=u(e,[`taskType`]);t!==void 0&&i!=null&&l(t,[`requests[]`,`taskType`],i);let a=u(e,[`title`]);t!==void 0&&a!=null&&l(t,[`requests[]`,`title`],a);let o=u(e,[`outputDimensionality`]);if(t!==void 0&&o!=null&&l(t,[`requests[]`,`outputDimensionality`],o),u(e,[`mimeType`])!==void 0)throw Error(`mimeType parameter is not supported in Gemini API.`);if(u(e,[`autoTruncate`])!==void 0)throw Error(`autoTruncate parameter is not supported in Gemini API.`);return r}function ga(e,t,n){let r={},i=u(n,[`embeddingApiType`]);if(i===void 0&&(i=`PREDICT`),i===`PREDICT`){let n=u(e,[`taskType`]);t!==void 0&&n!=null&&l(t,[`instances[]`,`task_type`],n)}else if(i===`EMBED_CONTENT`){let n=u(e,[`taskType`]);t!==void 0&&n!=null&&l(t,[`taskType`],n)}let a=u(n,[`embeddingApiType`]);if(a===void 0&&(a=`PREDICT`),a===`PREDICT`){let n=u(e,[`title`]);t!==void 0&&n!=null&&l(t,[`instances[]`,`title`],n)}else if(a===`EMBED_CONTENT`){let n=u(e,[`title`]);t!==void 0&&n!=null&&l(t,[`title`],n)}let o=u(n,[`embeddingApiType`]);if(o===void 0&&(o=`PREDICT`),o===`PREDICT`){let n=u(e,[`outputDimensionality`]);t!==void 0&&n!=null&&l(t,[`parameters`,`outputDimensionality`],n)}else if(o===`EMBED_CONTENT`){let n=u(e,[`outputDimensionality`]);t!==void 0&&n!=null&&l(t,[`outputDimensionality`],n)}let s=u(n,[`embeddingApiType`]);if(s===void 0&&(s=`PREDICT`),s===`PREDICT`){let n=u(e,[`mimeType`]);t!==void 0&&n!=null&&l(t,[`instances[]`,`mimeType`],n)}let c=u(n,[`embeddingApiType`]);if(c===void 0&&(c=`PREDICT`),c===`PREDICT`){let n=u(e,[`autoTruncate`]);t!==void 0&&n!=null&&l(t,[`parameters`,`autoTruncate`],n)}else if(c===`EMBED_CONTENT`){let n=u(e,[`autoTruncate`]);t!==void 0&&n!=null&&l(t,[`autoTruncate`],n)}return r}function _a(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`contents`]);if(a!=null){let t=Kt(e,a);Array.isArray(t)&&(t=t.map(e=>e)),l(r,[`requests[]`,`content`],t)}let o=u(t,[`content`]);o!=null&&ea(P(o));let s=u(t,[`config`]);s!=null&&ha(s,r);let c=u(t,[`model`]);return c!==void 0&&l(r,[`requests[]`,`model`],N(e,c)),r}function va(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(n,[`embeddingApiType`]);if(a===void 0&&(a=`PREDICT`),a===`PREDICT`){let n=u(t,[`contents`]);if(n!=null){let t=Kt(e,n);Array.isArray(t)&&(t=t.map(e=>e)),l(r,[`instances[]`,`content`],t)}}let o=u(n,[`embeddingApiType`]);if(o===void 0&&(o=`PREDICT`),o===`EMBED_CONTENT`){let e=u(t,[`content`]);e!=null&&l(r,[`content`],q(P(e)))}let s=u(t,[`config`]);return s!=null&&ga(s,r,n),r}function ya(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`embeddings`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`embeddings`],e)}let a=u(e,[`metadata`]);return a!=null&&l(n,[`metadata`],a),n}function ba(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`predictions[]`,`embeddings`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Qi(e))),l(n,[`embeddings`],e)}let a=u(e,[`metadata`]);if(a!=null&&l(n,[`metadata`],a),t&&u(t,[`embeddingApiType`])===`EMBED_CONTENT`){let t=u(e,[`embedding`]),r=u(e,[`usageMetadata`]),i=u(e,[`truncated`]);if(t){let e={};r&&r.promptTokenCount&&(e.tokenCount=r.promptTokenCount),i&&(e.truncated=i),t.statistics=e,l(n,[`embeddings`],[t])}}return n}function xa(e,t){let n={},r=u(e,[`endpoint`]);r!=null&&l(n,[`name`],r);let i=u(e,[`deployedModelId`]);return i!=null&&l(n,[`deployedModelId`],i),n}function Sa(e,t){let n={};if(u(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=u(e,[`fileUri`]);r!=null&&l(n,[`fileUri`],r);let i=u(e,[`mimeType`]);return i!=null&&l(n,[`mimeType`],i),n}function Ca(e,t){let n={},r=u(e,[`id`]);r!=null&&l(n,[`id`],r);let i=u(e,[`args`]);i!=null&&l(n,[`args`],i);let a=u(e,[`name`]);if(a!=null&&l(n,[`name`],a),u(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(u(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return n}function wa(e,t){let n={},r=u(e,[`allowedFunctionNames`]);r!=null&&l(n,[`allowedFunctionNames`],r);let i=u(e,[`mode`]);if(i!=null&&l(n,[`mode`],i),u(e,[`streamFunctionCallArguments`])!==void 0)throw Error(`streamFunctionCallArguments parameter is not supported in Gemini API.`);return n}function Ta(e,t){let n={},r=u(e,[`description`]);r!=null&&l(n,[`description`],r);let i=u(e,[`name`]);i!=null&&l(n,[`name`],i);let a=u(e,[`parameters`]);a!=null&&l(n,[`parameters`],a);let o=u(e,[`parametersJsonSchema`]);o!=null&&l(n,[`parametersJsonSchema`],o);let s=u(e,[`response`]);s!=null&&l(n,[`response`],s);let c=u(e,[`responseJsonSchema`]);if(c!=null&&l(n,[`responseJsonSchema`],c),u(e,[`behavior`])!==void 0)throw Error(`behavior parameter is not supported in Vertex AI.`);return n}function Ea(e,t,n,r){let i={},a=u(t,[`systemInstruction`]);n!==void 0&&a!=null&&l(n,[`systemInstruction`],ea(P(a)));let o=u(t,[`temperature`]);o!=null&&l(i,[`temperature`],o);let s=u(t,[`topP`]);s!=null&&l(i,[`topP`],s);let c=u(t,[`topK`]);c!=null&&l(i,[`topK`],c);let d=u(t,[`candidateCount`]);d!=null&&l(i,[`candidateCount`],d);let f=u(t,[`maxOutputTokens`]);f!=null&&l(i,[`maxOutputTokens`],f);let p=u(t,[`stopSequences`]);p!=null&&l(i,[`stopSequences`],p);let m=u(t,[`responseLogprobs`]);m!=null&&l(i,[`responseLogprobs`],m);let h=u(t,[`logprobs`]);h!=null&&l(i,[`logprobs`],h);let g=u(t,[`presencePenalty`]);g!=null&&l(i,[`presencePenalty`],g);let _=u(t,[`frequencyPenalty`]);_!=null&&l(i,[`frequencyPenalty`],_);let v=u(t,[`seed`]);v!=null&&l(i,[`seed`],v);let y=u(t,[`responseMimeType`]);y!=null&&l(i,[`responseMimeType`],y);let b=u(t,[`responseSchema`]);b!=null&&l(i,[`responseSchema`],Jt(b));let x=u(t,[`responseJsonSchema`]);if(x!=null&&l(i,[`responseJsonSchema`],x),u(t,[`routingConfig`])!==void 0)throw Error(`routingConfig parameter is not supported in Gemini API.`);if(u(t,[`modelSelectionConfig`])!==void 0)throw Error(`modelSelectionConfig parameter is not supported in Gemini API.`);let S=u(t,[`safetySettings`]);if(n!==void 0&&S!=null){let e=S;Array.isArray(e)&&(e=e.map(e=>jo(e))),l(n,[`safetySettings`],e)}let C=u(t,[`tools`]);if(n!==void 0&&C!=null){let e=R(C);Array.isArray(e)&&(e=e.map(e=>Vo(L(e)))),l(n,[`tools`],e)}let w=u(t,[`toolConfig`]);if(n!==void 0&&w!=null&&l(n,[`toolConfig`],zo(w)),u(t,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);let T=u(t,[`cachedContent`]);n!==void 0&&T!=null&&l(n,[`cachedContent`],z(e,T));let E=u(t,[`responseModalities`]);E!=null&&l(i,[`responseModalities`],E);let D=u(t,[`mediaResolution`]);D!=null&&l(i,[`mediaResolution`],D);let O=u(t,[`speechConfig`]);if(O!=null&&l(i,[`speechConfig`],Yt(O)),u(t,[`audioTimestamp`])!==void 0)throw Error(`audioTimestamp parameter is not supported in Gemini API.`);let k=u(t,[`thinkingConfig`]);k!=null&&l(i,[`thinkingConfig`],k);let A=u(t,[`imageConfig`]);A!=null&&l(i,[`imageConfig`],io(A));let j=u(t,[`enableEnhancedCivicAnswers`]);if(j!=null&&l(i,[`enableEnhancedCivicAnswers`],j),u(t,[`modelArmorConfig`])!==void 0)throw Error(`modelArmorConfig parameter is not supported in Gemini API.`);let M=u(t,[`serviceTier`]);return n!==void 0&&M!=null&&l(n,[`serviceTier`],M),i}function Da(e,t,n,r){let i={},a=u(t,[`systemInstruction`]);n!==void 0&&a!=null&&l(n,[`systemInstruction`],q(P(a)));let o=u(t,[`temperature`]);o!=null&&l(i,[`temperature`],o);let s=u(t,[`topP`]);s!=null&&l(i,[`topP`],s);let c=u(t,[`topK`]);c!=null&&l(i,[`topK`],c);let d=u(t,[`candidateCount`]);d!=null&&l(i,[`candidateCount`],d);let f=u(t,[`maxOutputTokens`]);f!=null&&l(i,[`maxOutputTokens`],f);let p=u(t,[`stopSequences`]);p!=null&&l(i,[`stopSequences`],p);let m=u(t,[`responseLogprobs`]);m!=null&&l(i,[`responseLogprobs`],m);let h=u(t,[`logprobs`]);h!=null&&l(i,[`logprobs`],h);let g=u(t,[`presencePenalty`]);g!=null&&l(i,[`presencePenalty`],g);let _=u(t,[`frequencyPenalty`]);_!=null&&l(i,[`frequencyPenalty`],_);let v=u(t,[`seed`]);v!=null&&l(i,[`seed`],v);let y=u(t,[`responseMimeType`]);y!=null&&l(i,[`responseMimeType`],y);let b=u(t,[`responseSchema`]);b!=null&&l(i,[`responseSchema`],Jt(b));let x=u(t,[`responseJsonSchema`]);x!=null&&l(i,[`responseJsonSchema`],x);let S=u(t,[`routingConfig`]);S!=null&&l(i,[`routingConfig`],S);let C=u(t,[`modelSelectionConfig`]);C!=null&&l(i,[`modelConfig`],C);let w=u(t,[`safetySettings`]);if(n!==void 0&&w!=null){let e=w;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`safetySettings`],e)}let T=u(t,[`tools`]);if(n!==void 0&&T!=null){let e=R(T);Array.isArray(e)&&(e=e.map(e=>Ho(L(e)))),l(n,[`tools`],e)}let E=u(t,[`toolConfig`]);n!==void 0&&E!=null&&l(n,[`toolConfig`],Bo(E));let D=u(t,[`labels`]);n!==void 0&&D!=null&&l(n,[`labels`],D);let O=u(t,[`cachedContent`]);n!==void 0&&O!=null&&l(n,[`cachedContent`],z(e,O));let k=u(t,[`responseModalities`]);k!=null&&l(i,[`responseModalities`],k);let A=u(t,[`mediaResolution`]);A!=null&&l(i,[`mediaResolution`],A);let j=u(t,[`speechConfig`]);j!=null&&l(i,[`speechConfig`],Ro(Yt(j)));let M=u(t,[`audioTimestamp`]);M!=null&&l(i,[`audioTimestamp`],M);let ee=u(t,[`thinkingConfig`]);ee!=null&&l(i,[`thinkingConfig`],ee);let te=u(t,[`imageConfig`]);if(te!=null&&l(i,[`imageConfig`],ao(te)),u(t,[`enableEnhancedCivicAnswers`])!==void 0)throw Error(`enableEnhancedCivicAnswers parameter is not supported in Vertex AI.`);let ne=u(t,[`modelArmorConfig`]);n!==void 0&&ne!=null&&l(n,[`modelArmorConfig`],ne);let re=u(t,[`serviceTier`]);return n!==void 0&&re!=null&&l(n,[`serviceTier`],re),i}function Oa(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>ea(e))),l(r,[`contents`],e)}let o=u(t,[`config`]);return o!=null&&l(r,[`generationConfig`],Ea(e,o,r)),r}function ka(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`contents`]);if(a!=null){let e=F(a);Array.isArray(e)&&(e=e.map(e=>q(e))),l(r,[`contents`],e)}let o=u(t,[`config`]);return o!=null&&l(r,[`generationConfig`],Da(e,o,r)),r}function Aa(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`candidates`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Ji(e))),l(n,[`candidates`],e)}let a=u(e,[`modelVersion`]);a!=null&&l(n,[`modelVersion`],a);let o=u(e,[`promptFeedback`]);o!=null&&l(n,[`promptFeedback`],o);let s=u(e,[`responseId`]);s!=null&&l(n,[`responseId`],s);let c=u(e,[`usageMetadata`]);c!=null&&l(n,[`usageMetadata`],c);let d=u(e,[`modelStatus`]);return d!=null&&l(n,[`modelStatus`],d),n}function ja(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`candidates`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`candidates`],e)}let a=u(e,[`createTime`]);a!=null&&l(n,[`createTime`],a);let o=u(e,[`modelVersion`]);o!=null&&l(n,[`modelVersion`],o);let s=u(e,[`promptFeedback`]);s!=null&&l(n,[`promptFeedback`],s);let c=u(e,[`responseId`]);c!=null&&l(n,[`responseId`],c);let d=u(e,[`usageMetadata`]);return d!=null&&l(n,[`usageMetadata`],d),n}function Ma(e,t,n){let r={};if(u(e,[`outputGcsUri`])!==void 0)throw Error(`outputGcsUri parameter is not supported in Gemini API.`);if(u(e,[`negativePrompt`])!==void 0)throw Error(`negativePrompt parameter is not supported in Gemini API.`);let i=u(e,[`numberOfImages`]);t!==void 0&&i!=null&&l(t,[`parameters`,`sampleCount`],i);let a=u(e,[`aspectRatio`]);t!==void 0&&a!=null&&l(t,[`parameters`,`aspectRatio`],a);let o=u(e,[`guidanceScale`]);if(t!==void 0&&o!=null&&l(t,[`parameters`,`guidanceScale`],o),u(e,[`seed`])!==void 0)throw Error(`seed parameter is not supported in Gemini API.`);let s=u(e,[`safetyFilterLevel`]);t!==void 0&&s!=null&&l(t,[`parameters`,`safetySetting`],s);let c=u(e,[`personGeneration`]);t!==void 0&&c!=null&&l(t,[`parameters`,`personGeneration`],c);let d=u(e,[`includeSafetyAttributes`]);t!==void 0&&d!=null&&l(t,[`parameters`,`includeSafetyAttributes`],d);let f=u(e,[`includeRaiReason`]);t!==void 0&&f!=null&&l(t,[`parameters`,`includeRaiReason`],f);let p=u(e,[`language`]);t!==void 0&&p!=null&&l(t,[`parameters`,`language`],p);let m=u(e,[`outputMimeType`]);t!==void 0&&m!=null&&l(t,[`parameters`,`outputOptions`,`mimeType`],m);let h=u(e,[`outputCompressionQuality`]);if(t!==void 0&&h!=null&&l(t,[`parameters`,`outputOptions`,`compressionQuality`],h),u(e,[`addWatermark`])!==void 0)throw Error(`addWatermark parameter is not supported in Gemini API.`);if(u(e,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);let g=u(e,[`imageSize`]);if(t!==void 0&&g!=null&&l(t,[`parameters`,`sampleImageSize`],g),u(e,[`enhancePrompt`])!==void 0)throw Error(`enhancePrompt parameter is not supported in Gemini API.`);return r}function Na(e,t,n){let r={},i=u(e,[`outputGcsUri`]);t!==void 0&&i!=null&&l(t,[`parameters`,`storageUri`],i);let a=u(e,[`negativePrompt`]);t!==void 0&&a!=null&&l(t,[`parameters`,`negativePrompt`],a);let o=u(e,[`numberOfImages`]);t!==void 0&&o!=null&&l(t,[`parameters`,`sampleCount`],o);let s=u(e,[`aspectRatio`]);t!==void 0&&s!=null&&l(t,[`parameters`,`aspectRatio`],s);let c=u(e,[`guidanceScale`]);t!==void 0&&c!=null&&l(t,[`parameters`,`guidanceScale`],c);let d=u(e,[`seed`]);t!==void 0&&d!=null&&l(t,[`parameters`,`seed`],d);let f=u(e,[`safetyFilterLevel`]);t!==void 0&&f!=null&&l(t,[`parameters`,`safetySetting`],f);let p=u(e,[`personGeneration`]);t!==void 0&&p!=null&&l(t,[`parameters`,`personGeneration`],p);let m=u(e,[`includeSafetyAttributes`]);t!==void 0&&m!=null&&l(t,[`parameters`,`includeSafetyAttributes`],m);let h=u(e,[`includeRaiReason`]);t!==void 0&&h!=null&&l(t,[`parameters`,`includeRaiReason`],h);let g=u(e,[`language`]);t!==void 0&&g!=null&&l(t,[`parameters`,`language`],g);let _=u(e,[`outputMimeType`]);t!==void 0&&_!=null&&l(t,[`parameters`,`outputOptions`,`mimeType`],_);let v=u(e,[`outputCompressionQuality`]);t!==void 0&&v!=null&&l(t,[`parameters`,`outputOptions`,`compressionQuality`],v);let y=u(e,[`addWatermark`]);t!==void 0&&y!=null&&l(t,[`parameters`,`addWatermark`],y);let b=u(e,[`labels`]);t!==void 0&&b!=null&&l(t,[`labels`],b);let x=u(e,[`imageSize`]);t!==void 0&&x!=null&&l(t,[`parameters`,`sampleImageSize`],x);let S=u(e,[`enhancePrompt`]);return t!==void 0&&S!=null&&l(t,[`parameters`,`enhancePrompt`],S),r}function Pa(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`prompt`]);a!=null&&l(r,[`instances[0]`,`prompt`],a);let o=u(t,[`config`]);return o!=null&&Ma(o,r),r}function Fa(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`prompt`]);a!=null&&l(r,[`instances[0]`,`prompt`],a);let o=u(t,[`config`]);return o!=null&&Na(o,r),r}function Ia(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Ja(e))),l(n,[`generatedImages`],e)}let a=u(e,[`positivePromptSafetyAttributes`]);return a!=null&&l(n,[`positivePromptSafetyAttributes`],ko(a)),n}function La(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Ya(e))),l(n,[`generatedImages`],e)}let a=u(e,[`positivePromptSafetyAttributes`]);return a!=null&&l(n,[`positivePromptSafetyAttributes`],Ao(a)),n}function Ra(e,t,n){let r={},i=u(e,[`numberOfVideos`]);if(t!==void 0&&i!=null&&l(t,[`parameters`,`sampleCount`],i),u(e,[`outputGcsUri`])!==void 0)throw Error(`outputGcsUri parameter is not supported in Gemini API.`);if(u(e,[`fps`])!==void 0)throw Error(`fps parameter is not supported in Gemini API.`);let a=u(e,[`durationSeconds`]);if(t!==void 0&&a!=null&&l(t,[`parameters`,`durationSeconds`],a),u(e,[`seed`])!==void 0)throw Error(`seed parameter is not supported in Gemini API.`);let o=u(e,[`aspectRatio`]);t!==void 0&&o!=null&&l(t,[`parameters`,`aspectRatio`],o);let s=u(e,[`resolution`]);t!==void 0&&s!=null&&l(t,[`parameters`,`resolution`],s);let c=u(e,[`personGeneration`]);if(t!==void 0&&c!=null&&l(t,[`parameters`,`personGeneration`],c),u(e,[`pubsubTopic`])!==void 0)throw Error(`pubsubTopic parameter is not supported in Gemini API.`);let d=u(e,[`negativePrompt`]);t!==void 0&&d!=null&&l(t,[`parameters`,`negativePrompt`],d);let f=u(e,[`enhancePrompt`]);if(t!==void 0&&f!=null&&l(t,[`parameters`,`enhancePrompt`],f),u(e,[`generateAudio`])!==void 0)throw Error(`generateAudio parameter is not supported in Gemini API.`);let p=u(e,[`lastFrame`]);t!==void 0&&p!=null&&l(t,[`instances[0]`,`lastFrame`],co(p));let m=u(e,[`referenceImages`]);if(t!==void 0&&m!=null){let e=m;Array.isArray(e)&&(e=e.map(e=>ts(e))),l(t,[`instances[0]`,`referenceImages`],e)}if(u(e,[`mask`])!==void 0)throw Error(`mask parameter is not supported in Gemini API.`);if(u(e,[`compressionQuality`])!==void 0)throw Error(`compressionQuality parameter is not supported in Gemini API.`);if(u(e,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);return r}function za(e,t,n){let r={},i=u(e,[`numberOfVideos`]);t!==void 0&&i!=null&&l(t,[`parameters`,`sampleCount`],i);let a=u(e,[`outputGcsUri`]);t!==void 0&&a!=null&&l(t,[`parameters`,`storageUri`],a);let o=u(e,[`fps`]);t!==void 0&&o!=null&&l(t,[`parameters`,`fps`],o);let s=u(e,[`durationSeconds`]);t!==void 0&&s!=null&&l(t,[`parameters`,`durationSeconds`],s);let c=u(e,[`seed`]);t!==void 0&&c!=null&&l(t,[`parameters`,`seed`],c);let d=u(e,[`aspectRatio`]);t!==void 0&&d!=null&&l(t,[`parameters`,`aspectRatio`],d);let f=u(e,[`resolution`]);t!==void 0&&f!=null&&l(t,[`parameters`,`resolution`],f);let p=u(e,[`personGeneration`]);t!==void 0&&p!=null&&l(t,[`parameters`,`personGeneration`],p);let m=u(e,[`pubsubTopic`]);t!==void 0&&m!=null&&l(t,[`parameters`,`pubsubTopic`],m);let h=u(e,[`negativePrompt`]);t!==void 0&&h!=null&&l(t,[`parameters`,`negativePrompt`],h);let g=u(e,[`enhancePrompt`]);t!==void 0&&g!=null&&l(t,[`parameters`,`enhancePrompt`],g);let _=u(e,[`generateAudio`]);t!==void 0&&_!=null&&l(t,[`parameters`,`generateAudio`],_);let v=u(e,[`lastFrame`]);t!==void 0&&v!=null&&l(t,[`instances[0]`,`lastFrame`],J(v));let y=u(e,[`referenceImages`]);if(t!==void 0&&y!=null){let e=y;Array.isArray(e)&&(e=e.map(e=>ns(e))),l(t,[`instances[0]`,`referenceImages`],e)}let b=u(e,[`mask`]);t!==void 0&&b!=null&&l(t,[`instances[0]`,`mask`],es(b));let x=u(e,[`compressionQuality`]);t!==void 0&&x!=null&&l(t,[`parameters`,`compressionQuality`],x);let S=u(e,[`labels`]);return t!==void 0&&S!=null&&l(t,[`labels`],S),r}function Ba(e,t){let n={},r=u(e,[`name`]);r!=null&&l(n,[`name`],r);let i=u(e,[`metadata`]);i!=null&&l(n,[`metadata`],i);let a=u(e,[`done`]);a!=null&&l(n,[`done`],a);let o=u(e,[`error`]);o!=null&&l(n,[`error`],o);let s=u(e,[`response`,`generateVideoResponse`]);return s!=null&&l(n,[`response`],Wa(s)),n}function Va(e,t){let n={},r=u(e,[`name`]);r!=null&&l(n,[`name`],r);let i=u(e,[`metadata`]);i!=null&&l(n,[`metadata`],i);let a=u(e,[`done`]);a!=null&&l(n,[`done`],a);let o=u(e,[`error`]);o!=null&&l(n,[`error`],o);let s=u(e,[`response`]);return s!=null&&l(n,[`response`],Ga(s)),n}function Ha(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`prompt`]);a!=null&&l(r,[`instances[0]`,`prompt`],a);let o=u(t,[`image`]);o!=null&&l(r,[`instances[0]`,`image`],co(o));let s=u(t,[`video`]);s!=null&&l(r,[`instances[0]`,`video`],rs(s));let c=u(t,[`source`]);c!=null&&Ka(c,r);let d=u(t,[`config`]);return d!=null&&Ra(d,r),r}function Ua(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`prompt`]);a!=null&&l(r,[`instances[0]`,`prompt`],a);let o=u(t,[`image`]);o!=null&&l(r,[`instances[0]`,`image`],J(o));let s=u(t,[`video`]);s!=null&&l(r,[`instances[0]`,`video`],is(s));let c=u(t,[`source`]);c!=null&&qa(c,r);let d=u(t,[`config`]);return d!=null&&za(d,r),r}function Wa(e,t){let n={},r=u(e,[`generatedSamples`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Za(e))),l(n,[`generatedVideos`],e)}let i=u(e,[`raiMediaFilteredCount`]);i!=null&&l(n,[`raiMediaFilteredCount`],i);let a=u(e,[`raiMediaFilteredReasons`]);return a!=null&&l(n,[`raiMediaFilteredReasons`],a),n}function Ga(e,t){let n={},r=u(e,[`videos`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Qa(e))),l(n,[`generatedVideos`],e)}let i=u(e,[`raiMediaFilteredCount`]);i!=null&&l(n,[`raiMediaFilteredCount`],i);let a=u(e,[`raiMediaFilteredReasons`]);return a!=null&&l(n,[`raiMediaFilteredReasons`],a),n}function Ka(e,t,n){let r={},i=u(e,[`prompt`]);t!==void 0&&i!=null&&l(t,[`instances[0]`,`prompt`],i);let a=u(e,[`image`]);t!==void 0&&a!=null&&l(t,[`instances[0]`,`image`],co(a));let o=u(e,[`video`]);return t!==void 0&&o!=null&&l(t,[`instances[0]`,`video`],rs(o)),r}function qa(e,t,n){let r={},i=u(e,[`prompt`]);t!==void 0&&i!=null&&l(t,[`instances[0]`,`prompt`],i);let a=u(e,[`image`]);t!==void 0&&a!=null&&l(t,[`instances[0]`,`image`],J(a));let o=u(e,[`video`]);return t!==void 0&&o!=null&&l(t,[`instances[0]`,`video`],is(o)),r}function Ja(e,t){let n={},r=u(e,[`_self`]);r!=null&&l(n,[`image`],oo(r));let i=u(e,[`raiFilteredReason`]);i!=null&&l(n,[`raiFilteredReason`],i);let a=u(e,[`_self`]);return a!=null&&l(n,[`safetyAttributes`],ko(a)),n}function Ya(e,t){let n={},r=u(e,[`_self`]);r!=null&&l(n,[`image`],so(r));let i=u(e,[`raiFilteredReason`]);i!=null&&l(n,[`raiFilteredReason`],i);let a=u(e,[`_self`]);a!=null&&l(n,[`safetyAttributes`],Ao(a));let o=u(e,[`prompt`]);return o!=null&&l(n,[`enhancedPrompt`],o),n}function Xa(e,t){let n={},r=u(e,[`_self`]);r!=null&&l(n,[`mask`],so(r));let i=u(e,[`labels`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`labels`],e)}return n}function Za(e,t){let n={},r=u(e,[`video`]);return r!=null&&l(n,[`video`],Qo(r)),n}function Qa(e,t){let n={},r=u(e,[`_self`]);return r!=null&&l(n,[`video`],$o(r)),n}function $a(e,t){let n={},r=u(e,[`modelSelectionConfig`]);r!=null&&l(n,[`modelConfig`],r);let i=u(e,[`responseJsonSchema`]);i!=null&&l(n,[`responseJsonSchema`],i);let a=u(e,[`audioTimestamp`]);a!=null&&l(n,[`audioTimestamp`],a);let o=u(e,[`candidateCount`]);o!=null&&l(n,[`candidateCount`],o);let s=u(e,[`enableAffectiveDialog`]);s!=null&&l(n,[`enableAffectiveDialog`],s);let c=u(e,[`frequencyPenalty`]);c!=null&&l(n,[`frequencyPenalty`],c);let d=u(e,[`logprobs`]);d!=null&&l(n,[`logprobs`],d);let f=u(e,[`maxOutputTokens`]);f!=null&&l(n,[`maxOutputTokens`],f);let p=u(e,[`mediaResolution`]);p!=null&&l(n,[`mediaResolution`],p);let m=u(e,[`presencePenalty`]);m!=null&&l(n,[`presencePenalty`],m);let h=u(e,[`responseLogprobs`]);h!=null&&l(n,[`responseLogprobs`],h);let g=u(e,[`responseMimeType`]);g!=null&&l(n,[`responseMimeType`],g);let _=u(e,[`responseModalities`]);_!=null&&l(n,[`responseModalities`],_);let v=u(e,[`responseSchema`]);v!=null&&l(n,[`responseSchema`],v);let y=u(e,[`routingConfig`]);y!=null&&l(n,[`routingConfig`],y);let b=u(e,[`seed`]);b!=null&&l(n,[`seed`],b);let x=u(e,[`speechConfig`]);x!=null&&l(n,[`speechConfig`],Ro(x));let S=u(e,[`stopSequences`]);S!=null&&l(n,[`stopSequences`],S);let C=u(e,[`temperature`]);C!=null&&l(n,[`temperature`],C);let w=u(e,[`thinkingConfig`]);w!=null&&l(n,[`thinkingConfig`],w);let T=u(e,[`topK`]);T!=null&&l(n,[`topK`],T);let E=u(e,[`topP`]);if(E!=null&&l(n,[`topP`],E),u(e,[`enableEnhancedCivicAnswers`])!==void 0)throw Error(`enableEnhancedCivicAnswers parameter is not supported in Vertex AI.`);return n}function eo(e,t,n){let r={},i=u(t,[`model`]);return i!=null&&l(r,[`_url`,`name`],N(e,i)),r}function to(e,t,n){let r={},i=u(t,[`model`]);return i!=null&&l(r,[`_url`,`name`],N(e,i)),r}function no(e,t){let n={},r=u(e,[`authConfig`]);r!=null&&l(n,[`authConfig`],Ki(r));let i=u(e,[`enableWidget`]);return i!=null&&l(n,[`enableWidget`],i),n}function ro(e,t){let n={},r=u(e,[`searchTypes`]);if(r!=null&&l(n,[`searchTypes`],r),u(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);if(u(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);let i=u(e,[`timeRangeFilter`]);return i!=null&&l(n,[`timeRangeFilter`],i),n}function io(e,t){let n={},r=u(e,[`aspectRatio`]);r!=null&&l(n,[`aspectRatio`],r);let i=u(e,[`imageSize`]);if(i!=null&&l(n,[`imageSize`],i),u(e,[`personGeneration`])!==void 0)throw Error(`personGeneration parameter is not supported in Gemini API.`);if(u(e,[`prominentPeople`])!==void 0)throw Error(`prominentPeople parameter is not supported in Gemini API.`);if(u(e,[`outputMimeType`])!==void 0)throw Error(`outputMimeType parameter is not supported in Gemini API.`);if(u(e,[`outputCompressionQuality`])!==void 0)throw Error(`outputCompressionQuality parameter is not supported in Gemini API.`);if(u(e,[`imageOutputOptions`])!==void 0)throw Error(`imageOutputOptions parameter is not supported in Gemini API.`);return n}function ao(e,t){let n={},r=u(e,[`aspectRatio`]);r!=null&&l(n,[`aspectRatio`],r);let i=u(e,[`imageSize`]);i!=null&&l(n,[`imageSize`],i);let a=u(e,[`personGeneration`]);a!=null&&l(n,[`personGeneration`],a);let o=u(e,[`prominentPeople`]);o!=null&&l(n,[`prominentPeople`],o);let s=u(e,[`outputMimeType`]);s!=null&&l(n,[`imageOutputOptions`,`mimeType`],s);let c=u(e,[`outputCompressionQuality`]);c!=null&&l(n,[`imageOutputOptions`,`compressionQuality`],c);let d=u(e,[`imageOutputOptions`]);return d!=null&&l(n,[`imageOutputOptions`],d),n}function oo(e,t){let n={},r=u(e,[`bytesBase64Encoded`]);r!=null&&l(n,[`imageBytes`],B(r));let i=u(e,[`mimeType`]);return i!=null&&l(n,[`mimeType`],i),n}function so(e,t){let n={},r=u(e,[`gcsUri`]);r!=null&&l(n,[`gcsUri`],r);let i=u(e,[`bytesBase64Encoded`]);i!=null&&l(n,[`imageBytes`],B(i));let a=u(e,[`mimeType`]);return a!=null&&l(n,[`mimeType`],a),n}function co(e,t){let n={};if(u(e,[`gcsUri`])!==void 0)throw Error(`gcsUri parameter is not supported in Gemini API.`);let r=u(e,[`imageBytes`]);r!=null&&l(n,[`bytesBase64Encoded`],B(r));let i=u(e,[`mimeType`]);return i!=null&&l(n,[`mimeType`],i),n}function J(e,t){let n={},r=u(e,[`gcsUri`]);r!=null&&l(n,[`gcsUri`],r);let i=u(e,[`imageBytes`]);i!=null&&l(n,[`bytesBase64Encoded`],B(i));let a=u(e,[`mimeType`]);return a!=null&&l(n,[`mimeType`],a),n}function lo(e,t,n,r){let i={},a=u(t,[`pageSize`]);n!==void 0&&a!=null&&l(n,[`_query`,`pageSize`],a);let o=u(t,[`pageToken`]);n!==void 0&&o!=null&&l(n,[`_query`,`pageToken`],o);let s=u(t,[`filter`]);n!==void 0&&s!=null&&l(n,[`_query`,`filter`],s);let c=u(t,[`queryBase`]);return n!==void 0&&c!=null&&l(n,[`_url`,`models_url`],rn(e,c)),i}function uo(e,t,n,r){let i={},a=u(t,[`pageSize`]);n!==void 0&&a!=null&&l(n,[`_query`,`pageSize`],a);let o=u(t,[`pageToken`]);n!==void 0&&o!=null&&l(n,[`_query`,`pageToken`],o);let s=u(t,[`filter`]);n!==void 0&&s!=null&&l(n,[`_query`,`filter`],s);let c=u(t,[`queryBase`]);return n!==void 0&&c!=null&&l(n,[`_url`,`models_url`],rn(e,c)),i}function fo(e,t,n){let r={},i=u(t,[`config`]);return i!=null&&lo(e,i,r),r}function po(e,t,n){let r={},i=u(t,[`config`]);return i!=null&&uo(e,i,r),r}function mo(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`nextPageToken`]);i!=null&&l(n,[`nextPageToken`],i);let a=u(e,[`_self`]);if(a!=null){let e=an(a);Array.isArray(e)&&(e=e.map(e=>_o(e))),l(n,[`models`],e)}return n}function ho(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`nextPageToken`]);i!=null&&l(n,[`nextPageToken`],i);let a=u(e,[`_self`]);if(a!=null){let e=an(a);Array.isArray(e)&&(e=e.map(e=>vo(e))),l(n,[`models`],e)}return n}function go(e,t){let n={},r=u(e,[`maskMode`]);r!=null&&l(n,[`maskMode`],r);let i=u(e,[`segmentationClasses`]);i!=null&&l(n,[`maskClasses`],i);let a=u(e,[`maskDilation`]);return a!=null&&l(n,[`dilation`],a),n}function _o(e,t){let n={},r=u(e,[`name`]);r!=null&&l(n,[`name`],r);let i=u(e,[`displayName`]);i!=null&&l(n,[`displayName`],i);let a=u(e,[`description`]);a!=null&&l(n,[`description`],a);let o=u(e,[`version`]);o!=null&&l(n,[`version`],o);let s=u(e,[`_self`]);s!=null&&l(n,[`tunedModelInfo`],Uo(s));let c=u(e,[`inputTokenLimit`]);c!=null&&l(n,[`inputTokenLimit`],c);let d=u(e,[`outputTokenLimit`]);d!=null&&l(n,[`outputTokenLimit`],d);let f=u(e,[`supportedGenerationMethods`]);f!=null&&l(n,[`supportedActions`],f);let p=u(e,[`temperature`]);p!=null&&l(n,[`temperature`],p);let m=u(e,[`maxTemperature`]);m!=null&&l(n,[`maxTemperature`],m);let h=u(e,[`topP`]);h!=null&&l(n,[`topP`],h);let g=u(e,[`topK`]);g!=null&&l(n,[`topK`],g);let _=u(e,[`thinking`]);return _!=null&&l(n,[`thinking`],_),n}function vo(e,t){let n={},r=u(e,[`name`]);r!=null&&l(n,[`name`],r);let i=u(e,[`displayName`]);i!=null&&l(n,[`displayName`],i);let a=u(e,[`description`]);a!=null&&l(n,[`description`],a);let o=u(e,[`versionId`]);o!=null&&l(n,[`version`],o);let s=u(e,[`deployedModels`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>xa(e))),l(n,[`endpoints`],e)}let c=u(e,[`labels`]);c!=null&&l(n,[`labels`],c);let d=u(e,[`_self`]);d!=null&&l(n,[`tunedModelInfo`],Wo(d));let f=u(e,[`defaultCheckpointId`]);f!=null&&l(n,[`defaultCheckpointId`],f);let p=u(e,[`checkpoints`]);if(p!=null){let e=p;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`checkpoints`],e)}return n}function yo(e,t){let n={},r=u(e,[`speakerVoiceConfigs`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Lo(e))),l(n,[`speakerVoiceConfigs`],e)}return n}function bo(e,t){let n={},r=u(e,[`mediaResolution`]);r!=null&&l(n,[`mediaResolution`],r);let i=u(e,[`codeExecutionResult`]);i!=null&&l(n,[`codeExecutionResult`],i);let a=u(e,[`executableCode`]);a!=null&&l(n,[`executableCode`],a);let o=u(e,[`fileData`]);o!=null&&l(n,[`fileData`],Sa(o));let s=u(e,[`functionCall`]);s!=null&&l(n,[`functionCall`],Ca(s));let c=u(e,[`functionResponse`]);c!=null&&l(n,[`functionResponse`],c);let d=u(e,[`inlineData`]);d!=null&&l(n,[`inlineData`],qi(d));let f=u(e,[`text`]);f!=null&&l(n,[`text`],f);let p=u(e,[`thought`]);p!=null&&l(n,[`thought`],p);let m=u(e,[`thoughtSignature`]);m!=null&&l(n,[`thoughtSignature`],m);let h=u(e,[`videoMetadata`]);h!=null&&l(n,[`videoMetadata`],h);let g=u(e,[`toolCall`]);g!=null&&l(n,[`toolCall`],g);let _=u(e,[`toolResponse`]);_!=null&&l(n,[`toolResponse`],_);let v=u(e,[`partMetadata`]);return v!=null&&l(n,[`partMetadata`],v),n}function xo(e,t){let n={},r=u(e,[`mediaResolution`]);r!=null&&l(n,[`mediaResolution`],r);let i=u(e,[`codeExecutionResult`]);i!=null&&l(n,[`codeExecutionResult`],i);let a=u(e,[`executableCode`]);a!=null&&l(n,[`executableCode`],a);let o=u(e,[`fileData`]);o!=null&&l(n,[`fileData`],o);let s=u(e,[`functionCall`]);s!=null&&l(n,[`functionCall`],s);let c=u(e,[`functionResponse`]);c!=null&&l(n,[`functionResponse`],c);let d=u(e,[`inlineData`]);d!=null&&l(n,[`inlineData`],d);let f=u(e,[`text`]);f!=null&&l(n,[`text`],f);let p=u(e,[`thought`]);p!=null&&l(n,[`thought`],p);let m=u(e,[`thoughtSignature`]);m!=null&&l(n,[`thoughtSignature`],m);let h=u(e,[`videoMetadata`]);if(h!=null&&l(n,[`videoMetadata`],h),u(e,[`toolCall`])!==void 0)throw Error(`toolCall parameter is not supported in Vertex AI.`);if(u(e,[`toolResponse`])!==void 0)throw Error(`toolResponse parameter is not supported in Vertex AI.`);if(u(e,[`partMetadata`])!==void 0)throw Error(`partMetadata parameter is not supported in Vertex AI.`);return n}function So(e,t){let n={},r=u(e,[`productImage`]);return r!=null&&l(n,[`image`],J(r)),n}function Co(e,t,n){let r={},i=u(e,[`numberOfImages`]);t!==void 0&&i!=null&&l(t,[`parameters`,`sampleCount`],i);let a=u(e,[`baseSteps`]);t!==void 0&&a!=null&&l(t,[`parameters`,`baseSteps`],a);let o=u(e,[`outputGcsUri`]);t!==void 0&&o!=null&&l(t,[`parameters`,`storageUri`],o);let s=u(e,[`seed`]);t!==void 0&&s!=null&&l(t,[`parameters`,`seed`],s);let c=u(e,[`safetyFilterLevel`]);t!==void 0&&c!=null&&l(t,[`parameters`,`safetySetting`],c);let d=u(e,[`personGeneration`]);t!==void 0&&d!=null&&l(t,[`parameters`,`personGeneration`],d);let f=u(e,[`addWatermark`]);t!==void 0&&f!=null&&l(t,[`parameters`,`addWatermark`],f);let p=u(e,[`outputMimeType`]);t!==void 0&&p!=null&&l(t,[`parameters`,`outputOptions`,`mimeType`],p);let m=u(e,[`outputCompressionQuality`]);t!==void 0&&m!=null&&l(t,[`parameters`,`outputOptions`,`compressionQuality`],m);let h=u(e,[`enhancePrompt`]);t!==void 0&&h!=null&&l(t,[`parameters`,`enhancePrompt`],h);let g=u(e,[`labels`]);return t!==void 0&&g!=null&&l(t,[`labels`],g),r}function wo(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`source`]);a!=null&&Eo(a,r);let o=u(t,[`config`]);return o!=null&&Co(o,r),r}function To(e,t){let n={},r=u(e,[`predictions`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Ya(e))),l(n,[`generatedImages`],e)}return n}function Eo(e,t,n){let r={},i=u(e,[`prompt`]);t!==void 0&&i!=null&&l(t,[`instances[0]`,`prompt`],i);let a=u(e,[`personImage`]);t!==void 0&&a!=null&&l(t,[`instances[0]`,`personImage`,`image`],J(a));let o=u(e,[`productImages`]);if(t!==void 0&&o!=null){let e=o;Array.isArray(e)&&(e=e.map(e=>So(e))),l(t,[`instances[0]`,`productImages`],e)}return r}function Do(e,t){let n={},r=u(e,[`referenceImage`]);r!=null&&l(n,[`referenceImage`],J(r));let i=u(e,[`referenceId`]);i!=null&&l(n,[`referenceId`],i);let a=u(e,[`referenceType`]);a!=null&&l(n,[`referenceType`],a);let o=u(e,[`maskImageConfig`]);o!=null&&l(n,[`maskImageConfig`],go(o));let s=u(e,[`controlImageConfig`]);s!=null&&l(n,[`controlImageConfig`],ta(s));let c=u(e,[`styleImageConfig`]);c!=null&&l(n,[`styleImageConfig`],c);let d=u(e,[`subjectImageConfig`]);return d!=null&&l(n,[`subjectImageConfig`],d),n}function Oo(e,t){let n={},r=u(e,[`mimeType`]);r!=null&&l(n,[`mimeType`],r);let i=u(e,[`voiceSampleAudio`]);return i!=null&&l(n,[`voiceSampleAudio`],i),n}function ko(e,t){let n={},r=u(e,[`safetyAttributes`,`categories`]);r!=null&&l(n,[`categories`],r);let i=u(e,[`safetyAttributes`,`scores`]);i!=null&&l(n,[`scores`],i);let a=u(e,[`contentType`]);return a!=null&&l(n,[`contentType`],a),n}function Ao(e,t){let n={},r=u(e,[`safetyAttributes`,`categories`]);r!=null&&l(n,[`categories`],r);let i=u(e,[`safetyAttributes`,`scores`]);i!=null&&l(n,[`scores`],i);let a=u(e,[`contentType`]);return a!=null&&l(n,[`contentType`],a),n}function jo(e,t){let n={},r=u(e,[`category`]);if(r!=null&&l(n,[`category`],r),u(e,[`method`])!==void 0)throw Error(`method parameter is not supported in Gemini API.`);let i=u(e,[`threshold`]);return i!=null&&l(n,[`threshold`],i),n}function Mo(e,t){let n={},r=u(e,[`image`]);return r!=null&&l(n,[`image`],J(r)),n}function No(e,t,n){let r={},i=u(e,[`mode`]);t!==void 0&&i!=null&&l(t,[`parameters`,`mode`],i);let a=u(e,[`maxPredictions`]);t!==void 0&&a!=null&&l(t,[`parameters`,`maxPredictions`],a);let o=u(e,[`confidenceThreshold`]);t!==void 0&&o!=null&&l(t,[`parameters`,`confidenceThreshold`],o);let s=u(e,[`maskDilation`]);t!==void 0&&s!=null&&l(t,[`parameters`,`maskDilation`],s);let c=u(e,[`binaryColorThreshold`]);t!==void 0&&c!=null&&l(t,[`parameters`,`binaryColorThreshold`],c);let d=u(e,[`labels`]);return t!==void 0&&d!=null&&l(t,[`labels`],d),r}function Po(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`source`]);a!=null&&Io(a,r);let o=u(t,[`config`]);return o!=null&&No(o,r),r}function Fo(e,t){let n={},r=u(e,[`predictions`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>Xa(e))),l(n,[`generatedMasks`],e)}return n}function Io(e,t,n){let r={},i=u(e,[`prompt`]);t!==void 0&&i!=null&&l(t,[`instances[0]`,`prompt`],i);let a=u(e,[`image`]);t!==void 0&&a!=null&&l(t,[`instances[0]`,`image`],J(a));let o=u(e,[`scribbleImage`]);return t!==void 0&&o!=null&&l(t,[`instances[0]`,`scribble`],Mo(o)),r}function Lo(e,t){let n={},r=u(e,[`speaker`]);r!=null&&l(n,[`speaker`],r);let i=u(e,[`voiceConfig`]);return i!=null&&l(n,[`voiceConfig`],as(i)),n}function Ro(e,t){let n={},r=u(e,[`voiceConfig`]);r!=null&&l(n,[`voiceConfig`],as(r));let i=u(e,[`languageCode`]);i!=null&&l(n,[`languageCode`],i);let a=u(e,[`multiSpeakerVoiceConfig`]);return a!=null&&l(n,[`multiSpeakerVoiceConfig`],yo(a)),n}function zo(e,t){let n={},r=u(e,[`retrievalConfig`]);r!=null&&l(n,[`retrievalConfig`],r);let i=u(e,[`functionCallingConfig`]);i!=null&&l(n,[`functionCallingConfig`],wa(i));let a=u(e,[`includeServerSideToolInvocations`]);return a!=null&&l(n,[`includeServerSideToolInvocations`],a),n}function Bo(e,t){let n={},r=u(e,[`retrievalConfig`]);r!=null&&l(n,[`retrievalConfig`],r);let i=u(e,[`functionCallingConfig`]);if(i!=null&&l(n,[`functionCallingConfig`],i),u(e,[`includeServerSideToolInvocations`])!==void 0)throw Error(`includeServerSideToolInvocations parameter is not supported in Vertex AI.`);return n}function Vo(e,t){let n={};if(u(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let r=u(e,[`computerUse`]);r!=null&&l(n,[`computerUse`],r);let i=u(e,[`fileSearch`]);i!=null&&l(n,[`fileSearch`],i);let a=u(e,[`googleSearch`]);a!=null&&l(n,[`googleSearch`],ro(a));let o=u(e,[`googleMaps`]);o!=null&&l(n,[`googleMaps`],no(o));let s=u(e,[`codeExecution`]);if(s!=null&&l(n,[`codeExecution`],s),u(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let c=u(e,[`functionDeclarations`]);if(c!=null){let e=c;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`functionDeclarations`],e)}let d=u(e,[`googleSearchRetrieval`]);if(d!=null&&l(n,[`googleSearchRetrieval`],d),u(e,[`parallelAiSearch`])!==void 0)throw Error(`parallelAiSearch parameter is not supported in Gemini API.`);let f=u(e,[`urlContext`]);f!=null&&l(n,[`urlContext`],f);let p=u(e,[`mcpServers`]);if(p!=null){let e=p;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`mcpServers`],e)}return n}function Ho(e,t){let n={},r=u(e,[`retrieval`]);r!=null&&l(n,[`retrieval`],r);let i=u(e,[`computerUse`]);if(i!=null&&l(n,[`computerUse`],i),u(e,[`fileSearch`])!==void 0)throw Error(`fileSearch parameter is not supported in Vertex AI.`);let a=u(e,[`googleSearch`]);a!=null&&l(n,[`googleSearch`],a);let o=u(e,[`googleMaps`]);o!=null&&l(n,[`googleMaps`],o);let s=u(e,[`codeExecution`]);s!=null&&l(n,[`codeExecution`],s);let c=u(e,[`enterpriseWebSearch`]);c!=null&&l(n,[`enterpriseWebSearch`],c);let d=u(e,[`functionDeclarations`]);if(d!=null){let e=d;Array.isArray(e)&&(e=e.map(e=>Ta(e))),l(n,[`functionDeclarations`],e)}let f=u(e,[`googleSearchRetrieval`]);f!=null&&l(n,[`googleSearchRetrieval`],f);let p=u(e,[`parallelAiSearch`]);p!=null&&l(n,[`parallelAiSearch`],p);let m=u(e,[`urlContext`]);if(m!=null&&l(n,[`urlContext`],m),u(e,[`mcpServers`])!==void 0)throw Error(`mcpServers parameter is not supported in Vertex AI.`);return n}function Uo(e,t){let n={},r=u(e,[`baseModel`]);r!=null&&l(n,[`baseModel`],r);let i=u(e,[`createTime`]);i!=null&&l(n,[`createTime`],i);let a=u(e,[`updateTime`]);return a!=null&&l(n,[`updateTime`],a),n}function Wo(e,t){let n={},r=u(e,[`labels`,`google-vertex-llm-tuning-base-model-id`]);r!=null&&l(n,[`baseModel`],r);let i=u(e,[`createTime`]);i!=null&&l(n,[`createTime`],i);let a=u(e,[`updateTime`]);return a!=null&&l(n,[`updateTime`],a),n}function Go(e,t,n){let r={},i=u(e,[`displayName`]);t!==void 0&&i!=null&&l(t,[`displayName`],i);let a=u(e,[`description`]);t!==void 0&&a!=null&&l(t,[`description`],a);let o=u(e,[`defaultCheckpointId`]);return t!==void 0&&o!=null&&l(t,[`defaultCheckpointId`],o),r}function Ko(e,t,n){let r={},i=u(e,[`displayName`]);t!==void 0&&i!=null&&l(t,[`displayName`],i);let a=u(e,[`description`]);t!==void 0&&a!=null&&l(t,[`description`],a);let o=u(e,[`defaultCheckpointId`]);return t!==void 0&&o!=null&&l(t,[`defaultCheckpointId`],o),r}function qo(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`name`],N(e,i));let a=u(t,[`config`]);return a!=null&&Go(a,r),r}function Jo(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`config`]);return a!=null&&Ko(a,r),r}function Yo(e,t,n){let r={},i=u(e,[`outputGcsUri`]);t!==void 0&&i!=null&&l(t,[`parameters`,`storageUri`],i);let a=u(e,[`safetyFilterLevel`]);t!==void 0&&a!=null&&l(t,[`parameters`,`safetySetting`],a);let o=u(e,[`personGeneration`]);t!==void 0&&o!=null&&l(t,[`parameters`,`personGeneration`],o);let s=u(e,[`includeRaiReason`]);t!==void 0&&s!=null&&l(t,[`parameters`,`includeRaiReason`],s);let c=u(e,[`outputMimeType`]);t!==void 0&&c!=null&&l(t,[`parameters`,`outputOptions`,`mimeType`],c);let d=u(e,[`outputCompressionQuality`]);t!==void 0&&d!=null&&l(t,[`parameters`,`outputOptions`,`compressionQuality`],d);let f=u(e,[`enhanceInputImage`]);t!==void 0&&f!=null&&l(t,[`parameters`,`upscaleConfig`,`enhanceInputImage`],f);let p=u(e,[`imagePreservationFactor`]);t!==void 0&&p!=null&&l(t,[`parameters`,`upscaleConfig`,`imagePreservationFactor`],p);let m=u(e,[`labels`]);t!==void 0&&m!=null&&l(t,[`labels`],m);let h=u(e,[`numberOfImages`]);t!==void 0&&h!=null&&l(t,[`parameters`,`sampleCount`],h);let g=u(e,[`mode`]);return t!==void 0&&g!=null&&l(t,[`parameters`,`mode`],g),r}function Xo(e,t,n){let r={},i=u(t,[`model`]);i!=null&&l(r,[`_url`,`model`],N(e,i));let a=u(t,[`image`]);a!=null&&l(r,[`instances[0]`,`image`],J(a));let o=u(t,[`upscaleFactor`]);o!=null&&l(r,[`parameters`,`upscaleConfig`,`upscaleFactor`],o);let s=u(t,[`config`]);return s!=null&&Yo(s,r),r}function Zo(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`predictions`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>Ya(e))),l(n,[`generatedImages`],e)}return n}function Qo(e,t){let n={},r=u(e,[`uri`]);r!=null&&l(n,[`uri`],r);let i=u(e,[`encodedVideo`]);i!=null&&l(n,[`videoBytes`],B(i));let a=u(e,[`encoding`]);return a!=null&&l(n,[`mimeType`],a),n}function $o(e,t){let n={},r=u(e,[`gcsUri`]);r!=null&&l(n,[`uri`],r);let i=u(e,[`bytesBase64Encoded`]);i!=null&&l(n,[`videoBytes`],B(i));let a=u(e,[`mimeType`]);return a!=null&&l(n,[`mimeType`],a),n}function es(e,t){let n={},r=u(e,[`image`]);r!=null&&l(n,[`_self`],J(r));let i=u(e,[`maskMode`]);return i!=null&&l(n,[`maskMode`],i),n}function ts(e,t){let n={},r=u(e,[`image`]);r!=null&&l(n,[`image`],co(r));let i=u(e,[`referenceType`]);return i!=null&&l(n,[`referenceType`],i),n}function ns(e,t){let n={},r=u(e,[`image`]);r!=null&&l(n,[`image`],J(r));let i=u(e,[`referenceType`]);return i!=null&&l(n,[`referenceType`],i),n}function rs(e,t){let n={},r=u(e,[`uri`]);r!=null&&l(n,[`uri`],r);let i=u(e,[`videoBytes`]);i!=null&&l(n,[`encodedVideo`],B(i));let a=u(e,[`mimeType`]);return a!=null&&l(n,[`encoding`],a),n}function is(e,t){let n={},r=u(e,[`uri`]);r!=null&&l(n,[`gcsUri`],r);let i=u(e,[`videoBytes`]);i!=null&&l(n,[`bytesBase64Encoded`],B(i));let a=u(e,[`mimeType`]);return a!=null&&l(n,[`mimeType`],a),n}function as(e,t){let n={},r=u(e,[`replicatedVoiceConfig`]);r!=null&&l(n,[`replicatedVoiceConfig`],Oo(r));let i=u(e,[`prebuiltVoiceConfig`]);return i!=null&&l(n,[`prebuiltVoiceConfig`],i),n}function os(e,t){let n={},r=u(e,[`displayName`]);return t!==void 0&&r!=null&&l(t,[`displayName`],r),n}function ss(e){let t={},n=u(e,[`config`]);return n!=null&&os(n,t),t}function cs(e,t){let n={},r=u(e,[`force`]);return t!==void 0&&r!=null&&l(t,[`_query`,`force`],r),n}function ls(e){let t={},n=u(e,[`name`]);n!=null&&l(t,[`_url`,`name`],n);let r=u(e,[`config`]);return r!=null&&cs(r,t),t}function us(e){let t={},n=u(e,[`name`]);return n!=null&&l(t,[`_url`,`name`],n),t}function ds(e,t){let n={},r=u(e,[`customMetadata`]);if(t!==void 0&&r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`customMetadata`],e)}let i=u(e,[`chunkingConfig`]);return t!==void 0&&i!=null&&l(t,[`chunkingConfig`],i),n}function fs(e){let t={},n=u(e,[`name`]);n!=null&&l(t,[`name`],n);let r=u(e,[`metadata`]);r!=null&&l(t,[`metadata`],r);let i=u(e,[`done`]);i!=null&&l(t,[`done`],i);let a=u(e,[`error`]);a!=null&&l(t,[`error`],a);let o=u(e,[`response`]);return o!=null&&l(t,[`response`],ms(o)),t}function ps(e){let t={},n=u(e,[`fileSearchStoreName`]);n!=null&&l(t,[`_url`,`file_search_store_name`],n);let r=u(e,[`fileName`]);r!=null&&l(t,[`fileName`],r);let i=u(e,[`config`]);return i!=null&&ds(i,t),t}function ms(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`parent`]);r!=null&&l(t,[`parent`],r);let i=u(e,[`documentName`]);return i!=null&&l(t,[`documentName`],i),t}function hs(e,t){let n={},r=u(e,[`pageSize`]);t!==void 0&&r!=null&&l(t,[`_query`,`pageSize`],r);let i=u(e,[`pageToken`]);return t!==void 0&&i!=null&&l(t,[`_query`,`pageToken`],i),n}function gs(e){let t={},n=u(e,[`config`]);return n!=null&&hs(n,t),t}function _s(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`nextPageToken`]);r!=null&&l(t,[`nextPageToken`],r);let i=u(e,[`fileSearchStores`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`fileSearchStores`],e)}return t}function vs(e,t){let n={},r=u(e,[`mimeType`]);t!==void 0&&r!=null&&l(t,[`mimeType`],r);let i=u(e,[`displayName`]);t!==void 0&&i!=null&&l(t,[`displayName`],i);let a=u(e,[`customMetadata`]);if(t!==void 0&&a!=null){let e=a;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`customMetadata`],e)}let o=u(e,[`chunkingConfig`]);return t!==void 0&&o!=null&&l(t,[`chunkingConfig`],o),n}function ys(e){let t={},n=u(e,[`fileSearchStoreName`]);n!=null&&l(t,[`_url`,`file_search_store_name`],n);let r=u(e,[`config`]);return r!=null&&vs(r,t),t}function bs(e){let t={},n=u(e,[`sdkHttpResponse`]);return n!=null&&l(t,[`sdkHttpResponse`],n),t}var xs=`Content-Type`,Ss=`X-Server-Timeout`,Cs=`User-Agent`,ws=`x-goog-api-client`,Ts=`google-genai-sdk/1.48.0`,Es=`v1beta1`,Ds=`v1beta`,Os=5,ks=[408,429,500,502,503,504],As=class{constructor(e){this.clientOptions=Object.assign({},e),this.customBaseUrl=e.httpOptions?.baseUrl,this.clientOptions.vertexai&&(this.clientOptions.project&&this.clientOptions.location?this.clientOptions.apiKey=void 0:this.clientOptions.apiKey&&(this.clientOptions.project=void 0,this.clientOptions.location=void 0));let t={};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 Error(`Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.`);let n=e.project&&e.location||!!e.apiKey;this.customBaseUrl&&!n?(t.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0):this.clientOptions.apiKey||this.clientOptions.location===`global`?t.baseUrl=`https://aiplatform.googleapis.com/`:this.clientOptions.project&&this.clientOptions.location&&this.clientOptions.location===`us`?t.baseUrl=`https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`:this.clientOptions.project&&this.clientOptions.location&&(t.baseUrl=`https://${this.clientOptions.location}-aiplatform.googleapis.com/`),t.apiVersion=this.clientOptions.apiVersion??Es}else this.clientOptions.apiKey||console.warn(`API key should be set when using the Gemini API.`),t.apiVersion=this.clientOptions.apiVersion??Ds,t.baseUrl=`https://generativelanguage.googleapis.com/`;t.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=t,e.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(t,e.httpOptions))}isVertexAI(){return this.clientOptions.vertexai??!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getCustomBaseUrl(){return this.customBaseUrl}async getAuthHeaders(){let e=new Headers;return await this.clientOptions.auth.addAuthHeaders(e),e}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw Error(`API version is not set.`)}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw Error(`Base 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 Error(`Headers are not set.`)}getRequestUrlInternal(e){if(!e||e.baseUrl===void 0||e.apiVersion===void 0)throw Error(`HTTP options are not correctly set.`);let t=[e.baseUrl.endsWith(`/`)?e.baseUrl.slice(0,-1):e.baseUrl];return e.apiVersion&&e.apiVersion!==``&&t.push(e.apiVersion),t.join(`/`)}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){let e=this.getBaseUrl(),t=new URL(e);return t.protocol=t.protocol==`http:`?`ws`:`wss`,t.toString()}setBaseUrl(e){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=e;else throw Error(`HTTP options are not correctly set.`)}constructUrl(e,t,n){let r=[this.getRequestUrlInternal(t)];return n&&r.push(this.getBaseResourcePath()),e!==``&&r.push(e),new URL(`${r.join(`/`)}`)}shouldPrependVertexProjectPath(e,t){return!(t.baseUrl&&t.baseUrlResourceScope===Ne.COLLECTION||this.clientOptions.apiKey||!this.clientOptions.vertexai||e.path.startsWith(`projects/`)||e.httpMethod===`GET`&&e.path.startsWith(`publishers/google/models`))}async request(e){let t=this.clientOptions.httpOptions;e.httpOptions&&(t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));let n=this.shouldPrependVertexProjectPath(e,t),r=this.constructUrl(e.path,t,n);if(e.queryParams)for(let[t,n]of Object.entries(e.queryParams))r.searchParams.append(t,String(n));let i={};if(e.httpMethod===`GET`){if(e.body&&e.body!==`{}`)throw Error(`Request body should be empty for GET request, but got non empty request body`)}else i.body=e.body;return i=await this.includeExtraHttpOptionsToRequestInit(i,t,r.toString(),e.abortSignal),this.unaryApiCall(r,i,e.httpMethod)}patchHttpOptions(e,t){let n=JSON.parse(JSON.stringify(e));for(let[e,r]of Object.entries(t))typeof r==`object`?n[e]=Object.assign(Object.assign({},n[e]),r):r!==void 0&&(n[e]=r);return n}async requestStream(e){let t=this.clientOptions.httpOptions;e.httpOptions&&(t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));let n=this.shouldPrependVertexProjectPath(e,t),r=this.constructUrl(e.path,t,n);(!r.searchParams.has(`alt`)||r.searchParams.get(`alt`)!==`sse`)&&r.searchParams.set(`alt`,`sse`);let i={};return i.body=e.body,i=await this.includeExtraHttpOptionsToRequestInit(i,t,r.toString(),e.abortSignal),this.streamApiCall(r,i,e.httpMethod)}async includeExtraHttpOptionsToRequestInit(e,t,n,r){if(t&&t.timeout||r){let n=new AbortController,i=n.signal;if(t.timeout&&t?.timeout>0){let e=setTimeout(()=>n.abort(),t.timeout);e&&typeof e.unref==`function`&&e.unref()}r&&r.addEventListener(`abort`,()=>{n.abort()}),e.signal=i}return t&&t.extraBody!==null&&Ms(e,t.extraBody),e.headers=await this.getHeadersInternal(t,n),e}async unaryApiCall(e,t,n){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:n})).then(async e=>(await js(e),new st(e))).catch(e=>{throw e instanceof Error?e:Error(JSON.stringify(e))})}async streamApiCall(e,t,n){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:n})).then(async e=>(await js(e),this.processStreamResponse(e))).catch(e=>{throw e instanceof Error?e:Error(JSON.stringify(e))})}processStreamResponse(e){return G(this,arguments,function*(){let t=(e?.body)?.getReader(),n=new TextDecoder(`utf-8`);if(!t)throw Error(`Response body is empty`);try{let r=``,i=[`
2
+
3
+ `,`\r\r`,`\r
4
+ \r
5
+ `];for(;;){let{done:a,value:o}=yield W(t.read());if(a){if(r.trim().length>0)throw Error(`Incomplete JSON segment at the end`);break}let s=n.decode(o,{stream:!0});try{let e=JSON.parse(s);if(`error`in e){let t=JSON.parse(JSON.stringify(e.error)),n=t.status,r=t.code,i=`got status: ${n}. ${JSON.stringify(e)}`;if(r>=400&&r<600)throw new ni({message:i,status:r})}}catch(e){if(e.name===`ApiError`)throw e}r+=s;let c=-1,l=0;for(;;){c=-1,l=0;for(let e of i){let t=r.indexOf(e);t!==-1&&(c===-1||t<c)&&(c=t,l=e.length)}if(c===-1)break;let t=r.substring(0,c);r=r.substring(c+l);let n=t.trim();if(n.startsWith(`data:`)){let t=n.substring(5).trim();try{yield yield W(new st(new Response(t,{headers:e?.headers,status:e?.status,statusText:e?.statusText})))}catch(e){throw Error(`exception parsing stream chunk ${t}. ${e}`)}}}}}finally{t.releaseLock()}})}async apiCall(e,t){if(!this.clientOptions.httpOptions||!this.clientOptions.httpOptions.retryOptions)return fetch(e,t);let r=this.clientOptions.httpOptions.retryOptions;return(0,n.default)(async()=>{let r=await fetch(e,t);if(r.ok)return r;throw ks.includes(r.status)?Error(`Retryable HTTP Error: ${r.statusText}`):new n.AbortError(`Non-retryable exception ${r.statusText} sending request`)},{retries:(r.attempts??Os)-1})}getDefaultHeaders(){let e={},t=Ts+` `+this.clientOptions.userAgentExtra;return e[Cs]=t,e[ws]=t,e[xs]=`application/json`,e}async getHeadersInternal(e,t){let n=new Headers;if(e&&e.headers){for(let[t,r]of Object.entries(e.headers))n.append(t,r);e.timeout&&e.timeout>0&&n.append(Ss,String(Math.ceil(e.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(n,t),n}getFileName(e){let t=``;return typeof e==`string`&&(t=e.replace(/[/\\]+$/,``),t=t.split(/[/\\]/).pop()??``),t}async uploadFile(e,t){let n={};t!=null&&(n.mimeType=t.mimeType,n.name=t.name,n.displayName=t.displayName),n.name&&!n.name.startsWith(`files/`)&&(n.name=`files/${n.name}`);let r=this.clientOptions.uploader,i=await r.stat(e);n.sizeBytes=String(i.size);let a=t?.mimeType??i.type;if(a===void 0||a===``)throw Error(`Can not determine mimeType. Please provide mimeType in the config.`);n.mimeType=a;let o={file:n},s=this.getFileName(e),l=c(`upload/v1beta/files`,o._url),u=await this.fetchUploadUrl(l,n.sizeBytes,n.mimeType,s,o,t?.httpOptions);return r.upload(e,u,this)}async uploadFileToFileSearchStore(e,t,n){let r=this.clientOptions.uploader,i=await r.stat(t),a=String(i.size),o=n?.mimeType??i.type;if(o===void 0||o===``)throw Error(`Can not determine mimeType. Please provide mimeType in the config.`);let s=`upload/v1beta/${e}:uploadToFileSearchStore`,c=this.getFileName(t),l={};n!=null&&vs(n,l);let u=await this.fetchUploadUrl(s,a,o,c,l,n?.httpOptions);return r.uploadToFileSearchStore(t,u,this)}async downloadFile(e){await this.clientOptions.downloader.download(e,this)}async fetchUploadUrl(e,t,n,r,i,a){let o={};o=a||{apiVersion:``,headers:Object.assign({"Content-Type":`application/json`,"X-Goog-Upload-Protocol":`resumable`,"X-Goog-Upload-Command":`start`,"X-Goog-Upload-Header-Content-Length":`${t}`,"X-Goog-Upload-Header-Content-Type":`${n}`},r?{"X-Goog-Upload-File-Name":r}:{})};let s=await this.request({path:e,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:o});if(!s||!s?.headers)throw Error(`Server did not return an HttpResponse or the returned HttpResponse did not have headers.`);let c=s?.headers?.[`x-goog-upload-url`];if(c===void 0)throw Error(`Failed to get upload url. Server did not return the x-google-upload-url in the headers`);return c}};async function js(e){if(e===void 0)throw Error(`response is undefined`);if(!e.ok){let t=e.status,n;n=e.headers.get(`content-type`)?.includes(`application/json`)?await e.json():{error:{message:await e.text(),code:e.status,status:e.statusText}};let r=JSON.stringify(n);throw t>=400&&t<600?new ni({message:r,status:t}):Error(r)}}function Ms(e,t){if(!t||Object.keys(t).length===0)return;if(e.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 n={};if(typeof e.body==`string`&&e.body.length>0)try{let t=JSON.parse(e.body);if(typeof t==`object`&&t&&!Array.isArray(t))n=t;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 r(e,t){let n=Object.assign({},e);for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let i=t[e],a=n[e];i&&typeof i==`object`&&!Array.isArray(i)&&a&&typeof a==`object`&&!Array.isArray(a)?n[e]=r(a,i):(a&&i&&typeof a!=typeof i&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${e}". Original type: ${typeof a}, New type: ${typeof i}. Overwriting.`),n[e]=i)}return n}let i=r(n,t);e.body=JSON.stringify(i)}var Ns=`mcp_used/unknown`,Ps=!1;function Fs(e){for(let t of e)if(Ls(t)||typeof t==`object`&&`inputSchema`in t)return!0;return Ps}function Is(e){e[ws]=((e[ws]??``)+` ${Ns}`).trimStart()}function Ls(e){return typeof e==`object`&&!!e&&e instanceof zs}function Rs(e){return G(this,arguments,function*(e,t=100){let n,r=0;for(;r<t;){let t=yield W(e.listTools({cursor:n}));for(let e of t.tools)yield yield W(e),r++;if(!t.nextCursor)break;n=t.nextCursor}})}var zs=class e{constructor(e=[],t){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=e,this.config=t}static create(t,n){return new e(t,n)}async initialize(){var e,t,n,r;if(this.mcpTools.length>0)return;let i={},a=[];for(let l of this.mcpClients)try{for(var o=!0,s=(t=void 0,K(Rs(l))),c;c=await s.next(),e=c.done,!e;o=!0){r=c.value,o=!1;let e=r;a.push(e);let t=e.name;if(i[t])throw Error(`Duplicate function name ${t} found in MCP tools. Please ensure function names are unique.`);i[t]=l}}catch(e){t={error:e}}finally{try{!o&&!e&&(n=s.return)&&await n.call(s)}finally{if(t)throw t.error}}this.mcpTools=a,this.functionNameToMcpClient=i}async tool(){return await this.initialize(),cn(this.mcpTools,this.config)}async callTool(e){await this.initialize();let t=[];for(let n of e)if(n.name in this.functionNameToMcpClient){let e=this.functionNameToMcpClient[n.name],r;this.config.timeout&&(r={timeout:this.config.timeout});let i=await e.callTool({name:n.name,arguments:n.args},void 0,r);t.push({functionResponse:{name:n.name,response:i.isError?{error:i}:i}})}return t}};async function Bs(e,t,n){let r=new Pt,i;i=n.data instanceof Blob?JSON.parse(await n.data.text()):JSON.parse(n.data),Object.assign(r,i),t(r)}var Vs=class{constructor(e,t,n){this.apiClient=e,this.auth=t,this.webSocketFactory=n}async connect(e){if(this.apiClient.isVertexAI())throw Error(`Live music is not supported for Vertex AI.`);console.warn(`Live music generation is experimental and may change in future versions.`);let t=this.apiClient.getWebsocketBaseUrl(),n=this.apiClient.getApiVersion(),r=Ws(this.apiClient.getDefaultHeaders()),i=`${t}/ws/google.ai.generativelanguage.${n}.GenerativeService.BidiGenerateMusic?key=${this.apiClient.getApiKey()}`,a=()=>{},o=new Promise(e=>{a=e}),s=e.callbacks,c=function(){a({})},l=this.apiClient,u={onopen:c,onmessage:e=>{Bs(l,s.onmessage,e)},onerror:s?.onerror??function(e){},onclose:s?.onclose??function(e){}},d=this.webSocketFactory.create(i,Us(r),u);d.connect(),await o;let f={setup:{model:N(this.apiClient,e.model)}};return d.send(JSON.stringify(f)),new Hs(d,this.apiClient)}},Hs=class{constructor(e,t){this.conn=e,this.apiClient=t}async setWeightedPrompts(e){if(!e.weightedPrompts||Object.keys(e.weightedPrompts).length===0)throw Error(`Weighted prompts must be set and contain at least one entry.`);let t=Ai(e);this.conn.send(JSON.stringify({clientContent:t}))}async setMusicGenerationConfig(e){e.musicGenerationConfig||={};let t=ki(e);this.conn.send(JSON.stringify(t))}sendPlaybackControl(e){let t={playbackControl:e};this.conn.send(JSON.stringify(t))}play(){this.sendPlaybackControl(ot.PLAY)}pause(){this.sendPlaybackControl(ot.PAUSE)}stop(){this.sendPlaybackControl(ot.STOP)}resetContext(){this.sendPlaybackControl(ot.RESET_CONTEXT)}close(){this.conn.close()}};function Us(e){let t={};return e.forEach((e,n)=>{t[n]=e}),t}function Ws(e){let t=new Headers;for(let[n,r]of Object.entries(e))t.append(n,r);return t}var Gs="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function Ks(e,t,n){let r=new Nt,i;i=n.data instanceof Blob?await n.data.text():n.data instanceof ArrayBuffer?new TextDecoder().decode(n.data):n.data;let a=JSON.parse(i);if(e.isVertexAI()){let e=Ni(a);Object.assign(r,e)}else Object.assign(r,a);t(r)}var qs=class{constructor(e,t,n){this.apiClient=e,this.auth=t,this.webSocketFactory=n,this.music=new Vs(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){if(e.config&&e.config.httpOptions)throw Error(`The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.`);let t=this.apiClient.getWebsocketBaseUrl(),n=this.apiClient.getApiVersion(),r,i=this.apiClient.getHeaders();e.config&&e.config.tools&&Fs(e.config.tools)&&Is(i);let a=Zs(i);if(this.apiClient.isVertexAI()){let e=this.apiClient.getProject(),i=this.apiClient.getLocation(),o=this.apiClient.getApiKey(),s=!!e&&!!i||!!o;this.apiClient.getCustomBaseUrl()&&!s?r=t:(r=`${t}/ws/google.cloud.aiplatform.${n}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(a,r))}else{let e=this.apiClient.getApiKey(),i=`BidiGenerateContent`,a=`key`;e?.startsWith(`auth_tokens/`)&&(console.warn(`Warning: Ephemeral token support is experimental and may change in future versions.`),n!==`v1alpha`&&console.warn(`Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection.`),i=`BidiGenerateContentConstrained`,a=`access_token`),r=`${t}/ws/google.ai.generativelanguage.${n}.GenerativeService.${i}?${a}=${e}`}let o=()=>{},s=new Promise(e=>{o=e}),c=e.callbacks,l=function(){var e;(e=c?.onopen)==null||e.call(c),o({})},u=this.apiClient,d={onopen:l,onmessage:e=>{Ks(u,c.onmessage,e)},onerror:c?.onerror??function(e){},onclose:c?.onclose??function(e){}},f=this.webSocketFactory.create(r,Xs(a),d);f.connect(),await s;let p=N(this.apiClient,e.model);if(this.apiClient.isVertexAI()&&p.startsWith(`publishers/`)){let e=this.apiClient.getProject(),t=this.apiClient.getLocation();e&&t&&(p=`projects/${e}/locations/${t}/`+p)}let m={};this.apiClient.isVertexAI()&&e.config?.responseModalities===void 0&&(e.config===void 0?e.config={responseModalities:[be.AUDIO]}:e.config.responseModalities=[be.AUDIO]),e.config?.generationConfig&&console.warn("Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).");let h=e.config?.tools??[],g=[];for(let e of h)if(this.isCallableTool(e)){let t=e;g.push(await t.tool())}else g.push(e);g.length>0&&(e.config.tools=g);let _={model:p,config:e.config,callbacks:e.callbacks};return m=this.apiClient.isVertexAI()?Oi(this.apiClient,_):Di(this.apiClient,_),delete m.config,f.send(JSON.stringify(m)),new Ys(f,this.apiClient)}isCallableTool(e){return`callTool`in e&&typeof e.callTool==`function`}},Js={turnComplete:!0},Ys=class{constructor(e,t){this.conn=e,this.apiClient=t}tLiveClientContent(e,t){if(t.turns!==null&&t.turns!==void 0){let n=[];try{n=F(t.turns),e.isVertexAI()||(n=n.map(e=>ea(e)))}catch{throw Error(`Failed to parse client content "turns", type: '${typeof t.turns}'`)}return{clientContent:{turns:n,turnComplete:t.turnComplete}}}return{clientContent:{turnComplete:t.turnComplete}}}tLiveClienttToolResponse(e,t){let n=[];if(t.functionResponses==null||(n=Array.isArray(t.functionResponses)?t.functionResponses:[t.functionResponses],n.length===0))throw Error(`functionResponses is required.`);for(let t of n){if(typeof t!=`object`||!t||!(`name`in t)||!(`response`in t))throw Error(`Could not parse function response, type '${typeof t}'.`);if(!e.isVertexAI()&&!(`id`in t))throw Error(Gs)}return{toolResponse:{functionResponses:n}}}sendClientContent(e){e=Object.assign(Object.assign({},Js),e);let t=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(t))}sendRealtimeInput(e){let t={};t=this.apiClient.isVertexAI()?{realtimeInput:Mi(e)}:{realtimeInput:ji(e)},this.conn.send(JSON.stringify(t))}sendToolResponse(e){if(e.functionResponses==null)throw Error(`Tool response parameters are required.`);let t=this.tLiveClienttToolResponse(this.apiClient,e);this.conn.send(JSON.stringify(t))}close(){this.conn.close()}};function Xs(e){let t={};return e.forEach((e,n)=>{t[n]=e}),t}function Zs(e){let t=new Headers;for(let[n,r]of Object.entries(e))t.append(n,r);return t}var Qs=10;function $s(e){if(e?.automaticFunctionCalling?.disable)return!0;let t=!1;for(let n of e?.tools??[])if(ec(n)){t=!0;break}if(!t)return!0;let n=e?.automaticFunctionCalling?.maximumRemoteCalls;return n&&(n<0||!Number.isInteger(n))||n==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:`,n),!0):!1}function ec(e){return`callTool`in e&&typeof e.callTool==`function`}function tc(e){return(e.config?.tools)?.some(e=>ec(e))??!1}function nc(e){let t=[];return e?.config?.tools&&e.config.tools.forEach((e,n)=>{if(ec(e))return;let r=e;r.functionDeclarations&&r.functionDeclarations.length>0&&t.push(n)}),t}function rc(e){return!e?.automaticFunctionCalling?.ignoreCallHistory}var ic=class extends s{constructor(e){super(),this.apiClient=e,this.embedContent=async e=>{if(!this.apiClient.isVertexAI())return await this.embedContentInternal(e);if(e.model.includes(`gemini`)&&e.model!==`gemini-embedding-001`||e.model.includes(`maas`)){let t=F(e.contents);if(t.length>1)throw Error(`The embedContent API for this model only supports one content at a time.`);let n=Object.assign(Object.assign({},e),{content:t[0],embeddingApiType:Ie.EMBED_CONTENT});return await this.embedContentInternal(n)}else{let t=Object.assign(Object.assign({},e),{embeddingApiType:Ie.PREDICT});return await this.embedContentInternal(t)}},this.generateContent=async e=>{let t=await this.processParamsMaybeAddMcpUsage(e);if(this.maybeMoveToResponseJsonSchem(e),!tc(e)||$s(e.config))return await this.generateContentInternal(t);let n=nc(e);if(n.length>0){let e=n.map(e=>`tools[${e}]`).join(`, `);throw Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${e}.`)}let r,i,a=F(t.contents),o=t.config?.automaticFunctionCalling?.maximumRemoteCalls??Qs,s=0;for(;s<o&&(r=await this.generateContentInternal(t),!(!r.functionCalls||r.functionCalls.length===0));){let n=r.candidates[0].content,o=[];for(let t of e.config?.tools??[])if(ec(t)){let e=await t.callTool(r.functionCalls);o.push(...e)}s++,i={role:`user`,parts:o},t.contents=F(t.contents),t.contents.push(n),t.contents.push(i),rc(t.config)&&(a.push(n),a.push(i))}return rc(t.config)&&(r.automaticFunctionCallingHistory=a),r},this.generateContentStream=async e=>{if(this.maybeMoveToResponseJsonSchem(e),$s(e.config)){let t=await this.processParamsMaybeAddMcpUsage(e);return await this.generateContentStreamInternal(t)}let t=nc(e);if(t.length>0){let e=t.map(e=>`tools[${e}]`).join(`, `);throw Error(`Incompatible tools found at ${e}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}let n=e?.config?.toolConfig?.functionCallingConfig?.streamFunctionCallArguments,r=e?.config?.automaticFunctionCalling?.disable;if(n&&!r)throw 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(e)},this.generateImages=async e=>await this.generateImagesInternal(e).then(e=>{let t,n=[];if(e?.generatedImages)for(let r of e.generatedImages)r&&r?.safetyAttributes&&r?.safetyAttributes?.contentType===`Positive Prompt`?t=r?.safetyAttributes:n.push(r);let r;return r=t?{generatedImages:n,positivePromptSafetyAttributes:t,sdkHttpResponse:e.sdkHttpResponse}:{generatedImages:n,sdkHttpResponse:e.sdkHttpResponse},r}),this.list=async e=>{let t={config:Object.assign(Object.assign({},{queryBase:!0}),e?.config)};if(this.apiClient.isVertexAI()&&!t.config.queryBase){if(t.config?.filter)throw Error(`Filtering tuned models list for Vertex AI is not currently supported`);t.config.filter=`labels.tune-type:*`}return new U(H.PAGED_ITEM_MODELS,e=>this.listInternal(e),await this.listInternal(t),t)},this.editImage=async e=>{let t={model:e.model,prompt:e.prompt,referenceImages:[],config:e.config};return e.referenceImages&&e.referenceImages&&(t.referenceImages=e.referenceImages.map(e=>e.toReferenceImageAPI())),await this.editImageInternal(t)},this.upscaleImage=async e=>{let t={numberOfImages:1,mode:`upscale`};e.config&&(t=Object.assign(Object.assign({},t),e.config));let n={model:e.model,image:e.image,upscaleFactor:e.upscaleFactor,config:t};return await this.upscaleImageInternal(n)},this.generateVideos=async e=>{if((e.prompt||e.image||e.video)&&e.source)throw Error(`Source and prompt/image/video are mutually exclusive. Please only use source.`);return this.apiClient.isVertexAI()||(e.video?.uri&&e.video?.videoBytes?e.video={uri:e.video.uri,mimeType:e.video.mimeType}:e.source?.video?.uri&&e.source?.video?.videoBytes&&(e.source.video={uri:e.source.video.uri,mimeType:e.source.video.mimeType})),await this.generateVideosInternal(e)}}maybeMoveToResponseJsonSchem(e){e.config&&e.config.responseSchema&&(e.config.responseJsonSchema||Object.keys(e.config.responseSchema).includes(`$schema`)&&(e.config.responseJsonSchema=e.config.responseSchema,delete e.config.responseSchema))}async processParamsMaybeAddMcpUsage(e){let t=e.config?.tools;if(!t)return e;let n=await Promise.all(t.map(async e=>ec(e)?await e.tool():e)),r={model:e.model,contents:e.contents,config:Object.assign(Object.assign({},e.config),{tools:n})};if(r.config.tools=n,e.config&&e.config.tools&&Fs(e.config.tools)){let t=e.config.httpOptions?.headers??{},n=Object.assign({},t);Object.keys(n).length===0&&(n=this.apiClient.getDefaultHeaders()),Is(n),r.config.httpOptions=Object.assign(Object.assign({},e.config.httpOptions),{headers:n})}return r}async initAfcToolsMap(e){let t=new Map;for(let n of e.config?.tools??[])if(ec(n)){let e=n,r=await e.tool();for(let n of r.functionDeclarations??[]){if(!n.name)throw Error(`Function declaration name is required.`);if(t.has(n.name))throw Error(`Duplicate tool declaration name: ${n.name}`);t.set(n.name,e)}}return t}async processAfcStream(e){let t=e.config?.automaticFunctionCalling?.maximumRemoteCalls??Qs,n=!1,r=0,i=await this.initAfcToolsMap(e);return(function(e,i,a){return G(this,arguments,function*(){for(var o,s,c,l;r<t;){n&&=(r++,!1);let p=yield W(e.processParamsMaybeAddMcpUsage(a)),m=yield W(e.generateContentStreamInternal(p)),h=[],g=[];try{for(var u=!0,d=(s=void 0,K(m)),f;f=yield W(d.next()),o=f.done,!o;u=!0){l=f.value,u=!1;let e=l;if(yield yield W(e),e.candidates&&e.candidates[0]?.content){g.push(e.candidates[0].content);for(let n of e.candidates[0].content.parts??[])if(r<t&&n.functionCall){if(!n.functionCall.name)throw Error(`Function call name was not returned by the model.`);if(i.has(n.functionCall.name)){let e=yield W(i.get(n.functionCall.name).callTool([n.functionCall]));h.push(...e)}else throw Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${i.keys()}, mising tool: ${n.functionCall.name}`)}}}}catch(e){s={error:e}}finally{try{!u&&!o&&(c=d.return)&&(yield W(c.call(d)))}finally{if(s)throw s.error}}if(h.length>0){n=!0;let e=new ct;e.candidates=[{content:{role:`user`,parts:h}}],yield yield W(e);let t=[];t.push(...g),t.push({role:`user`,parts:h}),a.contents=F(a.contents).concat(t)}else break}})})(this,i,e)}async generateContentInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=ka(this.apiClient,e);return n=c(`{model}:generateContent`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ja(e),n=new ct;return Object.assign(n,t),n})}else{let i=Oa(this.apiClient,e);return n=c(`{model}:generateContent`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Aa(e),n=new ct;return Object.assign(n,t),n})}}async generateContentStreamInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=ka(this.apiClient,e);return n=c(`{model}:streamGenerateContent?alt=sse`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.requestStream({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}),t.then(function(t){return G(this,arguments,function*(){var n,r,i,a;try{for(var o=!0,s=K(t),c;c=yield W(s.next()),n=c.done,!n;o=!0){a=c.value,o=!1;let t=a,n=ja(yield W(t.json()),e);n.sdkHttpResponse={headers:t.headers};let r=new ct;Object.assign(r,n),yield yield W(r)}}catch(e){r={error:e}}finally{try{!o&&!n&&(i=s.return)&&(yield W(i.call(s)))}finally{if(r)throw r.error}}})})}else{let i=Oa(this.apiClient,e);return n=c(`{model}:streamGenerateContent?alt=sse`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.requestStream({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}),t.then(function(t){return G(this,arguments,function*(){var n,r,i,a;try{for(var o=!0,s=K(t),c;c=yield W(s.next()),n=c.done,!n;o=!0){a=c.value,o=!1;let t=a,n=Aa(yield W(t.json()),e);n.sdkHttpResponse={headers:t.headers};let r=new ct;Object.assign(r,n),yield yield W(r)}}catch(e){r={error:e}}finally{try{!o&&!n&&(i=s.return)&&(yield W(i.call(s)))}finally{if(r)throw r.error}}})})}}async embedContentInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=va(this.apiClient,e,e);return n=c(pn(e.model)?`{model}:embedContent`:`{model}:predict`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(t=>{let n=ba(t,e),r=new lt;return Object.assign(r,n),r})}else{let i=_a(this.apiClient,e);return n=c(`{model}:batchEmbedContents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ya(e),n=new lt;return Object.assign(n,t),n})}}async generateImagesInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Fa(this.apiClient,e);return n=c(`{model}:predict`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=La(e),n=new ut;return Object.assign(n,t),n})}else{let i=Pa(this.apiClient,e);return n=c(`{model}:predict`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Ia(e),n=new ut;return Object.assign(n,t),n})}}async editImageInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=pa(this.apiClient,e);return n=c(`{model}:predict`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ma(e),n=new dt;return Object.assign(n,t),n})}else throw Error(`This method is only supported by the Vertex AI.`)}async upscaleImageInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Xo(this.apiClient,e);return n=c(`{model}:predict`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Zo(e),n=new ft;return Object.assign(n,t),n})}else throw Error(`This method is only supported by the Vertex AI.`)}async recontextImage(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=wo(this.apiClient,e);return n=c(`{model}:predict`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=To(e),n=new pt;return Object.assign(n,t),n})}else throw Error(`This method is only supported by the Vertex AI.`)}async segmentImage(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Po(this.apiClient,e);return n=c(`{model}:predict`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=Fo(e),n=new mt;return Object.assign(n,t),n})}else throw Error(`This method is only supported by the Vertex AI.`)}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=to(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>vo(e))}else{let i=eo(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>_o(e))}}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=po(this.apiClient,e);return n=c(`{models_url}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ho(e),n=new ht;return Object.assign(n,t),n})}else{let i=fo(this.apiClient,e);return n=c(`{models_url}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=mo(e),n=new ht;return Object.assign(n,t),n})}}async update(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Jo(this.apiClient,e);return n=c(`{model}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`PATCH`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>vo(e))}else{let i=qo(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`PATCH`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>_o(e))}}async delete(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=la(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=da(e),n=new gt;return Object.assign(n,t),n})}else{let i=ca(this.apiClient,e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=ua(e),n=new gt;return Object.assign(n,t),n})}}async countTokens(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=aa(this.apiClient,e);return n=c(`{model}:countTokens`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=sa(e),n=new _t;return Object.assign(n,t),n})}else{let i=ia(this.apiClient,e);return n=c(`{model}:countTokens`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=oa(e),n=new _t;return Object.assign(n,t),n})}}async computeTokens(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Xi(this.apiClient,e);return n=c(`{model}:computeTokens`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=Zi(e),n=new vt;return Object.assign(n,t),n})}else throw Error(`This method is only supported by the Vertex AI.`)}async generateVideosInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=Ua(this.apiClient,e);return n=c(`{model}:predictLongRunning`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=Va(e),n=new yt;return Object.assign(n,t),n})}else{let i=Ha(this.apiClient,e);return n=c(`{model}:predictLongRunning`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=Ba(e),n=new yt;return Object.assign(n,t),n})}}},ac=class extends s{constructor(e){super(),this.apiClient=e}async getVideosOperation(e){let t=e.operation,n=e.config;if(t.name===void 0||t.name===``)throw Error(`Operation name is required.`);if(this.apiClient.isVertexAI()){let e=t.name.split(`/operations/`)[0],r;n&&`httpOptions`in n&&(r=n.httpOptions);let i=await this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:e,config:{httpOptions:r}});return t._fromAPIResponse({apiResponse:i,_isVertexAI:!0})}else{let e=await this.getVideosOperationInternal({operationName:t.name,config:n});return t._fromAPIResponse({apiResponse:e,_isVertexAI:!1})}}async get(e){let t=e.operation,n=e.config;if(t.name===void 0||t.name===``)throw Error(`Operation name is required.`);if(this.apiClient.isVertexAI()){let e=t.name.split(`/operations/`)[0],r;n&&`httpOptions`in n&&(r=n.httpOptions);let i=await this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:e,config:{httpOptions:r}});return t._fromAPIResponse({apiResponse:i,_isVertexAI:!0})}else{let e=await this.getVideosOperationInternal({operationName:t.name,config:n});return t._fromAPIResponse({apiResponse:e,_isVertexAI:!1})}}async getVideosOperationInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=S(e);return n=c(`{operationName}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t}else{let i=x(e);return n=c(`{operationName}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t}}async fetchPredictVideosOperationInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=m(e);return n=c(`{resourceName}:fetchPredictOperation`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t}else throw Error(`This method is only supported by the Vertex AI.`)}};function oc(e){let t={};if(u(e,[`languageCodes`])!==void 0)throw Error(`languageCodes parameter is not supported in Gemini API.`);return t}function sc(e){let t={},n=u(e,[`apiKey`]);if(n!=null&&l(t,[`apiKey`],n),u(e,[`apiKeyConfig`])!==void 0)throw Error(`apiKeyConfig parameter is not supported in Gemini API.`);if(u(e,[`authType`])!==void 0)throw Error(`authType parameter is not supported in Gemini API.`);if(u(e,[`googleServiceAccountConfig`])!==void 0)throw Error(`googleServiceAccountConfig parameter is not supported in Gemini API.`);if(u(e,[`httpBasicAuthConfig`])!==void 0)throw Error(`httpBasicAuthConfig parameter is not supported in Gemini API.`);if(u(e,[`oauthConfig`])!==void 0)throw Error(`oauthConfig parameter is not supported in Gemini API.`);if(u(e,[`oidcConfig`])!==void 0)throw Error(`oidcConfig parameter is not supported in Gemini API.`);return t}function cc(e){let t={},n=u(e,[`data`]);if(n!=null&&l(t,[`data`],n),u(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let r=u(e,[`mimeType`]);return r!=null&&l(t,[`mimeType`],r),t}function lc(e){let t={},n=u(e,[`parts`]);if(n!=null){let e=n;Array.isArray(e)&&(e=e.map(e=>vc(e))),l(t,[`parts`],e)}let r=u(e,[`role`]);return r!=null&&l(t,[`role`],r),t}function uc(e,t,n){let r={},i=u(t,[`expireTime`]);n!==void 0&&i!=null&&l(n,[`expireTime`],i);let a=u(t,[`newSessionExpireTime`]);n!==void 0&&a!=null&&l(n,[`newSessionExpireTime`],a);let o=u(t,[`uses`]);n!==void 0&&o!=null&&l(n,[`uses`],o);let s=u(t,[`liveConnectConstraints`]);n!==void 0&&s!=null&&l(n,[`bidiGenerateContentSetup`],_c(e,s));let c=u(t,[`lockAdditionalFields`]);return n!==void 0&&c!=null&&l(n,[`fieldMask`],c),r}function dc(e,t){let n={},r=u(t,[`config`]);return r!=null&&l(n,[`config`],uc(e,r,n)),n}function fc(e){let t={};if(u(e,[`displayName`])!==void 0)throw Error(`displayName parameter is not supported in Gemini API.`);let n=u(e,[`fileUri`]);n!=null&&l(t,[`fileUri`],n);let r=u(e,[`mimeType`]);return r!=null&&l(t,[`mimeType`],r),t}function pc(e){let t={},n=u(e,[`id`]);n!=null&&l(t,[`id`],n);let r=u(e,[`args`]);r!=null&&l(t,[`args`],r);let i=u(e,[`name`]);if(i!=null&&l(t,[`name`],i),u(e,[`partialArgs`])!==void 0)throw Error(`partialArgs parameter is not supported in Gemini API.`);if(u(e,[`willContinue`])!==void 0)throw Error(`willContinue parameter is not supported in Gemini API.`);return t}function mc(e){let t={},n=u(e,[`authConfig`]);n!=null&&l(t,[`authConfig`],sc(n));let r=u(e,[`enableWidget`]);return r!=null&&l(t,[`enableWidget`],r),t}function hc(e){let t={},n=u(e,[`searchTypes`]);if(n!=null&&l(t,[`searchTypes`],n),u(e,[`blockingConfidence`])!==void 0)throw Error(`blockingConfidence parameter is not supported in Gemini API.`);if(u(e,[`excludeDomains`])!==void 0)throw Error(`excludeDomains parameter is not supported in Gemini API.`);let r=u(e,[`timeRangeFilter`]);return r!=null&&l(t,[`timeRangeFilter`],r),t}function gc(e,t){let n={},r=u(e,[`generationConfig`]);t!==void 0&&r!=null&&l(t,[`setup`,`generationConfig`],r);let i=u(e,[`responseModalities`]);t!==void 0&&i!=null&&l(t,[`setup`,`generationConfig`,`responseModalities`],i);let a=u(e,[`temperature`]);t!==void 0&&a!=null&&l(t,[`setup`,`generationConfig`,`temperature`],a);let o=u(e,[`topP`]);t!==void 0&&o!=null&&l(t,[`setup`,`generationConfig`,`topP`],o);let s=u(e,[`topK`]);t!==void 0&&s!=null&&l(t,[`setup`,`generationConfig`,`topK`],s);let c=u(e,[`maxOutputTokens`]);t!==void 0&&c!=null&&l(t,[`setup`,`generationConfig`,`maxOutputTokens`],c);let d=u(e,[`mediaResolution`]);t!==void 0&&d!=null&&l(t,[`setup`,`generationConfig`,`mediaResolution`],d);let f=u(e,[`seed`]);t!==void 0&&f!=null&&l(t,[`setup`,`generationConfig`,`seed`],f);let p=u(e,[`speechConfig`]);t!==void 0&&p!=null&&l(t,[`setup`,`generationConfig`,`speechConfig`],Xt(p));let m=u(e,[`thinkingConfig`]);t!==void 0&&m!=null&&l(t,[`setup`,`generationConfig`,`thinkingConfig`],m);let h=u(e,[`enableAffectiveDialog`]);t!==void 0&&h!=null&&l(t,[`setup`,`generationConfig`,`enableAffectiveDialog`],h);let g=u(e,[`systemInstruction`]);t!==void 0&&g!=null&&l(t,[`setup`,`systemInstruction`],lc(P(g)));let _=u(e,[`tools`]);if(t!==void 0&&_!=null){let e=R(_);Array.isArray(e)&&(e=e.map(e=>bc(L(e)))),l(t,[`setup`,`tools`],e)}let v=u(e,[`sessionResumption`]);t!==void 0&&v!=null&&l(t,[`setup`,`sessionResumption`],yc(v));let y=u(e,[`inputAudioTranscription`]);t!==void 0&&y!=null&&l(t,[`setup`,`inputAudioTranscription`],oc(y));let b=u(e,[`outputAudioTranscription`]);t!==void 0&&b!=null&&l(t,[`setup`,`outputAudioTranscription`],oc(b));let x=u(e,[`realtimeInputConfig`]);t!==void 0&&x!=null&&l(t,[`setup`,`realtimeInputConfig`],x);let S=u(e,[`contextWindowCompression`]);t!==void 0&&S!=null&&l(t,[`setup`,`contextWindowCompression`],S);let C=u(e,[`proactivity`]);if(t!==void 0&&C!=null&&l(t,[`setup`,`proactivity`],C),u(e,[`explicitVadSignal`])!==void 0)throw Error(`explicitVadSignal parameter is not supported in Gemini API.`);return n}function _c(e,t){let n={},r=u(t,[`model`]);r!=null&&l(n,[`setup`,`model`],N(e,r));let i=u(t,[`config`]);return i!=null&&l(n,[`config`],gc(i,n)),n}function vc(e){let t={},n=u(e,[`mediaResolution`]);n!=null&&l(t,[`mediaResolution`],n);let r=u(e,[`codeExecutionResult`]);r!=null&&l(t,[`codeExecutionResult`],r);let i=u(e,[`executableCode`]);i!=null&&l(t,[`executableCode`],i);let a=u(e,[`fileData`]);a!=null&&l(t,[`fileData`],fc(a));let o=u(e,[`functionCall`]);o!=null&&l(t,[`functionCall`],pc(o));let s=u(e,[`functionResponse`]);s!=null&&l(t,[`functionResponse`],s);let c=u(e,[`inlineData`]);c!=null&&l(t,[`inlineData`],cc(c));let d=u(e,[`text`]);d!=null&&l(t,[`text`],d);let f=u(e,[`thought`]);f!=null&&l(t,[`thought`],f);let p=u(e,[`thoughtSignature`]);p!=null&&l(t,[`thoughtSignature`],p);let m=u(e,[`videoMetadata`]);m!=null&&l(t,[`videoMetadata`],m);let h=u(e,[`toolCall`]);h!=null&&l(t,[`toolCall`],h);let g=u(e,[`toolResponse`]);g!=null&&l(t,[`toolResponse`],g);let _=u(e,[`partMetadata`]);return _!=null&&l(t,[`partMetadata`],_),t}function yc(e){let t={},n=u(e,[`handle`]);if(n!=null&&l(t,[`handle`],n),u(e,[`transparent`])!==void 0)throw Error(`transparent parameter is not supported in Gemini API.`);return t}function bc(e){let t={};if(u(e,[`retrieval`])!==void 0)throw Error(`retrieval parameter is not supported in Gemini API.`);let n=u(e,[`computerUse`]);n!=null&&l(t,[`computerUse`],n);let r=u(e,[`fileSearch`]);r!=null&&l(t,[`fileSearch`],r);let i=u(e,[`googleSearch`]);i!=null&&l(t,[`googleSearch`],hc(i));let a=u(e,[`googleMaps`]);a!=null&&l(t,[`googleMaps`],mc(a));let o=u(e,[`codeExecution`]);if(o!=null&&l(t,[`codeExecution`],o),u(e,[`enterpriseWebSearch`])!==void 0)throw Error(`enterpriseWebSearch parameter is not supported in Gemini API.`);let s=u(e,[`functionDeclarations`]);if(s!=null){let e=s;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`functionDeclarations`],e)}let c=u(e,[`googleSearchRetrieval`]);if(c!=null&&l(t,[`googleSearchRetrieval`],c),u(e,[`parallelAiSearch`])!==void 0)throw Error(`parallelAiSearch parameter is not supported in Gemini API.`);let d=u(e,[`urlContext`]);d!=null&&l(t,[`urlContext`],d);let f=u(e,[`mcpServers`]);if(f!=null){let e=f;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`mcpServers`],e)}return t}function xc(e){let t=[];for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let r=e[n];if(typeof r==`object`&&r&&Object.keys(r).length>0){let e=Object.keys(r).map(e=>`${n}.${e}`);t.push(...e)}else t.push(n)}return t.join(`,`)}function Sc(e,t){let n=null,r=e.bidiGenerateContentSetup;if(typeof r==`object`&&r&&`setup`in r){let t=r.setup;typeof t==`object`&&t?(e.bidiGenerateContentSetup=t,n=t):delete e.bidiGenerateContentSetup}else r!==void 0&&delete e.bidiGenerateContentSetup;let i=e.fieldMask;if(n){let r=xc(n);if(Array.isArray(t?.lockAdditionalFields)&&t?.lockAdditionalFields.length===0)r?e.fieldMask=r:delete e.fieldMask;else if(t?.lockAdditionalFields&&t.lockAdditionalFields.length>0&&i!==null&&Array.isArray(i)&&i.length>0){let t=[`temperature`,`topK`,`topP`,`maxOutputTokens`,`responseModalities`,`seed`,`speechConfig`],n=[];i.length>0&&(n=i.map(e=>t.includes(e)?`generationConfig.${e}`:e));let a=[];r&&a.push(r),n.length>0&&a.push(...n),a.length>0?e.fieldMask=a.join(`,`):delete e.fieldMask}else delete e.fieldMask}else i!==null&&Array.isArray(i)&&i.length>0?e.fieldMask=i.join(`,`):delete e.fieldMask;return e}var Cc=class extends s{constructor(e){super(),this.apiClient=e}async create(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`The client.tokens.create method is only supported by the Gemini Developer API.`);{let i=dc(this.apiClient,e);n=c(`auth_tokens`,i._url),r=i._query,delete i.config,delete i._url,delete i._query;let a=Sc(i,e.config);return t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(a),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}};function wc(e,t){let n={},r=u(e,[`force`]);return t!==void 0&&r!=null&&l(t,[`_query`,`force`],r),n}function Tc(e){let t={},n=u(e,[`name`]);n!=null&&l(t,[`_url`,`name`],n);let r=u(e,[`config`]);return r!=null&&wc(r,t),t}function Ec(e){let t={},n=u(e,[`name`]);return n!=null&&l(t,[`_url`,`name`],n),t}function Dc(e,t){let n={},r=u(e,[`pageSize`]);t!==void 0&&r!=null&&l(t,[`_query`,`pageSize`],r);let i=u(e,[`pageToken`]);return t!==void 0&&i!=null&&l(t,[`_query`,`pageToken`],i),n}function Oc(e){let t={},n=u(e,[`parent`]);n!=null&&l(t,[`_url`,`parent`],n);let r=u(e,[`config`]);return r!=null&&Dc(r,t),t}function kc(e){let t={},n=u(e,[`sdkHttpResponse`]);n!=null&&l(t,[`sdkHttpResponse`],n);let r=u(e,[`nextPageToken`]);r!=null&&l(t,[`nextPageToken`],r);let i=u(e,[`documents`]);if(i!=null){let e=i;Array.isArray(e)&&(e=e.map(e=>e)),l(t,[`documents`],e)}return t}var Ac=class extends s{constructor(e){super(),this.apiClient=e,this.list=async e=>new U(H.PAGED_ITEM_DOCUMENTS,t=>this.listInternal({parent:e.parent,config:t.config}),await this.listInternal(e),e)}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=Ec(e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async delete(e){let t=``,n={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let r=Tc(e);t=c(`{name}`,r._url),n=r._query,delete r._url,delete r._query,await this.apiClient.request({path:t,queryParams:n,body:JSON.stringify(r),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal})}}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=Oc(e);return n=c(`{parent}/documents`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=kc(e),n=new wt;return Object.assign(n,t),n})}}},jc=class extends s{constructor(e,t=new Ac(e)){super(),this.apiClient=e,this.documents=t,this.list=async(e={})=>new U(H.PAGED_ITEM_FILE_SEARCH_STORES,e=>this.listInternal(e),await this.listInternal(e),e)}async uploadToFileSearchStore(e){if(this.apiClient.isVertexAI())throw Error(`Vertex AI does not support uploading files to a file search store.`);return this.apiClient.uploadFileToFileSearchStore(e.fileSearchStoreName,e.file,e.config)}async create(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ss(e);return n=c(`fileSearchStores`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async get(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=us(e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>e)}}async delete(e){let t=``,n={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let r=ls(e);t=c(`{name}`,r._url),n=r._query,delete r._url,delete r._query,await this.apiClient.request({path:t,queryParams:n,body:JSON.stringify(r),httpMethod:`DELETE`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal})}}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=gs(e);return n=c(`fileSearchStores`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=_s(e),n=new Tt;return Object.assign(n,t),n})}}async uploadToFileSearchStoreInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ys(e);return n=c(`upload/v1beta/{file_search_store_name}:uploadToFileSearchStore`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=bs(e),n=new Et;return Object.assign(n,t),n})}}async importFile(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=ps(e);return n=c(`{file_search_store_name}:importFile`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json()),t.then(e=>{let t=fs(e),n=new Dt;return Object.assign(n,t),n})}}},Mc=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Mc=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))},Nc=()=>Mc();function Pc(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Fc=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},Y=class extends Error{},X=class e extends Y{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.error=n}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new Lc({message:r,cause:Fc(n)});let a=n;return t===400?new zc(t,a,r,i):t===401?new Bc(t,a,r,i):t===403?new Vc(t,a,r,i):t===404?new Hc(t,a,r,i):t===409?new Uc(t,a,r,i):t===422?new Wc(t,a,r,i):t===429?new Gc(t,a,r,i):t>=500?new Kc(t,a,r,i):new e(t,a,r,i)}},Ic=class extends X{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},Lc=class extends X{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Rc=class extends Lc{constructor({message:e}={}){super({message:e??`Request timed out.`})}},zc=class extends X{},Bc=class extends X{},Vc=class extends X{},Hc=class extends X{},Uc=class extends X{},Wc=class extends X{},Gc=class extends X{},Kc=class extends X{},qc=/^[a-z][a-z0-9+.-]*:/i,Jc=e=>qc.test(e),Yc=e=>(Yc=Array.isArray,Yc(e)),Xc=Yc;function Zc(e){if(!e)return!0;for(let t in e)return!1;return!0}function Qc(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var $c=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new Y(`${e} must be an integer`);if(t<0)throw new Y(`${e} must be a positive integer`);return t},el=e=>{try{return JSON.parse(e)}catch{return}},tl=e=>new Promise(t=>setTimeout(t,e));function nl(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new GeminiNextGenAPIClient({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function rl(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function il(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return rl({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.call(t)}})}function al(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function ol(e){var t;if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await(t=e[Symbol.asyncIterator]()).return?.call(t);return}let n=e.getReader(),r=n.cancel();n.releaseLock(),await r}var sl=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)});function cl(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new Y(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}var ll=`0.0.1`,ul=()=>{if(typeof File>`u`){let{process:e}=globalThis,t=typeof e?.versions?.node==`string`&&parseInt(e.versions.node.split(`.`))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":``))}};function dl(e,t,n){return ul(),new File(e,t??`unknown_file`,n)}function fl(e){return(typeof e==`object`&&!!e&&(`name`in e&&e.name&&String(e.name)||`url`in e&&e.url&&String(e.url)||`filename`in e&&e.filename&&String(e.filename)||`path`in e&&e.path&&String(e.path))||``).split(/[\\/]/).pop()||void 0}var pl=e=>typeof e==`object`&&!!e&&typeof e[Symbol.asyncIterator]==`function`,ml=e=>typeof e==`object`&&!!e&&typeof e.size==`number`&&typeof e.type==`string`&&typeof e.text==`function`&&typeof e.slice==`function`&&typeof e.arrayBuffer==`function`,hl=e=>typeof e==`object`&&!!e&&typeof e.name==`string`&&typeof e.lastModified==`number`&&ml(e),gl=e=>typeof e==`object`&&!!e&&typeof e.url==`string`&&typeof e.blob==`function`;async function _l(e,t,n){if(ul(),e=await e,hl(e))return e instanceof File?e:dl([await e.arrayBuffer()],e.name);if(gl(e)){let r=await e.blob();return t||=new URL(e.url).pathname.split(/[\\/]/).pop(),dl(await vl(r),t,n)}let r=await vl(e);if(t||=fl(e),!n?.type){let e=r.find(e=>typeof e==`object`&&`type`in e&&e.type);typeof e==`string`&&(n=Object.assign(Object.assign({},n),{type:e}))}return dl(r,t,n)}async function vl(e){var t,n,r,i;let a=[];if(typeof e==`string`||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)a.push(e);else if(ml(e))a.push(e instanceof Blob?e:await e.arrayBuffer());else if(pl(e))try{for(var o=!0,s=K(e),c;c=await s.next(),t=c.done,!t;o=!0){i=c.value,o=!1;let e=i;a.push(...await vl(e))}}catch(e){n={error:e}}finally{try{!o&&!t&&(r=s.return)&&await r.call(s)}finally{if(n)throw n.error}}else{let t=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:``}${yl(e)}`)}return a}function yl(e){return typeof e!=`object`||!e?``:`; props: [${Object.getOwnPropertyNames(e).map(e=>`"${e}"`).join(`, `)}]`}var bl=class{constructor(e){this._client=e}};bl._key=[];function xl(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Sl=Object.freeze(Object.create(null)),Cl=((e=xl)=>(function(t,...n){if(t.length===1)return t[0];let r=!1,i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);let s=n[o],c=(r?encodeURIComponent:e)(``+s);return o!==n.length&&(s==null||typeof s==`object`&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??Sl)??Sl)?.toString)&&(c=s+``,i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?``:c)},``),o=a.split(/[?#]/,1)[0],s=/(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=s.exec(o))!==null;){let e=c[0].startsWith(`/`),t=+!!e,n=e?c[0].slice(1):c[0];i.push({start:c.index+t,length:n.length,error:`Value "${n}" can\'t be safely passed as a path parameter`})}if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0,t=i.reduce((t,n)=>{let r=` `.repeat(n.start-e),i=`^`.repeat(n.length);return e=n.start+n.length,t+r+i},``);throw new Y(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join(`
6
+ `)}\n${a}\n${t}`)}return a}))(xl),wl=class extends bl{create(e,t){let{api_version:n=this._client.apiVersion}=e,r=Jr(e,[`api_version`]);if(`model`in r&&`agent_config`in r)throw new Y("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");if(`agent`in r&&`generation_config`in r)throw new Y("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");return this._client.post(Cl`/${n}/interactions`,Object.assign(Object.assign({body:r},t),{stream:e.stream??!1}))}delete(e,t={},n){let{api_version:r=this._client.apiVersion}=t??{};return this._client.delete(Cl`/${r}/interactions/${e}`,n)}cancel(e,t={},n){let{api_version:r=this._client.apiVersion}=t??{};return this._client.post(Cl`/${r}/interactions/${e}/cancel`,n)}get(e,t={},n){let r=t??{},{api_version:i=this._client.apiVersion}=r,a=Jr(r,[`api_version`]);return this._client.get(Cl`/${i}/interactions/${e}`,Object.assign(Object.assign({query:a},n),{stream:t?.stream??!1}))}};wl._key=Object.freeze([`interactions`]);var Tl=class extends wl{};function El(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}var Dl;function Ol(e){let t;return(Dl??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}var kl;function Al(e){let t;return(kl??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var jl=class{constructor(){this.buffer=new Uint8Array,this.carriageReturnIndex=null,this.searchIndex=0}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?Ol(e):e;this.buffer=El([this.buffer,t]);let n=[],r;for(;(r=Ml(this.buffer,this.carriageReturnIndex??this.searchIndex))!=null;){if(r.carriage&&this.carriageReturnIndex==null){this.carriageReturnIndex=r.index;continue}if(this.carriageReturnIndex!=null&&(r.index!==this.carriageReturnIndex+1||r.carriage)){n.push(Al(this.buffer.subarray(0,this.carriageReturnIndex-1))),this.buffer=this.buffer.subarray(this.carriageReturnIndex),this.carriageReturnIndex=null,this.searchIndex=0;continue}let e=this.carriageReturnIndex===null?r.preceding:r.preceding-1,t=Al(this.buffer.subarray(0,e));n.push(t),this.buffer=this.buffer.subarray(r.index),this.carriageReturnIndex=null,this.searchIndex=0}return this.searchIndex=Math.max(0,this.buffer.length-1),n}flush(){return this.buffer.length?this.decode(`
7
+ `):[]}};jl.NEWLINE_CHARS=new Set([`
8
+ `,`\r`]),jl.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ml(e,t){let n=t??0,r=e.indexOf(10,n),i=e.indexOf(13,n);if(r===-1&&i===-1)return null;let a;return a=r!==-1&&i!==-1?Math.min(r,i):r===-1?i:r,e[a]===10?{preceding:a,index:a+1,carriage:!1}:{preceding:a,index:a+1,carriage:!0}}var Nl={off:0,error:200,warn:300,info:400,debug:500},Pl=(e,t,n)=>{if(e){if(Qc(Nl,e))return e;Z(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Nl))}`)}};function Fl(){}function Il(e,t,n){return!t||Nl[e]>Nl[n]?Fl:t[e].bind(t)}var Ll={error:Fl,warn:Fl,info:Fl,debug:Fl},Rl=new WeakMap;function Z(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Ll;let r=Rl.get(t);if(r&&r[0]===n)return r[1];let i={error:Il(`error`,t,n),warn:Il(`warn`,t,n),info:Il(`info`,t,n),debug:Il(`debug`,t,n)};return Rl.set(t,[n,i]),i}var Q=e=>(e.options&&(e.options=Object.assign({},e.options),delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`x-goog-api-key`||e.toLowerCase()===`authorization`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),zl=class e{constructor(e,t,n){this.iterator=e,this.controller=t,this.client=n}static fromSSEResponse(t,n,r){let i=!1,a=r?Z(r):console;function o(){return G(this,arguments,function*(){var e,r,o,s;if(i)throw new Y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let c=!1;try{try{for(var l=!0,u=K(Bl(t,n)),d;d=yield W(u.next()),e=d.done,!e;l=!0){s=d.value,l=!1;let e=s;if(!c)if(e.data.startsWith(`[DONE]`)){c=!0;continue}else try{yield yield W(JSON.parse(e.data))}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}}}catch(e){r={error:e}}finally{try{!l&&!e&&(o=u.return)&&(yield W(o.call(u)))}finally{if(r)throw r.error}}c=!0}catch(e){if(Pc(e))return yield W(void 0);throw e}finally{c||n.abort()}})}return new e(o,n,r)}static fromReadableStream(t,n,r){let i=!1;function a(){return G(this,arguments,function*(){var e,n,r,i;let a=new jl,o=al(t);try{for(var s=!0,c=K(o),l;l=yield W(c.next()),e=l.done,!e;s=!0){i=l.value,s=!1;let e=i;for(let t of a.decode(e))yield yield W(t)}}catch(e){n={error:e}}finally{try{!s&&!e&&(r=c.return)&&(yield W(r.call(c)))}finally{if(n)throw n.error}}for(let e of a.flush())yield yield W(e)})}function o(){return G(this,arguments,function*(){var e,t,r,o;if(i)throw new Y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let s=!1;try{try{for(var c=!0,l=K(a()),u;u=yield W(l.next()),e=u.done,!e;c=!0){o=u.value,c=!1;let e=o;s||e&&(yield yield W(JSON.parse(e)))}}catch(e){t={error:e}}finally{try{!c&&!e&&(r=l.return)&&(yield W(r.call(l)))}finally{if(t)throw t.error}}s=!0}catch(e){if(Pc(e))return yield W(void 0);throw e}finally{s||n.abort()}})}return new e(o,n,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,this.client),new e(()=>i(n),this.controller,this.client)]}toReadableStream(){let e=this,t;return rl({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=Ol(JSON.stringify(n)+`
9
+ `);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.call(t)}})}};function Bl(e,t){return G(this,arguments,function*(){var n,r,i,a;if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new Y(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new Y(`Attempted to iterate over a response with no body`);let o=new Hl,s=new jl,c=al(e.body);try{for(var l=!0,u=K(Vl(c)),d;d=yield W(u.next()),n=d.done,!n;l=!0){a=d.value,l=!1;let e=a;for(let t of s.decode(e)){let e=o.decode(t);e&&(yield yield W(e))}}}catch(e){r={error:e}}finally{try{!l&&!n&&(i=u.return)&&(yield W(i.call(u)))}finally{if(r)throw r.error}}for(let e of s.flush()){let t=o.decode(e);t&&(yield yield W(t))}})}function Vl(e){return G(this,arguments,function*(){var t,n,r,i;try{for(var a=!0,o=K(e),s;s=yield W(o.next()),t=s.done,!t;a=!0){i=s.value,a=!1;let e=i;e!=null&&(yield yield W(e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?Ol(e):e))}}catch(e){n={error:e}}finally{try{!a&&!t&&(r=o.return)&&(yield W(r.call(o)))}finally{if(n)throw n.error}}})}var Hl=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
10
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],e}if(this.chunks.push(e),e.startsWith(`:`))return null;let[t,n,r]=Ul(e,`:`);return r.startsWith(` `)&&(r=r.substring(1)),t===`event`?this.event=r:t===`data`&&this.data.push(r),null}};function Ul(e,t){let n=e.indexOf(t);return n===-1?[e,``,``]:[e.substring(0,n),t,e.substring(n+t.length)]}async function Wl(e,t){let{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(t.options.stream)return Z(e).debug(`response`,n.status,n.url,n.headers,n.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(n,t.controller,e):zl.fromSSEResponse(n,t.controller,e);if(n.status===204)return null;if(t.options.__binaryResponse)return n;let r=(n.headers.get(`content-type`)?.split(`;`)[0])?.trim();return r?.includes(`application/json`)||r?.endsWith(`+json`)?n.headers.get(`content-length`)===`0`?void 0:await n.json():await n.text()})();return Z(e).debug(`[${r}] response parsed`,Q({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}var Gl=class e extends Promise{constructor(e,t,n=Wl){super(e=>{e(null)}),this.responsePromise=t,this.parseResponse=n,this.client=e}_thenUnwrap(t){return new e(this.client,this.responsePromise,async(e,n)=>t(await this.parseResponse(e,n),n))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t}}parse(){return this.parsedPromise||=this.responsePromise.then(e=>this.parseResponse(this.client,e)),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},Kl=Symbol(`brand.privateNullableHeaders`);function*ql(e){if(!e)return;if(Kl in e){let{values:t,nulls:n}=e;yield*t.entries();for(let e of n)yield[e,null];return}let t=!1,n;e instanceof Headers?n=e.entries():Xc(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let e of n){let n=e[0];if(typeof n!=`string`)throw TypeError(`expected header name to be a string`);let r=Xc(e[1])?e[1]:[e[1]],i=!1;for(let e of r)e!==void 0&&(t&&!i&&(i=!0,yield[n,null]),yield[n,e])}}var Jl=e=>{let t=new Headers,n=new Set;for(let r of e){let e=new Set;for(let[i,a]of ql(r)){let r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),a===null?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[Kl]:!0,values:t,nulls:n}},Yl=e=>{var t;if(globalThis.process!==void 0)return({}?.[e])?.trim()??void 0;if(globalThis.Deno!==void 0)return(((t=globalThis.Deno.env)?.get)?.call(t,e))?.trim()},Xl,Zl=class e{constructor(t){var{baseURL:n=Yl(`GEMINI_NEXT_GEN_API_BASE_URL`),apiKey:r=Yl(`GEMINI_API_KEY`)??null,apiVersion:i=`v1beta`}=t,a=Jr(t,[`baseURL`,`apiKey`,`apiVersion`]);let o=Object.assign(Object.assign({apiKey:r,apiVersion:i},a),{baseURL:n||`https://generativelanguage.googleapis.com`});this.baseURL=o.baseURL,this.timeout=o.timeout??e.DEFAULT_TIMEOUT,this.logger=o.logger??console;let s=`warn`;this.logLevel=s,this.logLevel=Pl(o.logLevel,`ClientOptions.logLevel`,this)??Pl(Yl(`GEMINI_NEXT_GEN_API_LOG`),`process.env['GEMINI_NEXT_GEN_API_LOG']`,this)??s,this.fetchOptions=o.fetchOptions,this.maxRetries=o.maxRetries??2,this.fetch=o.fetch??nl(),this.encoder=sl,this._options=o,this.apiKey=r,this.apiVersion=i,this.clientAdapter=o.clientAdapter}withOptions(e){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),e))}baseURLOverridden(){return this.baseURL!==`https://generativelanguage.googleapis.com`}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(e.has(`authorization`)||e.has(`x-goog-api-key`))&&!(this.apiKey&&e.get(`x-goog-api-key`))&&!t.has(`x-goog-api-key`))throw Error(`Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted`)}async authHeaders(e){let t=Jl([e.headers]);if(!(t.values.has(`authorization`)||t.values.has(`x-goog-api-key`))){if(this.apiKey)return Jl([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return Jl([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(e){return cl(e)}getUserAgent(){return`${this.constructor.name}/JS ${ll}`}defaultIdempotencyKey(){return`stainless-node-retry-${Nc()}`}makeStatusError(e,t,n,r){return X.generate(e,t,n,r)}buildURL(e,t,n){let r=!this.baseURLOverridden()&&n||this.baseURL,i=Jc(e)?new URL(e):new URL(r+(r.endsWith(`/`)&&e.startsWith(`/`)?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return(!Zc(a)||!Zc(o))&&(t=Object.assign(Object.assign(Object.assign({},o),a),t)),typeof t==`object`&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}async prepareOptions(e){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!e.path.startsWith(`/${this.apiVersion}/projects/`)){let t=e.path.slice(this.apiVersion.length+1);e.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${t}`}}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest(`get`,e,t)}post(e,t){return this.methodRequest(`post`,e,t)}patch(e,t){return this.methodRequest(`patch`,e,t)}put(e,t){return this.methodRequest(`put`,e,t)}delete(e,t){return this.methodRequest(`delete`,e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>Object.assign({method:e,path:t},n)))}request(e,t=null){return new Gl(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,i=r.maxRetries??this.maxRetries;t??=i,await this.prepareOptions(r);let{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});let c=`log_`+(Math.random()*(1<<24)|0).toString(16).padStart(6,`0`),l=n===void 0?``:`, retryOf: ${n}`,u=Date.now();if(Z(this).debug(`[${c}] sending request`,Q({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new Ic;let d=new AbortController,f=await this.fetchWithTimeout(o,a,s,d).catch(Fc),p=Date.now();if(f instanceof globalThis.Error){let e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new Ic;let i=Pc(f)||/timed? ?out/i.test(String(f)+(`cause`in f?String(f.cause):``));if(t)return Z(this).info(`[${c}] connection ${i?`timed out`:`failed`} - ${e}`),Z(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (${e})`,Q({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),this.retryRequest(r,t,n??c);throw Z(this).info(`[${c}] connection ${i?`timed out`:`failed`} - error; no more retries left`),Z(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (error; no more retries left)`,Q({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),i?new Rc:new Lc({cause:f})}let m=`[${c}${l}] ${a.method} ${o} ${f.ok?`succeeded`:`failed`} with status ${f.status} in ${p-u}ms`;if(!f.ok){let e=await this.shouldRetry(f);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await ol(f.body),Z(this).info(`${m} - ${e}`),Z(this).debug(`[${c}] response error (${e})`,Q({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:p-u})),this.retryRequest(r,t,n??c,f.headers)}let i=e?`error; no more retries left`:`error; not retryable`;Z(this).info(`${m} - ${i}`);let a=await f.text().catch(e=>Fc(e).message),o=el(a),s=o?void 0:a;throw Z(this).debug(`[${c}] response error (${i})`,Q({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,message:s,durationMs:Date.now()-u})),this.makeStatusError(f.status,o,s,f.headers)}return Z(this).info(m),Z(this).debug(`[${c}] response start`,Q({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:p-u})),{response:f,options:r,controller:d,requestLogID:c,retryOfRequestLogID:n,startTime:u}}async fetchWithTimeout(e,t,n,r){let i=t||{},{signal:a,method:o}=i,s=Jr(i,[`signal`,`method`]),c=this._makeAbort(r);a&&a.addEventListener(`abort`,c,{once:!0});let l=setTimeout(c,n),u=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body==`object`&&s.body!==null&&Symbol.asyncIterator in s.body,d=Object.assign(Object.assign(Object.assign({signal:r.signal},u?{duplex:`half`}:{}),{method:`GET`}),s);o&&(d.method=o.toUpperCase());try{return await this.fetch.call(void 0,e,d)}finally{clearTimeout(l)}}async shouldRetry(e){let t=e.headers.get(`x-should-retry`);return t===`true`?!0:t===`false`?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,n,r){let i,a=r?.get(`retry-after-ms`);if(a){let e=parseFloat(a);Number.isNaN(e)||(i=e)}let o=r?.get(`retry-after`);if(o&&!i){let e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():e*1e3}if(i===void 0){let n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}return await tl(i),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e;return Math.min(.5*2**n,8)*(1-Math.random()*.25)*1e3}async buildRequest(e,{retryCount:t=0}={}){let n=Object.assign({},e),{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);`timeout`in n&&$c(`timeout`,n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n}),u=await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:r,headers:u},n.signal&&{signal:n.signal}),globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:`half`}),l&&{body:l}),this.fetchOptions??{}),n.fetchOptions??{}),url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&t!==`get`&&(e.idempotencyKey||=this.defaultIdempotencyKey(),i[this.idempotencyHeader]=e.idempotencyKey);let a=await this.authHeaders(e),o=Jl([i,{Accept:`application/json`,"User-Agent":this.getUserAgent()},this._options.defaultHeaders,n,e.headers,a]);return this.validateHeaders(o),o.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=Jl([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==`string`&&n.values.has(`content-type`)||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e==`object`&&(Symbol.asyncIterator in e||Symbol.iterator in e&&`next`in e&&typeof e.next==`function`)?{bodyHeaders:void 0,body:il(e)}:typeof e==`object`&&n.values.get(`content-type`)===`application/x-www-form-urlencoded`?{bodyHeaders:{"content-type":`application/x-www-form-urlencoded`},body:this.stringifyQuery(e)}:this.encoder({body:e,headers:n})}};Zl.DEFAULT_TIMEOUT=6e4;var $=class extends Zl{constructor(){super(...arguments),this.interactions=new Tl(this)}};Xl=$,$.GeminiNextGenAPIClient=Xl,$.GeminiNextGenAPIClientError=Y,$.APIError=X,$.APIConnectionError=Lc,$.APIConnectionTimeoutError=Rc,$.APIUserAbortError=Ic,$.NotFoundError=Hc,$.ConflictError=Uc,$.RateLimitError=Gc,$.BadRequestError=zc,$.AuthenticationError=Bc,$.InternalServerError=Kc,$.PermissionDeniedError=Vc,$.UnprocessableEntityError=Wc,$.toFile=_l,$.Interactions=Tl;function Ql(e,t){let n={},r=u(e,[`name`]);return r!=null&&l(n,[`_url`,`name`],r),n}function $l(e,t){let n={},r=u(e,[`name`]);return r!=null&&l(n,[`_url`,`name`],r),n}function eu(e,t){let n={},r=u(e,[`sdkHttpResponse`]);return r!=null&&l(n,[`sdkHttpResponse`],r),n}function tu(e,t){let n={},r=u(e,[`sdkHttpResponse`]);return r!=null&&l(n,[`sdkHttpResponse`],r),n}function nu(e,t,n){let r={};if(u(e,[`validationDataset`])!==void 0)throw Error(`validationDataset parameter is not supported in Gemini API.`);let i=u(e,[`tunedModelDisplayName`]);if(t!==void 0&&i!=null&&l(t,[`displayName`],i),u(e,[`description`])!==void 0)throw Error(`description parameter is not supported in Gemini API.`);let a=u(e,[`epochCount`]);t!==void 0&&a!=null&&l(t,[`tuningTask`,`hyperparameters`,`epochCount`],a);let o=u(e,[`learningRateMultiplier`]);if(o!=null&&l(r,[`tuningTask`,`hyperparameters`,`learningRateMultiplier`],o),u(e,[`exportLastCheckpointOnly`])!==void 0)throw Error(`exportLastCheckpointOnly parameter is not supported in Gemini API.`);if(u(e,[`preTunedModelCheckpointId`])!==void 0)throw Error(`preTunedModelCheckpointId parameter is not supported in Gemini API.`);if(u(e,[`adapterSize`])!==void 0)throw Error(`adapterSize parameter is not supported in Gemini API.`);if(u(e,[`tuningMode`])!==void 0)throw Error(`tuningMode parameter is not supported in Gemini API.`);if(u(e,[`customBaseModel`])!==void 0)throw Error(`customBaseModel parameter is not supported in Gemini API.`);let s=u(e,[`batchSize`]);t!==void 0&&s!=null&&l(t,[`tuningTask`,`hyperparameters`,`batchSize`],s);let c=u(e,[`learningRate`]);if(t!==void 0&&c!=null&&l(t,[`tuningTask`,`hyperparameters`,`learningRate`],c),u(e,[`labels`])!==void 0)throw Error(`labels parameter is not supported in Gemini API.`);if(u(e,[`beta`])!==void 0)throw Error(`beta parameter is not supported in Gemini API.`);if(u(e,[`baseTeacherModel`])!==void 0)throw Error(`baseTeacherModel parameter is not supported in Gemini API.`);if(u(e,[`tunedTeacherModelSource`])!==void 0)throw Error(`tunedTeacherModelSource parameter is not supported in Gemini API.`);if(u(e,[`sftLossWeightMultiplier`])!==void 0)throw Error(`sftLossWeightMultiplier parameter is not supported in Gemini API.`);if(u(e,[`outputUri`])!==void 0)throw Error(`outputUri parameter is not supported in Gemini API.`);if(u(e,[`encryptionSpec`])!==void 0)throw Error(`encryptionSpec parameter is not supported in Gemini API.`);return r}function ru(e,t,n){let r={},i=u(n,[`config`,`method`]);if(i===void 0&&(i=`SUPERVISED_FINE_TUNING`),i===`SUPERVISED_FINE_TUNING`){let n=u(e,[`validationDataset`]);t!==void 0&&n!=null&&l(t,[`supervisedTuningSpec`],bu(n))}else if(i===`PREFERENCE_TUNING`){let n=u(e,[`validationDataset`]);t!==void 0&&n!=null&&l(t,[`preferenceOptimizationSpec`],bu(n))}else if(i===`DISTILLATION`){let n=u(e,[`validationDataset`]);t!==void 0&&n!=null&&l(t,[`distillationSpec`],bu(n))}let a=u(e,[`tunedModelDisplayName`]);t!==void 0&&a!=null&&l(t,[`tunedModelDisplayName`],a);let o=u(e,[`description`]);t!==void 0&&o!=null&&l(t,[`description`],o);let s=u(n,[`config`,`method`]);if(s===void 0&&(s=`SUPERVISED_FINE_TUNING`),s===`SUPERVISED_FINE_TUNING`){let n=u(e,[`epochCount`]);t!==void 0&&n!=null&&l(t,[`supervisedTuningSpec`,`hyperParameters`,`epochCount`],n)}else if(s===`PREFERENCE_TUNING`){let n=u(e,[`epochCount`]);t!==void 0&&n!=null&&l(t,[`preferenceOptimizationSpec`,`hyperParameters`,`epochCount`],n)}else if(s===`DISTILLATION`){let n=u(e,[`epochCount`]);t!==void 0&&n!=null&&l(t,[`distillationSpec`,`hyperParameters`,`epochCount`],n)}let c=u(n,[`config`,`method`]);if(c===void 0&&(c=`SUPERVISED_FINE_TUNING`),c===`SUPERVISED_FINE_TUNING`){let n=u(e,[`learningRateMultiplier`]);t!==void 0&&n!=null&&l(t,[`supervisedTuningSpec`,`hyperParameters`,`learningRateMultiplier`],n)}else if(c===`PREFERENCE_TUNING`){let n=u(e,[`learningRateMultiplier`]);t!==void 0&&n!=null&&l(t,[`preferenceOptimizationSpec`,`hyperParameters`,`learningRateMultiplier`],n)}else if(c===`DISTILLATION`){let n=u(e,[`learningRateMultiplier`]);t!==void 0&&n!=null&&l(t,[`distillationSpec`,`hyperParameters`,`learningRateMultiplier`],n)}let d=u(n,[`config`,`method`]);if(d===void 0&&(d=`SUPERVISED_FINE_TUNING`),d===`SUPERVISED_FINE_TUNING`){let n=u(e,[`exportLastCheckpointOnly`]);t!==void 0&&n!=null&&l(t,[`supervisedTuningSpec`,`exportLastCheckpointOnly`],n)}else if(d===`PREFERENCE_TUNING`){let n=u(e,[`exportLastCheckpointOnly`]);t!==void 0&&n!=null&&l(t,[`preferenceOptimizationSpec`,`exportLastCheckpointOnly`],n)}else if(d===`DISTILLATION`){let n=u(e,[`exportLastCheckpointOnly`]);t!==void 0&&n!=null&&l(t,[`distillationSpec`,`exportLastCheckpointOnly`],n)}let f=u(n,[`config`,`method`]);if(f===void 0&&(f=`SUPERVISED_FINE_TUNING`),f===`SUPERVISED_FINE_TUNING`){let n=u(e,[`adapterSize`]);t!==void 0&&n!=null&&l(t,[`supervisedTuningSpec`,`hyperParameters`,`adapterSize`],n)}else if(f===`PREFERENCE_TUNING`){let n=u(e,[`adapterSize`]);t!==void 0&&n!=null&&l(t,[`preferenceOptimizationSpec`,`hyperParameters`,`adapterSize`],n)}else if(f===`DISTILLATION`){let n=u(e,[`adapterSize`]);t!==void 0&&n!=null&&l(t,[`distillationSpec`,`hyperParameters`,`adapterSize`],n)}let p=u(n,[`config`,`method`]);if(p===void 0&&(p=`SUPERVISED_FINE_TUNING`),p===`SUPERVISED_FINE_TUNING`){let n=u(e,[`tuningMode`]);t!==void 0&&n!=null&&l(t,[`supervisedTuningSpec`,`tuningMode`],n)}else if(p===`DISTILLATION`){let n=u(e,[`tuningMode`]);t!==void 0&&n!=null&&l(t,[`distillationSpec`,`tuningMode`],n)}let m=u(e,[`customBaseModel`]);t!==void 0&&m!=null&&l(t,[`customBaseModel`],m);let h=u(n,[`config`,`method`]);if(h===void 0&&(h=`SUPERVISED_FINE_TUNING`),h===`SUPERVISED_FINE_TUNING`){let n=u(e,[`batchSize`]);t!==void 0&&n!=null&&l(t,[`supervisedTuningSpec`,`hyperParameters`,`batchSize`],n)}else if(h===`DISTILLATION`){let n=u(e,[`batchSize`]);t!==void 0&&n!=null&&l(t,[`distillationSpec`,`hyperParameters`,`batchSize`],n)}let g=u(n,[`config`,`method`]);if(g===void 0&&(g=`SUPERVISED_FINE_TUNING`),g===`SUPERVISED_FINE_TUNING`){let n=u(e,[`learningRate`]);t!==void 0&&n!=null&&l(t,[`supervisedTuningSpec`,`hyperParameters`,`learningRate`],n)}else if(g===`DISTILLATION`){let n=u(e,[`learningRate`]);t!==void 0&&n!=null&&l(t,[`distillationSpec`,`hyperParameters`,`learningRate`],n)}let _=u(e,[`labels`]);t!==void 0&&_!=null&&l(t,[`labels`],_);let v=u(e,[`beta`]);t!==void 0&&v!=null&&l(t,[`preferenceOptimizationSpec`,`hyperParameters`,`beta`],v);let y=u(e,[`baseTeacherModel`]);t!==void 0&&y!=null&&l(t,[`distillationSpec`,`baseTeacherModel`],y);let b=u(e,[`tunedTeacherModelSource`]);t!==void 0&&b!=null&&l(t,[`distillationSpec`,`tunedTeacherModelSource`],b);let x=u(e,[`sftLossWeightMultiplier`]);t!==void 0&&x!=null&&l(t,[`distillationSpec`,`hyperParameters`,`sftLossWeightMultiplier`],x);let S=u(e,[`outputUri`]);t!==void 0&&S!=null&&l(t,[`outputUri`],S);let C=u(e,[`encryptionSpec`]);return t!==void 0&&C!=null&&l(t,[`encryptionSpec`],C),r}function iu(e,t){let n={},r=u(e,[`baseModel`]);r!=null&&l(n,[`baseModel`],r);let i=u(e,[`preTunedModel`]);i!=null&&l(n,[`preTunedModel`],i);let a=u(e,[`trainingDataset`]);a!=null&&hu(a);let o=u(e,[`config`]);return o!=null&&nu(o,n),n}function au(e,t){let n={},r=u(e,[`baseModel`]);r!=null&&l(n,[`baseModel`],r);let i=u(e,[`preTunedModel`]);i!=null&&l(n,[`preTunedModel`],i);let a=u(e,[`trainingDataset`]);a!=null&&gu(a,n,t);let o=u(e,[`config`]);return o!=null&&ru(o,n,t),n}function ou(e,t){let n={},r=u(e,[`name`]);return r!=null&&l(n,[`_url`,`name`],r),n}function su(e,t){let n={},r=u(e,[`name`]);return r!=null&&l(n,[`_url`,`name`],r),n}function cu(e,t,n){let r={},i=u(e,[`pageSize`]);t!==void 0&&i!=null&&l(t,[`_query`,`pageSize`],i);let a=u(e,[`pageToken`]);t!==void 0&&a!=null&&l(t,[`_query`,`pageToken`],a);let o=u(e,[`filter`]);return t!==void 0&&o!=null&&l(t,[`_query`,`filter`],o),r}function lu(e,t,n){let r={},i=u(e,[`pageSize`]);t!==void 0&&i!=null&&l(t,[`_query`,`pageSize`],i);let a=u(e,[`pageToken`]);t!==void 0&&a!=null&&l(t,[`_query`,`pageToken`],a);let o=u(e,[`filter`]);return t!==void 0&&o!=null&&l(t,[`_query`,`filter`],o),r}function uu(e,t){let n={},r=u(e,[`config`]);return r!=null&&cu(r,n),n}function du(e,t){let n={},r=u(e,[`config`]);return r!=null&&lu(r,n),n}function fu(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`nextPageToken`]);i!=null&&l(n,[`nextPageToken`],i);let a=u(e,[`tunedModels`]);if(a!=null){let e=a;Array.isArray(e)&&(e=e.map(e=>_u(e))),l(n,[`tuningJobs`],e)}return n}function pu(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`nextPageToken`]);i!=null&&l(n,[`nextPageToken`],i);let a=u(e,[`tuningJobs`]);if(a!=null){let e=a;Array.isArray(e)&&(e=e.map(e=>vu(e))),l(n,[`tuningJobs`],e)}return n}function mu(e,t){let n={},r=u(e,[`name`]);r!=null&&l(n,[`model`],r);let i=u(e,[`name`]);return i!=null&&l(n,[`endpoint`],i),n}function hu(e,t){let n={};if(u(e,[`gcsUri`])!==void 0)throw Error(`gcsUri parameter is not supported in Gemini API.`);if(u(e,[`vertexDatasetResource`])!==void 0)throw Error(`vertexDatasetResource parameter is not supported in Gemini API.`);let r=u(e,[`examples`]);if(r!=null){let e=r;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`examples`,`examples`],e)}return n}function gu(e,t,n){let r={},i=u(n,[`config`,`method`]);if(i===void 0&&(i=`SUPERVISED_FINE_TUNING`),i===`SUPERVISED_FINE_TUNING`){let n=u(e,[`gcsUri`]);t!==void 0&&n!=null&&l(t,[`supervisedTuningSpec`,`trainingDatasetUri`],n)}else if(i===`PREFERENCE_TUNING`){let n=u(e,[`gcsUri`]);t!==void 0&&n!=null&&l(t,[`preferenceOptimizationSpec`,`trainingDatasetUri`],n)}else if(i===`DISTILLATION`){let n=u(e,[`gcsUri`]);t!==void 0&&n!=null&&l(t,[`distillationSpec`,`promptDatasetUri`],n)}let a=u(n,[`config`,`method`]);if(a===void 0&&(a=`SUPERVISED_FINE_TUNING`),a===`SUPERVISED_FINE_TUNING`){let n=u(e,[`vertexDatasetResource`]);t!==void 0&&n!=null&&l(t,[`supervisedTuningSpec`,`trainingDatasetUri`],n)}else if(a===`PREFERENCE_TUNING`){let n=u(e,[`vertexDatasetResource`]);t!==void 0&&n!=null&&l(t,[`preferenceOptimizationSpec`,`trainingDatasetUri`],n)}else if(a===`DISTILLATION`){let n=u(e,[`vertexDatasetResource`]);t!==void 0&&n!=null&&l(t,[`distillationSpec`,`promptDatasetUri`],n)}if(u(e,[`examples`])!==void 0)throw Error(`examples parameter is not supported in Vertex AI.`);return r}function _u(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`name`]);i!=null&&l(n,[`name`],i);let a=u(e,[`state`]);a!=null&&l(n,[`state`],Qt(a));let o=u(e,[`createTime`]);o!=null&&l(n,[`createTime`],o);let s=u(e,[`tuningTask`,`startTime`]);s!=null&&l(n,[`startTime`],s);let c=u(e,[`tuningTask`,`completeTime`]);c!=null&&l(n,[`endTime`],c);let d=u(e,[`updateTime`]);d!=null&&l(n,[`updateTime`],d);let f=u(e,[`description`]);f!=null&&l(n,[`description`],f);let p=u(e,[`baseModel`]);p!=null&&l(n,[`baseModel`],p);let m=u(e,[`_self`]);return m!=null&&l(n,[`tunedModel`],mu(m)),n}function vu(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`name`]);i!=null&&l(n,[`name`],i);let a=u(e,[`state`]);a!=null&&l(n,[`state`],Qt(a));let o=u(e,[`createTime`]);o!=null&&l(n,[`createTime`],o);let s=u(e,[`startTime`]);s!=null&&l(n,[`startTime`],s);let c=u(e,[`endTime`]);c!=null&&l(n,[`endTime`],c);let d=u(e,[`updateTime`]);d!=null&&l(n,[`updateTime`],d);let f=u(e,[`error`]);f!=null&&l(n,[`error`],f);let p=u(e,[`description`]);p!=null&&l(n,[`description`],p);let m=u(e,[`baseModel`]);m!=null&&l(n,[`baseModel`],m);let h=u(e,[`tunedModel`]);h!=null&&l(n,[`tunedModel`],h);let g=u(e,[`preTunedModel`]);g!=null&&l(n,[`preTunedModel`],g);let _=u(e,[`supervisedTuningSpec`]);_!=null&&l(n,[`supervisedTuningSpec`],_);let v=u(e,[`preferenceOptimizationSpec`]);v!=null&&l(n,[`preferenceOptimizationSpec`],v);let y=u(e,[`distillationSpec`]);y!=null&&l(n,[`distillationSpec`],y);let b=u(e,[`tuningDataStats`]);b!=null&&l(n,[`tuningDataStats`],b);let x=u(e,[`encryptionSpec`]);x!=null&&l(n,[`encryptionSpec`],x);let S=u(e,[`partnerModelTuningSpec`]);S!=null&&l(n,[`partnerModelTuningSpec`],S);let C=u(e,[`customBaseModel`]);C!=null&&l(n,[`customBaseModel`],C);let w=u(e,[`evaluateDatasetRuns`]);if(w!=null){let e=w;Array.isArray(e)&&(e=e.map(e=>e)),l(n,[`evaluateDatasetRuns`],e)}let T=u(e,[`experiment`]);T!=null&&l(n,[`experiment`],T);let E=u(e,[`fullFineTuningSpec`]);E!=null&&l(n,[`fullFineTuningSpec`],E);let D=u(e,[`labels`]);D!=null&&l(n,[`labels`],D);let O=u(e,[`outputUri`]);O!=null&&l(n,[`outputUri`],O);let k=u(e,[`pipelineJob`]);k!=null&&l(n,[`pipelineJob`],k);let A=u(e,[`serviceAccount`]);A!=null&&l(n,[`serviceAccount`],A);let j=u(e,[`tunedModelDisplayName`]);j!=null&&l(n,[`tunedModelDisplayName`],j);let M=u(e,[`tuningJobState`]);M!=null&&l(n,[`tuningJobState`],M);let ee=u(e,[`veoTuningSpec`]);ee!=null&&l(n,[`veoTuningSpec`],ee);let te=u(e,[`distillationSamplingSpec`]);te!=null&&l(n,[`distillationSamplingSpec`],te);let ne=u(e,[`tuningJobMetadata`]);return ne!=null&&l(n,[`tuningJobMetadata`],ne),n}function yu(e,t){let n={},r=u(e,[`sdkHttpResponse`]);r!=null&&l(n,[`sdkHttpResponse`],r);let i=u(e,[`name`]);i!=null&&l(n,[`name`],i);let a=u(e,[`metadata`]);a!=null&&l(n,[`metadata`],a);let o=u(e,[`done`]);o!=null&&l(n,[`done`],o);let s=u(e,[`error`]);return s!=null&&l(n,[`error`],s),n}function bu(e,t){let n={},r=u(e,[`gcsUri`]);r!=null&&l(n,[`validationDatasetUri`],r);let i=u(e,[`vertexDatasetResource`]);return i!=null&&l(n,[`validationDatasetUri`],i),n}var xu=class extends s{constructor(e){super(),this.apiClient=e,this.list=async(e={})=>new U(H.PAGED_ITEM_TUNING_JOBS,e=>this.listInternal(e),await this.listInternal(e),e),this.get=async e=>await this.getInternal(e),this.tune=async e=>{if(this.apiClient.isVertexAI())if(e.baseModel.startsWith(`projects/`)){let t={tunedModelName:e.baseModel};e.config?.preTunedModelCheckpointId&&(t.checkpointId=e.config.preTunedModelCheckpointId);let n=Object.assign(Object.assign({},e),{preTunedModel:t});return n.baseModel=void 0,await this.tuneInternal(n)}else{let t=Object.assign({},e);return await this.tuneInternal(t)}else{let t=Object.assign({},e),n=await this.tuneMldevInternal(t),r=``;return n.metadata!==void 0&&n.metadata.tunedModel!==void 0?r=n.metadata.tunedModel:n.name!==void 0&&n.name.includes(`/operations/`)&&(r=n.name.split(`/operations/`)[0]),{name:r,state:Te.JOB_STATE_QUEUED}}}}async getInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=su(e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>vu(e))}else{let i=ou(e);return n=c(`{name}`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>_u(e))}}async listInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=du(e);return n=c(`tuningJobs`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=pu(e),n=new bt;return Object.assign(n,t),n})}else{let i=uu(e);return n=c(`tunedModels`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`GET`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=fu(e),n=new bt;return Object.assign(n,t),n})}}async cancel(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=$l(e);return n=c(`{name}:cancel`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=tu(e),n=new xt;return Object.assign(n,t),n})}else{let i=Ql(e);return n=c(`{name}:cancel`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>{let t=eu(e),n=new xt;return Object.assign(n,t),n})}}async tuneInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI()){let i=au(e,e);return n=c(`tuningJobs`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>vu(e))}else throw Error(`This method is only supported by the Vertex AI.`)}async tuneMldevInternal(e){let t,n=``,r={};if(this.apiClient.isVertexAI())throw Error(`This method is only supported by the Gemini Developer API.`);{let i=iu(e);return n=c(`tunedModels`,i._url),r=i._query,delete i._url,delete i._query,t=this.apiClient.request({path:n,queryParams:r,body:JSON.stringify(i),httpMethod:`POST`,httpOptions:e.config?.httpOptions,abortSignal:e.config?.abortSignal}).then(e=>e.json().then(t=>{let n=t;return n.sdkHttpResponse={headers:e.headers},n})),t.then(e=>yu(e))}}},Su=class{async download(e,t){throw Error(`Download to file is not supported in the browser, please use a browser compliant download like an <a> tag.`)}},Cu=1024*1024*8,wu=3,Tu=1e3,Eu=2,Du=`x-goog-upload-status`;async function Ou(e,t,n,r){let i=await Au(e,t,n,r),a=await i?.json();if(i?.headers?.[Du]!==`final`)throw Error(`Failed to upload file: Upload status is not finalized.`);return a.file}async function ku(e,t,n,r){let i=await Au(e,t,n,r),a=await i?.json();if(i?.headers?.[Du]!==`final`)throw Error(`Failed to upload file: Upload status is not finalized.`);let o=T(a),s=new Ft;return Object.assign(s,o),s}async function Au(e,t,n,r){let i=t,a=r?.baseUrl||n.clientOptions.httpOptions?.baseUrl;if(a){let e=new URL(a),n=new URL(t);n.protocol=e.protocol,n.host=e.host,n.port=e.port,i=n.toString()}let o=0,s=0,c=new st(new Response),l=`upload`;for(o=e.size;s<o;){let t=Math.min(Cu,o-s),a=e.slice(s,s+t);s+t>=o&&(l+=`, finalize`);let u=0,d=Tu;for(;u<wu;){let e=Object.assign(Object.assign({},r?.headers||{}),{"X-Goog-Upload-Command":l,"X-Goog-Upload-Offset":String(s),"Content-Length":String(t)});if(c=await n.request({path:``,body:a,httpMethod:`POST`,httpOptions:Object.assign(Object.assign({},r),{apiVersion:``,baseUrl:i,headers:e})}),c?.headers?.[Du])break;u++,await Mu(d),d*=Eu}if(s+=t,c?.headers?.[Du]!==`active`)break;if(o<=s)throw Error(`All content has been uploaded, but the upload status is not finalized.`)}return c}async function ju(e){return{size:e.size,type:e.type}}function Mu(e){return new Promise(t=>setTimeout(t,e))}var Nu=class{async upload(e,t,n,r){if(typeof e==`string`)throw Error(`File path is not supported in browser uploader.`);return await Ou(e,t,n,r)}async uploadToFileSearchStore(e,t,n,r){if(typeof e==`string`)throw Error(`File path is not supported in browser uploader.`);return await ku(e,t,n,r)}async stat(e){if(typeof e==`string`)throw Error(`File path is not supported in browser uploader.`);return await ju(e)}},Pu=class{create(e,t,n){return new Fu(e,t,n)}},Fu=class{constructor(e,t,n){this.url=e,this.headers=t,this.callbacks=n}connect(){this.ws=new WebSocket(this.url),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(e){if(this.ws===void 0)throw Error(`WebSocket is not connected`);this.ws.send(e)}close(){if(this.ws===void 0)throw Error(`WebSocket is not connected`);this.ws.close()}},Iu=`x-goog-api-key`,Lu=class{constructor(e){this.apiKey=e}async addAuthHeaders(e,t){if(e.get(Iu)===null){if(this.apiKey.startsWith(`auth_tokens/`))throw Error(`Ephemeral tokens are only supported by the live API.`);if(!this.apiKey)throw Error(`API key is missing. Please provide a valid API key.`);e.append(Iu,this.apiKey)}}},Ru=`gl-node/`,zu=class{get interactions(){if(this._interactions!==void 0)return this._interactions;console.warn(`GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.`);let e=this.httpOptions;return e?.extraBody&&console.warn(`GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.`),this._interactions=new $({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,apiVersion:this.apiClient.getApiVersion(),clientAdapter:this.apiClient,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:e?.timeout,maxRetries:e?.retryOptions?.attempts}).interactions,this._interactions}constructor(e){if(e.apiKey==null)throw Error(`An API Key must be set when running in a browser`);if(e.project||e.location)throw Error(`Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.`);this.vertexai=e.vertexai??!1,this.apiKey=e.apiKey;let t=o(e.httpOptions,e.vertexai,void 0,void 0);t&&(e.httpOptions?e.httpOptions.baseUrl=t:e.httpOptions={baseUrl:t}),this.apiVersion=e.apiVersion,this.httpOptions=e.httpOptions;let n=new Lu(this.apiKey);this.apiClient=new As({auth:n,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:Ru+`web`,uploader:new Nu,downloader:new Su}),this.models=new ic(this.apiClient),this.live=new qs(this.apiClient,n,new Pu),this.batches=new ur(this.apiClient),this.chats=new ei(this.models,this.apiClient),this.caches=new qr(this.apiClient),this.files=new pi(this.apiClient),this.operations=new ac(this.apiClient),this.authTokens=new Cc(this.apiClient),this.tunings=new xu(this.apiClient),this.fileSearchStores=new jc(this.apiClient)}};export{zu as GoogleGenAI,be as Modality,ce as ThinkingLevel};