@vasfal/vellum 0.1.0 → 0.1.2

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 (484) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +5 -5
  3. package/.next/build-manifest.json +13 -14
  4. package/.next/next-minimal-server.js.nft.json +1 -1
  5. package/.next/next-server.js.nft.json +1 -1
  6. package/.next/prerender-manifest.json +3 -3
  7. package/.next/required-server-files.js +2 -0
  8. package/.next/required-server-files.json +2 -0
  9. package/.next/server/app/(app)/page.js +2 -15
  10. package/.next/server/app/(app)/page.js.nft.json +1 -1
  11. package/.next/server/app/(app)/page_client-reference-manifest.js +1 -3
  12. package/.next/server/app/(app)/session/[name]/page.js +2 -15
  13. package/.next/server/app/(app)/session/[name]/page.js.nft.json +1 -1
  14. package/.next/server/app/(app)/session/[name]/page_client-reference-manifest.js +1 -3
  15. package/.next/server/app/(app)/settings/key/page.js +2 -15
  16. package/.next/server/app/(app)/settings/key/page.js.nft.json +1 -1
  17. package/.next/server/app/(app)/settings/key/page_client-reference-manifest.js +1 -3
  18. package/.next/server/app/_global-error/page.js +32 -9
  19. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  20. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -3
  21. package/.next/server/app/_global-error.html +1 -1
  22. package/.next/server/app/_global-error.meta +2 -1
  23. package/.next/server/app/_global-error.rsc +7 -7
  24. package/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  25. package/.next/server/app/_global-error.segments/{__PAGE__.segment.rsc → _global-error/__PAGE__.segment.rsc} +2 -2
  26. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +5 -0
  27. package/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  28. package/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  29. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  30. package/.next/server/app/_not-found/page.js +2 -13
  31. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  32. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -3
  33. package/.next/server/app/_not-found.html +1 -1
  34. package/.next/server/app/_not-found.rsc +14 -12
  35. package/.next/server/app/_not-found.segments/_full.segment.rsc +14 -12
  36. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  37. package/.next/server/app/_not-found.segments/_index.segment.rsc +6 -6
  38. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  39. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  40. package/.next/server/app/_not-found.segments/_tree.segment.rsc +4 -2
  41. package/.next/server/app/api/analyze/route.js +12 -9
  42. package/.next/server/app/api/analyze/route.js.nft.json +1 -1
  43. package/.next/server/app/api/analyze/route_client-reference-manifest.js +1 -3
  44. package/.next/server/app/api/key/route.js +1 -8
  45. package/.next/server/app/api/key/route.js.nft.json +1 -1
  46. package/.next/server/app/api/key/route_client-reference-manifest.js +1 -3
  47. package/.next/server/app/api/key-status/route.js +1 -7
  48. package/.next/server/app/api/key-status/route.js.nft.json +1 -1
  49. package/.next/server/app/api/key-status/route_client-reference-manifest.js +1 -3
  50. package/.next/server/app/api/models/route.js +1 -7
  51. package/.next/server/app/api/models/route.js.nft.json +1 -1
  52. package/.next/server/app/api/models/route_client-reference-manifest.js +1 -3
  53. package/.next/server/app/api/revise/route.js +1 -8
  54. package/.next/server/app/api/revise/route.js.nft.json +1 -1
  55. package/.next/server/app/api/revise/route_client-reference-manifest.js +1 -3
  56. package/.next/server/app/icon.svg/route.js +1 -7
  57. package/.next/server/app/icon.svg/route.js.nft.json +1 -1
  58. package/.next/server/app/index.html +1 -1
  59. package/.next/server/app/index.rsc +24 -27
  60. package/.next/server/app/index.segments/!KGFwcCk/__PAGE__.segment.rsc +6 -6
  61. package/.next/server/app/index.segments/!KGFwcCk.segment.rsc +9 -9
  62. package/.next/server/app/index.segments/_full.segment.rsc +24 -27
  63. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  64. package/.next/server/app/index.segments/_index.segment.rsc +6 -6
  65. package/.next/server/app/index.segments/_tree.segment.rsc +4 -4
  66. package/.next/server/app/record-test/page.js +8 -14
  67. package/.next/server/app/record-test/page.js.nft.json +1 -1
  68. package/.next/server/app/record-test/page_client-reference-manifest.js +1 -3
  69. package/.next/server/app/record-test.html +2 -2
  70. package/.next/server/app/record-test.rsc +16 -16
  71. package/.next/server/app/record-test.segments/_full.segment.rsc +16 -16
  72. package/.next/server/app/record-test.segments/_head.segment.rsc +4 -4
  73. package/.next/server/app/record-test.segments/_index.segment.rsc +6 -6
  74. package/.next/server/app/record-test.segments/_tree.segment.rsc +4 -4
  75. package/.next/server/app/record-test.segments/record-test/__PAGE__.segment.rsc +4 -4
  76. package/.next/server/app/record-test.segments/record-test.segment.rsc +3 -3
  77. package/.next/server/app/settings/key.html +1 -1
  78. package/.next/server/app/settings/key.rsc +28 -34
  79. package/.next/server/app/settings/key.segments/!KGFwcCk/settings/key/__PAGE__.segment.rsc +5 -5
  80. package/.next/server/app/settings/key.segments/!KGFwcCk/settings/key.segment.rsc +3 -3
  81. package/.next/server/app/settings/key.segments/!KGFwcCk/settings.segment.rsc +3 -3
  82. package/.next/server/app/settings/key.segments/!KGFwcCk.segment.rsc +9 -9
  83. package/.next/server/app/settings/key.segments/_full.segment.rsc +28 -34
  84. package/.next/server/app/settings/key.segments/_head.segment.rsc +4 -4
  85. package/.next/server/app/settings/key.segments/_index.segment.rsc +6 -6
  86. package/.next/server/app/settings/key.segments/_tree.segment.rsc +4 -4
  87. package/.next/server/app/styleguide/page.js +2 -15
  88. package/.next/server/app/styleguide/page.js.nft.json +1 -1
  89. package/.next/server/app/styleguide/page_client-reference-manifest.js +1 -3
  90. package/.next/server/app/styleguide.html +1 -1
  91. package/.next/server/app/styleguide.rsc +68 -71
  92. package/.next/server/app/styleguide.segments/_full.segment.rsc +68 -71
  93. package/.next/server/app/styleguide.segments/_head.segment.rsc +4 -4
  94. package/.next/server/app/styleguide.segments/_index.segment.rsc +6 -6
  95. package/.next/server/app/styleguide.segments/_tree.segment.rsc +4 -4
  96. package/.next/server/app/styleguide.segments/styleguide/__PAGE__.segment.rsc +43 -45
  97. package/.next/server/app/styleguide.segments/styleguide.segment.rsc +3 -3
  98. package/.next/server/app-paths-manifest.json +5 -5
  99. package/.next/server/chunks/15.js +1 -0
  100. package/.next/server/chunks/319.js +45 -0
  101. package/.next/server/chunks/367.js +122 -0
  102. package/.next/server/chunks/393.js +4 -0
  103. package/.next/server/chunks/491.js +2 -0
  104. package/.next/server/chunks/497.js +1 -0
  105. package/.next/server/chunks/546.js +1 -0
  106. package/.next/server/chunks/592.js +44 -0
  107. package/.next/server/chunks/607.js +4 -0
  108. package/.next/server/chunks/724.js +1 -0
  109. package/.next/server/chunks/741.js +18 -0
  110. package/.next/server/chunks/813.js +1 -0
  111. package/.next/server/chunks/837.js +75 -0
  112. package/.next/server/chunks/852.js +14 -0
  113. package/.next/server/chunks/907.js +62 -0
  114. package/.next/server/chunks/915.js +8 -0
  115. package/.next/server/chunks/994.js +8 -0
  116. package/.next/server/middleware-build-manifest.js +1 -21
  117. package/.next/server/middleware-manifest.json +2 -2
  118. package/.next/server/middleware-react-loadable-manifest.js +1 -0
  119. package/.next/server/next-font-manifest.js +1 -1
  120. package/.next/server/next-font-manifest.json +1 -31
  121. package/.next/server/pages/404.html +1 -1
  122. package/.next/server/pages/500.html +1 -1
  123. package/.next/server/server-reference-manifest.js +1 -1
  124. package/.next/server/server-reference-manifest.json +1 -5
  125. package/.next/server/webpack-runtime.js +1 -0
  126. package/.next/static/FExJe2q2O67X3zxf-SYQ_/_buildManifest.js +1 -0
  127. package/.next/static/chunks/185-9c51ded7cd36ca7e.js +1 -0
  128. package/.next/static/chunks/20-cca33f633fa125b2.js +1 -0
  129. package/.next/static/chunks/27-02413cc56fbb4570.js +1 -0
  130. package/.next/static/chunks/376-6f7bc95550542e0b.js +62 -0
  131. package/.next/static/chunks/479-ea67f878851afbcd.js +1 -0
  132. package/.next/static/chunks/493-6bd8c75c972d3abd.js +2 -0
  133. package/.next/static/chunks/4bd1b696-deb4a0a1da1923b0.js +1 -0
  134. package/.next/static/chunks/603-6235d4d53b37035c.js +1 -0
  135. package/.next/static/chunks/743-c183133e0fbf1564.js +44 -0
  136. package/.next/static/chunks/793-5e37343b804eb1d9.js +1 -0
  137. package/.next/static/chunks/794-dc751ec6c8c611f8.js +32 -0
  138. package/.next/static/chunks/924-9226750edc5c2c2f.js +1 -0
  139. package/.next/static/chunks/95247769-a29d70f7fbba27c6.js +1 -0
  140. package/.next/static/chunks/app/(app)/layout-aad46049bfd54648.js +1 -0
  141. package/.next/static/chunks/app/(app)/page-d75e1fccccdbe30e.js +1 -0
  142. package/.next/static/chunks/app/(app)/session/[name]/page-60529ed1fd7a66a1.js +1 -0
  143. package/.next/static/chunks/app/(app)/settings/key/page-c2aab9f11db98d4e.js +1 -0
  144. package/.next/static/chunks/app/_global-error/page-b1c3f51315835726.js +1 -0
  145. package/.next/static/chunks/app/_not-found/page-6830be21b0ed0c95.js +1 -0
  146. package/.next/static/chunks/app/api/analyze/route-b1c3f51315835726.js +1 -0
  147. package/.next/static/chunks/app/api/key/route-b1c3f51315835726.js +1 -0
  148. package/.next/static/chunks/app/api/key-status/route-b1c3f51315835726.js +1 -0
  149. package/.next/static/chunks/app/api/models/route-b1c3f51315835726.js +1 -0
  150. package/.next/static/chunks/app/api/revise/route-b1c3f51315835726.js +1 -0
  151. package/.next/static/chunks/app/layout-aa71ca14e7f13c0c.js +1 -0
  152. package/.next/static/chunks/app/record-test/page-efb4287dda79ede4.js +7 -0
  153. package/.next/static/chunks/app/styleguide/page-f39510e82c1f9f31.js +1 -0
  154. package/.next/static/chunks/framework-b29f9083d3cda3b2.js +1 -0
  155. package/.next/static/chunks/main-app-39f57c6e6702740e.js +1 -0
  156. package/.next/static/chunks/main-fac8900b4f9c4833.js +5 -0
  157. package/.next/static/chunks/next/dist/client/components/builtin/app-error-b1c3f51315835726.js +1 -0
  158. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-b1c3f51315835726.js +1 -0
  159. package/.next/static/chunks/next/dist/client/components/builtin/global-error-c1d4bb24e31b66a2.js +1 -0
  160. package/.next/static/chunks/next/dist/client/components/builtin/not-found-b1c3f51315835726.js +1 -0
  161. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-b1c3f51315835726.js +1 -0
  162. package/.next/static/chunks/webpack-ceb933bd5f77076f.js +1 -0
  163. package/.next/static/css/e2905f0858acd77d.css +3 -0
  164. package/.next/types/app/(app)/page.ts +87 -0
  165. package/.next/types/app/(app)/session/[name]/page.ts +87 -0
  166. package/.next/types/app/(app)/settings/key/page.ts +87 -0
  167. package/.next/types/app/api/analyze/route.ts +351 -0
  168. package/.next/types/app/api/key/route.ts +351 -0
  169. package/.next/types/app/api/key-status/route.ts +351 -0
  170. package/.next/types/app/api/models/route.ts +351 -0
  171. package/.next/types/app/api/revise/route.ts +351 -0
  172. package/.next/types/app/layout.ts +87 -0
  173. package/.next/types/app/record-test/page.ts +87 -0
  174. package/.next/types/app/styleguide/page.ts +87 -0
  175. package/.next/types/package.json +1 -0
  176. package/README.md +4 -6
  177. package/next.config.ts +8 -0
  178. package/package.json +4 -4
  179. package/.next/build/56416d4ae4ce586f.js +0 -6
  180. package/.next/build/56416d4ae4ce586f.js.map +0 -5
  181. package/.next/build/chunks/[root-of-the-server]__0oj80bi._.js +0 -206
  182. package/.next/build/chunks/[root-of-the-server]__0oj80bi._.js.map +0 -8
  183. package/.next/build/chunks/[root-of-the-server]__1f933tp._.js +0 -500
  184. package/.next/build/chunks/[root-of-the-server]__1f933tp._.js.map +0 -11
  185. package/.next/build/chunks/[turbopack-node]_transforms_postcss_ts_0b7xl6g._.js +0 -13
  186. package/.next/build/chunks/[turbopack-node]_transforms_postcss_ts_0b7xl6g._.js.map +0 -5
  187. package/.next/build/chunks/[turbopack]_runtime.js +0 -890
  188. package/.next/build/chunks/[turbopack]_runtime.js.map +0 -11
  189. package/.next/build/chunks/node_modules_20v-8wl._.js +0 -6832
  190. package/.next/build/chunks/node_modules_20v-8wl._.js.map +0 -47
  191. package/.next/build/package.json +0 -1
  192. package/.next/cache/.previewinfo +0 -1
  193. package/.next/cache/.rscinfo +0 -1
  194. package/.next/cache/.tsbuildinfo +0 -1
  195. package/.next/diagnostics/route-bundle-stats.json +0 -111
  196. package/.next/fallback-build-manifest.json +0 -13
  197. package/.next/server/app/(app)/page/app-paths-manifest.json +0 -3
  198. package/.next/server/app/(app)/page/build-manifest.json +0 -17
  199. package/.next/server/app/(app)/page/next-font-manifest.json +0 -11
  200. package/.next/server/app/(app)/page/server-reference-manifest.json +0 -4
  201. package/.next/server/app/(app)/page.js.map +0 -5
  202. package/.next/server/app/(app)/session/[name]/page/app-paths-manifest.json +0 -3
  203. package/.next/server/app/(app)/session/[name]/page/build-manifest.json +0 -17
  204. package/.next/server/app/(app)/session/[name]/page/next-font-manifest.json +0 -11
  205. package/.next/server/app/(app)/session/[name]/page/react-loadable-manifest.json +0 -1
  206. package/.next/server/app/(app)/session/[name]/page/server-reference-manifest.json +0 -4
  207. package/.next/server/app/(app)/session/[name]/page.js.map +0 -5
  208. package/.next/server/app/(app)/settings/key/page/app-paths-manifest.json +0 -3
  209. package/.next/server/app/(app)/settings/key/page/build-manifest.json +0 -17
  210. package/.next/server/app/(app)/settings/key/page/next-font-manifest.json +0 -11
  211. package/.next/server/app/(app)/settings/key/page/react-loadable-manifest.json +0 -1
  212. package/.next/server/app/(app)/settings/key/page/server-reference-manifest.json +0 -4
  213. package/.next/server/app/(app)/settings/key/page.js.map +0 -5
  214. package/.next/server/app/_global-error/page/app-paths-manifest.json +0 -3
  215. package/.next/server/app/_global-error/page/build-manifest.json +0 -17
  216. package/.next/server/app/_global-error/page/next-font-manifest.json +0 -6
  217. package/.next/server/app/_global-error/page/react-loadable-manifest.json +0 -1
  218. package/.next/server/app/_global-error/page/server-reference-manifest.json +0 -4
  219. package/.next/server/app/_global-error/page.js.map +0 -5
  220. package/.next/server/app/_not-found/page/app-paths-manifest.json +0 -3
  221. package/.next/server/app/_not-found/page/build-manifest.json +0 -17
  222. package/.next/server/app/_not-found/page/next-font-manifest.json +0 -11
  223. package/.next/server/app/_not-found/page/react-loadable-manifest.json +0 -1
  224. package/.next/server/app/_not-found/page/server-reference-manifest.json +0 -4
  225. package/.next/server/app/_not-found/page.js.map +0 -5
  226. package/.next/server/app/api/analyze/route/app-paths-manifest.json +0 -3
  227. package/.next/server/app/api/analyze/route/build-manifest.json +0 -9
  228. package/.next/server/app/api/analyze/route/server-reference-manifest.json +0 -4
  229. package/.next/server/app/api/analyze/route.js.map +0 -5
  230. package/.next/server/app/api/key/route/app-paths-manifest.json +0 -3
  231. package/.next/server/app/api/key/route/build-manifest.json +0 -9
  232. package/.next/server/app/api/key/route/server-reference-manifest.json +0 -4
  233. package/.next/server/app/api/key/route.js.map +0 -5
  234. package/.next/server/app/api/key-status/route/app-paths-manifest.json +0 -3
  235. package/.next/server/app/api/key-status/route/build-manifest.json +0 -9
  236. package/.next/server/app/api/key-status/route/server-reference-manifest.json +0 -4
  237. package/.next/server/app/api/key-status/route.js.map +0 -5
  238. package/.next/server/app/api/models/route/app-paths-manifest.json +0 -3
  239. package/.next/server/app/api/models/route/build-manifest.json +0 -9
  240. package/.next/server/app/api/models/route/server-reference-manifest.json +0 -4
  241. package/.next/server/app/api/models/route.js.map +0 -5
  242. package/.next/server/app/api/revise/route/app-paths-manifest.json +0 -3
  243. package/.next/server/app/api/revise/route/build-manifest.json +0 -9
  244. package/.next/server/app/api/revise/route/server-reference-manifest.json +0 -4
  245. package/.next/server/app/api/revise/route.js.map +0 -5
  246. package/.next/server/app/icon.svg/route/app-paths-manifest.json +0 -3
  247. package/.next/server/app/icon.svg/route/build-manifest.json +0 -9
  248. package/.next/server/app/icon.svg/route.js.map +0 -5
  249. package/.next/server/app/record-test/page/app-paths-manifest.json +0 -3
  250. package/.next/server/app/record-test/page/build-manifest.json +0 -17
  251. package/.next/server/app/record-test/page/next-font-manifest.json +0 -11
  252. package/.next/server/app/record-test/page/react-loadable-manifest.json +0 -1
  253. package/.next/server/app/record-test/page/server-reference-manifest.json +0 -4
  254. package/.next/server/app/record-test/page.js.map +0 -5
  255. package/.next/server/app/styleguide/page/app-paths-manifest.json +0 -3
  256. package/.next/server/app/styleguide/page/build-manifest.json +0 -17
  257. package/.next/server/app/styleguide/page/next-font-manifest.json +0 -11
  258. package/.next/server/app/styleguide/page/react-loadable-manifest.json +0 -1
  259. package/.next/server/app/styleguide/page/server-reference-manifest.json +0 -4
  260. package/.next/server/app/styleguide/page.js.map +0 -5
  261. package/.next/server/chunks/[externals]__1l0bqbz._.js +0 -3
  262. package/.next/server/chunks/[externals]__1l0bqbz._.js.map +0 -1
  263. package/.next/server/chunks/[root-of-the-server]__00u0a0m._.js +0 -3
  264. package/.next/server/chunks/[root-of-the-server]__00u0a0m._.js.map +0 -1
  265. package/.next/server/chunks/[root-of-the-server]__02oblj7._.js +0 -3
  266. package/.next/server/chunks/[root-of-the-server]__02oblj7._.js.map +0 -1
  267. package/.next/server/chunks/[root-of-the-server]__04dzkv1._.js +0 -3
  268. package/.next/server/chunks/[root-of-the-server]__04dzkv1._.js.map +0 -1
  269. package/.next/server/chunks/[root-of-the-server]__081zp1m._.js +0 -3
  270. package/.next/server/chunks/[root-of-the-server]__081zp1m._.js.map +0 -1
  271. package/.next/server/chunks/[root-of-the-server]__0dkua3v._.js +0 -3
  272. package/.next/server/chunks/[root-of-the-server]__0dkua3v._.js.map +0 -1
  273. package/.next/server/chunks/[root-of-the-server]__0ezil_h._.js +0 -3
  274. package/.next/server/chunks/[root-of-the-server]__0ezil_h._.js.map +0 -1
  275. package/.next/server/chunks/[root-of-the-server]__0ww_12a._.js +0 -3
  276. package/.next/server/chunks/[root-of-the-server]__0ww_12a._.js.map +0 -1
  277. package/.next/server/chunks/[root-of-the-server]__0x-kpif._.js +0 -3
  278. package/.next/server/chunks/[root-of-the-server]__0x-kpif._.js.map +0 -1
  279. package/.next/server/chunks/[root-of-the-server]__15bjnu5._.js +0 -3
  280. package/.next/server/chunks/[root-of-the-server]__15bjnu5._.js.map +0 -1
  281. package/.next/server/chunks/[root-of-the-server]__1kmbnvv._.js +0 -3
  282. package/.next/server/chunks/[root-of-the-server]__1kmbnvv._.js.map +0 -1
  283. package/.next/server/chunks/[root-of-the-server]__1kp4vwc._.js +0 -14
  284. package/.next/server/chunks/[root-of-the-server]__1kp4vwc._.js.map +0 -1
  285. package/.next/server/chunks/[root-of-the-server]__1lbd3kd._.js +0 -3
  286. package/.next/server/chunks/[root-of-the-server]__1lbd3kd._.js.map +0 -1
  287. package/.next/server/chunks/[root-of-the-server]__1ra6psc._.js +0 -3
  288. package/.next/server/chunks/[root-of-the-server]__1ra6psc._.js.map +0 -1
  289. package/.next/server/chunks/[root-of-the-server]__1zn977r._.js +0 -3
  290. package/.next/server/chunks/[root-of-the-server]__1zn977r._.js.map +0 -1
  291. package/.next/server/chunks/[turbopack]_runtime.js +0 -903
  292. package/.next/server/chunks/[turbopack]_runtime.js.map +0 -11
  293. package/.next/server/chunks/_04h1cv_._.js +0 -185
  294. package/.next/server/chunks/_04h1cv_._.js.map +0 -1
  295. package/.next/server/chunks/_0pqmhjh._.js +0 -185
  296. package/.next/server/chunks/_0pqmhjh._.js.map +0 -1
  297. package/.next/server/chunks/_next-internal_server_app_api_analyze_route_actions_0lx-23h.js +0 -3
  298. package/.next/server/chunks/_next-internal_server_app_api_analyze_route_actions_0lx-23h.js.map +0 -1
  299. package/.next/server/chunks/_next-internal_server_app_api_key-status_route_actions_1qgztm2.js +0 -3
  300. package/.next/server/chunks/_next-internal_server_app_api_key-status_route_actions_1qgztm2.js.map +0 -1
  301. package/.next/server/chunks/_next-internal_server_app_api_key_route_actions_15n2qsb.js +0 -3
  302. package/.next/server/chunks/_next-internal_server_app_api_key_route_actions_15n2qsb.js.map +0 -1
  303. package/.next/server/chunks/_next-internal_server_app_api_models_route_actions_1h6mkqp.js +0 -3
  304. package/.next/server/chunks/_next-internal_server_app_api_models_route_actions_1h6mkqp.js.map +0 -1
  305. package/.next/server/chunks/_next-internal_server_app_api_revise_route_actions_19kk3m-.js +0 -3
  306. package/.next/server/chunks/_next-internal_server_app_api_revise_route_actions_19kk3m-.js.map +0 -1
  307. package/.next/server/chunks/_next-internal_server_app_icon_svg_route_actions_1r2h_ub.js +0 -3
  308. package/.next/server/chunks/_next-internal_server_app_icon_svg_route_actions_1r2h_ub.js.map +0 -1
  309. package/.next/server/chunks/node_modules_0x51oh_._.js +0 -10
  310. package/.next/server/chunks/node_modules_0x51oh_._.js.map +0 -1
  311. package/.next/server/chunks/node_modules_19bvt3l._.js +0 -6
  312. package/.next/server/chunks/node_modules_19bvt3l._.js.map +0 -1
  313. package/.next/server/chunks/node_modules_1_-az43._.js +0 -16
  314. package/.next/server/chunks/node_modules_1_-az43._.js.map +0 -1
  315. package/.next/server/chunks/node_modules_1t2pqct._.js +0 -10
  316. package/.next/server/chunks/node_modules_1t2pqct._.js.map +0 -1
  317. package/.next/server/chunks/node_modules_next_08s853w._.js +0 -13
  318. package/.next/server/chunks/node_modules_next_08s853w._.js.map +0 -1
  319. package/.next/server/chunks/node_modules_node-fetch_src_index_1gf-_pn.js +0 -3
  320. package/.next/server/chunks/node_modules_node-fetch_src_index_1gf-_pn.js.map +0 -1
  321. package/.next/server/chunks/ssr/[externals]__1l0bqbz._.js +0 -3
  322. package/.next/server/chunks/ssr/[externals]__1l0bqbz._.js.map +0 -1
  323. package/.next/server/chunks/ssr/[root-of-the-server]__06ync7f._.js +0 -3
  324. package/.next/server/chunks/ssr/[root-of-the-server]__06ync7f._.js.map +0 -1
  325. package/.next/server/chunks/ssr/[root-of-the-server]__0hml-pd._.js +0 -3
  326. package/.next/server/chunks/ssr/[root-of-the-server]__0hml-pd._.js.map +0 -1
  327. package/.next/server/chunks/ssr/[root-of-the-server]__0ntia6u._.js +0 -3
  328. package/.next/server/chunks/ssr/[root-of-the-server]__0ntia6u._.js.map +0 -1
  329. package/.next/server/chunks/ssr/[root-of-the-server]__0sdpd0o._.js +0 -3
  330. package/.next/server/chunks/ssr/[root-of-the-server]__0sdpd0o._.js.map +0 -1
  331. package/.next/server/chunks/ssr/[root-of-the-server]__0w2pa_y._.js +0 -33
  332. package/.next/server/chunks/ssr/[root-of-the-server]__0w2pa_y._.js.map +0 -1
  333. package/.next/server/chunks/ssr/[root-of-the-server]__10y0-wv._.js +0 -3
  334. package/.next/server/chunks/ssr/[root-of-the-server]__10y0-wv._.js.map +0 -1
  335. package/.next/server/chunks/ssr/[root-of-the-server]__11_7weu._.js +0 -3
  336. package/.next/server/chunks/ssr/[root-of-the-server]__11_7weu._.js.map +0 -1
  337. package/.next/server/chunks/ssr/[root-of-the-server]__1_stkwn._.js +0 -3
  338. package/.next/server/chunks/ssr/[root-of-the-server]__1_stkwn._.js.map +0 -1
  339. package/.next/server/chunks/ssr/[root-of-the-server]__1dky4g0._.js +0 -33
  340. package/.next/server/chunks/ssr/[root-of-the-server]__1dky4g0._.js.map +0 -1
  341. package/.next/server/chunks/ssr/[root-of-the-server]__1k6ey-q._.js +0 -3
  342. package/.next/server/chunks/ssr/[root-of-the-server]__1k6ey-q._.js.map +0 -1
  343. package/.next/server/chunks/ssr/[root-of-the-server]__1la73u1._.js +0 -3
  344. package/.next/server/chunks/ssr/[root-of-the-server]__1la73u1._.js.map +0 -1
  345. package/.next/server/chunks/ssr/[root-of-the-server]__1nshnxm._.js +0 -3
  346. package/.next/server/chunks/ssr/[root-of-the-server]__1nshnxm._.js.map +0 -1
  347. package/.next/server/chunks/ssr/[root-of-the-server]__1pssg49._.js +0 -3
  348. package/.next/server/chunks/ssr/[root-of-the-server]__1pssg49._.js.map +0 -1
  349. package/.next/server/chunks/ssr/[root-of-the-server]__1q6zd30._.js +0 -3
  350. package/.next/server/chunks/ssr/[root-of-the-server]__1q6zd30._.js.map +0 -1
  351. package/.next/server/chunks/ssr/[root-of-the-server]__1qlmg27._.js +0 -3
  352. package/.next/server/chunks/ssr/[root-of-the-server]__1qlmg27._.js.map +0 -1
  353. package/.next/server/chunks/ssr/[turbopack]_runtime.js +0 -903
  354. package/.next/server/chunks/ssr/[turbopack]_runtime.js.map +0 -11
  355. package/.next/server/chunks/ssr/_01pksvc._.js +0 -78
  356. package/.next/server/chunks/ssr/_01pksvc._.js.map +0 -1
  357. package/.next/server/chunks/ssr/_03lgii8._.js +0 -3
  358. package/.next/server/chunks/ssr/_03lgii8._.js.map +0 -1
  359. package/.next/server/chunks/ssr/_05tft_r._.js +0 -3
  360. package/.next/server/chunks/ssr/_05tft_r._.js.map +0 -1
  361. package/.next/server/chunks/ssr/_06gt995._.js +0 -3
  362. package/.next/server/chunks/ssr/_06gt995._.js.map +0 -1
  363. package/.next/server/chunks/ssr/_0jrh37c._.js +0 -46
  364. package/.next/server/chunks/ssr/_0jrh37c._.js.map +0 -1
  365. package/.next/server/chunks/ssr/_0kw6yq_._.js +0 -3
  366. package/.next/server/chunks/ssr/_0kw6yq_._.js.map +0 -1
  367. package/.next/server/chunks/ssr/_0l3c05z._.js +0 -3
  368. package/.next/server/chunks/ssr/_0l3c05z._.js.map +0 -1
  369. package/.next/server/chunks/ssr/_0n-ojw-._.js +0 -3
  370. package/.next/server/chunks/ssr/_0n-ojw-._.js.map +0 -1
  371. package/.next/server/chunks/ssr/_0t6a1ln._.js +0 -6
  372. package/.next/server/chunks/ssr/_0t6a1ln._.js.map +0 -1
  373. package/.next/server/chunks/ssr/_0td-xk-._.js +0 -3
  374. package/.next/server/chunks/ssr/_0td-xk-._.js.map +0 -1
  375. package/.next/server/chunks/ssr/_0y92f-y._.js +0 -46
  376. package/.next/server/chunks/ssr/_0y92f-y._.js.map +0 -1
  377. package/.next/server/chunks/ssr/_1b6au28._.js +0 -3
  378. package/.next/server/chunks/ssr/_1b6au28._.js.map +0 -1
  379. package/.next/server/chunks/ssr/_next-internal_server_app_(app)_page_actions_1gxdy57.js +0 -3
  380. package/.next/server/chunks/ssr/_next-internal_server_app_(app)_page_actions_1gxdy57.js.map +0 -1
  381. package/.next/server/chunks/ssr/_next-internal_server_app_(app)_session_[name]_page_actions_115d_ja.js +0 -3
  382. package/.next/server/chunks/ssr/_next-internal_server_app_(app)_session_[name]_page_actions_115d_ja.js.map +0 -1
  383. package/.next/server/chunks/ssr/_next-internal_server_app_(app)_settings_key_page_actions_1jsc3or.js +0 -3
  384. package/.next/server/chunks/ssr/_next-internal_server_app_(app)_settings_key_page_actions_1jsc3or.js.map +0 -1
  385. package/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_0zi5s8-.js +0 -3
  386. package/.next/server/chunks/ssr/_next-internal_server_app__global-error_page_actions_0zi5s8-.js.map +0 -1
  387. package/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_0pt47yr.js +0 -3
  388. package/.next/server/chunks/ssr/_next-internal_server_app__not-found_page_actions_0pt47yr.js.map +0 -1
  389. package/.next/server/chunks/ssr/_next-internal_server_app_record-test_page_actions_0a_yofw.js +0 -3
  390. package/.next/server/chunks/ssr/_next-internal_server_app_record-test_page_actions_0a_yofw.js.map +0 -1
  391. package/.next/server/chunks/ssr/_next-internal_server_app_styleguide_page_actions_174h7x7.js +0 -3
  392. package/.next/server/chunks/ssr/_next-internal_server_app_styleguide_page_actions_174h7x7.js.map +0 -1
  393. package/.next/server/chunks/ssr/node_modules_0el53_h._.js +0 -10
  394. package/.next/server/chunks/ssr/node_modules_0el53_h._.js.map +0 -1
  395. package/.next/server/chunks/ssr/node_modules_0h91jdk._.js +0 -33
  396. package/.next/server/chunks/ssr/node_modules_0h91jdk._.js.map +0 -1
  397. package/.next/server/chunks/ssr/node_modules_1fxqp22._.js +0 -10
  398. package/.next/server/chunks/ssr/node_modules_1fxqp22._.js.map +0 -1
  399. package/.next/server/chunks/ssr/node_modules_1loo6j7._.js +0 -6
  400. package/.next/server/chunks/ssr/node_modules_1loo6j7._.js.map +0 -1
  401. package/.next/server/chunks/ssr/node_modules_1pvqj0r._.js +0 -3
  402. package/.next/server/chunks/ssr/node_modules_1pvqj0r._.js.map +0 -1
  403. package/.next/server/chunks/ssr/node_modules_next_dist_0uboya6._.js +0 -6
  404. package/.next/server/chunks/ssr/node_modules_next_dist_0uboya6._.js.map +0 -1
  405. package/.next/server/chunks/ssr/node_modules_next_dist_172hvm-._.js +0 -19
  406. package/.next/server/chunks/ssr/node_modules_next_dist_172hvm-._.js.map +0 -1
  407. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_0wpq8j3._.js +0 -3
  408. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_0wpq8j3._.js.map +0 -1
  409. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0symwr9.js +0 -3
  410. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0symwr9.js.map +0 -1
  411. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0-o-goa.js +0 -3
  412. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0-o-goa.js.map +0 -1
  413. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0x.js +0 -3
  414. package/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0l_sp0x.js.map +0 -1
  415. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0_q50sh.js +0 -4
  416. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0_q50sh.js.map +0 -1
  417. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0_xbpm0.js +0 -4
  418. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0_xbpm0.js.map +0 -1
  419. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_119i6eu.js +0 -4
  420. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_119i6eu.js.map +0 -1
  421. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_14nl2rs.js +0 -4
  422. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_14nl2rs.js.map +0 -1
  423. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_18u8k23.js +0 -4
  424. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_18u8k23.js.map +0 -1
  425. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_19--w_z.js +0 -4
  426. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_19--w_z.js.map +0 -1
  427. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_1_iwj0a.js +0 -4
  428. package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_1_iwj0a.js.map +0 -1
  429. package/.next/server/chunks/ssr/node_modules_node-fetch_src_index_1e0t9p6.js +0 -3
  430. package/.next/server/chunks/ssr/node_modules_node-fetch_src_index_1e0t9p6.js.map +0 -1
  431. package/.next/server/chunks/ssr/src_19oqe9t._.js +0 -3
  432. package/.next/server/chunks/ssr/src_19oqe9t._.js.map +0 -1
  433. package/.next/server/chunks/ssr/src_app_record-test_page_tsx_08-2bld._.js +0 -9
  434. package/.next/server/chunks/ssr/src_app_record-test_page_tsx_08-2bld._.js.map +0 -1
  435. package/.next/server/chunks/ssr/src_components_app-sidebar_tsx_1xx2k53._.js +0 -3
  436. package/.next/server/chunks/ssr/src_components_app-sidebar_tsx_1xx2k53._.js.map +0 -1
  437. package/.next/server/chunks/ssr/src_components_settings_key-setup_tsx_0jxhnpa._.js +0 -3
  438. package/.next/server/chunks/ssr/src_components_settings_key-setup_tsx_0jxhnpa._.js.map +0 -1
  439. package/.next/server/chunks/ssr/src_components_ui_0lq7ewx._.js +0 -3
  440. package/.next/server/chunks/ssr/src_components_ui_0lq7ewx._.js.map +0 -1
  441. package/.next/static/CIZxngYjzUw1Kb0KrE473/_buildManifest.js +0 -11
  442. package/.next/static/CIZxngYjzUw1Kb0KrE473/_clientMiddlewareManifest.js +0 -1
  443. package/.next/static/chunks/05-c3ty_6dwfk.js +0 -1
  444. package/.next/static/chunks/07-hzktxqjvzd.js +0 -4
  445. package/.next/static/chunks/09bn0buuu6k2x.js +0 -1
  446. package/.next/static/chunks/0kkimqpuecvfn.js +0 -1
  447. package/.next/static/chunks/0mk1g55o6kl1e.js +0 -2
  448. package/.next/static/chunks/0ul837-9k0zx_.js +0 -63
  449. package/.next/static/chunks/0wpges32btt_p.js +0 -1
  450. package/.next/static/chunks/18qo-4_hfuwko.js +0 -1
  451. package/.next/static/chunks/1_dsevxz78b97.js +0 -1
  452. package/.next/static/chunks/2-oqhnxovgl_2.js +0 -44
  453. package/.next/static/chunks/2et_7fxuzt9cq.js +0 -31
  454. package/.next/static/chunks/2im7c515bo69p.js +0 -1
  455. package/.next/static/chunks/2merpuxt1zcvf.js +0 -1
  456. package/.next/static/chunks/2qb8lge1e2sv2.js +0 -1
  457. package/.next/static/chunks/2sj0gufu0lojq.css +0 -3
  458. package/.next/static/chunks/2zloaj9ja_vpy.js +0 -1
  459. package/.next/static/chunks/3rvy2rc9d_hwt.js +0 -1
  460. package/.next/static/chunks/3uci2qhsbp444.js +0 -50
  461. package/.next/static/chunks/3yao5u25-bf0g.js +0 -1
  462. package/.next/static/chunks/41_0qs6kjmoek.js +0 -1
  463. package/.next/static/chunks/4395sbjm36lbl.js +0 -1
  464. package/.next/static/chunks/turbopack-2cevjmbuh84ft.js +0 -1
  465. package/.next/static/media/icon.2_sgat73yt9an.svg +0 -7
  466. package/.next/trace +0 -1
  467. package/.next/trace-build +0 -1
  468. package/.next/turbopack +0 -0
  469. /package/.next/{server/app/(app)/page/react-loadable-manifest.json → react-loadable-manifest.json} +0 -0
  470. /package/.next/static/{CIZxngYjzUw1Kb0KrE473 → FExJe2q2O67X3zxf-SYQ_}/_ssgManifest.js +0 -0
  471. /package/.next/static/chunks/{0cz1d0mv5g_q7.js → polyfills-42372ed130431b0a.js} +0 -0
  472. /package/.next/static/media/{5ce348bf30bf5439-s.31988l_ccedte.woff2 → 013b72fa676f92e0-s.woff2} +0 -0
  473. /package/.next/static/media/{5476f68d60460930-s.2uwcyprjm3xu3.woff2 → 19cfc7226ec3afaa-s.woff2} +0 -0
  474. /package/.next/static/media/{9c72aa0f40e4eef8-s.1y4-pdgsjb-pw.woff2 → 21350d82a1f187e9-s.woff2} +0 -0
  475. /package/.next/static/media/{bbc41e54d2fcbd21-s.1rgnod-3esatf.woff2 → 2b5b02fc7e511755-s.woff2} +0 -0
  476. /package/.next/static/media/{6306c77e7c8268e4-s.2dbetqa9o8jxf.woff2 → 65f03d54ccadf4a8-s.woff2} +0 -0
  477. /package/.next/static/media/{797e433ab948586e-s.p.0r6juujl39pe6.woff2 → 7d4881bb7e1bf84d-s.p.woff2} +0 -0
  478. /package/.next/static/media/{1bffadaabf893a1e-s.3-6t-g6q0vh0a.woff2 → 8e9860b6e62d6359-s.woff2} +0 -0
  479. /package/.next/static/media/{4fa387ec64143e14-s.2tuy5pz7dlieh.woff2 → b9408752a0c24fb9-s.woff2} +0 -0
  480. /package/.next/static/media/{2c55a0e60120577a-s.0-dom-5bn10r2.woff2 → ba9851c3c22cd980-s.woff2} +0 -0
  481. /package/.next/static/media/{ad66f9afd8947f86-s.3lvt2whj97whp.woff2 → c5fe6dc8356a8c31-s.woff2} +0 -0
  482. /package/.next/static/media/{2bbe8d2671613f1f-s.0k62hbripvv8p.woff2 → df0a9ae256c0569c-s.woff2} +0 -0
  483. /package/.next/static/media/{7d817b4c03b0c5f1-s.1uyisp29ctx0d.woff2 → e038a29029a234f2-s.woff2} +0 -0
  484. /package/.next/static/media/{83afe278b6a6bb3c-s.p.2bn3s6zvc0dyp.woff2 → e4af272ccee01ff0-s.p.woff2} +0 -0
@@ -0,0 +1,14 @@
1
+ exports.id=852,exports.ids=[852],exports.modules={30:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.PluggableAuthHandler=b.ExecutableError=void 0;let d=c(67201),e=c(79646),f=c(29021);class g extends Error{code;constructor(a,b){super(`The executable failed with exit code: ${b} and error message: ${a}.`),this.code=b,Object.setPrototypeOf(this,new.target.prototype)}}b.ExecutableError=g;class h{commandComponents;timeoutMillis;outputFile;constructor(a){if(!a.command)throw Error("No command provided.");if(this.commandComponents=h.parseCommand(a.command),this.timeoutMillis=a.timeoutMillis,!this.timeoutMillis)throw Error("No timeoutMillis provided.");this.outputFile=a.outputFile}retrieveResponseFromExecutable(a){return new Promise((b,c)=>{let f=e.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(a)}}),h="";f.stdout.on("data",a=>{h+=a}),f.stderr.on("data",a=>{h+=a});let i=setTimeout(()=>(f.removeAllListeners(),f.kill(),c(Error("The executable failed to finish within the timeout specified."))),this.timeoutMillis);f.on("close",a=>{if(clearTimeout(i),0!==a)return c(new g(h,a.toString()));try{let a=JSON.parse(h),c=new d.ExecutableResponse(a);return b(c)}catch(a){if(a instanceof d.ExecutableResponseError)return c(a);return c(new d.ExecutableResponseError(`The executable returned an invalid response: ${h}`))}})})}async retrieveCachedResponse(){let a;if(!this.outputFile||0===this.outputFile.length)return;try{a=await f.promises.realpath(this.outputFile)}catch{return}if(!(await f.promises.lstat(a)).isFile())return;let b=await f.promises.readFile(a,{encoding:"utf8"});if(""!==b)try{let a=JSON.parse(b);if(new d.ExecutableResponse(a).isValid())return new d.ExecutableResponse(a);return}catch(a){if(a instanceof d.ExecutableResponseError)throw a;throw new d.ExecutableResponseError(`The output file contained an invalid response: ${b}`)}}static parseCommand(a){let b=a.match(/(?:[^\s"]+|"[^"]*")+/g);if(!b)throw Error(`Provided command: "${a}" could not be parsed.`);for(let a=0;a<b.length;a++)'"'===b[a][0]&&'"'===b[a].slice(-1)&&(b[a]=b[a].slice(1,-1));return b}}b.PluggableAuthHandler=h},492:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BrowserCrypto=void 0;let d=c(54831),e=c(18853);class f{constructor(){if("u"<typeof window||void 0===window.crypto||void 0===window.crypto.subtle)throw Error("SubtleCrypto not found. Make sure it's an https:// website.")}async sha256DigestBase64(a){let b=new TextEncoder().encode(a),c=await window.crypto.subtle.digest("SHA-256",b);return d.fromByteArray(new Uint8Array(c))}randomBytesBase64(a){let b=new Uint8Array(a);return window.crypto.getRandomValues(b),d.fromByteArray(b)}static padBase64(a){for(;a.length%4!=0;)a+="=";return a}async verify(a,b,c){let e={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},g=new TextEncoder().encode(b),h=d.toByteArray(f.padBase64(c)),i=await window.crypto.subtle.importKey("jwk",a,e,!0,["verify"]);return await window.crypto.subtle.verify(e,i,Buffer.from(h),g)}async sign(a,b){let c={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},e=new TextEncoder().encode(b),f=await window.crypto.subtle.importKey("jwk",a,c,!0,["sign"]),g=await window.crypto.subtle.sign(c,f,e);return d.fromByteArray(new Uint8Array(g))}decodeBase64StringUtf8(a){let b=d.toByteArray(f.padBase64(a));return new TextDecoder().decode(b)}encodeBase64StringUtf8(a){let b=new TextEncoder().encode(a);return d.fromByteArray(b)}async sha256DigestHex(a){let b=new TextEncoder().encode(a),c=await window.crypto.subtle.digest("SHA-256",b);return(0,e.fromArrayBufferToHex)(c)}async signWithHmacSha256(a,b){let c="string"==typeof a?a:String.fromCharCode(...new Uint16Array(a)),d=new TextEncoder,e=await window.crypto.subtle.importKey("raw",d.encode(c),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return window.crypto.subtle.sign("HMAC",e,d.encode(b))}}b.BrowserCrypto=f},572:(a,b,c)=>{var d,e=c(62760).Buffer,f=c(55511),g=c(15667),h=c(28354),i="secret must be a string or buffer",j="key must be a string or a buffer",k="function"==typeof f.createPublicKey;function l(a){if(!e.isBuffer(a)&&"string"!=typeof a&&(!k||"object"!=typeof a||"string"!=typeof a.type||"string"!=typeof a.asymmetricKeyType||"function"!=typeof a.export))throw p(j)}function m(a){if(!e.isBuffer(a)&&"string"!=typeof a&&"object"!=typeof a)throw p("key must be a string, a buffer or an object")}function n(a){return a.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function o(a){var b=4-(a=a.toString()).length%4;if(4!==b)for(var c=0;c<b;++c)a+="=";return a.replace(/\-/g,"+").replace(/_/g,"/")}function p(a){var b=[].slice.call(arguments,1);return TypeError(h.format.bind(h,a).apply(null,b))}function q(a){var b;return b=a,e.isBuffer(b)||"string"==typeof b||(a=JSON.stringify(a)),a}function r(a){return function(b,c){!function(a){if(!e.isBuffer(a)){if("string"!=typeof a){if(!k||"object"!=typeof a||"secret"!==a.type||"function"!=typeof a.export)throw p(i)}}}(c),b=q(b);var d=f.createHmac("sha"+a,c);return n((d.update(b),d.digest("base64")))}}k&&(j+=" or a KeyObject",i+="or a KeyObject");var s="timingSafeEqual"in f?function(a,b){return a.byteLength===b.byteLength&&f.timingSafeEqual(a,b)}:function(a,b){return d||(d=c(65254)),d(a,b)};function t(a){return function(b,c,d){var f=r(a)(b,d);return s(e.from(c),e.from(f))}}function u(a){return function(b,c){m(c),b=q(b);var d=f.createSign("RSA-SHA"+a);return n((d.update(b),d.sign(c,"base64")))}}function v(a){return function(b,c,d){l(d),b=q(b),c=o(c);var e=f.createVerify("RSA-SHA"+a);return e.update(b),e.verify(d,c,"base64")}}function w(a){return function(b,c){m(c),b=q(b);var d=f.createSign("RSA-SHA"+a);return n((d.update(b),d.sign({key:c,padding:f.constants.RSA_PKCS1_PSS_PADDING,saltLength:f.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function x(a){return function(b,c,d){l(d),b=q(b),c=o(c);var e=f.createVerify("RSA-SHA"+a);return e.update(b),e.verify({key:d,padding:f.constants.RSA_PKCS1_PSS_PADDING,saltLength:f.constants.RSA_PSS_SALTLEN_DIGEST},c,"base64")}}function y(a){var b=u(a);return function(){var c=b.apply(null,arguments);return g.derToJose(c,"ES"+a)}}function z(a){var b=v(a);return function(c,d,e){return b(c,d=g.joseToDer(d,"ES"+a).toString("base64"),e)}}function A(){return function(){return""}}function B(){return function(a,b){return""===b}}a.exports=function(a){var b=a.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!b)throw p('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',a);var c=(b[1]||b[3]).toLowerCase(),d=b[2];return{sign:({hs:r,rs:u,ps:w,es:y,none:A})[c](d),verify:({hs:t,rs:v,ps:x,es:z,none:B})[c](d)}}},1951:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.CertificateSubjectTokenSupplier=b.InvalidConfigurationError=b.CertificateSourceUnavailableError=b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE=void 0;let d=c(45920),e=c(29021),f=c(55511),g=c(55591);b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE="GOOGLE_API_CERTIFICATE_CONFIG";class h extends Error{constructor(a){super(a),this.name="CertificateSourceUnavailableError"}}b.CertificateSourceUnavailableError=h;class i extends Error{constructor(a){super(a),this.name="InvalidConfigurationError"}}b.InvalidConfigurationError=i;class j{certificateConfigPath;trustChainPath;cert;key;constructor(a){if(!a.useDefaultCertificateConfig&&!a.certificateConfigLocation)throw new i("Either `useDefaultCertificateConfig` must be true or a `certificateConfigLocation` must be provided.");if(a.useDefaultCertificateConfig&&a.certificateConfigLocation)throw new i("Both `useDefaultCertificateConfig` and `certificateConfigLocation` cannot be provided.");this.trustChainPath=a.trustChainPath,this.certificateConfigPath=a.certificateConfigLocation??""}async createMtlsHttpsAgent(){if(!this.key||!this.cert)throw new i("Cannot create mTLS Agent with missing certificate or key");return new g.Agent({key:this.key,cert:this.cert})}async getSubjectToken(){this.certificateConfigPath=await this.#a();let{certPath:a,keyPath:b}=await this.#b();return{cert:this.cert,key:this.key}=await this.#c(a,b),await this.#d(this.cert)}async #a(){let a=this.certificateConfigPath;if(a){if(await (0,d.isValidFile)(a))return a;throw new h(`Provided certificate config path is invalid: ${a}`)}let c=process.env[b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE];if(c){if(await (0,d.isValidFile)(c))return c;throw new h(`Path from environment variable "${b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" is invalid: ${c}`)}let e=(0,d.getWellKnownCertificateConfigFileLocation)();if(await (0,d.isValidFile)(e))return e;throw new h(`Could not find certificate configuration file. Searched override path, the "${b.CERTIFICATE_CONFIGURATION_ENV_VARIABLE}" env var, and the gcloud path (${e}).`)}async #b(){let a,b=this.certificateConfigPath;try{a=await e.promises.readFile(b,"utf8")}catch(a){throw new h(`Failed to read certificate config file at: ${b}`)}try{let c=JSON.parse(a),d=c?.cert_configs?.workload?.cert_path,e=c?.cert_configs?.workload?.key_path;if(!d||!e)throw new i(`Certificate config file (${b}) is missing required "cert_path" or "key_path" in the workload config.`);return{certPath:d,keyPath:e}}catch(a){if(a instanceof i)throw a;throw new i(`Failed to parse certificate config from ${b}: ${a.message}`)}}async #c(a,b){let c,d;try{c=await e.promises.readFile(a),new f.X509Certificate(c)}catch(c){let b=c instanceof Error?c.message:String(c);throw new h(`Failed to read certificate file at ${a}: ${b}`)}try{d=await e.promises.readFile(b),(0,f.createPrivateKey)(d)}catch(c){let a=c instanceof Error?c.message:String(c);throw new h(`Failed to read private key file at ${b}: ${a}`)}return{cert:c,key:d}}async #d(a){let b=new f.X509Certificate(a);if(!this.trustChainPath)return JSON.stringify([b.raw.toString("base64")]);try{let a,c=((await e.promises.readFile(this.trustChainPath,"utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g)??[]).map((a,b)=>{try{return new f.X509Certificate(a)}catch(c){let a=c instanceof Error?c.message:String(c);throw new i(`Failed to parse certificate at index ${b} in trust chain file ${this.trustChainPath}: ${a}`)}}),d=c.findIndex(a=>b.raw.equals(a.raw));if(-1===d)a=[b,...c];else if(0===d)a=c;else throw new i(`Leaf certificate exists in the trust chain but is not the first entry (found at index ${d}).`);return JSON.stringify(a.map(a=>a.raw.toString("base64")))}catch(b){if(b instanceof i)throw b;let a=b instanceof Error?b.message:String(b);throw new h(`Failed to process certificate chain from ${this.trustChainPath}: ${a}`)}}}b.CertificateSubjectTokenSupplier=j},2553:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UrlSubjectTokenSupplier=void 0;let d=c(56916);class e{url;headers;formatType;subjectTokenFieldName;additionalGaxiosOptions;constructor(a){this.url=a.url,this.formatType=a.formatType,this.subjectTokenFieldName=a.subjectTokenFieldName,this.headers=a.headers,this.additionalGaxiosOptions=a.additionalGaxiosOptions}async getSubjectToken(a){let b,c={...this.additionalGaxiosOptions,url:this.url,method:"GET",headers:this.headers,responseType:this.formatType};if(d.AuthClient.setMethodName(c,"getSubjectToken"),"text"===this.formatType?b=(await a.transporter.request(c)).data:"json"===this.formatType&&this.subjectTokenFieldName&&(b=(await a.transporter.request(c)).data[this.subjectTokenFieldName]),!b)throw Error("Unable to parse the subject_token from the credential_source URL");return b}}b.UrlSubjectTokenSupplier=e},2800:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.GoogleAuth=b.GoogleAuthExceptionMessages=void 0;let d=c(79646),e=c(29021),f=c(27064),g=c(18240),h=c(21820),i=c(33873),j=c(55661),k=c(29027),l=c(71776),m=c(45813),n=c(10607),o=c(75357),p=c(2874),q=c(75093),r=c(82080),s=c(56916),t=c(60446),u=c(36654),v=c(45920);b.GoogleAuthExceptionMessages={API_KEY_WITH_CREDENTIALS:"API Keys and Credentials are mutually exclusive authentication methods and cannot be used together.",NO_PROJECT_ID_FOUND:"Unable to detect a Project Id in the current environment. \nTo learn more about authentication and Google APIs, visit: \nhttps://cloud.google.com/docs/authentication/getting-started",NO_CREDENTIALS_FOUND:"Unable to find credentials in current environment. \nTo learn more about authentication and Google APIs, visit: \nhttps://cloud.google.com/docs/authentication/getting-started",NO_ADC_FOUND:"Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.",NO_UNIVERSE_DOMAIN_FOUND:"Unable to detect a Universe Domain in the current environment.\nTo learn more about Universe Domain retrieval, visit: \nhttps://cloud.google.com/compute/docs/metadata/predefined-metadata-keys"};class w{checkIsGCE=void 0;useJWTAccessWithScope;defaultServicePath;get isGCE(){return this.checkIsGCE}_findProjectIdPromise;_cachedProjectId;jsonContent=null;apiKey;cachedCredential=null;#e=null;defaultScopes;keyFilename;scopes;clientOptions={};constructor(a={}){if(this._cachedProjectId=a.projectId||null,this.cachedCredential=a.authClient||null,this.keyFilename=a.keyFilename||a.keyFile,this.scopes=a.scopes,this.clientOptions=a.clientOptions||{},this.jsonContent=a.credentials||null,this.apiKey=a.apiKey||this.clientOptions.apiKey||null,this.apiKey&&(this.jsonContent||this.clientOptions.credentials))throw RangeError(b.GoogleAuthExceptionMessages.API_KEY_WITH_CREDENTIALS);a.universeDomain&&(this.clientOptions.universeDomain=a.universeDomain)}setGapicJWTValues(a){a.defaultServicePath=this.defaultServicePath,a.useJWTAccessWithScope=this.useJWTAccessWithScope,a.defaultScopes=this.defaultScopes}getProjectId(a){if(!a)return this.getProjectIdAsync();this.getProjectIdAsync().then(b=>a(null,b),a)}async getProjectIdOptional(){try{return await this.getProjectId()}catch(a){if(a instanceof Error&&a.message===b.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)return null;throw a}}async findAndCacheProjectId(){let a=null;if(a||=await this.getProductionProjectId(),a||=await this.getFileProjectId(),a||=await this.getDefaultServiceProjectId(),a||=await this.getGCEProjectId(),a||=await this.getExternalAccountClientProjectId())return this._cachedProjectId=a,a;throw Error(b.GoogleAuthExceptionMessages.NO_PROJECT_ID_FOUND)}async getProjectIdAsync(){return this._cachedProjectId?this._cachedProjectId:(this._findProjectIdPromise||(this._findProjectIdPromise=this.findAndCacheProjectId()),this._findProjectIdPromise)}async getUniverseDomainFromMetadataServer(){let a;try{a=await g.universe("universe-domain"),a||=s.DEFAULT_UNIVERSE}catch(b){if(b&&b?.response?.status===404)a=s.DEFAULT_UNIVERSE;else throw b}return a}async getUniverseDomain(){let a=(0,v.originalOrCamelOptions)(this.clientOptions).get("universe_domain");try{a??=(await this.getClient()).universeDomain}catch{a??=s.DEFAULT_UNIVERSE}return a}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(a={},b){let c;if("function"==typeof a?b=a:c=a,!b)return this.getApplicationDefaultAsync(c);this.getApplicationDefaultAsync(c).then(a=>b(null,a.credential,a.projectId),b)}async getApplicationDefaultAsync(a={}){let c;if(this.cachedCredential)return await this.#f(this.cachedCredential,null);if((c=await this._tryGetApplicationCredentialsFromEnvironmentVariable(a))||(c=await this._tryGetApplicationCredentialsFromWellKnownFile(a)))return c instanceof n.JWT?c.scopes=this.scopes:c instanceof r.BaseExternalAccountClient&&(c.scopes=this.getAnyScopes()),await this.#f(c);if(await this._checkIsGCE())return a.scopes=this.getAnyScopes(),await this.#f(new k.Compute(a));throw Error(b.GoogleAuthExceptionMessages.NO_ADC_FOUND)}async #f(a,b=process.env.GOOGLE_CLOUD_QUOTA_PROJECT||null){let c=await this.getProjectIdOptional();return b&&(a.quotaProjectId=b),this.cachedCredential=a,{credential:a,projectId:c}}async _checkIsGCE(){return void 0===this.checkIsGCE&&(this.checkIsGCE=g.getGCPResidency()||await g.isAvailable()),this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(a){let b=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials;if(!b||0===b.length)return null;try{return this._getApplicationCredentialsFromFilePath(b,a)}catch(a){throw a instanceof Error&&(a.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${a.message}`),a}}async _tryGetApplicationCredentialsFromWellKnownFile(a){let b=null;if(this._isWindows())b=process.env.APPDATA;else{let a=process.env.HOME;a&&(b=i.join(a,".config"))}return(b&&(b=i.join(b,"gcloud","application_default_credentials.json"),e.existsSync(b)||(b=null)),b)?await this._getApplicationCredentialsFromFilePath(b,a):null}async _getApplicationCredentialsFromFilePath(a,b={}){if(!a||0===a.length)throw Error("The file path is invalid.");try{if(a=e.realpathSync(a),!e.lstatSync(a).isFile())throw Error()}catch(b){throw b instanceof Error&&(b.message=`The file at ${a} does not exist, or it is not a file. ${b.message}`),b}let c=e.createReadStream(a);return this.fromStream(c,b)}fromImpersonatedJSON(a){if(!a)throw Error("Must pass in a JSON object containing an impersonated refresh token");if(a.type!==p.IMPERSONATED_ACCOUNT_TYPE)throw Error(`The incoming JSON object does not have the "${p.IMPERSONATED_ACCOUNT_TYPE}" type`);if(!a.source_credentials)throw Error("The incoming JSON object does not contain a source_credentials field");if(!a.service_account_impersonation_url)throw Error("The incoming JSON object does not contain a service_account_impersonation_url field");let b=this.fromJSON(a.source_credentials);if(a.service_account_impersonation_url?.length>256)throw RangeError(`Target principal is too long: ${a.service_account_impersonation_url}`);let c=/(?<target>[^/]+):(generateAccessToken|generateIdToken)$/.exec(a.service_account_impersonation_url)?.groups?.target;if(!c)throw RangeError(`Cannot extract target principal from ${a.service_account_impersonation_url}`);let d=(this.scopes||a.scopes||this.defaultScopes)??[];return new p.Impersonated({...a,sourceClient:b,targetPrincipal:c,targetScopes:Array.isArray(d)?d:[d]})}fromJSON(a,b={}){let c,d=(0,v.originalOrCamelOptions)(b).get("universe_domain");return a.type===o.USER_REFRESH_ACCOUNT_TYPE?(c=new o.UserRefreshClient(b)).fromJSON(a):a.type===p.IMPERSONATED_ACCOUNT_TYPE?c=this.fromImpersonatedJSON(a):a.type===r.EXTERNAL_ACCOUNT_TYPE?(c=q.ExternalAccountClient.fromJSON({...a,...b})).scopes=this.getAnyScopes():a.type===t.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE?c=new t.ExternalAccountAuthorizedUserClient({...a,...b}):a.type===u.GDCH_SERVICE_ACCOUNT_TYPE?(c=new u.GdchClient(b)).fromJSON(a):(b.scopes=this.scopes,c=new n.JWT(b),this.setGapicJWTValues(c),c.fromJSON(a)),d&&(c.universeDomain=d),c}_cacheClientFromJSON(a,b){let c=this.fromJSON(a,b);return this.jsonContent=a,this.cachedCredential=c,c}fromStream(a,b={},c){let d={};if("function"==typeof b?c=b:d=b,!c)return this.fromStreamAsync(a,d);this.fromStreamAsync(a,d).then(a=>c(null,a),c)}fromStreamAsync(a,b){return new Promise((c,d)=>{if(!a)throw Error("Must pass in a stream containing the Google auth settings.");let e=[];a.setEncoding("utf8").on("error",d).on("data",a=>e.push(a)).on("end",()=>{try{try{let a=JSON.parse(e.join("")),d=this._cacheClientFromJSON(a,b);return c(d)}catch(b){if(!this.keyFilename)throw b;let a=new n.JWT({...this.clientOptions,keyFile:this.keyFilename});return this.cachedCredential=a,this.setGapicJWTValues(a),c(a)}}catch(a){return d(a)}})})}fromAPIKey(a,b={}){return new n.JWT({...b,apiKey:a})}_isWindows(){let a=h.platform();return!!a&&!!(a.length>=3)&&"win"===a.substring(0,3).toLowerCase()}async getDefaultServiceProjectId(){return new Promise(a=>{(0,d.exec)("gcloud config config-helper --format json",(b,c)=>{if(!b&&c)try{let b=JSON.parse(c).configuration.properties.core.project;a(b);return}catch(a){}a(null)})})}getProductionProjectId(){return process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project}async getFileProjectId(){if(this.cachedCredential)return this.cachedCredential.projectId;if(this.keyFilename){let a=await this.getClient();if(a&&a.projectId)return a.projectId}let a=await this._tryGetApplicationCredentialsFromEnvironmentVariable();return a?a.projectId:null}async getExternalAccountClientProjectId(){if(!this.jsonContent||this.jsonContent.type!==r.EXTERNAL_ACCOUNT_TYPE)return null;let a=await this.getClient();return await a.getProjectId()}async getGCEProjectId(){try{return await g.project("project-id")}catch(a){return null}}getCredentials(a){if(!a)return this.getCredentialsAsync();this.getCredentialsAsync().then(b=>a(null,b),a)}async getCredentialsAsync(){let a=await this.getClient();if(a instanceof p.Impersonated)return{client_email:a.getTargetPrincipal()};if(a instanceof r.BaseExternalAccountClient){let b=a.getServiceAccountEmail();if(b)return{client_email:b,universe_domain:a.universeDomain}}if(this.jsonContent)return{client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key,universe_domain:this.jsonContent.universe_domain};if(await this._checkIsGCE()){let[a,b]=await Promise.all([g.instance("service-accounts/default/email"),this.getUniverseDomain()]);return{client_email:a,universe_domain:b}}throw Error(b.GoogleAuthExceptionMessages.NO_CREDENTIALS_FOUND)}async getClient(){if(this.cachedCredential)return this.cachedCredential;this.#e=this.#e||this.#g();try{let a=await this.#e;if(a instanceof u.GdchClient&&!a.apiAudience){let b=this.clientOptions,c=b.apiEndpoint||b.servicePath;if(c){let b=c.startsWith("http")?"":"https://",d=`${b}${c}`.replace(/\/+$/,""),e=a.createWithGdchAudience(d);return this.cachedCredential=e,e}}return a}finally{this.#e=null}}async #g(){if(this.jsonContent)return this._cacheClientFromJSON(this.jsonContent,this.clientOptions);if(this.keyFilename){let a=i.resolve(this.keyFilename),b=e.createReadStream(a);return await this.fromStreamAsync(b,this.clientOptions)}if(this.apiKey){let a=await this.fromAPIKey(this.apiKey,this.clientOptions);a.scopes=this.scopes;let{credential:b}=await this.#f(a);return b}{let{credential:a}=await this.getApplicationDefaultAsync(this.clientOptions);return a}}async getIdTokenClient(a){let b=await this.getClient();if(!("fetchIdToken"in b))throw Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.");return new l.IdTokenClient({targetAudience:a,idTokenProvider:b})}async getAccessToken(){let a=await this.getClient();return(await a.getAccessToken()).token}async getRequestHeaders(a){return(await this.getClient()).getRequestHeaders(a)}async authorizeRequest(a={}){let b=a.url,c=await this.getClient(),d=await c.getRequestHeaders(b);return a.headers=f.Gaxios.mergeHeaders(a.headers,d),a}async fetch(...a){return(await this.getClient()).fetch(...a)}async request(a){return(await this.getClient()).request(a)}getEnv(){return(0,m.getEnv)()}async sign(a,b){let c=await this.getClient(),d=await this.getUniverseDomain();if(b=b||`https://iamcredentials.${d}/v1/projects/-/serviceAccounts/`,c instanceof p.Impersonated)return(await c.sign(a)).signedBlob;let e=(0,j.createCrypto)();if(c instanceof n.JWT&&c.key)return await e.sign(c.key,a);let f=await this.getCredentials();if(!f.client_email)throw Error("Cannot sign data without `client_email`.");return this.signBlob(e,f.client_email,a,b)}async signBlob(a,b,c,d){let e=new URL(d+`${b}:signBlob`);return(await this.request({method:"POST",url:e.href,data:{payload:a.encodeBase64StringUtf8(c)},retry:!0,retryConfig:{httpMethodsToRetry:["POST"]}})).data.signedBlob}}b.GoogleAuth=w},2874:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Impersonated=b.IMPERSONATED_ACCOUNT_TYPE=void 0;let d=c(16757),e=c(27064),f=c(45920);b.IMPERSONATED_ACCOUNT_TYPE="impersonated_service_account";class g extends d.OAuth2Client{sourceClient;targetPrincipal;targetScopes;delegates;lifetime;endpoint;constructor(a={}){if(super(a),this.credentials={expiry_date:1,refresh_token:"impersonated-placeholder"},this.sourceClient=a.sourceClient??new d.OAuth2Client,this.targetPrincipal=a.targetPrincipal??"",this.delegates=a.delegates??[],this.targetScopes=a.targetScopes??[],this.lifetime=a.lifetime??3600,(0,f.originalOrCamelOptions)(a).get("universe_domain")){if(this.sourceClient.universeDomain!==this.universeDomain)throw RangeError(`Universe domain ${this.sourceClient.universeDomain} in source credentials does not match ${this.universeDomain} universe domain set for impersonated credentials.`)}else this.universeDomain=this.sourceClient.universeDomain;this.endpoint=a.endpoint??`https://iamcredentials.${this.universeDomain}`}async sign(a){await this.sourceClient.getAccessToken();let b=`projects/-/serviceAccounts/${this.targetPrincipal}`,c=`${this.endpoint}/v1/${b}:signBlob`,d={delegates:this.delegates,payload:Buffer.from(a).toString("base64")};return(await this.sourceClient.request({...g.RETRY_CONFIG,url:c,data:d,method:"POST"})).data}getTargetPrincipal(){return this.targetPrincipal}async refreshToken(){try{await this.sourceClient.getAccessToken();let a="projects/-/serviceAccounts/"+this.targetPrincipal,b=`${this.endpoint}/v1/${a}:generateAccessToken`,c={delegates:this.delegates,scope:this.targetScopes,lifetime:this.lifetime+"s"},d=await this.sourceClient.request({...g.RETRY_CONFIG,url:b,data:c,method:"POST"}),e=d.data;return this.credentials.access_token=e.accessToken,this.credentials.expiry_date=Date.parse(e.expireTime),{tokens:this.credentials,res:d}}catch(c){if(!(c instanceof Error))throw c;let a=0,b="";if(c instanceof e.GaxiosError&&(a=c?.response?.data?.error?.status,b=c?.response?.data?.error?.message),a&&b)throw c.message=`${a}: unable to impersonate: ${b}`,c;throw c.message=`unable to impersonate: ${c}`,c}}async fetchIdToken(a,b){await this.sourceClient.getAccessToken();let c=`projects/-/serviceAccounts/${this.targetPrincipal}`,d=`${this.endpoint}/v1/${c}:generateIdToken`,e={delegates:this.delegates,audience:a,includeEmail:b?.includeEmail??!0,useEmailAzp:b?.includeEmail??!0};return(await this.sourceClient.request({...g.RETRY_CONFIG,url:d,data:e,method:"POST"})).data.token}}b.Impersonated=g},3783:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.GaxiosInterceptorManager=void 0;class c extends Set{}b.GaxiosInterceptorManager=c},4198:(a,b)=>{"use strict";async function c(a,b){return await b.request({url:"https://oauth2.googleapis.com/revoke?token="+a,retry:!0})}Object.defineProperty(b,"__esModule",{value:!0}),b.revokeToken=c},6361:(a,b,c)=>{"use strict";let{EMPTY_BUFFER:d}=c(17165),e=Buffer[Symbol.species];function f(a,b,c,d,e){for(let f=0;f<e;f++)c[d+f]=a[f]^b[3&f]}function g(a,b){for(let c=0;c<a.length;c++)a[c]^=b[3&c]}function h(a){let b;return(h.readOnly=!0,Buffer.isBuffer(a))?a:(a instanceof ArrayBuffer?b=new e(a):ArrayBuffer.isView(a)?b=new e(a.buffer,a.byteOffset,a.byteLength):(b=Buffer.from(a),h.readOnly=!1),b)}if(a.exports={concat:function(a,b){if(0===a.length)return d;if(1===a.length)return a[0];let c=Buffer.allocUnsafe(b),f=0;for(let b=0;b<a.length;b++){let d=a[b];c.set(d,f),f+=d.length}return f<b?new e(c.buffer,c.byteOffset,f):c},mask:f,toArrayBuffer:function(a){return a.length===a.buffer.byteLength?a.buffer:a.buffer.slice(a.byteOffset,a.byteOffset+a.length)},toBuffer:h,unmask:g},!process.env.WS_NO_BUFFER_UTIL)try{let b=c(39727);a.exports.mask=function(a,c,d,e,g){g<48?f(a,c,d,e,g):b.mask(a,c,d,e,g)},a.exports.unmask=function(a,c){a.length<32?g(a,c):b.unmask(a,c)}}catch(a){}},6624:a=>{function b(a,b){"boolean"==typeof b&&(b={forever:b}),this._originalTimeouts=JSON.parse(JSON.stringify(a)),this._timeouts=a,this._options=b||{},this._maxRetryTime=b&&b.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}a.exports=b,b.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},b.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},b.prototype.retry=function(a){if(this._timeout&&clearTimeout(this._timeout),!a)return!1;var b=new Date().getTime();if(a&&b-this._operationStart>=this._maxRetryTime)return this._errors.push(a),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(a);var c=this._timeouts.shift();if(void 0===c)if(!this._cachedTimeouts)return!1;else this._errors.splice(0,this._errors.length-1),c=this._cachedTimeouts.slice(-1);var d=this;return this._timer=setTimeout(function(){d._attempts++,d._operationTimeoutCb&&(d._timeout=setTimeout(function(){d._operationTimeoutCb(d._attempts)},d._operationTimeout),d._options.unref&&d._timeout.unref()),d._fn(d._attempts)},c),this._options.unref&&this._timer.unref(),!0},b.prototype.attempt=function(a,b){this._fn=a,b&&(b.timeout&&(this._operationTimeout=b.timeout),b.cb&&(this._operationTimeoutCb=b.cb));var c=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){c._operationTimeoutCb()},c._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},b.prototype.try=function(a){console.log("Using RetryOperation.try() is deprecated"),this.attempt(a)},b.prototype.start=function(a){console.log("Using RetryOperation.start() is deprecated"),this.attempt(a)},b.prototype.start=b.prototype.try,b.prototype.errors=function(){return this._errors},b.prototype.attempts=function(){return this._attempts},b.prototype.mainError=function(){if(0===this._errors.length)return null;for(var a={},b=null,c=0,d=0;d<this._errors.length;d++){var e=this._errors[d],f=e.message,g=(a[f]||0)+1;a[f]=g,g>=c&&(b=e,c=g)}return b}},6677:(a,b,c)=>{var d=c(82517),e=a.exports;!function(){"use strict";var a,b,c,f=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function h(a){return f.lastIndex=0,f.test(a)?'"'+a.replace(f,function(a){var b=g[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}"function"!=typeof e.stringify&&(e.stringify=function(e,f,g){var i;if(a="",b="","number"==typeof g)for(i=0;i<g;i+=1)b+=" ";else"string"==typeof g&&(b=g);if(c=f,f&&"function"!=typeof f&&("object"!=typeof f||"number"!=typeof f.length))throw Error("JSON.stringify");return function e(f,g){var i,j,k,l,m,n=a,o=g[f],p=null!=o&&(o instanceof d||d.isBigNumber(o));switch(o&&"object"==typeof o&&"function"==typeof o.toJSON&&(o=o.toJSON(f)),"function"==typeof c&&(o=c.call(g,f,o)),typeof o){case"string":if(p)return o;return h(o);case"number":return isFinite(o)?String(o):"null";case"boolean":case"null":case"bigint":return String(o);case"object":if(!o)return"null";if(a+=b,m=[],"[object Array]"===Object.prototype.toString.apply(o)){for(i=0,l=o.length;i<l;i+=1)m[i]=e(i,o)||"null";return k=0===m.length?"[]":a?"[\n"+a+m.join(",\n"+a)+"\n"+n+"]":"["+m.join(",")+"]",a=n,k}if(c&&"object"==typeof c)for(i=0,l=c.length;i<l;i+=1)"string"==typeof c[i]&&(k=e(j=c[i],o))&&m.push(h(j)+(a?": ":":")+k);else Object.keys(o).forEach(function(b){var c=e(b,o);c&&m.push(h(b)+(a?": ":":")+c)});return k=0===m.length?"{}":a?"{\n"+a+m.join(",\n"+a)+"\n"+n+"}":"{"+m.join(",")+"}",a=n,k}}("",{"":e})})}()},7236:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.getToken=e;let d=c(70592);async function e(a){if(!a.transporter)throw Error("No transporter set.");try{let b={method:"POST",url:"https://oauth2.googleapis.com/token",data:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:(0,d.getJwsSign)(a)}),responseType:"json",retryConfig:{httpMethodsToRetry:["POST"]}};return(await a.transporter.request(b)).data}catch(b){let a=b.response?.data;throw a?.error&&(b.message=`${a.error}: ${a.error_description}`),b}}},10607:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.JWT=void 0;let d=c(26389),e=c(36079),f=c(16822),g=c(16757),h=c(56916);class i extends g.OAuth2Client{email;keyFile;key;keyId;defaultScopes;scopes;scope;subject;gtoken;additionalClaims;useJWTAccessWithScope;defaultServicePath;access;constructor(a={}){super(a),this.email=a.email,this.keyFile=a.keyFile,this.key=a.key,this.keyId=a.keyId,this.scopes=a.scopes,this.subject=a.subject,this.additionalClaims=a.additionalClaims,this.credentials={refresh_token:"jwt-placeholder",expiry_date:1}}createScoped(a){let b=new i(this);return b.scopes=a,b}async getRequestMetadataAsync(a){a=this.defaultServicePath?`https://${this.defaultServicePath}/`:a;let b=!this.hasUserScopes()&&a||this.useJWTAccessWithScope&&this.hasAnyScopes()||this.universeDomain!==h.DEFAULT_UNIVERSE;if(this.subject&&this.universeDomain!==h.DEFAULT_UNIVERSE)throw RangeError(`Service Account user is configured for the credential. Domain-wide delegation is not supported in universes other than ${h.DEFAULT_UNIVERSE}`);if(!this.apiKey&&b)if(this.additionalClaims&&this.additionalClaims.target_audience){let{tokens:a}=await this.refreshToken();return{headers:this.addSharedMetadataHeaders(new Headers({authorization:`Bearer ${a.id_token}`}))}}else{let b;this.access||(this.access=new f.JWTAccess(this.email,this.key,this.keyId,this.eagerRefreshThresholdMillis)),this.hasUserScopes()?b=this.scopes:a||(b=this.defaultScopes);let c=this.useJWTAccessWithScope||this.universeDomain!==h.DEFAULT_UNIVERSE,d=await this.access.getRequestHeaders(a??void 0,this.additionalClaims,c?b:void 0);return{headers:this.addSharedMetadataHeaders(d)}}return this.hasAnyScopes()||this.apiKey?super.getRequestMetadataAsync(a):{headers:new Headers}}async fetchIdToken(a){let b=new d.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:{target_audience:a},transporter:this.transporter});if(await b.getToken({forceRefresh:!0}),!b.idToken)throw Error("Unknown error: Failed to fetch ID token");return b.idToken}hasUserScopes(){return!!this.scopes&&this.scopes.length>0}hasAnyScopes(){return!!this.scopes&&!!(this.scopes.length>0)||!!this.defaultScopes&&!!(this.defaultScopes.length>0)}authorize(a){if(!a)return this.authorizeAsync();this.authorizeAsync().then(b=>a(null,b),a)}async authorizeAsync(){let a=await this.refreshToken();if(!a)throw Error("No result returned");return this.credentials=a.tokens,this.credentials.refresh_token="jwt-placeholder",this.key=this.gtoken.googleTokenOptions?.key,this.email=this.gtoken.googleTokenOptions?.iss,a.tokens}async refreshTokenNoCache(){let a=this.createGToken(),b={access_token:(await a.getToken({forceRefresh:this.isTokenExpiring()})).access_token,token_type:"Bearer",expiry_date:a.expiresAt,id_token:a.idToken};return this.emit("tokens",b),{res:null,tokens:b}}createGToken(){return this.gtoken||(this.gtoken=new d.GoogleToken({iss:this.email,sub:this.subject,scope:this.scopes||this.defaultScopes,keyFile:this.keyFile,key:this.key,additionalClaims:this.additionalClaims,transporter:this.transporter})),this.gtoken}fromJSON(a){if(!a)throw Error("Must pass in a JSON object containing the service account auth settings.");if(!a.client_email)throw Error("The incoming JSON object does not contain a client_email field");if(!a.private_key)throw Error("The incoming JSON object does not contain a private_key field");this.email=a.client_email,this.key=a.private_key,this.keyId=a.private_key_id,this.projectId=a.project_id,this.quotaProjectId=a.quota_project_id,this.universeDomain=a.universe_domain||this.universeDomain}fromStream(a,b){if(!b)return this.fromStreamAsync(a);this.fromStreamAsync(a).then(()=>b(),b)}fromStreamAsync(a){return new Promise((b,c)=>{if(!a)throw Error("Must pass in a stream containing the service account auth settings.");let d="";a.setEncoding("utf8").on("error",c).on("data",a=>d+=a).on("end",()=>{try{let a=JSON.parse(d);this.fromJSON(a),b()}catch(a){c(a)}})})}fromAPIKey(a){if("string"!=typeof a)throw Error("Must provide an API Key string.");this.apiKey=a}async getCredentials(){if(this.key)return{private_key:this.key,client_email:this.email};if(this.keyFile){this.createGToken();let a=await (0,e.getCredentials)(this.keyFile);return{private_key:a.privateKey,client_email:a.clientEmail}}throw Error("A key or a keyFile must be provided to getCredentials.")}}b.JWT=i},10692:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.IAMAuth=void 0;class c{selector;token;constructor(a,b){this.selector=a,this.token=b,this.selector=a,this.token=b}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}}b.IAMAuth=c},12135:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.StsCredentials=void 0;let d=c(27064),e=c(56916),f=c(50091),g=c(45920);class h extends f.OAuthClientAuthHandler{#h;constructor(a={tokenExchangeEndpoint:""},b){("object"!=typeof a||a instanceof URL)&&(a={tokenExchangeEndpoint:a,clientAuthentication:b}),super(a),this.#h=a.tokenExchangeEndpoint}async exchangeToken(a,b,c){let i={grant_type:a.grantType,resource:a.resource,audience:a.audience,scope:a.scope?.join(" "),requested_token_type:a.requestedTokenType,subject_token:a.subjectToken,subject_token_type:a.subjectTokenType,actor_token:a.actingParty?.actorToken,actor_token_type:a.actingParty?.actorTokenType,options:c&&JSON.stringify(c)},j={...h.RETRY_CONFIG,url:this.#h.toString(),method:"POST",headers:b,data:new URLSearchParams((0,g.removeUndefinedValuesInObject)(i)),responseType:"json"};e.AuthClient.setMethodName(j,"exchangeToken"),this.applyClientAuthenticationOptions(j);try{let a=await this.transporter.request(j),b=a.data;return b.res=a,b}catch(a){if(a instanceof d.GaxiosError&&a.response)throw(0,f.getErrorFromOAuthErrorResponse)(a.response.data,a);throw a}}}b.StsCredentials=h},12586:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.USER_AGENT=b.PRODUCT_NAME=b.pkg=void 0;let d=c(90630);b.pkg=d;let e="google-api-nodejs-client";b.PRODUCT_NAME=e,b.USER_AGENT=`${e}/${d.version}`},13259:(a,b,c)=>{"use strict";let{Writable:d}=c(27910),e=c(88634),{BINARY_TYPES:f,EMPTY_BUFFER:g,kStatusCode:h,kWebSocket:i}=c(17165),{concat:j,toArrayBuffer:k,unmask:l}=c(6361),{isValidStatusCode:m,isValidUTF8:n}=c(97861),o=Buffer[Symbol.species];class p extends d{constructor(a={}){super(),this._allowSynchronousEvents=void 0===a.allowSynchronousEvents||a.allowSynchronousEvents,this._binaryType=a.binaryType||f[0],this._extensions=a.extensions||{},this._isServer=!!a.isServer,this._maxBufferedChunks=0|a.maxBufferedChunks,this._maxFragments=0|a.maxFragments,this._maxPayload=0|a.maxPayload,this._skipUTF8Validation=!!a.skipUTF8Validation,this[i]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(a,b,c){return 8===this._opcode&&0==this._state?c():this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks?void c(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS")):void(this._bufferedBytes+=a.length,this._buffers.push(a),this.startLoop(c))}consume(a){if(this._bufferedBytes-=a,a===this._buffers[0].length)return this._buffers.shift();if(a<this._buffers[0].length){let b=this._buffers[0];return this._buffers[0]=new o(b.buffer,b.byteOffset+a,b.length-a),new o(b.buffer,b.byteOffset,a)}let b=Buffer.allocUnsafe(a);do{let c=this._buffers[0],d=b.length-a;a>=c.length?b.set(this._buffers.shift(),d):(b.set(new Uint8Array(c.buffer,c.byteOffset,a),d),this._buffers[0]=new o(c.buffer,c.byteOffset+a,c.length-a)),a-=c.length}while(a>0);return b}startLoop(a){this._loop=!0;do switch(this._state){case 0:this.getInfo(a);break;case 1:this.getPayloadLength16(a);break;case 2:this.getPayloadLength64(a);break;case 3:this.getMask();break;case 4:this.getData(a);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||a()}getInfo(a){if(this._bufferedBytes<2){this._loop=!1;return}let b=this.consume(2);if((48&b[0])!=0)return void a(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"));let c=(64&b[0])==64;if(c&&!this._extensions[e.extensionName])return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._fin=(128&b[0])==128,this._opcode=15&b[0],this._payloadLength=127&b[1],0===this._opcode){if(c)return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(!this._fragmented)return void a(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"));this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return void a(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));this._compressed=c}else{if(!(this._opcode>7)||!(this._opcode<11))return void a(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));if(!this._fin)return void a(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"));if(c)return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength)return void a(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=(128&b[1])==128,this._isServer){if(!this._masked)return void a(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}else if(this._masked)return void a(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"));126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(a)}getPayloadLength16(a){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(a)}getPayloadLength64(a){if(this._bufferedBytes<8){this._loop=!1;return}let b=this.consume(8),c=b.readUInt32BE(0);c>2097151?a(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=0x100000000*c+b.readUInt32BE(4),this.haveLength(a))}haveLength(a){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?a(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH")):this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(a){let b=g;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}b=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!=0&&l(b,this._mask)}if(this._opcode>7)return void this.controlMessage(b,a);if(this._compressed){this._state=5,this.decompress(b,a);return}if(b.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments)return void a(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));this._messageLength=this._totalPayloadLength,this._fragments.push(b)}this.dataMessage(a)}decompress(a,b){this._extensions[e.extensionName].decompress(a,this._fin,(a,c)=>{if(a)return b(a);if(c.length){if(this._messageLength+=c.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return void b(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));if(this._maxFragments>0&&this._fragments.length>=this._maxFragments)return void b(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));this._fragments.push(c)}this.dataMessage(b),0===this._state&&this.startLoop(b)})}dataMessage(a){if(!this._fin){this._state=0;return}let b=this._messageLength,c=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let d;d="nodebuffer"===this._binaryType?j(c,b):"arraybuffer"===this._binaryType?k(j(c,b)):"blob"===this._binaryType?new Blob(c):c,this._allowSynchronousEvents?(this.emit("message",d,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",d,!0),this._state=0,this.startLoop(a)}))}else{let d=j(c,b);if(!this._skipUTF8Validation&&!n(d))return void a(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));5===this._state||this._allowSynchronousEvents?(this.emit("message",d,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",d,!1),this._state=0,this.startLoop(a)}))}}controlMessage(a,b){if(8===this._opcode){if(0===a.length)this._loop=!1,this.emit("conclude",1005,g),this.end();else{let c=a.readUInt16BE(0);if(!m(c))return void b(this.createError(RangeError,`invalid status code ${c}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE"));let d=new o(a.buffer,a.byteOffset+2,a.length-2);if(!this._skipUTF8Validation&&!n(d))return void b(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._loop=!1,this.emit("conclude",c,d),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",a),this._state=0):(this._state=6,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",a),this._state=0,this.startLoop(b)}))}createError(a,b,c,d,e){this._loop=!1,this._errored=!0;let f=new a(c?`Invalid WebSocket frame: ${b}`:b);return Error.captureStackTrace(f,this.createError),f.code=e,f[h]=d,f}}a.exports=p},14986:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Colours=void 0;class c{static isEnabled(a){return a&&a.isTTY&&("function"!=typeof a.getColorDepth||a.getColorDepth()>2)}static refresh(){c.enabled=c.isEnabled(null==process?void 0:process.stderr),this.enabled?(c.reset="\x1b[0m",c.bright="\x1b[1m",c.dim="\x1b[2m",c.red="\x1b[31m",c.green="\x1b[32m",c.yellow="\x1b[33m",c.blue="\x1b[34m",c.magenta="\x1b[35m",c.cyan="\x1b[36m",c.white="\x1b[37m",c.grey="\x1b[90m"):(c.reset="",c.bright="",c.dim="",c.red="",c.green="",c.yellow="",c.blue="",c.magenta="",c.cyan="",c.white="",c.grey="")}}b.Colours=c,c.enabled=!1,c.reset="",c.bright="",c.dim="",c.red="",c.green="",c.yellow="",c.blue="",c.magenta="",c.cyan="",c.white="",c.grey="",c.refresh()},15394:(a,b,c)=>{var d=c(95790),e=c(51638);b.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],b.sign=d.sign,b.verify=e.verify,b.decode=e.decode,b.isValid=e.isValid,b.createSign=function(a){return new d(a)},b.createVerify=function(a){return new e(a)}},15599:function(a,b,c){"use strict";var d=this&&this.__createBinding||(Object.create?function(a,b,c,d){void 0===d&&(d=c);var e=Object.getOwnPropertyDescriptor(b,c);(!e||("get"in e?!b.__esModule:e.writable||e.configurable))&&(e={enumerable:!0,get:function(){return b[c]}}),Object.defineProperty(a,d,e)}:function(a,b,c,d){void 0===d&&(d=c),a[d]=b[c]}),e=this&&this.__exportStar||function(a,b){for(var c in a)"default"===c||Object.prototype.hasOwnProperty.call(b,c)||d(b,a,c)};Object.defineProperty(b,"__esModule",{value:!0}),e(c(35278),b)},15638:(a,b)=>{"use strict";async function c(a){var b;let c=e(a);if(!a||!a.config||!c&&!a.config.retry)return{shouldRetry:!1};(c=c||{}).currentRetryAttempt=c.currentRetryAttempt||0,c.retry=void 0===c.retry||null===c.retry?3:c.retry,c.httpMethodsToRetry=c.httpMethodsToRetry||["GET","HEAD","PUT","OPTIONS","DELETE"],c.noResponseRetries=void 0===c.noResponseRetries||null===c.noResponseRetries?2:c.noResponseRetries,c.retryDelayMultiplier=c.retryDelayMultiplier?c.retryDelayMultiplier:2,c.timeOfFirstRequest=c.timeOfFirstRequest?c.timeOfFirstRequest:Date.now(),c.totalTimeout=c.totalTimeout?c.totalTimeout:Number.MAX_SAFE_INTEGER,c.maxRetryDelay=c.maxRetryDelay?c.maxRetryDelay:Number.MAX_SAFE_INTEGER,c.statusCodesToRetry=c.statusCodesToRetry||[[100,199],[408,408],[429,429],[500,599]],a.config.retryConfig=c;let f=c.shouldRetry||d;if(!await f(a))return{shouldRetry:!1,config:a.config};let g=Math.min(((b=c).currentRetryAttempt?0:b.retryDelay??100)+(Math.pow(b.retryDelayMultiplier,b.currentRetryAttempt)-1)/2*1e3,b.totalTimeout-(Date.now()-b.timeOfFirstRequest),b.maxRetryDelay);a.config.retryConfig.currentRetryAttempt+=1;let h=c.retryBackoff?c.retryBackoff(a,g):new Promise(a=>{setTimeout(a,g)});return c.onRetryAttempt&&await c.onRetryAttempt(a),await h,{shouldRetry:!0,config:a.config}}function d(a){let b=e(a);if(a.config.signal?.aborted&&"TimeoutError"!==a.code||"AbortError"===a.code||!b||0===b.retry||!a.response&&(b.currentRetryAttempt||0)>=b.noResponseRetries||!b.httpMethodsToRetry||!b.httpMethodsToRetry.includes(a.config.method?.toUpperCase()||"GET"))return!1;if(a.response&&a.response.status){let c=!1;for(let[d,e]of b.statusCodesToRetry){let b=a.response.status;if(b>=d&&b<=e){c=!0;break}}if(!c)return!1}return b.currentRetryAttempt=b.currentRetryAttempt||0,!(b.currentRetryAttempt>=b.retry)}function e(a){if(a&&a.config&&a.config.retryConfig)return a.config.retryConfig}Object.defineProperty(b,"__esModule",{value:!0}),b.getRetryConfig=c},15667:(a,b,c)=>{"use strict";var d=c(62760).Buffer,e=c(28838);function f(a){if(d.isBuffer(a))return a;if("string"==typeof a)return d.from(a,"base64");throw TypeError("ECDSA signature must be a Base64 string or a Buffer")}function g(a,b,c){for(var d=0;b+d<c&&0===a[b+d];)++d;return a[b+d]>=128&&--d,d}a.exports={derToJose:function(a,b){a=f(a);var c=e(b),g=c+1,h=a.length,i=0;if(48!==a[i++])throw Error('Could not find expected "seq"');var j=a[i++];if(129===j&&(j=a[i++]),h-i<j)throw Error('"seq" specified length of "'+j+'", only "'+(h-i)+'" remaining');if(2!==a[i++])throw Error('Could not find expected "int" for "r"');var k=a[i++];if(h-i-2<k)throw Error('"r" specified length of "'+k+'", only "'+(h-i-2)+'" available');if(g<k)throw Error('"r" specified length of "'+k+'", max of "'+g+'" is acceptable');var l=i;if(i+=k,2!==a[i++])throw Error('Could not find expected "int" for "s"');var m=a[i++];if(h-i!==m)throw Error('"s" specified length of "'+m+'", expected "'+(h-i)+'"');if(g<m)throw Error('"s" specified length of "'+m+'", max of "'+g+'" is acceptable');var n=i;if((i+=m)!==h)throw Error('Expected to consume entire buffer, but "'+(h-i)+'" bytes remain');var o=c-k,p=c-m,q=d.allocUnsafe(o+k+p+m);for(i=0;i<o;++i)q[i]=0;a.copy(q,i,l+Math.max(-o,0),l+k),i=c;for(var r=i;i<r+p;++i)q[i]=0;return a.copy(q,i,n+Math.max(-p,0),n+m),q=(q=q.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(a,b){a=f(a);var c=e(b),h=a.length;if(h!==2*c)throw TypeError('"'+b+'" signatures must be "'+2*c+'" bytes, saw "'+h+'"');var i=g(a,0,c),j=g(a,c,a.length),k=c-i,l=c-j,m=2+k+1+1+l,n=m<128,o=d.allocUnsafe((n?2:3)+m),p=0;return o[p++]=48,n?o[p++]=m:(o[p++]=129,o[p++]=255&m),o[p++]=2,o[p++]=k,i<0?(o[p++]=0,p+=a.copy(o,p,0,c)):p+=a.copy(o,p,i,c),o[p++]=2,o[p++]=l,j<0?(o[p++]=0,a.copy(o,p,c)):a.copy(o,p,c+j),o}}},15876:(a,b,c)=>{var d=c(79428).Buffer;a.exports=function(a){return"string"==typeof a?a:"number"==typeof a||d.isBuffer(a)?a.toString():JSON.stringify(a)}},16589:(a,b,c)=>{"use strict";let d=c(81664),e=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class f extends Error{constructor(a){super(),a instanceof Error?(this.originalError=a,{message:a}=a):(this.originalError=Error(a),this.originalError.stack=this.stack),this.name="AbortError",this.message=a}}let g=(a,b)=>new Promise((c,g)=>{b={onFailedAttempt:()=>{},retries:10,...b};let h=d.operation(b);h.attempt(async d=>{try{c(await a(d))}catch(a){if(!(a instanceof Error))return void g(TypeError(`Non-error was thrown: "${a}". You should only throw errors.`));if(a instanceof f)h.stop(),g(a.originalError);else{let c;if(a instanceof TypeError&&(c=a.message,!e.includes(c)))h.stop(),g(a);else{let c;c=b.retries-(d-1),a.attemptNumber=d,a.retriesLeft=c;try{await b.onFailedAttempt(a)}catch(a){g(a);return}h.retry(a)||g(h.mainError())}}}})});a.exports=g,a.exports.default=g,a.exports.AbortError=f},16679:(a,b,c)=>{var d=null;let e=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,f=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;a.exports=function(a){"use strict";var b={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(null!=a){if(!0===a.strict&&(b.strict=!0),!0===a.storeAsString&&(b.storeAsString=!0),b.alwaysParseAsBig=!0===a.alwaysParseAsBig&&a.alwaysParseAsBig,b.useNativeBigInt=!0===a.useNativeBigInt&&a.useNativeBigInt,void 0!==a.constructorAction)if("error"===a.constructorAction||"ignore"===a.constructorAction||"preserve"===a.constructorAction)b.constructorAction=a.constructorAction;else throw Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${a.constructorAction}`);if(void 0!==a.protoAction)if("error"===a.protoAction||"ignore"===a.protoAction||"preserve"===a.protoAction)b.protoAction=a.protoAction;else throw Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${a.protoAction}`)}var g,h,i,j,k={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},l=function(a){throw{name:"SyntaxError",message:a,at:g,text:i}},m=function(a){return a&&a!==h&&l("Expected '"+a+"' instead of '"+h+"'"),h=i.charAt(g),g+=1,h},n=function(){var a,e="";for("-"===h&&(e="-",m("-"));h>="0"&&h<="9";)e+=h,m();if("."===h)for(e+=".";m()&&h>="0"&&h<="9";)e+=h;if("e"===h||"E"===h)for(e+=h,m(),("-"===h||"+"===h)&&(e+=h,m());h>="0"&&h<="9";)e+=h,m();if(isFinite(a=+e))return(null==d&&(d=c(82517)),e.length>15)?b.storeAsString?e:b.useNativeBigInt?BigInt(e):new d(e):b.alwaysParseAsBig?b.useNativeBigInt?BigInt(a):new d(a):a;l("Bad number")},o=function(){var a,b,c,d="";if('"'===h)for(var e=g;m();){if('"'===h)return g-1>e&&(d+=i.substring(e,g-1)),m(),d;if("\\"===h){if(g-1>e&&(d+=i.substring(e,g-1)),m(),"u"===h){for(b=0,c=0;b<4&&isFinite(a=parseInt(m(),16));b+=1)c=16*c+a;d+=String.fromCharCode(c)}else if("string"==typeof k[h])d+=k[h];else break;e=g}}l("Bad string")},p=function(){for(;h&&h<=" ";)m()},q=function(){switch(h){case"t":return m("t"),m("r"),m("u"),m("e"),!0;case"f":return m("f"),m("a"),m("l"),m("s"),m("e"),!1;case"n":return m("n"),m("u"),m("l"),m("l"),null}l("Unexpected '"+h+"'")},r=function(){var a=[];if("["===h){if(m("["),p(),"]"===h)return m("]"),a;for(;h;){if(a.push(j()),p(),"]"===h)return m("]"),a;m(","),p()}}l("Bad array")},s=function(){var a,c=Object.create(null);if("{"===h){if(m("{"),p(),"}"===h)return m("}"),c;for(;h;){if(a=o(),p(),m(":"),!0===b.strict&&Object.hasOwnProperty.call(c,a)&&l('Duplicate key "'+a+'"'),!0===e.test(a)?"error"===b.protoAction?l("Object contains forbidden prototype property"):"ignore"===b.protoAction?j():c[a]=j():!0===f.test(a)?"error"===b.constructorAction?l("Object contains forbidden constructor property"):"ignore"===b.constructorAction?j():c[a]=j():c[a]=j(),p(),"}"===h)return m("}"),c;m(","),p()}}l("Bad object")};return j=function(){switch(p(),h){case"{":return s();case"[":return r();case'"':return o();case"-":return n();default:return h>="0"&&h<="9"?n():q()}},function(a,b){var c;return i=a+"",g=0,h=" ",c=j(),p(),h&&l("Syntax error"),"function"==typeof b?function a(c,d){var e,f=c[d];return f&&"object"==typeof f&&Object.keys(f).forEach(function(b){void 0!==(e=a(f,b))?f[b]=e:delete f[b]}),b.call(c,d,f)}({"":c},""):c}}},16757:(a,b,c)=>{"use strict";var d,e,f,g,h,i;Object.defineProperty(b,"__esModule",{value:!0}),b.OAuth2Client=b.ClientAuthentication=b.CertificateFormat=b.CodeChallengeMethod=void 0;let j=c(27064),k=c(11723),l=c(27910),m=c(15667),n=c(45920),o=c(55661),p=c(56916),q=c(82660);(g=d||(b.CodeChallengeMethod=d={})).Plain="plain",g.S256="S256",(h=e||(b.CertificateFormat=e={})).PEM="PEM",h.JWK="JWK",(i=f||(b.ClientAuthentication=f={})).ClientSecretPost="ClientSecretPost",i.ClientSecretBasic="ClientSecretBasic",i.None="None";class r extends p.AuthClient{redirectUri;certificateCache={};certificateExpiry=null;certificateCacheFormat=e.PEM;refreshTokenPromises=new Map;endpoints;issuers;clientAuthentication;_clientId;_clientSecret;refreshHandler;constructor(a={},b,c){super("object"==typeof a?a:{}),"object"!=typeof a&&(a={clientId:a,clientSecret:b,redirectUri:c}),this._clientId=a.clientId||a.client_id,this._clientSecret=a.clientSecret||a.client_secret,this.redirectUri=a.redirectUri||a.redirect_uris?.[0],this.endpoints={tokenInfoUrl:"https://oauth2.googleapis.com/tokeninfo",oauth2AuthBaseUrl:"https://accounts.google.com/o/oauth2/v2/auth",oauth2TokenUrl:"https://oauth2.googleapis.com/token",oauth2RevokeUrl:"https://oauth2.googleapis.com/revoke",oauth2FederatedSignonPemCertsUrl:"https://www.googleapis.com/oauth2/v1/certs",oauth2FederatedSignonJwkCertsUrl:"https://www.googleapis.com/oauth2/v3/certs",oauth2IapPublicKeyUrl:"https://www.gstatic.com/iap/verify/public_key",...a.endpoints},this.clientAuthentication=a.clientAuthentication||f.ClientSecretPost,this.issuers=a.issuers||["accounts.google.com","https://accounts.google.com",this.universeDomain]}static GOOGLE_TOKEN_INFO_URL="https://oauth2.googleapis.com/tokeninfo";static CLOCK_SKEW_SECS_=300;static DEFAULT_MAX_TOKEN_LIFETIME_SECS_=86400;generateAuthUrl(a={}){if(a.code_challenge_method&&!a.code_challenge)throw Error("If a code_challenge_method is provided, code_challenge must be included.");return a.response_type=a.response_type||"code",a.client_id=a.client_id||this._clientId,a.redirect_uri=a.redirect_uri||this.redirectUri,Array.isArray(a.scope)&&(a.scope=a.scope.join(" ")),this.endpoints.oauth2AuthBaseUrl.toString()+"?"+k.stringify(a)}generateCodeVerifier(){throw Error("generateCodeVerifier is removed, please use generateCodeVerifierAsync instead.")}async generateCodeVerifierAsync(){let a=(0,o.createCrypto)(),b=a.randomBytesBase64(96).replace(/\+/g,"~").replace(/=/g,"_").replace(/\//g,"-"),c=(await a.sha256DigestBase64(b)).split("=")[0].replace(/\+/g,"-").replace(/\//g,"_");return{codeVerifier:b,codeChallenge:c}}getToken(a,b){let c="string"==typeof a?{code:a}:a;if(!b)return this.getTokenAsync(c);this.getTokenAsync(c).then(a=>b(null,a.tokens,a.res),a=>b(a,null,a.response))}async getTokenAsync(a){let b=this.endpoints.oauth2TokenUrl.toString(),c=new Headers,d={client_id:a.client_id||this._clientId,code_verifier:a.codeVerifier,code:a.code,grant_type:"authorization_code",redirect_uri:a.redirect_uri||this.redirectUri};if(this.clientAuthentication===f.ClientSecretBasic){let a=Buffer.from(`${this._clientId}:${this._clientSecret}`);c.set("authorization",`Basic ${a.toString("base64")}`)}this.clientAuthentication===f.ClientSecretPost&&(d.client_secret=this._clientSecret);let e={...r.RETRY_CONFIG,method:"POST",url:b,data:new URLSearchParams((0,n.removeUndefinedValuesInObject)(d)),headers:c};p.AuthClient.setMethodName(e,"getTokenAsync");let g=await this.transporter.request(e),h=g.data;return g.data&&g.data.expires_in&&(h.expiry_date=new Date().getTime()+1e3*g.data.expires_in,delete h.expires_in),this.emit("tokens",h),{tokens:h,res:g}}async refreshToken(a){if(!a)return this.refreshTokenNoCache(a);if(this.refreshTokenPromises.has(a))return this.refreshTokenPromises.get(a);let b=this.refreshTokenNoCache(a).then(b=>(this.refreshTokenPromises.delete(a),b),b=>{throw this.refreshTokenPromises.delete(a),b});return this.refreshTokenPromises.set(a,b),b}async refreshTokenNoCache(a){let b;if(!a)throw Error("No refresh token is set.");let c=this.endpoints.oauth2TokenUrl.toString(),d={refresh_token:a,client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token"};try{let a={...r.RETRY_CONFIG,method:"POST",url:c,data:new URLSearchParams((0,n.removeUndefinedValuesInObject)(d))};p.AuthClient.setMethodName(a,"refreshTokenNoCache"),b=await this.transporter.request(a)}catch(a){throw a instanceof j.GaxiosError&&"invalid_grant"===a.message&&a.response?.data&&/ReAuth/i.test(a.response.data.error_description)&&(a.message=JSON.stringify(a.response.data)),a}let e=b.data;return b.data&&b.data.expires_in&&(e.expiry_date=new Date().getTime()+1e3*b.data.expires_in,delete e.expires_in),this.emit("tokens",e),{tokens:e,res:b}}refreshAccessToken(a){if(!a)return this.refreshAccessTokenAsync();this.refreshAccessTokenAsync().then(b=>a(null,b.credentials,b.res),a)}async refreshAccessTokenAsync(){let a=await this.refreshToken(this.credentials.refresh_token),b=a.tokens;return b.refresh_token=this.credentials.refresh_token,this.credentials=b,{credentials:this.credentials,res:a.res}}getAccessToken(a){if(!a)return this.getAccessTokenAsync();this.getAccessTokenAsync().then(b=>a(null,b.token,b.res),a)}async getAccessTokenAsync(){if(!(!this.credentials.access_token||this.isTokenExpiring()))return{token:this.credentials.access_token};{if(!this.credentials.refresh_token)if(this.refreshHandler){let a=await this.processAndValidateRefreshHandler();if(a?.access_token)return this.setCredentials(a),{token:this.credentials.access_token}}else throw Error("No refresh token or refresh handler callback is set.");let a=await this.refreshAccessTokenAsync();if(!a.credentials||a.credentials&&!a.credentials.access_token)throw Error("Could not refresh access token.");return{token:a.credentials.access_token,res:a.res}}}async getRequestHeaders(a){return(await this.getRequestMetadataAsync(a)).headers}async getRequestMetadataAsync(a){let b=this.credentials;if(!b.access_token&&!b.refresh_token&&!this.apiKey&&!this.refreshHandler)throw Error("No access, refresh token, API key or refresh handler callback is set.");if(b.access_token&&!this.isTokenExpiring()){b.token_type=b.token_type||"Bearer";let a=new Headers({authorization:b.token_type+" "+b.access_token});return{headers:this.addSharedMetadataHeaders(a)}}if(this.refreshHandler){let a=await this.processAndValidateRefreshHandler();if(a?.access_token){this.setCredentials(a);let b=new Headers({authorization:"Bearer "+this.credentials.access_token});return{headers:this.addSharedMetadataHeaders(b)}}}if(this.apiKey)return{headers:new Headers({"X-Goog-Api-Key":this.apiKey})};let c=null,d=null;try{d=(c=await this.refreshToken(b.refresh_token)).tokens}catch(a){throw a.response&&(403===a.response.status||404===a.response.status)&&(a.message=`Could not refresh access token: ${a.message}`),a}let e=this.credentials;e.token_type=e.token_type||"Bearer",d.refresh_token=e.refresh_token,this.credentials=d;let f=new Headers({authorization:e.token_type+" "+d.access_token});return{headers:this.addSharedMetadataHeaders(f),res:c.res}}static getRevokeTokenUrl(a){return new r().getRevokeTokenURL(a).toString()}getRevokeTokenURL(a){let b=new URL(this.endpoints.oauth2RevokeUrl);return b.searchParams.append("token",a),b}revokeToken(a,b){let c={...r.RETRY_CONFIG,url:this.getRevokeTokenURL(a).toString(),method:"POST"};if(p.AuthClient.setMethodName(c,"revokeToken"),!b)return this.transporter.request(c);this.transporter.request(c).then(a=>b(null,a),b)}revokeCredentials(a){if(!a)return this.revokeCredentialsAsync();this.revokeCredentialsAsync().then(b=>a(null,b),a)}async revokeCredentialsAsync(){let a=this.credentials.access_token;if(this.credentials={},a)return this.revokeToken(a);throw Error("No access token to revoke.")}request(a,b){if(!b)return this.requestAsync(a);this.requestAsync(a).then(a=>b(null,a),a=>b(a,a.response))}async requestAsync(a,b=!1){try{let b=await this.getRequestMetadataAsync();return a.headers=j.Gaxios.mergeHeaders(a.headers),this.addUserProjectAndAuthHeaders(a.headers,b.headers),this.apiKey&&a.headers.set("X-Goog-Api-Key",this.apiKey),await this.transporter.request(a)}catch(d){let c=d.response;if(c){let d=c.status,e=this.credentials&&this.credentials.access_token&&this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure),f=this.credentials&&this.credentials.access_token&&!this.credentials.refresh_token&&(!this.credentials.expiry_date||this.forceRefreshOnFailure)&&this.refreshHandler,g=c.config.data instanceof l.Readable,h=401===d||403===d;if(!b&&h&&!g&&e)return await this.refreshAccessTokenAsync(),this.requestAsync(a,!0);if(!b&&h&&!g&&f){let b=await this.processAndValidateRefreshHandler();return b?.access_token&&this.setCredentials(b),this.requestAsync(a,!0)}}throw d}}verifyIdToken(a,b){if(b&&"function"!=typeof b)throw Error("This method accepts an options object as the first parameter, which includes the idToken, audience, and maxExpiry.");if(!b)return this.verifyIdTokenAsync(a);this.verifyIdTokenAsync(a).then(a=>b(null,a),b)}async verifyIdTokenAsync(a){if(!a.idToken)throw Error("The verifyIdToken method requires an ID Token");let b=await this.getFederatedSignonCertsAsync();return await this.verifySignedJwtWithCertsAsync(a.idToken,b.certs,a.audience,this.issuers,a.maxExpiry)}async getTokenInfo(a){let{data:b}=await this.transporter.request({...r.RETRY_CONFIG,method:"POST",headers:{"content-type":"application/x-www-form-urlencoded;charset=UTF-8",authorization:`Bearer ${a}`},url:this.endpoints.tokenInfoUrl.toString()}),c=Object.assign({expiry_date:new Date().getTime()+1e3*b.expires_in,scopes:b.scope.split(" ")},b);return delete c.expires_in,delete c.scope,c}getFederatedSignonCerts(a){if(!a)return this.getFederatedSignonCertsAsync();this.getFederatedSignonCertsAsync().then(b=>a(null,b.certs,b.res),a)}async getFederatedSignonCertsAsync(){let a,b,c=new Date().getTime(),d=(0,o.hasBrowserCrypto)()?e.JWK:e.PEM;if(this.certificateExpiry&&c<this.certificateExpiry.getTime()&&this.certificateCacheFormat===d)return{certs:this.certificateCache,format:d};switch(d){case e.PEM:b=this.endpoints.oauth2FederatedSignonPemCertsUrl.toString();break;case e.JWK:b=this.endpoints.oauth2FederatedSignonJwkCertsUrl.toString();break;default:throw Error(`Unsupported certificate format ${d}`)}try{let c={...r.RETRY_CONFIG,url:b};p.AuthClient.setMethodName(c,"getFederatedSignonCertsAsync"),a=await this.transporter.request(c)}catch(a){throw a instanceof Error&&(a.message=`Failed to retrieve verification certificates: ${a.message}`),a}let f=a?.headers.get("cache-control"),g=-1;if(f){let a=/max-age=(?<maxAge>[0-9]+)/.exec(f)?.groups?.maxAge;a&&(g=1e3*Number(a))}let h={};switch(d){case e.PEM:h=a.data;break;case e.JWK:for(let b of a.data.keys)h[b.kid]=b;break;default:throw Error(`Unsupported certificate format ${d}`)}let i=new Date;return this.certificateExpiry=-1===g?null:new Date(i.getTime()+g),this.certificateCache=h,this.certificateCacheFormat=d,{certs:h,format:d,res:a}}getIapPublicKeys(a){if(!a)return this.getIapPublicKeysAsync();this.getIapPublicKeysAsync().then(b=>a(null,b.pubkeys,b.res),a)}async getIapPublicKeysAsync(){let a,b=this.endpoints.oauth2IapPublicKeyUrl.toString();try{let c={...r.RETRY_CONFIG,url:b};p.AuthClient.setMethodName(c,"getIapPublicKeysAsync"),a=await this.transporter.request(c)}catch(a){throw a instanceof Error&&(a.message=`Failed to retrieve verification certificates: ${a.message}`),a}return{pubkeys:a.data,res:a}}verifySignedJwtWithCerts(){throw Error("verifySignedJwtWithCerts is removed, please use verifySignedJwtWithCertsAsync instead.")}async verifySignedJwtWithCertsAsync(a,b,c,d,e){let f,g,h=(0,o.createCrypto)();e||(e=r.DEFAULT_MAX_TOKEN_LIFETIME_SECS_);let i=a.split(".");if(3!==i.length)throw Error("Wrong number of segments in token: "+a);let j=i[0]+"."+i[1],k=i[2];try{f=JSON.parse(h.decodeBase64StringUtf8(i[0]))}catch(a){throw a instanceof Error&&(a.message=`Can't parse token envelope: ${i[0]}': ${a.message}`),a}if(!f)throw Error("Can't parse token envelope: "+i[0]);try{g=JSON.parse(h.decodeBase64StringUtf8(i[1]))}catch(a){throw a instanceof Error&&(a.message=`Can't parse token payload '${i[0]}`),a}if(!g)throw Error("Can't parse token payload: "+i[1]);if(!Object.prototype.hasOwnProperty.call(b,f.kid))throw Error("No pem found for envelope: "+JSON.stringify(f));let l=b[f.kid];if("ES256"===f.alg&&(k=m.joseToDer(k,"ES256").toString("base64")),!await h.verify(l,j,k))throw Error("Invalid token signature: "+a);if(!g.iat)throw Error("No issue time in token: "+JSON.stringify(g));if(!g.exp)throw Error("No expiration time in token: "+JSON.stringify(g));let n=Number(g.iat);if(isNaN(n))throw Error("iat field using invalid format");let p=Number(g.exp);if(isNaN(p))throw Error("exp field using invalid format");let s=new Date().getTime()/1e3;if(p>=s+e)throw Error("Expiration time too far in future: "+JSON.stringify(g));let t=n-r.CLOCK_SKEW_SECS_,u=p+r.CLOCK_SKEW_SECS_;if(s<t)throw Error("Token used too early, "+s+" < "+t+": "+JSON.stringify(g));if(s>u)throw Error("Token used too late, "+s+" > "+u+": "+JSON.stringify(g));if(d&&0>d.indexOf(g.iss))throw Error("Invalid issuer, expected one of ["+d+"], but got "+g.iss);if(null!=c){let a=g.aud;if(!(c.constructor===Array?c.indexOf(a)>-1:a===c))throw Error("Wrong recipient, payload audience != requiredAudience")}return new q.LoginTicket(f,g)}async processAndValidateRefreshHandler(){if(this.refreshHandler){let a=await this.refreshHandler();if(!a.access_token)throw Error("No access token is returned by the refreshHandler callback.");return a}}isTokenExpiring(){let a=this.credentials.expiry_date;return!!a&&a<=new Date().getTime()+this.eagerRefreshThresholdMillis}}b.OAuth2Client=r},16822:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.JWTAccess=void 0;let d=c(15394),e=c(45920),f={alg:"RS256",typ:"JWT"};class g{email;key;keyId;projectId;eagerRefreshThresholdMillis;cache=new e.LRUCache({capacity:500,maxAge:36e5});constructor(a,b,c,d){this.email=a,this.key=b,this.keyId=c,this.eagerRefreshThresholdMillis=d??3e5}getCachedKey(a,b){let c=a;if(b&&Array.isArray(b)&&b.length?c=a?`${a}_${b.join("_")}`:`${b.join("_")}`:"string"==typeof b&&(c=a?`${a}_${b}`:b),!c)throw Error("Scopes or url must be provided");return c}getRequestHeaders(a,b,c){let e,h=this.getCachedKey(a,c),i=this.cache.get(h),j=Date.now();if(i&&i.expiration-j>this.eagerRefreshThresholdMillis)return new Headers(i.headers);let k=Math.floor(Date.now()/1e3),l=g.getExpirationTime(k);if(Array.isArray(c)&&(c=c.join(" ")),e=c?{iss:this.email,sub:this.email,scope:c,exp:l,iat:k}:{iss:this.email,sub:this.email,aud:a,exp:l,iat:k},b){for(let a in e)if(b[a])throw Error(`The '${a}' property is not allowed when passing additionalClaims. This claim is included in the JWT by default.`)}let m=this.keyId?{...f,kid:this.keyId}:f,n=Object.assign(e,b),o=d.sign({header:m,payload:n,secret:this.key}),p=new Headers({authorization:`Bearer ${o}`});return this.cache.set(h,{expiration:1e3*l,headers:p}),p}static getExpirationTime(a){return a+3600}fromJSON(a){if(!a)throw Error("Must pass in a JSON object containing the service account auth settings.");if(!a.client_email)throw Error("The incoming JSON object does not contain a client_email field");if(!a.private_key)throw Error("The incoming JSON object does not contain a private_key field");this.email=a.client_email,this.key=a.private_key,this.keyId=a.private_key_id,this.projectId=a.project_id}fromStream(a,b){if(!b)return this.fromStreamAsync(a);this.fromStreamAsync(a).then(()=>b(),b)}fromStreamAsync(a){return new Promise((b,c)=>{a||c(Error("Must pass in a stream containing the service account auth settings."));let d="";a.setEncoding("utf8").on("data",a=>d+=a).on("error",c).on("end",()=>{try{let a=JSON.parse(d);this.fromJSON(a),b()}catch(a){c(a)}})})}}b.JWTAccess=g},17165:a=>{"use strict";let b=["nodebuffer","arraybuffer","fragments"],c="u">typeof Blob;c&&b.push("blob"),a.exports={BINARY_TYPES:b,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:c,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},18240:function(a,b,c){"use strict";let d;var e,f=this&&this.__createBinding||(Object.create?function(a,b,c,d){void 0===d&&(d=c);var e=Object.getOwnPropertyDescriptor(b,c);(!e||("get"in e?!b.__esModule:e.writable||e.configurable))&&(e={enumerable:!0,get:function(){return b[c]}}),Object.defineProperty(a,d,e)}:function(a,b,c,d){void 0===d&&(d=c),a[d]=b[c]}),g=this&&this.__setModuleDefault||(Object.create?function(a,b){Object.defineProperty(a,"default",{enumerable:!0,value:b})}:function(a,b){a.default=b}),h=this&&this.__importStar||(e=function(a){return(e=Object.getOwnPropertyNames||function(a){var b=[];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[b.length]=c);return b})(a)},function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c=e(a),d=0;d<c.length;d++)"default"!==c[d]&&f(b,a,c[d]);return g(b,a),b}),i=this&&this.__exportStar||function(a,b){for(var c in a)"default"===c||Object.prototype.hasOwnProperty.call(b,c)||f(b,a,c)};Object.defineProperty(b,"__esModule",{value:!0}),b.gcpResidencyCache=b.METADATA_SERVER_DETECTION=b.HEADERS=b.HEADER_VALUE=b.HEADER_NAME=b.SECONDARY_HOST_ADDRESS=b.HOST_ADDRESS=b.BASE_PATH=void 0,b.instance=function(a){return p("instance",a)},b.project=function(a){return p("project",a)},b.universe=function(a){return p("universe",a)},b.bulk=r,b.isAvailable=s,b.resetIsAvailableCache=function(){d=void 0},b.getGCPResidency=t,b.setGCPResidency=u,b.requestTimeout=v;let j=c(27064),k=c(39028),l=c(19807),m=h(c(15599));b.BASE_PATH="/computeMetadata/v1",b.HOST_ADDRESS="http://169.254.169.254",b.SECONDARY_HOST_ADDRESS="http://metadata.google.internal.",b.HEADER_NAME="Metadata-Flavor",b.HEADER_VALUE="Google",b.HEADERS=Object.freeze({[b.HEADER_NAME]:b.HEADER_VALUE});let n=m.log("gcp-metadata");function o(a){return a||(a=process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST||b.HOST_ADDRESS),/^https?:\/\//.test(a)||(a=`http://${a}`),new URL(b.BASE_PATH,a).href}async function p(a,c={},d=3,e=!1){let f=new Headers(b.HEADERS),g="",h={};("object"==typeof a?(new Headers(a.headers).forEach((a,b)=>f.set(b,a)),g=a.metadataKey,h=a.params||h,d=a.noResponseRetries||d,e=a.fastFail||e):g=a,"string"==typeof c)?g+=`/${c}`:(Object.keys(c).forEach(a=>{switch(a){case"params":case"property":case"headers":break;case"qs":throw Error("'qs' is not a valid configuration option. Please use 'params' instead.");default:throw Error(`'${a}' is not a valid configuration option.`)}}),c.property&&(g+=`/${c.property}`),new Headers(c.headers).forEach((a,b)=>f.set(b,a)),h=c.params||h);let i=e?q:j.request,l={url:`${o()}/${g}`,headers:f,retryConfig:{noResponseRetries:d},params:h,responseType:"text",timeout:v()};n.info("instance request %j",l);let m=await i(l);n.info("instance metadata is %s",m.data);let r=m.headers.get(b.HEADER_NAME);if(r!==b.HEADER_VALUE)throw RangeError(`Invalid response from metadata service: incorrect ${b.HEADER_NAME} header. Expected '${b.HEADER_VALUE}', got ${r?`'${r}'`:"no header"}`);if("string"==typeof m.data)try{return k.parse(m.data)}catch{}return m.data}async function q(a){let c={...a,url:a.url?.toString().replace(o(),o(b.SECONDARY_HOST_ADDRESS))};return Promise.any([(0,j.request)(a),(0,j.request)(c)])}async function r(a){let b={};return await Promise.all(a.map(a=>(async()=>{let c=await p(a);b[a.metadataKey]=c})())),b}async function s(){if(process.env.METADATA_SERVER_DETECTION){let a=process.env.METADATA_SERVER_DETECTION.trim().toLocaleLowerCase();if(!(a in b.METADATA_SERVER_DETECTION))throw RangeError(`Unknown \`METADATA_SERVER_DETECTION\` env variable. Got \`${a}\`, but it should be \`${Object.keys(b.METADATA_SERVER_DETECTION).join("`, `")}\`, or unset`);switch(a){case"assume-present":return!0;case"none":return!1;case"bios-only":return t()}}try{return void 0===d&&(d=p("instance",void 0,process.env.DETECT_GCP_RETRIES?Number(process.env.DETECT_GCP_RETRIES):0,!(process.env.GCE_METADATA_IP||process.env.GCE_METADATA_HOST))),await d,!0}catch(a){if(process.env.DEBUG_AUTH&&console.info(a),"request-timeout"===a.type||a.response&&404===a.response.status)return!1;if(!(a.response&&404===a.response.status)&&(!a.code||!["EHOSTDOWN","EHOSTUNREACH","ENETUNREACH","ENOENT","ENOTFOUND","ECONNREFUSED"].includes(a.code.toString()))){let b="UNKNOWN";a.code&&(b=a.code.toString()),process.emitWarning(`received unexpected error = ${a.message} code = ${b}`,"MetadataLookupWarning")}return!1}}function t(){return null===b.gcpResidencyCache&&u(),b.gcpResidencyCache}function u(a=null){b.gcpResidencyCache=null!==a?a:(0,l.detectGCPResidency)()}function v(){return 3e3*!t()}b.METADATA_SERVER_DETECTION=Object.freeze({"assume-present":"don't try to ping the metadata server, but assume it's present",none:"don't try to ping the metadata server, but don't try to use it either","bios-only":"treat the result of a BIOS probe as canonical (don't fall back to pinging)","ping-only":"skip the BIOS probe, and go straight to pinging"}),b.gcpResidencyCache=null,i(c(19807),b)},18853:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.fromArrayBufferToHex=function(a){return Array.from(new Uint8Array(a)).map(a=>a.toString(16).padStart(2,"0")).join("")}},19807:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.GCE_LINUX_BIOS_PATHS=void 0,b.isGoogleCloudServerless=g,b.isGoogleComputeEngineLinux=h,b.isGoogleComputeEngineMACAddress=i,b.isGoogleComputeEngine=j,b.detectGCPResidency=function(){return g()||j()};let d=c(29021),e=c(21820);b.GCE_LINUX_BIOS_PATHS={BIOS_DATE:"/sys/class/dmi/id/bios_date",BIOS_VENDOR:"/sys/class/dmi/id/bios_vendor"};let f=/^42:01/;function g(){return!!(process.env.CLOUD_RUN_JOB||process.env.FUNCTION_NAME||process.env.K_SERVICE)}function h(){if("linux"!==(0,e.platform)())return!1;try{(0,d.statSync)(b.GCE_LINUX_BIOS_PATHS.BIOS_DATE);let a=(0,d.readFileSync)(b.GCE_LINUX_BIOS_PATHS.BIOS_VENDOR,"utf8");return/Google/.test(a)}catch{return!1}}function i(){for(let a of Object.values((0,e.networkInterfaces)()))if(a){for(let{mac:b}of a)if(f.test(b))return!0}return!1}function j(){return h()||i()}},24509:(a,b,c)=>{"use strict";let{tokenChars:d}=c(97861);function e(a,b,c){void 0===a[b]?a[b]=[c]:a[b].push(c)}a.exports={format:function(a){return Object.keys(a).map(b=>{let c=a[b];return Array.isArray(c)||(c=[c]),c.map(a=>[b].concat(Object.keys(a).map(b=>{let c=a[b];return Array.isArray(c)||(c=[c]),c.map(a=>!0===a?b:`${b}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(a){let b,c,f=Object.create(null),g=Object.create(null),h=!1,i=!1,j=!1,k=-1,l=-1,m=-1,n=0;for(;n<a.length;n++)if(l=a.charCodeAt(n),void 0===b)if(-1===m&&1===d[l])-1===k&&(k=n);else if(0!==n&&(32===l||9===l))-1===m&&-1!==k&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n);let c=a.slice(k,m);44===l?(e(f,c,g),g=Object.create(null)):b=c,k=m=-1}else throw SyntaxError(`Unexpected character at index ${n}`);else if(void 0===c)if(-1===m&&1===d[l])-1===k&&(k=n);else if(32===l||9===l)-1===m&&-1!==k&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n),e(g,a.slice(k,m),!0),44===l&&(e(f,b,g),g=Object.create(null),b=void 0),k=m=-1}else if(61===l&&-1!==k&&-1===m)c=a.slice(k,n),k=m=-1;else throw SyntaxError(`Unexpected character at index ${n}`);else if(i){if(1!==d[l])throw SyntaxError(`Unexpected character at index ${n}`);-1===k?k=n:h||(h=!0),i=!1}else if(j)if(1===d[l])-1===k&&(k=n);else if(34===l&&-1!==k)j=!1,m=n;else if(92===l)i=!0;else throw SyntaxError(`Unexpected character at index ${n}`);else if(34===l&&61===a.charCodeAt(n-1))j=!0;else if(-1===m&&1===d[l])-1===k&&(k=n);else if(-1!==k&&(32===l||9===l))-1===m&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n);let d=a.slice(k,m);h&&(d=d.replace(/\\/g,""),h=!1),e(g,c,d),44===l&&(e(f,b,g),g=Object.create(null),b=void 0),c=void 0,k=m=-1}else throw SyntaxError(`Unexpected character at index ${n}`);if(-1===k||j||32===l||9===l)throw SyntaxError("Unexpected end of input");-1===m&&(m=n);let o=a.slice(k,m);return void 0===b?e(f,o,g):(void 0===c?e(g,o,!0):h?e(g,c,o.replace(/\\/g,"")):e(g,c,o),e(f,b,g)),f}}},25306:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.IdentityPoolClient=void 0;let d=c(82080),e=c(45920),f=c(33938),g=c(2553),h=c(1951),i=c(12135),j=c(27064);class k extends d.BaseExternalAccountClient{subjectTokenSupplier;constructor(a){super(a);const b=(0,e.originalOrCamelOptions)(a),c=b.get("credential_source"),d=b.get("subject_token_supplier");if(!c&&!d)throw Error("A credential source or subject token supplier must be specified.");if(c&&d)throw Error("Only one of credential source or subject token supplier can be specified.");if(d)this.subjectTokenSupplier=d,this.credentialSourceType="programmatic";else{const a=(0,e.originalOrCamelOptions)(c),b=(0,e.originalOrCamelOptions)(a.get("format")),d=b.get("type")||"text",i=b.get("subject_token_field_name");if("json"!==d&&"text"!==d)throw Error(`Invalid credential_source format "${d}"`);if("json"===d&&!i)throw Error("Missing subject_token_field_name for JSON credential_source format");const j=a.get("file"),l=a.get("url"),m=a.get("certificate"),n=a.get("headers");if(j&&l||l&&m||j&&m)throw Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.');if(j)this.credentialSourceType="file",this.subjectTokenSupplier=new f.FileSubjectTokenSupplier({filePath:j,formatType:d,subjectTokenFieldName:i});else if(l)this.credentialSourceType="url",this.subjectTokenSupplier=new g.UrlSubjectTokenSupplier({url:l,formatType:d,subjectTokenFieldName:i,headers:n,additionalGaxiosOptions:k.RETRY_CONFIG});else if(m){this.credentialSourceType="certificate";const a=new h.CertificateSubjectTokenSupplier({useDefaultCertificateConfig:m.use_default_certificate_config,certificateConfigLocation:m.certificate_config_location,trustChainPath:m.trust_chain_path});this.subjectTokenSupplier=a}else throw Error('No valid Identity Pool "credential_source" provided, must be either file, url, or certificate.')}}async retrieveSubjectToken(){let a=await this.subjectTokenSupplier.getSubjectToken(this.supplierContext);if(this.subjectTokenSupplier instanceof h.CertificateSubjectTokenSupplier){let a=await this.subjectTokenSupplier.createMtlsHttpsAgent();this.stsCredential=new i.StsCredentials({tokenExchangeEndpoint:this.getTokenUrl(),clientAuthentication:this.clientAuth,transporter:new j.Gaxios({agent:a})}),this.transporter=new j.Gaxios({...this.transporter.defaults||{},agent:a})}return a}}b.IdentityPoolClient=k},26389:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.GoogleToken=void 0;let d=c(27064),e=c(96674),f=c(4198);class g{tokenOptions;tokenHandler;constructor(a){this.tokenOptions=a||{},this.tokenOptions.transporter=this.tokenOptions.transporter||{request:a=>(0,d.request)(a)},this.tokenOptions.iss||(this.tokenOptions.iss=this.tokenOptions.email),"object"==typeof this.tokenOptions.scope&&(this.tokenOptions.scope=this.tokenOptions.scope.join(" ")),this.tokenHandler=new e.TokenHandler(this.tokenOptions)}get expiresAt(){return this.tokenHandler.tokenExpiresAt}get accessToken(){return this.tokenHandler.token?.access_token}get idToken(){return this.tokenHandler.token?.id_token}get tokenType(){return this.tokenHandler.token?.token_type}get refreshToken(){return this.tokenHandler.token?.refresh_token}hasExpired(){return this.tokenHandler.hasExpired()}isTokenExpiring(){return this.tokenHandler.isTokenExpiring()}getToken(a,b={forceRefresh:!1}){let c;"function"==typeof a?c=a:"object"==typeof a&&(b=a);let d=this.tokenHandler.getToken(b.forceRefresh??!1);return c&&d.then(a=>c(null,a),c),d}revokeToken(a){if(!this.accessToken)return Promise.reject(Error("No token to revoke."));let b=(0,f.revokeToken)(this.accessToken,this.tokenOptions.transporter);a&&b.then(()=>a(),a),this.tokenHandler=new e.TokenHandler(this.tokenOptions)}get googleTokenOptions(){return this.tokenOptions}}b.GoogleToken=g},27064:function(a,b,c){"use strict";var d=this&&this.__createBinding||(Object.create?function(a,b,c,d){void 0===d&&(d=c);var e=Object.getOwnPropertyDescriptor(b,c);(!e||("get"in e?!b.__esModule:e.writable||e.configurable))&&(e={enumerable:!0,get:function(){return b[c]}}),Object.defineProperty(a,d,e)}:function(a,b,c,d){void 0===d&&(d=c),a[d]=b[c]}),e=this&&this.__exportStar||function(a,b){for(var c in a)"default"===c||Object.prototype.hasOwnProperty.call(b,c)||d(b,a,c)};Object.defineProperty(b,"__esModule",{value:!0}),b.instance=b.Gaxios=b.GaxiosError=void 0,b.request=h;let f=c(72111);Object.defineProperty(b,"Gaxios",{enumerable:!0,get:function(){return f.Gaxios}});var g=c(51047);async function h(a){return b.instance.request(a)}Object.defineProperty(b,"GaxiosError",{enumerable:!0,get:function(){return g.GaxiosError}}),e(c(3783),b),b.instance=new f.Gaxios},28838:a=>{"use strict";function b(a){return(a/8|0)+ +(a%8!=0)}var c={ES256:b(256),ES384:b(384),ES512:b(521)};a.exports=function(a){var b=c[a];if(b)return b;throw Error('Unknown algorithm "'+a+'"')}},29027:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Compute=void 0;let d=c(27064),e=c(18240),f=c(16757);class g extends f.OAuth2Client{serviceAccountEmail;scopes;constructor(a={}){super(a),this.credentials={expiry_date:1,refresh_token:"compute-placeholder"},this.serviceAccountEmail=a.serviceAccountEmail||"default",this.scopes=Array.isArray(a.scopes)?a.scopes:a.scopes?[a.scopes]:[]}async refreshTokenNoCache(){let a,b=`service-accounts/${this.serviceAccountEmail}/token`;try{let c={property:b};this.scopes.length>0&&(c.params={scopes:this.scopes.join(",")}),a=await e.instance(c)}catch(a){throw a instanceof d.GaxiosError&&(a.message=`Could not refresh access token: ${a.message}`,this.wrapError(a)),a}let c=a;return a&&a.expires_in&&(c.expiry_date=new Date().getTime()+1e3*a.expires_in,delete c.expires_in),this.emit("tokens",c),{tokens:c,res:null}}async fetchIdToken(a){let b,c=`service-accounts/${this.serviceAccountEmail}/identity?format=full&audience=${a}`;try{b=await e.instance({property:c})}catch(a){throw a instanceof Error&&(a.message=`Could not fetch ID token: ${a.message}`),a}return b}wrapError(a){let b=a.response;b&&b.status&&(a.status=b.status,403===b.status?a.message="A Forbidden error was returned while attempting to retrieve an access token for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have the correct permission scopes specified: "+a.message:404===b.status&&(a.message="A Not Found error was returned while attempting to retrieve an accesstoken for the Compute Engine built-in service account. This may be because the Compute Engine instance does not have any permission scopes specified: "+a.message))}}b.Compute=g},31299:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.PluggableAuthClient=b.ExecutableError=void 0;let d=c(82080),e=c(67201),f=c(30);var g=c(30);Object.defineProperty(b,"ExecutableError",{enumerable:!0,get:function(){return g.ExecutableError}});class h extends d.BaseExternalAccountClient{command;timeoutMillis;outputFile;handler;constructor(a){if(super(a),!a.credential_source.executable||(this.command=a.credential_source.executable.command,!this.command))throw Error('No valid Pluggable Auth "credential_source" provided.');if(void 0===a.credential_source.executable.timeout_millis)this.timeoutMillis=3e4;else if(this.timeoutMillis=a.credential_source.executable.timeout_millis,this.timeoutMillis<5e3||this.timeoutMillis>12e4)throw Error("Timeout must be between 5000120000 milliseconds.");this.outputFile=a.credential_source.executable.output_file,this.handler=new f.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile}),this.credentialSourceType="executable"}async retrieveSubjectToken(){let a;if("1"!==process.env.GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES)throw Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.");if(this.outputFile&&(a=await this.handler.retrieveCachedResponse()),!a){let b=new Map;b.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience),b.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType),b.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0"),this.outputFile&&b.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile);let c=this.getServiceAccountEmail();c&&b.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",c),a=await this.handler.retrieveResponseFromExecutable(b)}if(a.version>1)throw Error("Version of executable is not currently supported, maximum supported version is 1.");if(!a.success)throw new f.ExecutableError(a.errorMessage,a.errorCode);if(this.outputFile&&!a.expirationTime)throw new e.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.");if(a.isExpired())throw Error("Executable response is expired.");return a.subjectToken}}b.PluggableAuthClient=h},33938:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.FileSubjectTokenSupplier=void 0;let d=c(28354),e=c(29021),f=(0,d.promisify)(e.readFile??(()=>{})),g=(0,d.promisify)(e.realpath??(()=>{})),h=(0,d.promisify)(e.lstat??(()=>{}));class i{filePath;formatType;subjectTokenFieldName;constructor(a){this.filePath=a.filePath,this.formatType=a.formatType,this.subjectTokenFieldName=a.subjectTokenFieldName}async getSubjectToken(){let a,b=this.filePath;try{if(b=await g(b),!(await h(b)).isFile())throw Error()}catch(a){throw a instanceof Error&&(a.message=`The file at ${b} does not exist, or it is not a file. ${a.message}`),a}let c=await f(b,{encoding:"utf8"});if("text"===this.formatType?a=c:"json"===this.formatType&&this.subjectTokenFieldName&&(a=JSON.parse(c)[this.subjectTokenFieldName]),!a)throw Error("Unable to parse the subject_token from the credential_source file");return a}}b.FileSubjectTokenSupplier=i},35278:function(a,b,c){"use strict";let d;var e,f,g,h=this&&this.__createBinding||(Object.create?function(a,b,c,d){void 0===d&&(d=c);var e=Object.getOwnPropertyDescriptor(b,c);(!e||("get"in e?!b.__esModule:e.writable||e.configurable))&&(e={enumerable:!0,get:function(){return b[c]}}),Object.defineProperty(a,d,e)}:function(a,b,c,d){void 0===d&&(d=c),a[d]=b[c]}),i=this&&this.__setModuleDefault||(Object.create?function(a,b){Object.defineProperty(a,"default",{enumerable:!0,value:b})}:function(a,b){a.default=b}),j=this&&this.__importStar||(e=function(a){return(e=Object.getOwnPropertyNames||function(a){var b=[];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[b.length]=c);return b})(a)},function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c=e(a),d=0;d<c.length;d++)"default"!==c[d]&&h(b,a,c[d]);return i(b,a),b});Object.defineProperty(b,"__esModule",{value:!0}),b.env=b.DebugLogBackendBase=b.placeholder=b.AdhocDebugLogger=b.LogSeverity=void 0,b.getNodeBackend=r,b.getDebugBackend=function(a){return new s(a)},b.getStructuredBackend=function(a){return new t(a)},b.setBackend=function(a){d=a,u.clear()},b.log=v;let k=c(94735),l=j(c(19771)),m=j(c(28354)),n=c(14986);(f=g||(b.LogSeverity=g={})).DEFAULT="DEFAULT",f.DEBUG="DEBUG",f.INFO="INFO",f.WARNING="WARNING",f.ERROR="ERROR";class o extends k.EventEmitter{constructor(a,b){super(),this.namespace=a,this.upstream=b,this.func=Object.assign(this.invoke.bind(this),{instance:this,on:(a,b)=>this.on(a,b)}),this.func.debug=(...a)=>this.invokeSeverity(g.DEBUG,...a),this.func.info=(...a)=>this.invokeSeverity(g.INFO,...a),this.func.warn=(...a)=>this.invokeSeverity(g.WARNING,...a),this.func.error=(...a)=>this.invokeSeverity(g.ERROR,...a),this.func.sublog=a=>v(a,this.func)}invoke(a,...b){if(this.upstream)try{this.upstream(a,...b)}catch(a){}try{this.emit("log",a,b)}catch(a){}}invokeSeverity(a,...b){this.invoke({severity:a},...b)}}b.AdhocDebugLogger=o,b.placeholder=new o("",()=>{}).func;class p{constructor(){var a;this.cached=new Map,this.filters=[],this.filtersSet=!1;let c=null!=(a=l.env[b.env.nodeEnables])?a:"*";"all"===c&&(c="*"),this.filters=c.split(",")}log(a,b,...c){try{this.filtersSet||(this.setFilters(),this.filtersSet=!0);let d=this.cached.get(a);d||(d=this.makeLogger(a),this.cached.set(a,d)),d(b,...c)}catch(a){console.error(a)}}}b.DebugLogBackendBase=p;class q extends p{constructor(){super(...arguments),this.enabledRegexp=/.*/g}isEnabled(a){return this.enabledRegexp.test(a)}makeLogger(a){return this.enabledRegexp.test(a)?(b,...c)=>{var d;let e,f=`${n.Colours.green}${a}${n.Colours.reset}`,h=`${n.Colours.yellow}${l.pid}${n.Colours.reset}`;switch(b.severity){case g.ERROR:e=`${n.Colours.red}${b.severity}${n.Colours.reset}`;break;case g.INFO:e=`${n.Colours.magenta}${b.severity}${n.Colours.reset}`;break;case g.WARNING:e=`${n.Colours.yellow}${b.severity}${n.Colours.reset}`;break;default:e=null!=(d=b.severity)?d:g.DEFAULT}let i=m.formatWithOptions({colors:n.Colours.enabled},...c),j=Object.assign({},b);delete j.severity;let k=Object.getOwnPropertyNames(j).length?JSON.stringify(j):"",o=k?`${n.Colours.grey}${k}${n.Colours.reset}`:"";console.error("%s [%s|%s] %s%s",h,f,e,i,k?` ${o}`:"")}:()=>{}}setFilters(){let a=this.filters.join(",").replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^");this.enabledRegexp=RegExp(`^${a}$`,"i")}}function r(){return new q}class s extends p{constructor(a){super(),this.debugPkg=a}makeLogger(a){let b=this.debugPkg(a);return(a,...c)=>{b(c[0],...c.slice(1))}}setFilters(){var a;let b=null!=(a=l.env.NODE_DEBUG)?a:"";l.env.NODE_DEBUG=`${b}${b?",":""}${this.filters.join(",")}`}}class t extends p{constructor(a){super(),this.upstream=null!=a?a:void 0}makeLogger(a){var b;let c=null==(b=this.upstream)?void 0:b.makeLogger(a);return(a,...b)=>{var d;let e=JSON.stringify(Object.assign({severity:null!=(d=a.severity)?d:g.INFO,message:m.format(...b)},a));c?c(a,e):console.log("%s",e)}}setFilters(){var a;null==(a=this.upstream)||a.setFilters()}}b.env={nodeEnables:"GOOGLE_SDK_NODE_LOGGING"};let u=new Map;function v(a,c){let e;if(!d&&!l.env[b.env.nodeEnables]||!a)return b.placeholder;c&&(a=`${c.instance.namespace}:${a}`);let f=u.get(a);if(f)return f.func;if(null===d)return b.placeholder;void 0===d&&(d=r());let g=new o(a,(b,...c)=>{if(e!==d){if(null===d)return;void 0===d&&(d=r()),e=d}null==d||d.log(a,b,...c)});return u.set(a,g),g.func}},36079:(a,b,c)=>{"use strict";var d,e;Object.defineProperty(b,"__esModule",{value:!0}),b.getCredentials=o;let f=c(33873),g=c(29021),h=c(28354),i=c(92109),j=g.readFile?(0,h.promisify)(g.readFile):async()=>{throw new i.ErrorWithCode("use key rather than keyFile.","MISSING_CREDENTIALS")};(e=d||(d={})).JSON=".json",e.DER=".der",e.CRT=".crt",e.PEM=".pem",e.P12=".p12",e.PFX=".pfx";class k{keyFilePath;constructor(a){this.keyFilePath=a}async getCredentials(){let a,b=await j(this.keyFilePath,"utf8");try{a=JSON.parse(b)}catch(a){throw Error(`Invalid JSON key file: ${a.message}`)}let c=a.private_key,d=a.client_email;if(!c||!d)throw new i.ErrorWithCode("private_key and client_email are required.","MISSING_CREDENTIALS");return{privateKey:c,clientEmail:d}}}class l{keyFilePath;constructor(a){this.keyFilePath=a}async getCredentials(){return{privateKey:await j(this.keyFilePath,"utf8")}}}class m{async getCredentials(){throw new i.ErrorWithCode("*.p12 certificates are not supported after v6.1.2. Consider utilizing *.json format or converting *.p12 to *.pem using the OpenSSL CLI.","UNKNOWN_CERTIFICATE_TYPE")}}class n{static create(a){switch(f.extname(a)){case d.JSON:return new k(a);case d.DER:case d.CRT:case d.PEM:return new l(a);case d.P12:case d.PFX:return new m;default:throw new i.ErrorWithCode("Unknown certificate type. Type is determined based on file extension. Current supported extensions are *.json, and *.pem.","UNKNOWN_CERTIFICATE_TYPE")}}}async function o(a){return n.create(a).getCredentials()}},36547:a=>{"use strict";a.exports=JSON.parse('{"name":"gaxios","version":"7.1.5","description":"A simple common HTTP client specifically for Google APIs and services.","main":"build/cjs/src/index.js","types":"build/cjs/src/index.d.ts","files":["build/"],"exports":{".":{"import":{"types":"./build/esm/src/index.d.ts","default":"./build/esm/src/index.js"},"require":{"types":"./build/cjs/src/index.d.ts","default":"./build/cjs/src/index.js"}}},"scripts":{"lint":"gts check --no-inline-config","test":"c8 mocha build/esm/test","presystem-test":"npm run compile","system-test":"mocha build/esm/system-test --timeout 80000","compile":"tsc -b ./tsconfig.json ./tsconfig.cjs.json && node utils/enable-esm.mjs","fix":"gts fix","prepare":"npm run compile","pretest":"npm run compile","webpack":"webpack","prebrowser-test":"npm run compile","browser-test":"node build/browser-test/browser-test-runner.js","docs":"jsdoc -c .jsdoc.js","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","prelint":"cd samples; npm link ../; npm install","clean":"gts clean"},"repository":{"type":"git","directory":"packages/gaxios","url":"https://github.com/googleapis/google-cloud-node-core.git"},"keywords":["google"],"engines":{"node":">=18"},"author":"Google, LLC","license":"Apache-2.0","devDependencies":{"@babel/plugin-proposal-private-methods":"^7.18.6","@types/cors":"^2.8.6","@types/express":"^5.0.0","@types/extend":"^3.0.1","@types/mocha":"^10.0.10","@types/multiparty":"4.2.1","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","@types/tmp":"^0.2.6","assert":"^2.0.0","browserify":"^17.0.0","c8":"^10.1.3","cors":"^2.8.5","express":"^5.0.0","gts":"^6.0.2","is-docker":"^3.0.0","jsdoc":"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0","karma":"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-remap-coverage":"^0.1.5","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1","mocha":"^11.1.0","multiparty":"^4.2.1","mv":"^2.1.1","ncp":"^2.0.0","nock":"14.0.5","null-loader":"^4.0.1","pack-n-play":"^4.0.0","puppeteer":"^24.0.0","sinon":"21.0.3","stream-browserify":"^3.0.0","tmp":"0.2.6","ts-loader":"^9.5.2","typescript":"5.8.3","undici-types":"^7.24.1","webpack":"^5.97.1","webpack-cli":"^6.0.1"},"dependencies":{"extend":"^3.0.2","https-proxy-agent":"^7.0.1","node-fetch":"^3.3.2"},"homepage":"https://github.com/googleapis/google-cloud-node-core/tree/main/packages/gaxios"}')},36654:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.GdchClient=b.GDCH_SERVICE_ACCOUNT_TYPE=void 0;let d=c(55511),e=c(29021),f=c(55591),g=c(16757);b.GDCH_SERVICE_ACCOUNT_TYPE="gdch_service_account";class h extends g.OAuth2Client{projectId;privateKeyId;privateKey;serviceIdentityName;tokenServerUri;caCertPath;apiAudience;lifetime;gdchOptions;caAgentPromise;cachedCaCertPath;lastCaCertReadTime=0;CA_CERT_TTL_MS=3e5;constructor(a={}){super(a),this.gdchOptions=a,this.projectId=a.projectId||void 0,this.privateKeyId=a.privateKeyId,this.privateKey=a.privateKey,this.serviceIdentityName=a.serviceIdentityName,this.tokenServerUri=a.tokenServerUri,this.caCertPath=a.caCertPath,this.apiAudience=a.apiAudience,this.lifetime=a.lifetime||3600,this.credentials={refresh_token:"gdch-placeholder",expiry_date:1}}createWithGdchAudience(a){if(!a)throw Error("Audience cannot be null or empty for GDCH service account credentials.");return new h({...this.gdchOptions,projectId:this.projectId,privateKeyId:this.privateKeyId,privateKey:this.privateKey,serviceIdentityName:this.serviceIdentityName,tokenServerUri:this.tokenServerUri,caCertPath:this.caCertPath,lifetime:this.lifetime,apiAudience:a})}fromJSON(a){if(!a)throw Error("Must pass in a JSON object containing the GDCH credentials settings.");if(a.type!==b.GDCH_SERVICE_ACCOUNT_TYPE)throw Error(`The incoming JSON object does not have the "${b.GDCH_SERVICE_ACCOUNT_TYPE}" type`);if("1"!==a.format_version)throw Error("Only format version 1 is supported.");if(!a.project)throw Error("The incoming JSON object does not contain a project field");if(!a.private_key_id)throw Error("The incoming JSON object does not contain a private_key_id field");if(!a.private_key)throw Error("The incoming JSON object does not contain a private_key field");if(!a.name)throw Error("The incoming JSON object does not contain a name field");if(!a.token_uri)throw Error("The incoming JSON object does not contain a token_uri field");this.projectId=a.project,this.privateKeyId=a.private_key_id,this.privateKey=a.private_key,this.serviceIdentityName=a.name,this.tokenServerUri=a.token_uri,this.caCertPath=a.ca_cert_path,this.gdchOptions={...this.gdchOptions,projectId:a.project,privateKeyId:a.private_key_id,privateKey:a.private_key,serviceIdentityName:a.name,tokenServerUri:a.token_uri,caCertPath:a.ca_cert_path}}async refreshTokenNoCache(){if(!this.apiAudience)throw Error("Audience cannot be null or empty for GDCH service account credentials. Specify the audience by calling createWithGdchAudience.");if(!this.privateKey)throw Error("Private key is not configured for GDCH credentials.");if(!this.privateKeyId)throw Error("Private key ID is not configured for GDCH credentials.");if(!this.projectId)throw Error("Project is not configured for GDCH credentials.");if(!this.serviceIdentityName)throw Error("Service identity name is not configured for GDCH credentials.");if(!this.tokenServerUri)throw Error("Token server URI is not configured for GDCH credentials.");let a=this.createAssertion(),b={audience:this.apiAudience,grant_type:"urn:ietf:params:oauth:token-type:token-exchange",requested_token_type:"urn:ietf:params:oauth:token-type:access_token",subject_token:a,subject_token_type:"urn:k8s:params:oauth:token-type:serviceaccount"},c={url:this.tokenServerUri,method:"POST",headers:{"Content-Type":"application/json"},data:b,responseType:"json",timeout:1e4,retry:!0,retryConfig:{httpMethodsToRetry:["POST"],statusCodesToRetry:[[500,599]],noResponseRetries:3}};this.caCertPath&&(c.agent=await this.getCaAgent());try{let a=await this.transporter.request(c),b=a.data;if(!b.access_token)throw Error("Token response did not contain an access_token.");if(!b.expires_in)throw Error("Token response did not contain an expires_in field.");let d={access_token:b.access_token,token_type:"STS-Bearer",expiry_date:Date.now()+1e3*b.expires_in};return this.emit("tokens",d),{res:a,tokens:d}}catch(a){if(a&&a.config&&a.config.data)try{if("string"==typeof a.config.data){let b=JSON.parse(a.config.data);b.subject_token&&(b.subject_token="***REDACTED***",a.config.data=JSON.stringify(b))}else"object"==typeof a.config.data&&a.config.data.subject_token&&(a.config.data.subject_token="***REDACTED***")}catch{}throw a instanceof Error&&(a.message=`Error getting access token for GDCH service account: ${a.message}, iss: ${this.serviceIdentityName}`),a}}createAssertion(){let a={alg:"ES256",typ:"JWT",kid:this.privateKeyId},b=`system:serviceaccount:${this.projectId}:${this.serviceIdentityName}`,c=Math.floor(Date.now()/1e3),e={iss:b,sub:b,iat:c,exp:c+this.lifetime,aud:this.tokenServerUri},f=this.base64UrlEncode(JSON.stringify(a)),g=this.base64UrlEncode(JSON.stringify(e)),h=`${f}.${g}`,i=d.sign("sha256",Buffer.from(h),{key:this.privateKey,dsaEncoding:"ieee-p1363"}),j=this.base64UrlEncode(i);return`${h}.${j}`}async requestAsync(a,b=!1){if(this.caCertPath&&!a.agent){let b=(a.url||"").toString();b.includes("googleapis.com")||b.includes("google.com")||(a.agent=await this.getCaAgent())}return super.requestAsync(a,b)}getCaAgent(){if(!this.caCertPath){this.caAgentPromise=void 0,this.cachedCaCertPath=void 0,this.lastCaCertReadTime=0;return}let a=Date.now(),b=a-this.lastCaCertReadTime>this.CA_CERT_TTL_MS;if(this.caAgentPromise&&this.caCertPath===this.cachedCaCertPath&&!b)return this.caAgentPromise;this.cachedCaCertPath=this.caCertPath,this.lastCaCertReadTime=a;let c=this.caCertPath;return this.caAgentPromise=(async()=>{try{let a=await e.promises.readFile(c);return new f.Agent({ca:a})}catch(a){throw this.cachedCaCertPath===c&&(this.caAgentPromise=void 0,this.cachedCaCertPath=void 0,this.lastCaCertReadTime=0),a instanceof Error&&(a.message=`Error reading certificate file from CA cert path, value '${c}': ${a.message}`),a}})(),this.caAgentPromise}toJSON(){return{...this,privateKey:this.privateKey?"***REDACTED***":void 0,_clientSecret:this._clientSecret?"***REDACTED***":void 0,apiKey:this.apiKey?"***REDACTED***":void 0,gdchOptions:this.gdchOptions?{...this.gdchOptions,privateKey:this.gdchOptions.privateKey?"***REDACTED***":void 0,clientSecret:this.gdchOptions.clientSecret?"***REDACTED***":void 0,client_secret:this.gdchOptions.client_secret?"***REDACTED***":void 0,apiKey:this.gdchOptions.apiKey?"***REDACTED***":void 0,credentials:this.gdchOptions.credentials?{...this.gdchOptions.credentials,access_token:this.gdchOptions.credentials.access_token?"***REDACTED***":void 0,refresh_token:this.gdchOptions.credentials.refresh_token?"***REDACTED***":void 0}:void 0}:void 0,credentials:{...this.credentials,access_token:this.credentials?.access_token?"***REDACTED***":void 0,refresh_token:this.credentials?.refresh_token?"***REDACTED***":void 0}}}[Symbol.for("nodejs.util.inspect.custom")](){return this.toJSON()}base64UrlEncode(a){return("string"==typeof a?Buffer.from(a):a).toString("base64url")}}b.GdchClient=h},38087:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.AwsClient=void 0;let d=c(58545),e=c(82080),f=c(82799),g=c(45920),h=c(27064);class i extends e.BaseExternalAccountClient{environmentId;awsSecurityCredentialsSupplier;regionalCredVerificationUrl;awsRequestSigner;region;static #i="https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15";static AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";static AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254";constructor(a){super(a);const b=(0,g.originalOrCamelOptions)(a),c=b.get("credential_source"),d=b.get("aws_security_credentials_supplier");if(!c&&!d)throw Error("A credential source or AWS security credentials supplier must be specified.");if(c&&d)throw Error("Only one of credential source or AWS security credentials supplier can be specified.");if(d)this.awsSecurityCredentialsSupplier=d,this.regionalCredVerificationUrl=i.#i,this.credentialSourceType="programmatic";else{const a=(0,g.originalOrCamelOptions)(c);this.environmentId=a.get("environment_id");const b=a.get("region_url"),d=a.get("url"),e=a.get("imdsv2_session_token_url");this.awsSecurityCredentialsSupplier=new f.DefaultAwsSecurityCredentialsSupplier({regionUrl:b,securityCredentialsUrl:d,imdsV2SessionTokenUrl:e}),this.regionalCredVerificationUrl=a.get("regional_cred_verification_url"),this.credentialSourceType="aws",this.validateEnvironmentId()}this.awsRequestSigner=null,this.region=""}validateEnvironmentId(){let a=this.environmentId?.match(/^(aws)(\d+)$/);if(a&&this.regionalCredVerificationUrl){if(1!==parseInt(a[2],10))throw Error(`aws version "${a[2]}" is not supported in the current build.`)}else throw Error('No valid AWS "credential_source" provided')}async retrieveSubjectToken(){this.awsRequestSigner||(this.region=await this.awsSecurityCredentialsSupplier.getAwsRegion(this.supplierContext),this.awsRequestSigner=new d.AwsRequestSigner(async()=>this.awsSecurityCredentialsSupplier.getAwsSecurityCredentials(this.supplierContext),this.region));let a=await this.awsRequestSigner.getRequestOptions({...i.RETRY_CONFIG,url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"}),b=[];return h.Gaxios.mergeHeaders({"x-goog-cloud-target-resource":this.audience},a.headers).forEach((a,c)=>b.push({key:c,value:a})),encodeURIComponent(JSON.stringify({url:a.url,method:a.method,headers:b}))}}b.AwsClient=i},39028:(a,b,c)=>{var d=c(6677).stringify,e=c(16679);a.exports=function(a){return{parse:e(a),stringify:d}},a.exports.parse=e(),a.exports.stringify=d},39370:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.NodeCrypto=void 0;let d=c(55511);class e{async sha256DigestBase64(a){return d.createHash("sha256").update(a).digest("base64")}randomBytesBase64(a){return d.randomBytes(a).toString("base64")}async verify(a,b,c){let e=d.createVerify("RSA-SHA256");return e.update(b),e.end(),e.verify(a,c,"base64")}async sign(a,b){let c=d.createSign("RSA-SHA256");return c.update(b),c.end(),c.sign(a,"base64")}decodeBase64StringUtf8(a){return Buffer.from(a,"base64").toString("utf-8")}encodeBase64StringUtf8(a){return Buffer.from(a,"utf-8").toString("base64")}async sha256DigestHex(a){return d.createHash("sha256").update(a).digest("hex")}async signWithHmacSha256(a,b){var c;let e="string"==typeof a?a:(c=a,Buffer.from(c));return function(a){let b=new ArrayBuffer(a.length),c=new Uint8Array(b);for(let b=0;b<a.length;++b)c[b]=a[b];return b}(d.createHmac("sha256",e).update(b).digest())}}b.NodeCrypto=e},41715:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.PassThroughClient=void 0;let d=c(56916);class e extends d.AuthClient{async request(a){return this.transporter.request(a)}async getAccessToken(){return{}}async getRequestHeaders(){return new Headers}}b.PassThroughClient=e},44852:(a,b,c)=>{"use strict";let d,e,f;c.d(b,{hD:()=>dc,Mz:()=>bv,M4:()=>gl,ZU:()=>aC,eX:()=>bY,$o:()=>b$});var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay,az,aA,aB,aC,aD,aE,aF,aG,aH,aI,aJ,aK,aL,aM,aN,aO,aP,aQ,aR,aS,aT,aU,aV,aW,aX,aY,aZ,a$,a_,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,bA,bB,bC,bD,bE,bF,bG,bH,bI,bJ,bK=c(16589),bL=c(88490),bM=c(29021),bN=c(79748),bO=c(57075),bP=c(46466);c(82146),c(24509),c(88634),c(13259),c(53455),c(72786);var bQ=c(80123);c(54351);var bR=c(33873);class bS{}function bT(a,b){return a.replace(/\{([^}]+)\}/g,(a,c)=>{if(Object.prototype.hasOwnProperty.call(b,c)){let a=b[c];return null!=a?String(a):""}throw Error(`Key '${c}' not found in valueMap.`)})}function bU(a,b,c){for(let d=0;d<b.length-1;d++){let e=b[d];if(e.endsWith("[]")){let f=e.slice(0,-2);if(!(f in a))if(Array.isArray(c))a[f]=Array.from({length:c.length},()=>({}));else throw Error(`Value must be a list given an array path ${e}`);if(Array.isArray(a[f])){let e=a[f];if(Array.isArray(c))for(let a=0;a<e.length;a++)bU(e[a],b.slice(d+1),c[a]);else for(let a of e)bU(a,b.slice(d+1),c)}return}if(e.endsWith("[0]")){let f=e.slice(0,-3);f in a||(a[f]=[{}]),bU(a[f][0],b.slice(d+1),c);return}a[e]&&"object"==typeof a[e]||(a[e]={}),a=a[e]}let d=b[b.length-1],e=a[d];if(void 0!==e){if(!c||"object"==typeof c&&0===Object.keys(c).length||c===e)return;if("object"==typeof e&&"object"==typeof c&&null!==e&&null!==c)Object.assign(e,c);else throw Error(`Cannot set value for an existing key. Key: ${d}`)}else"_self"!==d||"object"!=typeof c||null===c||Array.isArray(c)?a[d]=c:Object.assign(a,c)}function bV(a,b,c){try{if(1===b.length&&"_self"===b[0])return a;for(let d=0;d<b.length;d++){if("object"!=typeof a||null===a)return c;let e=b[d];if(e.endsWith("[]")){let f=e.slice(0,-2);if(!(f in a))return c;{let e=a[f];if(!Array.isArray(e))return c;return e.map(a=>bV(a,b.slice(d+1),c))}}a=a[e]}return a}catch(a){if(a instanceof TypeError)return c;throw a}}function bW(a){if("string"!=typeof a)throw Error("fromImageBytes must be a string");return a}function bX(a){var b;let c,d,e,f,g={},h=bV(a,["name"]);null!=h&&bU(g,["name"],h);let i=bV(a,["metadata"]);null!=i&&bU(g,["metadata"],i);let j=bV(a,["done"]);null!=j&&bU(g,["done"],j);let k=bV(a,["error"]);null!=k&&bU(g,["error"],k);let l=bV(a,["response"]);return null!=l&&bU(g,["response"],(c={},null!=(d=bV(b=l,["sdkHttpResponse"]))&&bU(c,["sdkHttpResponse"],d),null!=(e=bV(b,["parent"]))&&bU(c,["parent"],e),null!=(f=bV(b,["documentName"]))&&bU(c,["documentName"],f),c)),g}function bY(a,b,c){return Object.assign({fileData:{fileUri:a,mimeType:b}},c&&{mediaResolution:{level:c}})}function bZ(a){return"object"==typeof a&&null!==a&&("fileData"in a||"text"in a||"functionCall"in a||"functionResponse"in a||"inlineData"in a||"videoMetadata"in a||"codeExecutionResult"in a||"executableCode"in a)}function b$(a){return{role:"user",parts:function(a){let b=[];if("string"==typeof a)b.push({text:a});else if(bZ(a))b.push(a);else if(Array.isArray(a)){if(0===a.length)throw Error("partOrString cannot be an empty array");for(let c of a)if("string"==typeof c)b.push({text:c});else if(bZ(c))b.push(c);else throw Error("element in PartUnion must be a Part object or string")}else throw Error("partOrString must be a Part object, string, or array");return b}(a)}}(g=az||(az={})).OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",g.OUTCOME_OK="OUTCOME_OK",g.OUTCOME_FAILED="OUTCOME_FAILED",g.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED",(h=aA||(aA={})).LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",h.PYTHON="PYTHON",(i=aB||(aB={})).SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",i.SILENT="SILENT",i.WHEN_IDLE="WHEN_IDLE",i.INTERRUPT="INTERRUPT",(j=aC||(aC={})).TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",j.STRING="STRING",j.NUMBER="NUMBER",j.INTEGER="INTEGER",j.BOOLEAN="BOOLEAN",j.ARRAY="ARRAY",j.OBJECT="OBJECT",j.NULL="NULL",(k=aD||(aD={})).AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",k.NO_AUTH="NO_AUTH",k.API_KEY_AUTH="API_KEY_AUTH",k.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",k.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",k.OAUTH="OAUTH",k.OIDC_AUTH="OIDC_AUTH",(l=aE||(aE={})).HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",l.HTTP_IN_QUERY="HTTP_IN_QUERY",l.HTTP_IN_HEADER="HTTP_IN_HEADER",l.HTTP_IN_PATH="HTTP_IN_PATH",l.HTTP_IN_BODY="HTTP_IN_BODY",l.HTTP_IN_COOKIE="HTTP_IN_COOKIE",(m=aF||(aF={})).API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",m.SIMPLE_SEARCH="SIMPLE_SEARCH",m.ELASTIC_SEARCH="ELASTIC_SEARCH",(n=aG||(aG={})).ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",n.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER",n.ENVIRONMENT_MOBILE="ENVIRONMENT_MOBILE",n.ENVIRONMENT_DESKTOP="ENVIRONMENT_DESKTOP",(o=aH||(aH={})).SAFETY_POLICY_UNSPECIFIED="SAFETY_POLICY_UNSPECIFIED",o.FINANCIAL_TRANSACTIONS="FINANCIAL_TRANSACTIONS",o.SENSITIVE_DATA_MODIFICATION="SENSITIVE_DATA_MODIFICATION",o.COMMUNICATION_TOOL="COMMUNICATION_TOOL",o.ACCOUNT_CREATION="ACCOUNT_CREATION",o.DATA_MODIFICATION="DATA_MODIFICATION",o.USER_CONSENT_MANAGEMENT="USER_CONSENT_MANAGEMENT",o.LEGAL_TERMS_AND_AGREEMENTS="LEGAL_TERMS_AND_AGREEMENTS",(p=aI||(aI={})).PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",p.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",p.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",p.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",p.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",p.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",p.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH",(q=aJ||(aJ={})).UNSPECIFIED="UNSPECIFIED",q.BLOCKING="BLOCKING",q.NON_BLOCKING="NON_BLOCKING",(r=aK||(aK={})).MODE_UNSPECIFIED="MODE_UNSPECIFIED",r.MODE_DYNAMIC="MODE_DYNAMIC",(s=aL||(aL={})).THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",s.MINIMAL="MINIMAL",s.LOW="LOW",s.MEDIUM="MEDIUM",s.HIGH="HIGH",(t=aM||(aM={})).DONT_ALLOW="DONT_ALLOW",t.ALLOW_ADULT="ALLOW_ADULT",t.ALLOW_ALL="ALLOW_ALL",(u=aN||(aN={})).PROMINENT_PEOPLE_UNSPECIFIED="PROMINENT_PEOPLE_UNSPECIFIED",u.ALLOW_PROMINENT_PEOPLE="ALLOW_PROMINENT_PEOPLE",u.BLOCK_PROMINENT_PEOPLE="BLOCK_PROMINENT_PEOPLE",(v=aO||(aO={})).HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",v.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",v.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",v.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",v.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",v.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",v.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",v.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",v.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",v.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",v.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK",(w=aP||(aP={})).HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",w.SEVERITY="SEVERITY",w.PROBABILITY="PROBABILITY",(x=aQ||(aQ={})).HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",x.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",x.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",x.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",x.BLOCK_NONE="BLOCK_NONE",x.OFF="OFF",(y=aR||(aR={})).MODE_UNSPECIFIED="MODE_UNSPECIFIED",y.AUTO="AUTO",y.ANY="ANY",y.NONE="NONE",y.VALIDATED="VALIDATED",(z=aS||(aS={})).FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",z.STOP="STOP",z.MAX_TOKENS="MAX_TOKENS",z.SAFETY="SAFETY",z.RECITATION="RECITATION",z.LANGUAGE="LANGUAGE",z.OTHER="OTHER",z.BLOCKLIST="BLOCKLIST",z.PROHIBITED_CONTENT="PROHIBITED_CONTENT",z.SPII="SPII",z.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",z.IMAGE_SAFETY="IMAGE_SAFETY",z.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",z.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",z.NO_IMAGE="NO_IMAGE",z.IMAGE_RECITATION="IMAGE_RECITATION",z.IMAGE_OTHER="IMAGE_OTHER",(A=aT||(aT={})).HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",A.NEGLIGIBLE="NEGLIGIBLE",A.LOW="LOW",A.MEDIUM="MEDIUM",A.HIGH="HIGH",(B=aU||(aU={})).HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",B.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",B.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",B.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",B.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH",(C=aV||(aV={})).URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",C.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",C.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",C.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",C.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE",(D=aW||(aW={})).BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",D.SAFETY="SAFETY",D.OTHER="OTHER",D.BLOCKLIST="BLOCKLIST",D.PROHIBITED_CONTENT="PROHIBITED_CONTENT",D.IMAGE_SAFETY="IMAGE_SAFETY",D.MODEL_ARMOR="MODEL_ARMOR",D.JAILBREAK="JAILBREAK",(E=aX||(aX={})).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",(F=aY||(aY={})).MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",F.TEXT="TEXT",F.IMAGE="IMAGE",F.VIDEO="VIDEO",F.AUDIO="AUDIO",F.DOCUMENT="DOCUMENT",(G=aZ||(aZ={})).MODEL_STAGE_UNSPECIFIED="MODEL_STAGE_UNSPECIFIED",G.UNSTABLE_EXPERIMENTAL="UNSTABLE_EXPERIMENTAL",G.EXPERIMENTAL="EXPERIMENTAL",G.PREVIEW="PREVIEW",G.STABLE="STABLE",G.LEGACY="LEGACY",G.DEPRECATED="DEPRECATED",G.RETIRED="RETIRED",(H=a$||(a$={})).MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",H.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",H.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",H.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH",(I=a_||(a_={})).MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",I.TEXT="TEXT",I.IMAGE="IMAGE",I.AUDIO="AUDIO",I.VIDEO="VIDEO",(J=a0||(a0={})).TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",J.TUNING_MODE_FULL="TUNING_MODE_FULL",J.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER",(K=a1||(a1={})).ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",K.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",K.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",K.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",K.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",K.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",K.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO",(L=a2||(a2={})).JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",L.JOB_STATE_QUEUED="JOB_STATE_QUEUED",L.JOB_STATE_PENDING="JOB_STATE_PENDING",L.JOB_STATE_RUNNING="JOB_STATE_RUNNING",L.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",L.JOB_STATE_FAILED="JOB_STATE_FAILED",L.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",L.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",L.JOB_STATE_PAUSED="JOB_STATE_PAUSED",L.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",L.JOB_STATE_UPDATING="JOB_STATE_UPDATING",L.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED",(M=a3||(a3={})).TUNING_JOB_STATE_UNSPECIFIED="TUNING_JOB_STATE_UNSPECIFIED",M.TUNING_JOB_STATE_WAITING_FOR_QUOTA="TUNING_JOB_STATE_WAITING_FOR_QUOTA",M.TUNING_JOB_STATE_PROCESSING_DATASET="TUNING_JOB_STATE_PROCESSING_DATASET",M.TUNING_JOB_STATE_WAITING_FOR_CAPACITY="TUNING_JOB_STATE_WAITING_FOR_CAPACITY",M.TUNING_JOB_STATE_TUNING="TUNING_JOB_STATE_TUNING",M.TUNING_JOB_STATE_POST_PROCESSING="TUNING_JOB_STATE_POST_PROCESSING",(N=a4||(a4={})).AGGREGATION_METRIC_UNSPECIFIED="AGGREGATION_METRIC_UNSPECIFIED",N.AVERAGE="AVERAGE",N.MODE="MODE",N.STANDARD_DEVIATION="STANDARD_DEVIATION",N.VARIANCE="VARIANCE",N.MINIMUM="MINIMUM",N.MAXIMUM="MAXIMUM",N.MEDIAN="MEDIAN",N.PERCENTILE_P90="PERCENTILE_P90",N.PERCENTILE_P95="PERCENTILE_P95",N.PERCENTILE_P99="PERCENTILE_P99",(O=a5||(a5={})).PAIRWISE_CHOICE_UNSPECIFIED="PAIRWISE_CHOICE_UNSPECIFIED",O.BASELINE="BASELINE",O.CANDIDATE="CANDIDATE",O.TIE="TIE",(P=a6||(a6={})).TUNING_SPEED_UNSPECIFIED="TUNING_SPEED_UNSPECIFIED",P.REGULAR="REGULAR",P.FAST="FAST",(Q=a7||(a7={})).TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",Q.TUNING_TASK_I2V="TUNING_TASK_I2V",Q.TUNING_TASK_T2V="TUNING_TASK_T2V",Q.TUNING_TASK_R2V="TUNING_TASK_R2V",(R=a8||(a8={})).VIDEO_ORIENTATION_UNSPECIFIED="VIDEO_ORIENTATION_UNSPECIFIED",R.LANDSCAPE="LANDSCAPE",R.PORTRAIT="PORTRAIT",(S=a9||(a9={})).STATE_UNSPECIFIED="STATE_UNSPECIFIED",S.STATE_PENDING="STATE_PENDING",S.STATE_ACTIVE="STATE_ACTIVE",S.STATE_FAILED="STATE_FAILED",(T=ba||(ba={})).UNSPECIFIED="unspecified",T.FLEX="flex",T.STANDARD="standard",T.PRIORITY="priority",(U=bb||(bb={})).MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",U.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",U.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",U.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH",U.MEDIA_RESOLUTION_ULTRA_HIGH="MEDIA_RESOLUTION_ULTRA_HIGH",(V=bc||(bc={})).TOOL_TYPE_UNSPECIFIED="TOOL_TYPE_UNSPECIFIED",V.GOOGLE_SEARCH_WEB="GOOGLE_SEARCH_WEB",V.GOOGLE_SEARCH_IMAGE="GOOGLE_SEARCH_IMAGE",V.URL_CONTEXT="URL_CONTEXT",V.GOOGLE_MAPS="GOOGLE_MAPS",V.FILE_SEARCH="FILE_SEARCH",(bd||(bd={})).COLLECTION="COLLECTION",(W=be||(be={})).FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",W.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",W.BALANCED="BALANCED",W.PRIORITIZE_COST="PRIORITIZE_COST",(X=bf||(bf={})).PREDICT="PREDICT",X.EMBED_CONTENT="EMBED_CONTENT",(Y=bg||(bg={})).BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",Y.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",Y.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",Y.BLOCK_NONE="BLOCK_NONE",(Z=bh||(bh={})).auto="auto",Z.en="en",Z.ja="ja",Z.ko="ko",Z.hi="hi",Z.zh="zh",Z.pt="pt",Z.es="es",($=bi||(bi={})).MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",$.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",$.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",$.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",$.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC",(_=bj||(bj={})).CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",_.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",_.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",_.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH",(aa=bk||(bk={})).SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",aa.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",aa.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",aa.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT",(ab=bl||(bl={})).EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",ab.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",ab.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",ab.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",ab.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",ab.EDIT_MODE_STYLE="EDIT_MODE_STYLE",ab.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",ab.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE",(ac=bm||(bm={})).FOREGROUND="FOREGROUND",ac.BACKGROUND="BACKGROUND",ac.PROMPT="PROMPT",ac.SEMANTIC="SEMANTIC",ac.INTERACTIVE="INTERACTIVE",(ad=bn||(bn={})).ASSET="ASSET",ad.STYLE="STYLE",(ae=bo||(bo={})).INSERT="INSERT",ae.REMOVE="REMOVE",ae.REMOVE_STATIC="REMOVE_STATIC",ae.OUTPAINT="OUTPAINT",(af=bp||(bp={})).OPTIMIZED="OPTIMIZED",af.LOSSLESS="LOSSLESS",(ag=bq||(bq={})).CROP="CROP",ag.PAD="PAD",(ah=br||(br={})).RESPONSE_PARSE_TYPE_UNSPECIFIED="RESPONSE_PARSE_TYPE_UNSPECIFIED",ah.IDENTITY="IDENTITY",ah.REGEX_EXTRACT="REGEX_EXTRACT",(ai=bs||(bs={})).MATCH_OPERATION_UNSPECIFIED="MATCH_OPERATION_UNSPECIFIED",ai.REGEX_CONTAINS="REGEX_CONTAINS",ai.PARTIAL_MATCH="PARTIAL_MATCH",ai.EXACT_MATCH="EXACT_MATCH",(aj=bt||(bt={})).REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED="REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED",aj.MINIMAL="MINIMAL",aj.HIGH="HIGH",(ak=bu||(bu={})).SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",ak.PREFERENCE_TUNING="PREFERENCE_TUNING",ak.DISTILLATION="DISTILLATION",ak.REINFORCEMENT_TUNING="REINFORCEMENT_TUNING",(al=bv||(bv={})).STATE_UNSPECIFIED="STATE_UNSPECIFIED",al.PROCESSING="PROCESSING",al.ACTIVE="ACTIVE",al.FAILED="FAILED",(am=bw||(bw={})).SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",am.UPLOADED="UPLOADED",am.GENERATED="GENERATED",am.REGISTERED="REGISTERED",(an=bx||(bx={})).TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",an.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",an.RESPONSE_REJECTED="RESPONSE_REJECTED",an.NEED_MORE_INPUT="NEED_MORE_INPUT",an.PROHIBITED_INPUT_CONTENT="PROHIBITED_INPUT_CONTENT",an.IMAGE_PROHIBITED_INPUT_CONTENT="IMAGE_PROHIBITED_INPUT_CONTENT",an.INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED="INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED",an.INPUT_IMAGE_CELEBRITY="INPUT_IMAGE_CELEBRITY",an.INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED="INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED",an.INPUT_TEXT_NCII_PROHIBITED="INPUT_TEXT_NCII_PROHIBITED",an.INPUT_OTHER="INPUT_OTHER",an.INPUT_IP_PROHIBITED="INPUT_IP_PROHIBITED",an.BLOCKLIST="BLOCKLIST",an.UNSAFE_PROMPT_FOR_IMAGE_GENERATION="UNSAFE_PROMPT_FOR_IMAGE_GENERATION",an.GENERATED_IMAGE_SAFETY="GENERATED_IMAGE_SAFETY",an.GENERATED_CONTENT_SAFETY="GENERATED_CONTENT_SAFETY",an.GENERATED_AUDIO_SAFETY="GENERATED_AUDIO_SAFETY",an.GENERATED_VIDEO_SAFETY="GENERATED_VIDEO_SAFETY",an.GENERATED_CONTENT_PROHIBITED="GENERATED_CONTENT_PROHIBITED",an.GENERATED_CONTENT_BLOCKLIST="GENERATED_CONTENT_BLOCKLIST",an.GENERATED_IMAGE_PROHIBITED="GENERATED_IMAGE_PROHIBITED",an.GENERATED_IMAGE_CELEBRITY="GENERATED_IMAGE_CELEBRITY",an.GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER="GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER",an.GENERATED_IMAGE_IDENTIFIABLE_PEOPLE="GENERATED_IMAGE_IDENTIFIABLE_PEOPLE",an.GENERATED_IMAGE_MINORS="GENERATED_IMAGE_MINORS",an.OUTPUT_IMAGE_IP_PROHIBITED="OUTPUT_IMAGE_IP_PROHIBITED",an.GENERATED_OTHER="GENERATED_OTHER",an.MAX_REGENERATION_REACHED="MAX_REGENERATION_REACHED",(ao=by||(by={})).VAD_SIGNAL_TYPE_UNSPECIFIED="VAD_SIGNAL_TYPE_UNSPECIFIED",ao.VAD_SIGNAL_TYPE_SOS="VAD_SIGNAL_TYPE_SOS",ao.VAD_SIGNAL_TYPE_EOS="VAD_SIGNAL_TYPE_EOS",(ap=bz||(bz={})).TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",ap.ACTIVITY_START="ACTIVITY_START",ap.ACTIVITY_END="ACTIVITY_END",(aq=bA||(bA={})).START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",aq.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",aq.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW",(ar=bB||(bB={})).END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",ar.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",ar.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW",(as=bC||(bC={})).ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",as.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",as.NO_INTERRUPTION="NO_INTERRUPTION",(at=bD||(bD={})).TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",at.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",at.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT",at.TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO="TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO",(au=bE||(bE={})).SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",au.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",au.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",au.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",au.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",au.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",au.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",au.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",au.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",au.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",au.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",au.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",au.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR",(av=bF||(bF={})).MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",av.QUALITY="QUALITY",av.DIVERSITY="DIVERSITY",av.VOCALIZATION="VOCALIZATION",(aw=bG||(bG={})).PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",aw.PLAY="PLAY",aw.PAUSE="PAUSE",aw.STOP="STOP",aw.RESET_CONTEXT="RESET_CONTEXT";class b_{constructor(a){const b={};for(const c of a.headers.entries())b[c[0]]=c[1];this.headers=b,this.responseInternal=a}json(){return this.responseInternal.json()}}class b0{get text(){var a,b,c,d,e,f,g,h;if((null==(d=null==(c=null==(b=null==(a=this.candidates)?void 0:a[0])?void 0:b.content)?void 0:c.parts)?void 0:d.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 i="",j=!1,k=[];for(let a of null!=(h=null==(g=null==(f=null==(e=this.candidates)?void 0:e[0])?void 0:f.content)?void 0:g.parts)?h:[]){for(let[b,c]of Object.entries(a))"text"!==b&&"thought"!==b&&"thoughtSignature"!==b&&(null!==c||void 0!==c)&&k.push(b);if("string"==typeof a.text){if("boolean"==typeof a.thought&&a.thought)continue;j=!0,i+=a.text}}return k.length>0&&console.warn(`there are non-text parts ${k} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),j?i:void 0}get data(){var a,b,c,d,e,f,g,h;if((null==(d=null==(c=null==(b=null==(a=this.candidates)?void 0:a[0])?void 0:b.content)?void 0:c.parts)?void 0:d.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 i="",j=[];for(let a of null!=(h=null==(g=null==(f=null==(e=this.candidates)?void 0:e[0])?void 0:f.content)?void 0:g.parts)?h:[]){for(let[b,c]of Object.entries(a))"inlineData"!==b&&(null!==c||void 0!==c)&&j.push(b);a.inlineData&&"string"==typeof a.inlineData.data&&(i+=atob(a.inlineData.data))}return j.length>0&&console.warn(`there are non-data parts ${j} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),i.length>0?btoa(i):void 0}get functionCalls(){var a,b,c,d,e,f,g,h;if((null==(d=null==(c=null==(b=null==(a=this.candidates)?void 0:a[0])?void 0:b.content)?void 0:c.parts)?void 0:d.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 i=null==(h=null==(g=null==(f=null==(e=this.candidates)?void 0:e[0])?void 0:f.content)?void 0:g.parts)?void 0:h.filter(a=>a.functionCall).map(a=>a.functionCall).filter(a=>void 0!==a);if((null==i?void 0:i.length)!==0)return i}get executableCode(){var a,b,c,d,e,f,g,h,i;if((null==(d=null==(c=null==(b=null==(a=this.candidates)?void 0:a[0])?void 0:b.content)?void 0:c.parts)?void 0:d.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 j=null==(h=null==(g=null==(f=null==(e=this.candidates)?void 0:e[0])?void 0:f.content)?void 0:g.parts)?void 0:h.filter(a=>a.executableCode).map(a=>a.executableCode).filter(a=>void 0!==a);if((null==j?void 0:j.length)!==0)return null==(i=null==j?void 0:j[0])?void 0:i.code}get codeExecutionResult(){var a,b,c,d,e,f,g,h,i;if((null==(d=null==(c=null==(b=null==(a=this.candidates)?void 0:a[0])?void 0:b.content)?void 0:c.parts)?void 0:d.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 j=null==(h=null==(g=null==(f=null==(e=this.candidates)?void 0:e[0])?void 0:f.content)?void 0:g.parts)?void 0:h.filter(a=>a.codeExecutionResult).map(a=>a.codeExecutionResult).filter(a=>void 0!==a);if((null==j?void 0:j.length)!==0)return null==(i=null==j?void 0:j[0])?void 0:i.output}}class b1{}class b2{}class b3{}class b4{}class b5{}class b6{}class b7{}class b8{}class b9{}class ca{}class cb{_fromAPIResponse({apiResponse:a,_isVertexAI:b}){let c,d=new cb;if(b){let b,d,e,f,g,h;b={},null!=(d=bV(a,["name"]))&&bU(b,["name"],d),null!=(e=bV(a,["metadata"]))&&bU(b,["metadata"],e),null!=(f=bV(a,["done"]))&&bU(b,["done"],f),null!=(g=bV(a,["error"]))&&bU(b,["error"],g),null!=(h=bV(a,["response"]))&&bU(b,["response"],function(a){let b={},c=bV(a,["videos"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f,g,h;return c={},null!=(d=bV(a,["_self"]))&&bU(c,["video"],(e={},null!=(f=bV(b=d,["gcsUri"]))&&bU(e,["uri"],f),null!=(g=bV(b,["bytesBase64Encoded"]))&&bU(e,["videoBytes"],bW(g)),null!=(h=bV(b,["mimeType"]))&&bU(e,["mimeType"],h),e)),c})),bU(b,["generatedVideos"],a)}let d=bV(a,["raiMediaFilteredCount"]);null!=d&&bU(b,["raiMediaFilteredCount"],d);let e=bV(a,["raiMediaFilteredReasons"]);return null!=e&&bU(b,["raiMediaFilteredReasons"],e),b}(h)),c=b}else{let b,d,e,f,g,h;b={},null!=(d=bV(a,["name"]))&&bU(b,["name"],d),null!=(e=bV(a,["metadata"]))&&bU(b,["metadata"],e),null!=(f=bV(a,["done"]))&&bU(b,["done"],f),null!=(g=bV(a,["error"]))&&bU(b,["error"],g),null!=(h=bV(a,["response","generateVideoResponse"]))&&bU(b,["response"],function(a){let b={},c=bV(a,["generatedSamples"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f,g,h;return c={},null!=(d=bV(a,["video"]))&&bU(c,["video"],(e={},null!=(f=bV(b=d,["uri"]))&&bU(e,["uri"],f),null!=(g=bV(b,["encodedVideo"]))&&bU(e,["videoBytes"],bW(g)),null!=(h=bV(b,["encoding"]))&&bU(e,["mimeType"],h),e)),c})),bU(b,["generatedVideos"],a)}let d=bV(a,["raiMediaFilteredCount"]);null!=d&&bU(b,["raiMediaFilteredCount"],d);let e=bV(a,["raiMediaFilteredReasons"]);return null!=e&&bU(b,["raiMediaFilteredReasons"],e),b}(h)),c=b}return Object.assign(d,c),d}}class cc{}class cd{}class ce{}class cf{}class cg{}class ch{}class ci{}class cj{}class ck{_fromAPIResponse({apiResponse:a,_isVertexAI:b}){var c;let d,e,f,g,h,i,j,k,l,m,n=new ck;return Object.assign(n,(h={},null!=(i=bV(a,["name"]))&&bU(h,["name"],i),null!=(j=bV(a,["metadata"]))&&bU(h,["metadata"],j),null!=(k=bV(a,["done"]))&&bU(h,["done"],k),null!=(l=bV(a,["error"]))&&bU(h,["error"],l),null!=(m=bV(a,["response"]))&&bU(h,["response"],(d={},null!=(e=bV(c=m,["sdkHttpResponse"]))&&bU(d,["sdkHttpResponse"],e),null!=(f=bV(c,["parent"]))&&bU(d,["parent"],f),null!=(g=bV(c,["documentName"]))&&bU(d,["documentName"],g),d)),h)),n}}class cl{}class cm{}class cn{}class co{}class cp{}class cq{get text(){var a,b,c;let d="",e=!1,f=[];for(let g of null!=(c=null==(b=null==(a=this.serverContent)?void 0:a.modelTurn)?void 0:b.parts)?c:[]){for(let[a,b]of Object.entries(g))"text"!==a&&"thought"!==a&&null!==b&&f.push(a);if("string"==typeof g.text){if("boolean"==typeof g.thought&&g.thought)continue;e=!0,d+=g.text}}return f.length>0&&console.warn(`there are non-text parts ${f} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),e?d:void 0}get data(){var a,b,c;let d="",e=[];for(let f of null!=(c=null==(b=null==(a=this.serverContent)?void 0:a.modelTurn)?void 0:b.parts)?c:[]){for(let[a,b]of Object.entries(f))"inlineData"!==a&&null!==b&&e.push(a);f.inlineData&&"string"==typeof f.inlineData.data&&(d+=atob(f.inlineData.data))}return e.length>0&&console.warn(`there are non-data parts ${e} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),d.length>0?btoa(d):void 0}}class cr{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}class cs{_fromAPIResponse({apiResponse:a,_isVertexAI:b}){let c=new cs;return Object.assign(c,bX(a)),c}}function ct(a,b){if(!b||"string"!=typeof b)throw Error("model is required and must be a string");if(b.includes("..")||b.includes("?")||b.includes("&"))throw Error("invalid model parameter");if(a.isVertexAI())if(b.startsWith("publishers/")||b.startsWith("projects/")||b.startsWith("models/"))return b;else{if(!(b.indexOf("/")>=0))return`publishers/google/models/${b}`;let a=b.split("/",2);return`publishers/${a[0]}/models/${a[1]}`}return b.startsWith("models/")||b.startsWith("tunedModels/")?b:`models/${b}`}function cu(a,b){let c=ct(a,b);return c?c.startsWith("publishers/")&&a.isVertexAI()?`projects/${a.getProject()}/locations/${a.getLocation()}/${c}`:c.startsWith("models/")&&a.isVertexAI()?`projects/${a.getProject()}/locations/${a.getLocation()}/publishers/google/${c}`:c:""}function cv(a){return Array.isArray(a)?a.map(a=>cw(a)):[cw(a)]}function cw(a){if("object"==typeof a&&null!==a)return a;throw Error(`Could not parse input as Blob. Unsupported blob type: ${typeof a}`)}function cx(a){let b=cw(a);if(b.mimeType&&b.mimeType.startsWith("image/"))return b;throw Error(`Unsupported mime type: ${b.mimeType}`)}function cy(a){let b=cw(a);if(b.mimeType&&b.mimeType.startsWith("audio/"))return b;throw Error(`Unsupported mime type: ${b.mimeType}`)}function cz(a){if(null==a)throw Error("PartUnion is required");if("object"==typeof a)return a;if("string"==typeof a)return{text:a};throw Error(`Unsupported part type: ${typeof a}`)}function cA(a){if(null==a||Array.isArray(a)&&0===a.length)throw Error("PartListUnion is required");return Array.isArray(a)?a.map(a=>cz(a)):[cz(a)]}function cB(a){return null!=a&&"object"==typeof a&&"parts"in a&&Array.isArray(a.parts)}function cC(a){return null!=a&&"object"==typeof a&&"functionCall"in a}function cD(a){return null!=a&&"object"==typeof a&&"functionResponse"in a}function cE(a){if(null==a)throw Error("ContentUnion is required");return cB(a)?a:{role:"user",parts:cA(a)}}function cF(a,b){if(!b)return[];if(a.isVertexAI()&&Array.isArray(b))return b.flatMap(a=>{let b=cE(a);return b.parts&&b.parts.length>0&&void 0!==b.parts[0].text?[b.parts[0].text]:[]});if(a.isVertexAI()){let a=cE(b);return a.parts&&a.parts.length>0&&void 0!==a.parts[0].text?[a.parts[0].text]:[]}return Array.isArray(b)?b.map(a=>cE(a)):[cE(b)]}function cG(a){if(null==a||Array.isArray(a)&&0===a.length)throw Error("contents are required");if(!Array.isArray(a)){if(cC(a)||cD(a))throw Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[cE(a)]}let b=[],c=[],d=cB(a[0]);for(let e of a){let a=cB(e);if(a!=d)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(a)b.push(e);else if(cC(e)||cD(e))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 c.push(e)}return d||b.push({role:"user",parts:cA(c)}),b}function cH(a){let b={},c=["items"],d=["anyOf"],e=["properties"];if(a.type&&a.anyOf)throw Error("type and anyOf cannot be both populated.");let f=a.anyOf;for(let[g,h]of(null!=f&&2==f.length&&("null"===f[0].type?(b.nullable=!0,a=f[1]):"null"===f[1].type&&(b.nullable=!0,a=f[0])),a.type instanceof Array&&function(a,b){a.includes("null")&&(b.nullable=!0);let c=a.filter(a=>"null"!==a);if(1===c.length)b.type=Object.values(aC).includes(c[0].toUpperCase())?c[0].toUpperCase():aC.TYPE_UNSPECIFIED;else for(let a of(b.anyOf=[],c))b.anyOf.push({type:Object.values(aC).includes(a.toUpperCase())?a.toUpperCase():aC.TYPE_UNSPECIFIED})}(a.type,b),Object.entries(a)))if(null!=h)if("type"==g){if("null"===h)throw Error("type: null can not be the only possible type for the field.");if(h instanceof Array)continue;b.type=Object.values(aC).includes(h.toUpperCase())?h.toUpperCase():aC.TYPE_UNSPECIFIED}else if(c.includes(g))b[g]=cH(h);else if(d.includes(g)){let a=[];for(let c of h){if("null"==c.type){b.nullable=!0;continue}a.push(cH(c))}b[g]=a}else if(e.includes(g)){let a={};for(let[b,c]of Object.entries(h))a[b]=cH(c);b[g]=a}else{if("additionalProperties"===g)continue;b[g]=h}return b}function cI(a){if("object"==typeof a)return a;if("string"==typeof a)return{voiceConfig:{prebuiltVoiceConfig:{voiceName:a}}};throw Error(`Unsupported speechConfig type: ${typeof a}`)}function cJ(a){if("multiSpeakerVoiceConfig"in a)throw Error("multiSpeakerVoiceConfig is not supported in the live API.");return a}function cK(a){if(a.functionDeclarations)for(let b of a.functionDeclarations)b.parameters&&(Object.keys(b.parameters).includes("$schema")?b.parametersJsonSchema||(b.parametersJsonSchema=b.parameters,delete b.parameters):b.parameters=cH(b.parameters)),b.response&&(Object.keys(b.response).includes("$schema")?b.responseJsonSchema||(b.responseJsonSchema=b.response,delete b.response):b.response=cH(b.response));return a}function cL(a){if(null==a)throw Error("tools is required");if(!Array.isArray(a))throw Error("tools is required and must be an array of Tools");let b=[];for(let c of a)b.push(c);return b}function cM(a,b){if("string"!=typeof b)throw Error("name must be a string");return function(a,b,c,d=1){let e=!b.startsWith(`${c}/`)&&b.split("/").length===d;if(a.isVertexAI())if(b.startsWith("projects/"))return b;else if(b.startsWith("locations/"))return`projects/${a.getProject()}/${b}`;else if(b.startsWith(`${c}/`))return`projects/${a.getProject()}/locations/${a.getLocation()}/${b}`;else if(e)return`projects/${a.getProject()}/locations/${a.getLocation()}/${c}/${b}`;else return b;return e?`${c}/${b}`:b}(a,b,"cachedContents")}function cN(a){switch(a){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 a}}function cO(a){return null!=a&&"object"==typeof a&&"video"in a}function cP(a){return null!=a&&"object"==typeof a&&"uri"in a}function cQ(a){var b;let c;if(null!=a&&"object"==typeof a&&"name"in a&&(c=a.name),!cP(a)||void 0!==(c=a.uri)){if(!cO(a)||void 0!==(c=null==(b=a.video)?void 0:b.uri)){if("string"==typeof a&&(c=a),void 0===c)throw Error("Could not extract file name from the provided input.");if(c.startsWith("https://")){let a=c.split("files/")[1].match(/[a-z0-9]+/);if(null===a)throw Error(`Could not extract file name from URI ${c}`);c=a[0]}else c.startsWith("files/")&&(c=c.split("files/")[1]);return c}}}function cR(a,b){return a.isVertexAI()?b?"publishers/google/models":"models":b?"models":"tunedModels"}function cS(a){for(let d of["models","tunedModels","publisherModels"]){var b,c;if(b=a,c=d,null!==b&&"object"==typeof b&&c in b)return a[d]}return[]}function cT(a,b){let c;if("string"==typeof b)if(a.isVertexAI())if(b.startsWith("gs://"))c={format:"jsonl",gcsUri:[b]};else if(b.startsWith("bq://"))c={format:"bigquery",bigqueryUri:b};else if(/^projects\/[^/]+\/locations\/[^/]+\/datasets\/[^/]+$/.test(b))c={format:"vertex-dataset",vertexDatasetName:b};else throw Error(`Unsupported string source for Vertex AI: ${b}`);else if(b.startsWith("files/"))c={fileName:b};else throw Error(`Unsupported string source for Gemini API: ${b}`);else if(Array.isArray(b)){if(a.isVertexAI())throw Error("InlinedRequest[] is not supported in Vertex AI.");c={inlinedRequests:b}}else c=b;let d=[c.gcsUri,c.bigqueryUri,c.vertexDatasetName].filter(Boolean).length,e=[c.inlinedRequests,c.fileName].filter(Boolean).length;if(a.isVertexAI()){if(e>0||1!==d)throw Error("Exactly one of `gcsUri`, `bigqueryUri`, or `vertexDatasetName` must be set for Vertex AI.")}else if(d>0||1!==e)throw Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return c}function cU(a){if("object"!=typeof a||null===a)return{};let b=a.inlinedResponses;if("object"!=typeof b||null===b)return a;let c=b.inlinedResponses;if(!Array.isArray(c)||0===c.length)return a;let d=!1;for(let a of c){if("object"!=typeof a||null===a)continue;let b=a.response;if("object"==typeof b&&null!==b&&void 0!==b.embedding){d=!0;break}}return d&&(a.inlinedEmbedContentResponses=a.inlinedResponses,delete a.inlinedResponses),a}function cV(a,b){if(!a.isVertexAI()){if(/batches\/[^/]+$/.test(b))return b.split("/").pop();throw Error(`Invalid batch job name: ${b}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(b))return b.split("/").pop();if(/^\d+$/.test(b))return b;throw Error(`Invalid batch job name: ${b}.`)}function cW(a){if("BATCH_STATE_UNSPECIFIED"===a)return"JOB_STATE_UNSPECIFIED";if("BATCH_STATE_PENDING"===a)return"JOB_STATE_PENDING";if("BATCH_STATE_RUNNING"===a)return"JOB_STATE_RUNNING";if("BATCH_STATE_SUCCEEDED"===a)return"JOB_STATE_SUCCEEDED";if("BATCH_STATE_FAILED"===a)return"JOB_STATE_FAILED";else if("BATCH_STATE_CANCELLED"===a)return"JOB_STATE_CANCELLED";else if("BATCH_STATE_EXPIRED"===a)return"JOB_STATE_EXPIRED";else return a}function cX(a){let b={},c=bV(a,["name"]);null!=c&&bU(b,["name"],c);let d=bV(a,["metadata","displayName"]);null!=d&&bU(b,["displayName"],d);let e=bV(a,["metadata","state"]);null!=e&&bU(b,["state"],cW(e));let f=bV(a,["metadata","createTime"]);null!=f&&bU(b,["createTime"],f);let g=bV(a,["metadata","endTime"]);null!=g&&bU(b,["endTime"],g);let h=bV(a,["metadata","updateTime"]);null!=h&&bU(b,["updateTime"],h);let i=bV(a,["metadata","model"]);null!=i&&bU(b,["model"],i);let j=bV(a,["metadata","output"]);return null!=j&&bU(b,["dest"],function(a){let b={},c=bV(a,["responsesFile"]);null!=c&&bU(b,["fileName"],c);let d=bV(a,["inlinedResponses","inlinedResponses"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f;return c={},null!=(d=bV(b=a,["response"]))&&bU(c,["response"],function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["candidates"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["content"]);null!=c&&bU(b,["content"],c);let d=bV(a,["citationMetadata"]);null!=d&&bU(b,["citationMetadata"],function(a){let b={},c=bV(a,["citationSources"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["citations"],a)}return b}(d));let e=bV(a,["tokenCount"]);null!=e&&bU(b,["tokenCount"],e);let f=bV(a,["finishReason"]);null!=f&&bU(b,["finishReason"],f);let g=bV(a,["groundingMetadata"]);null!=g&&bU(b,["groundingMetadata"],g);let h=bV(a,["avgLogprobs"]);null!=h&&bU(b,["avgLogprobs"],h);let i=bV(a,["index"]);null!=i&&bU(b,["index"],i);let j=bV(a,["logprobsResult"]);null!=j&&bU(b,["logprobsResult"],j);let k=bV(a,["safetyRatings"]);if(null!=k){let a=k;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["safetyRatings"],a)}let l=bV(a,["urlContextMetadata"]);return null!=l&&bU(b,["urlContextMetadata"],l),b})(a))),bU(b,["candidates"],a)}let e=bV(a,["modelVersion"]);null!=e&&bU(b,["modelVersion"],e);let f=bV(a,["promptFeedback"]);null!=f&&bU(b,["promptFeedback"],f);let g=bV(a,["responseId"]);null!=g&&bU(b,["responseId"],g);let h=bV(a,["usageMetadata"]);null!=h&&bU(b,["usageMetadata"],h);let i=bV(a,["modelStatus"]);return null!=i&&bU(b,["modelStatus"],i),b}(d)),null!=(e=bV(b,["metadata"]))&&bU(c,["metadata"],e),null!=(f=bV(b,["error"]))&&bU(c,["error"],f),c})),bU(b,["inlinedResponses"],a)}let e=bV(a,["inlinedEmbedContentResponses","inlinedResponses"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["inlinedEmbedContentResponses"],a)}return b}(cU(j))),b}function cY(a){var b,c,d;let e,f,g,h,i,j,k,l,m,n,o,p,q,r={},s=bV(a,["name"]);null!=s&&bU(r,["name"],s);let t=bV(a,["displayName"]);null!=t&&bU(r,["displayName"],t);let u=bV(a,["state"]);null!=u&&bU(r,["state"],cW(u));let v=bV(a,["error"]);null!=v&&bU(r,["error"],v);let w=bV(a,["createTime"]);null!=w&&bU(r,["createTime"],w);let x=bV(a,["startTime"]);null!=x&&bU(r,["startTime"],x);let y=bV(a,["endTime"]);null!=y&&bU(r,["endTime"],y);let z=bV(a,["updateTime"]);null!=z&&bU(r,["updateTime"],z);let A=bV(a,["model"]);null!=A&&bU(r,["model"],A);let B=bV(a,["inputConfig"]);null!=B&&bU(r,["src"],(e={},null!=(f=bV(c=B,["instancesFormat"]))&&bU(e,["format"],f),null!=(g=bV(c,["gcsSource","uris"]))&&bU(e,["gcsUri"],g),null!=(h=bV(c,["bigquerySource","inputUri"]))&&bU(e,["bigqueryUri"],h),null!=(i=bV(c,["vertexMultimodalDatasetSource","datasetName"]))&&bU(e,["vertexDatasetName"],i),e));let C=bV(a,["outputConfig"]);null!=C&&bU(r,["dest"],(b=cU(C),m={},null!=(n=bV(b,["predictionsFormat"]))&&bU(m,["format"],n),null!=(o=bV(b,["gcsDestination","outputUriPrefix"]))&&bU(m,["gcsUri"],o),null!=(p=bV(b,["bigqueryDestination","outputUri"]))&&bU(m,["bigqueryUri"],p),null!=(q=bV(b,["vertexMultimodalDatasetDestination"]))&&bU(m,["vertexDataset"],(j={},null!=(k=bV(d=q,["bigqueryDestination","outputUri"]))&&bU(j,["bigqueryDestination"],k),null!=(l=bV(d,["displayName"]))&&bU(j,["displayName"],l),j)),m));let D=bV(a,["completionStats"]);null!=D&&bU(r,["completionStats"],D);let E=bV(a,["outputInfo"]);return null!=E&&bU(r,["outputInfo"],E),r}function cZ(a){let b={},c=bV(a,["parts"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;return c={},null!=(d=bV(b=a,["mediaResolution"]))&&bU(c,["mediaResolution"],d),null!=(e=bV(b,["codeExecutionResult"]))&&bU(c,["codeExecutionResult"],e),null!=(f=bV(b,["executableCode"]))&&bU(c,["executableCode"],f),null!=(g=bV(b,["fileData"]))&&bU(c,["fileData"],function(a){let b={};if(void 0!==bV(a,["displayName"]))throw Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=bV(a,["fileUri"]);null!=c&&bU(b,["fileUri"],c);let d=bV(a,["mimeType"]);return null!=d&&bU(b,["mimeType"],d),b}(g)),null!=(h=bV(b,["functionCall"]))&&bU(c,["functionCall"],function(a){let b={},c=bV(a,["id"]);null!=c&&bU(b,["id"],c);let d=bV(a,["args"]);null!=d&&bU(b,["args"],d);let e=bV(a,["name"]);if(null!=e&&bU(b,["name"],e),void 0!==bV(a,["partialArgs"]))throw Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["willContinue"]))throw Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(h)),null!=(i=bV(b,["functionResponse"]))&&bU(c,["functionResponse"],i),null!=(j=bV(b,["inlineData"]))&&bU(c,["inlineData"],function(a){let b={},c=bV(a,["data"]);if(null!=c&&bU(b,["data"],c),void 0!==bV(a,["displayName"]))throw Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["mimeType"]);return null!=d&&bU(b,["mimeType"],d),b}(j)),null!=(k=bV(b,["text"]))&&bU(c,["text"],k),null!=(l=bV(b,["thought"]))&&bU(c,["thought"],l),null!=(m=bV(b,["thoughtSignature"]))&&bU(c,["thoughtSignature"],m),null!=(n=bV(b,["videoMetadata"]))&&bU(c,["videoMetadata"],n),null!=(o=bV(b,["toolCall"]))&&bU(c,["toolCall"],o),null!=(p=bV(b,["toolResponse"]))&&bU(c,["toolResponse"],p),null!=(q=bV(b,["partMetadata"]))&&bU(c,["partMetadata"],q),c})),bU(b,["parts"],a)}let d=bV(a,["role"]);return null!=d&&bU(b,["role"],d),b}function c$(a,b){let c={},d=bV(b,["model"]);null!=d&&bU(c,["_url","model"],ct(a,d));let e=bV(b,["src"]);null!=e&&bU(c,["batch","inputConfig"],function(a,b){let c={};if(void 0!==bV(b,["format"]))throw Error("format parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(b,["gcsUri"]))throw Error("gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(b,["bigqueryUri"]))throw Error("bigqueryUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(b,["fileName"]);null!=d&&bU(c,["fileName"],d);let e=bV(b,["inlinedRequests"]);if(null!=e){let b=e;Array.isArray(b)&&(b=b.map(b=>(function(a,b){let c={},d=bV(b,["model"]);null!=d&&bU(c,["request","model"],ct(a,d));let e=bV(b,["contents"]);if(null!=e){let a=cG(e);Array.isArray(a)&&(a=a.map(a=>cZ(a))),bU(c,["request","contents"],a)}let f=bV(b,["metadata"]);null!=f&&bU(c,["metadata"],f);let g=bV(b,["config"]);return null!=g&&bU(c,["request","generationConfig"],function(a,b,c){var d;let e,f,g,h,i={},j=bV(b,["systemInstruction"]);void 0!==c&&null!=j&&bU(c,["systemInstruction"],cZ(cE(j)));let k=bV(b,["temperature"]);null!=k&&bU(i,["temperature"],k);let l=bV(b,["topP"]);null!=l&&bU(i,["topP"],l);let m=bV(b,["topK"]);null!=m&&bU(i,["topK"],m);let n=bV(b,["candidateCount"]);null!=n&&bU(i,["candidateCount"],n);let o=bV(b,["maxOutputTokens"]);null!=o&&bU(i,["maxOutputTokens"],o);let p=bV(b,["stopSequences"]);null!=p&&bU(i,["stopSequences"],p);let q=bV(b,["responseLogprobs"]);null!=q&&bU(i,["responseLogprobs"],q);let r=bV(b,["logprobs"]);null!=r&&bU(i,["logprobs"],r);let s=bV(b,["presencePenalty"]);null!=s&&bU(i,["presencePenalty"],s);let t=bV(b,["frequencyPenalty"]);null!=t&&bU(i,["frequencyPenalty"],t);let u=bV(b,["seed"]);null!=u&&bU(i,["seed"],u);let v=bV(b,["responseMimeType"]);null!=v&&bU(i,["responseMimeType"],v);let w=bV(b,["responseSchema"]);null!=w&&bU(i,["responseSchema"],cH(w));let x=bV(b,["responseJsonSchema"]);if(null!=x&&bU(i,["responseJsonSchema"],x),void 0!==bV(b,["routingConfig"]))throw Error("routingConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(b,["modelSelectionConfig"]))throw Error("modelSelectionConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let y=bV(b,["safetySettings"]);if(void 0!==c&&null!=y){let a=y;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["category"]);if(null!=c&&bU(b,["category"],c),void 0!==bV(a,["method"]))throw Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["threshold"]);return null!=d&&bU(b,["threshold"],d),b})(a))),bU(c,["safetySettings"],a)}let z=bV(b,["tools"]);if(void 0!==c&&null!=z){let a=cL(z);Array.isArray(a)&&(a=a.map(a=>(function(a){let b,c,d,e={};if(void 0!==bV(a,["retrieval"]))throw Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let f=bV(a,["computerUse"]);null!=f&&bU(e,["computerUse"],f);let g=bV(a,["fileSearch"]);null!=g&&bU(e,["fileSearch"],g);let h=bV(a,["googleSearch"]);null!=h&&bU(e,["googleSearch"],function(a){let b={},c=bV(a,["searchTypes"]);if(null!=c&&bU(b,["searchTypes"],c),void 0!==bV(a,["blockingConfidence"]))throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["excludeDomains"]))throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["timeRangeFilter"]);return null!=d&&bU(b,["timeRangeFilter"],d),b}(h));let i=bV(a,["googleMaps"]);null!=i&&bU(e,["googleMaps"],(b={},null!=(c=bV(i,["authConfig"]))&&bU(b,["authConfig"],function(a){let b={},c=bV(a,["apiKey"]);if(null!=c&&bU(b,["apiKey"],c),void 0!==bV(a,["apiKeyConfig"]))throw Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["authType"]))throw Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["googleServiceAccountConfig"]))throw Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["httpBasicAuthConfig"]))throw Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["oauthConfig"]))throw Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["oidcConfig"]))throw Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(c)),null!=(d=bV(i,["enableWidget"]))&&bU(b,["enableWidget"],d),b));let j=bV(a,["codeExecution"]);if(null!=j&&bU(e,["codeExecution"],j),void 0!==bV(a,["enterpriseWebSearch"]))throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let k=bV(a,["functionDeclarations"]);if(null!=k){let a=k;Array.isArray(a)&&(a=a.map(a=>a)),bU(e,["functionDeclarations"],a)}let l=bV(a,["googleSearchRetrieval"]);if(null!=l&&bU(e,["googleSearchRetrieval"],l),void 0!==bV(a,["parallelAiSearch"]))throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let m=bV(a,["urlContext"]);null!=m&&bU(e,["urlContext"],m);let n=bV(a,["mcpServers"]);if(null!=n){let a=n;Array.isArray(a)&&(a=a.map(a=>a)),bU(e,["mcpServers"],a)}return e})(cK(a)))),bU(c,["tools"],a)}let A=bV(b,["toolConfig"]);if(void 0!==c&&null!=A&&bU(c,["toolConfig"],(e={},null!=(f=bV(d=A,["retrievalConfig"]))&&bU(e,["retrievalConfig"],f),null!=(g=bV(d,["functionCallingConfig"]))&&bU(e,["functionCallingConfig"],function(a){let b={},c=bV(a,["allowedFunctionNames"]);null!=c&&bU(b,["allowedFunctionNames"],c);let d=bV(a,["mode"]);if(null!=d&&bU(b,["mode"],d),void 0!==bV(a,["streamFunctionCallArguments"]))throw Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(g)),null!=(h=bV(d,["includeServerSideToolInvocations"]))&&bU(e,["includeServerSideToolInvocations"],h),e)),void 0!==bV(b,["labels"]))throw Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let B=bV(b,["cachedContent"]);void 0!==c&&null!=B&&bU(c,["cachedContent"],cM(a,B));let C=bV(b,["responseModalities"]);null!=C&&bU(i,["responseModalities"],C);let D=bV(b,["mediaResolution"]);null!=D&&bU(i,["mediaResolution"],D);let E=bV(b,["speechConfig"]);if(null!=E&&bU(i,["speechConfig"],cI(E)),void 0!==bV(b,["audioTimestamp"]))throw Error("audioTimestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let F=bV(b,["thinkingConfig"]);null!=F&&bU(i,["thinkingConfig"],F);let G=bV(b,["imageConfig"]);null!=G&&bU(i,["imageConfig"],function(a){let b={},c=bV(a,["aspectRatio"]);null!=c&&bU(b,["aspectRatio"],c);let d=bV(a,["imageSize"]);if(null!=d&&bU(b,["imageSize"],d),void 0!==bV(a,["personGeneration"]))throw Error("personGeneration parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["prominentPeople"]))throw Error("prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["outputMimeType"]))throw Error("outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["outputCompressionQuality"]))throw Error("outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["imageOutputOptions"]))throw Error("imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(G));let H=bV(b,["enableEnhancedCivicAnswers"]);if(null!=H&&bU(i,["enableEnhancedCivicAnswers"],H),void 0!==bV(b,["modelArmorConfig"]))throw Error("modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let I=bV(b,["serviceTier"]);return void 0!==c&&null!=I&&bU(c,["serviceTier"],I),i}(a,g,bV(c,["request"],{}))),c})(a,b))),bU(c,["requests","requests"],b)}if(void 0!==bV(b,["vertexDatasetName"]))throw Error("vertexDatasetName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return c}(a,cT(a,e)));let f=bV(b,["config"]);return null!=f&&function(a,b){let c=bV(a,["displayName"]);if(void 0!==b&&null!=c&&bU(b,["batch","displayName"],c),void 0!==bV(a,["dest"]))throw Error("dest parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["webhookConfig"]);void 0!==b&&null!=d&&bU(b,["batch","webhookConfig"],d)}(f,c),c}(ax=bH||(bH={})).PAGED_ITEM_BATCH_JOBS="batchJobs",ax.PAGED_ITEM_MODELS="models",ax.PAGED_ITEM_TUNING_JOBS="tuningJobs",ax.PAGED_ITEM_FILES="files",ax.PAGED_ITEM_CACHED_CONTENTS="cachedContents",ax.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",ax.PAGED_ITEM_DOCUMENTS="documents",ax.PAGED_ITEM_SKILLS="skills";class c_{constructor(a,b,c,d){this.pageInternal=[],this.paramsInternal={},this.requestInternal=b,this.init(a,c,d)}init(a,b,c){var d,e;this.nameInternal=a,this.pageInternal=b[this.nameInternal]||[],this.sdkHttpResponseInternal=null==b?void 0:b.sdkHttpResponse,this.idxInternal=0;let f={config:{}};(f=c&&0!==Object.keys(c).length?"object"==typeof c?Object.assign({},c):c:{config:{}}).config&&(f.config.pageToken=b.nextPageToken),this.paramsInternal=f,this.pageInternalSize=null!=(e=null==(d=f.config)?void 0:d.pageSize)?e:this.pageInternal.length}initNextPage(a){this.init(this.nameInternal,a,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(a){return this.pageInternal[a]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(!this.hasNextPage())return{value:void 0,done:!0};else await this.nextPage();let a=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:a,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw Error("No more pages to fetch.");let a=await this.requestInternal(this.params);return this.initNextPage(a),this.page}hasNextPage(){var a;return(null==(a=this.params.config)?void 0:a.pageToken)!==void 0}}class c0 extends bS{constructor(a){super(),this.apiClient=a,this.list=async(a={})=>new c_(bH.PAGED_ITEM_BATCH_JOBS,a=>this.listInternal(a),await this.listInternal(a),a),this.create=async a=>(this.apiClient.isVertexAI()&&(a.config=this.formatDestination(a.src,a.config)),this.createInternal(a)),this.createEmbeddings=async a=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(a)}}createInlinedGenerateContentRequest(a){let b=c$(this.apiClient,a),c=bT("{model}:batchGenerateContent",b._url),d=b.batch.inputConfig.requests,e=d.requests,f=[];for(let a of e){let b=Object.assign({},a);if(b.systemInstruction){let a=b.systemInstruction;delete b.systemInstruction;let c=b.request;c.systemInstruction=a,b.request=c}f.push(b)}return d.requests=f,delete b.config,delete b._url,delete b._query,{path:c,body:b}}getGcsUri(a){return"string"==typeof a?a.startsWith("gs://")?a:void 0:!Array.isArray(a)&&a.gcsUri&&a.gcsUri.length>0?a.gcsUri[0]:void 0}getBigqueryUri(a){return"string"==typeof a?a.startsWith("bq://")?a:void 0:Array.isArray(a)?void 0:a.bigqueryUri}formatDestination(a,b){let c=b?Object.assign({},b):{},d=Date.now().toString();if(c.displayName||(c.displayName=`genaiBatchJob_${d}`),void 0===c.dest){let b=this.getGcsUri(a),e=this.getBigqueryUri(a);if(b)b.endsWith(".jsonl")?c.dest=`${b.slice(0,-6)}/dest`:c.dest=`${b}_dest_${d}`;else if(e)c.dest=`${e}_dest_${d}`;else throw Error("Unsupported source for Gemini Enterprise Agent Platform (previously known as Vertex AI): No GCS or BigQuery URI found.")}return c}async createInternal(a){var b,c,d,e,f;let g="",h={};if(this.apiClient.isVertexAI()){let d,e,i,j,k=(f=this.apiClient,d={},null!=(e=bV(a,["model"]))&&bU(d,["model"],ct(f,e)),null!=(i=bV(a,["src"]))&&bU(d,["inputConfig"],function(a){let b={},c=bV(a,["format"]);null!=c&&bU(b,["instancesFormat"],c);let d=bV(a,["gcsUri"]);null!=d&&bU(b,["gcsSource","uris"],d);let e=bV(a,["bigqueryUri"]);if(null!=e&&bU(b,["bigquerySource","inputUri"],e),void 0!==bV(a,["fileName"]))throw Error("fileName parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["inlinedRequests"]))throw Error("inlinedRequests parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let f=bV(a,["vertexDatasetName"]);return null!=f&&bU(b,["vertexMultimodalDatasetSource","datasetName"],f),b}(cT(f,i))),null!=(j=bV(a,["config"]))&&function(a,b){let c=bV(a,["displayName"]);void 0!==b&&null!=c&&bU(b,["displayName"],c);let d=bV(a,["dest"]);if(void 0!==b&&null!=d&&bU(b,["outputConfig"],function(a){var b;let c,d,e,f={},g=bV(a,["format"]);null!=g&&bU(f,["predictionsFormat"],g);let h=bV(a,["gcsUri"]);null!=h&&bU(f,["gcsDestination","outputUriPrefix"],h);let i=bV(a,["bigqueryUri"]);if(null!=i&&bU(f,["bigqueryDestination","outputUri"],i),void 0!==bV(a,["fileName"]))throw Error("fileName parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["inlinedResponses"]))throw Error("inlinedResponses parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["inlinedEmbedContentResponses"]))throw Error("inlinedEmbedContentResponses parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let j=bV(a,["vertexDataset"]);return null!=j&&bU(f,["vertexMultimodalDatasetDestination"],(c={},null!=(d=bV(b=j,["bigqueryDestination"]))&&bU(c,["bigqueryDestination","outputUri"],d),null!=(e=bV(b,["displayName"]))&&bU(c,["displayName"],e),c)),f}(function(a){if("string"!=typeof a)return a;if(a.startsWith("gs://"))return{format:"jsonl",gcsUri:a};if(a.startsWith("bq://"))return{format:"bigquery",bigqueryUri:a};throw Error(`Unsupported destination: ${a}`)}(d))),void 0!==bV(a,["webhookConfig"]))throw Error("webhookConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.")}(j,d),d);return g=bT("batchPredictionJobs",k._url),h=k._query,delete k._url,delete k._query,this.apiClient.request({path:g,queryParams:h,body:JSON.stringify(k),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>cY(a))}{let b=c$(this.apiClient,a);return g=bT("{model}:batchGenerateContent",b._url),h=b._query,delete b._url,delete b._query,this.apiClient.request({path:g,queryParams:h,body:JSON.stringify(b),httpMethod:"POST",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json()).then(a=>cX(a))}}async createEmbeddingsInternal(a){var b,c,d,e,f;let g="",h={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let i,j,k,l,m,n,o,p,q=(d=this.apiClient,l={},null!=(m=bV(a,["model"]))&&bU(l,["_url","model"],ct(d,m)),null!=(n=bV(a,["src"]))&&bU(l,["batch","inputConfig"],(e=d,i={},null!=(j=bV(f=n,["fileName"]))&&bU(i,["file_name"],j),null!=(k=bV(f,["inlinedRequests"]))&&bU(i,["requests"],function(a,b){let c={},d=bV(b,["contents"]);if(null!=d){let b=cF(a,d);Array.isArray(b)&&(b=b.map(a=>a)),bU(c,["requests[]","request","content"],b)}let e=bV(b,["config"]);return null!=e&&(bU(c,["_self"],function(a,b){let c=bV(a,["taskType"]);void 0!==b&&null!=c&&bU(b,["requests[]","taskType"],c);let d=bV(a,["title"]);void 0!==b&&null!=d&&bU(b,["requests[]","title"],d);let e=bV(a,["outputDimensionality"]);if(void 0!==b&&null!=e&&bU(b,["requests[]","outputDimensionality"],e),void 0!==bV(a,["mimeType"]))throw Error("mimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["autoTruncate"]))throw Error("autoTruncate parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["documentOcr"]))throw Error("documentOcr parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["audioTrackExtraction"]))throw Error("audioTrackExtraction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return{}}(e,c)),!function(a,b){for(let[c,d]of Object.entries(b)){let b=c.split("."),e=d.split("."),f=new Set,g=-1;for(let a=0;a<b.length;a++)if("*"===b[a]){g=a;break}if(-1!==g&&e.length>g)for(let a=g;a<e.length;a++){let b=e[a];"*"===b||b.endsWith("[]")||b.endsWith("[0]")||f.add(b)}!function a(b,c,d,e,f){if(e>=c.length||"object"!=typeof b||null===b)return;let g=c[e];if(g.endsWith("[]")){let h=g.slice(0,-2);if(h in b&&Array.isArray(b[h]))for(let g of b[h])a(g,c,d,e+1,f)}else if("*"===g){if("object"==typeof b&&null!==b&&!Array.isArray(b)){let a=Object.keys(b).filter(a=>!a.startsWith("_")&&!f.has(a)),c={};for(let d of a)c[d]=b[d];for(let[a,f]of Object.entries(c)){let c=[];for(let b of d.slice(e))"*"===b?c.push(a):c.push(b);bU(b,c,f)}for(let c of a)delete b[c]}}else g in b&&a(b[g],c,d,e+1,f)}(a,b,e,0,f)}}(c,{"requests[].*":"requests[].request.*"})),c}(e,k)),i)),null!=(o=bV(a,["config"]))&&(p=bV(o,["displayName"]),void 0!==l&&null!=p&&bU(l,["batch","displayName"],p)),l);return g=bT("{model}:asyncBatchEmbedContent",q._url),h=q._query,delete q._url,delete q._query,this.apiClient.request({path:g,queryParams:h,body:JSON.stringify(q),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>cX(a))}}async get(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g=(f=this.apiClient,d={},null!=(e=bV(a,["name"]))&&bU(d,["_url","name"],cV(f,e)),d);return h=bT("batchPredictionJobs/{name}",g._url),i=g._query,delete g._url,delete g._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(g),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>cY(a))}{let b,c,f=(g=this.apiClient,b={},null!=(c=bV(a,["name"]))&&bU(b,["_url","name"],cV(g,c)),b);return h=bT("batches/{name}",f._url),i=f._query,delete f._url,delete f._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(f),httpMethod:"GET",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json()).then(a=>cX(a))}}async cancel(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g=(f=this.apiClient,d={},null!=(e=bV(a,["name"]))&&bU(d,["_url","name"],cV(f,e)),d);h=bT("batchPredictionJobs/{name}:cancel",g._url),i=g._query,delete g._url,delete g._query,await this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(g),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal})}else{let b,c,f=(g=this.apiClient,b={},null!=(c=bV(a,["name"]))&&bU(b,["_url","name"],cV(g,c)),b);h=bT("batches/{name}:cancel",f._url),i=f._query,delete f._url,delete f._query,await this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(f),httpMethod:"POST",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal})}}async listInternal(a){var b,c,d,e;let f="",g={};if(this.apiClient.isVertexAI()){let d,e,h,i,j,k=(d={},null!=(e=bV(a,["config"]))&&(h=bV(e,["pageSize"]),void 0!==d&&null!=h&&bU(d,["_query","pageSize"],h),i=bV(e,["pageToken"]),void 0!==d&&null!=i&&bU(d,["_query","pageToken"],i),j=bV(e,["filter"]),void 0!==d&&null!=j&&bU(d,["_query","filter"],j)),d);return f=bT("batchPredictionJobs",k._url),g=k._query,delete k._url,delete k._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(k),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["nextPageToken"]);null!=d&&bU(b,["nextPageToken"],d);let e=bV(a,["batchPredictionJobs"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>cY(a))),bU(b,["batchJobs"],a)}return b}(a),c=new cp;return Object.assign(c,b),c})}{let b,c,h=(b={},null!=(c=bV(a,["config"]))&&function(a,b){let c=bV(a,["pageSize"]);void 0!==b&&null!=c&&bU(b,["_query","pageSize"],c);let d=bV(a,["pageToken"]);if(void 0!==b&&null!=d&&bU(b,["_query","pageToken"],d),void 0!==bV(a,["filter"]))throw Error("filter parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.")}(c,b),b);return f=bT("batches",h._url),g=h._query,delete h._url,delete h._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(h),httpMethod:"GET",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["nextPageToken"]);null!=d&&bU(b,["nextPageToken"],d);let e=bV(a,["operations"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>cX(a))),bU(b,["batchJobs"],a)}return b}(a),c=new cp;return Object.assign(c,b),c})}}async delete(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g=(f=this.apiClient,d={},null!=(e=bV(a,["name"]))&&bU(d,["_url","name"],cV(f,e)),d);return h=bT("batchPredictionJobs/{name}",g._url),i=g._query,delete g._url,delete g._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(g),httpMethod:"DELETE",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d,e,f;return b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),null!=(d=bV(a,["name"]))&&bU(b,["name"],d),null!=(e=bV(a,["done"]))&&bU(b,["done"],e),null!=(f=bV(a,["error"]))&&bU(b,["error"],f),b})}{let b,c,f=(g=this.apiClient,b={},null!=(c=bV(a,["name"]))&&bU(b,["_url","name"],cV(g,c)),b);return h=bT("batches/{name}",f._url),i=f._query,delete f._url,delete f._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(f),httpMethod:"DELETE",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d,e,f;return b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),null!=(d=bV(a,["name"]))&&bU(b,["name"],d),null!=(e=bV(a,["done"]))&&bU(b,["done"],e),null!=(f=bV(a,["error"]))&&bU(b,["error"],f),b})}}}function c1(a){let b={},c=bV(a,["parts"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;return c={},null!=(d=bV(b=a,["mediaResolution"]))&&bU(c,["mediaResolution"],d),null!=(e=bV(b,["codeExecutionResult"]))&&bU(c,["codeExecutionResult"],e),null!=(f=bV(b,["executableCode"]))&&bU(c,["executableCode"],f),null!=(g=bV(b,["fileData"]))&&bU(c,["fileData"],function(a){let b={};if(void 0!==bV(a,["displayName"]))throw Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=bV(a,["fileUri"]);null!=c&&bU(b,["fileUri"],c);let d=bV(a,["mimeType"]);return null!=d&&bU(b,["mimeType"],d),b}(g)),null!=(h=bV(b,["functionCall"]))&&bU(c,["functionCall"],function(a){let b={},c=bV(a,["id"]);null!=c&&bU(b,["id"],c);let d=bV(a,["args"]);null!=d&&bU(b,["args"],d);let e=bV(a,["name"]);if(null!=e&&bU(b,["name"],e),void 0!==bV(a,["partialArgs"]))throw Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["willContinue"]))throw Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(h)),null!=(i=bV(b,["functionResponse"]))&&bU(c,["functionResponse"],i),null!=(j=bV(b,["inlineData"]))&&bU(c,["inlineData"],function(a){let b={},c=bV(a,["data"]);if(null!=c&&bU(b,["data"],c),void 0!==bV(a,["displayName"]))throw Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["mimeType"]);return null!=d&&bU(b,["mimeType"],d),b}(j)),null!=(k=bV(b,["text"]))&&bU(c,["text"],k),null!=(l=bV(b,["thought"]))&&bU(c,["thought"],l),null!=(m=bV(b,["thoughtSignature"]))&&bU(c,["thoughtSignature"],m),null!=(n=bV(b,["videoMetadata"]))&&bU(c,["videoMetadata"],n),null!=(o=bV(b,["toolCall"]))&&bU(c,["toolCall"],o),null!=(p=bV(b,["toolResponse"]))&&bU(c,["toolResponse"],p),null!=(q=bV(b,["partMetadata"]))&&bU(c,["partMetadata"],q),c})),bU(b,["parts"],a)}let d=bV(a,["role"]);return null!=d&&bU(b,["role"],d),b}function c2(a){let b={},c=bV(a,["parts"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["mediaResolution"]);null!=c&&bU(b,["mediaResolution"],c);let d=bV(a,["codeExecutionResult"]);null!=d&&bU(b,["codeExecutionResult"],function(a){let b={},c=bV(a,["outcome"]);null!=c&&bU(b,["outcome"],c);let d=bV(a,["output"]);if(null!=d&&bU(b,["output"],d),void 0!==bV(a,["id"]))throw Error("id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(d));let e=bV(a,["executableCode"]);null!=e&&bU(b,["executableCode"],function(a){let b={},c=bV(a,["code"]);null!=c&&bU(b,["code"],c);let d=bV(a,["language"]);if(null!=d&&bU(b,["language"],d),void 0!==bV(a,["id"]))throw Error("id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(e));let f=bV(a,["fileData"]);null!=f&&bU(b,["fileData"],f);let g=bV(a,["functionCall"]);null!=g&&bU(b,["functionCall"],g);let h=bV(a,["functionResponse"]);null!=h&&bU(b,["functionResponse"],h);let i=bV(a,["inlineData"]);null!=i&&bU(b,["inlineData"],i);let j=bV(a,["text"]);null!=j&&bU(b,["text"],j);let k=bV(a,["thought"]);null!=k&&bU(b,["thought"],k);let l=bV(a,["thoughtSignature"]);null!=l&&bU(b,["thoughtSignature"],l);let m=bV(a,["videoMetadata"]);if(null!=m&&bU(b,["videoMetadata"],m),void 0!==bV(a,["toolCall"]))throw Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["toolResponse"]))throw Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["partMetadata"]))throw Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b})(a))),bU(b,["parts"],a)}let d=bV(a,["role"]);return null!=d&&bU(b,["role"],d),b}class c3 extends bS{constructor(a){super(),this.apiClient=a,this.list=async(a={})=>new c_(bH.PAGED_ITEM_CACHED_CONTENTS,a=>this.listInternal(a),await this.listInternal(a),a)}async create(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g,j=(f=this.apiClient,d={},null!=(e=bV(a,["model"]))&&bU(d,["model"],cu(f,e)),null!=(g=bV(a,["config"]))&&function(a,b){let c=bV(a,["ttl"]);void 0!==b&&null!=c&&bU(b,["ttl"],c);let d=bV(a,["expireTime"]);void 0!==b&&null!=d&&bU(b,["expireTime"],d);let e=bV(a,["displayName"]);void 0!==b&&null!=e&&bU(b,["displayName"],e);let f=bV(a,["contents"]);if(void 0!==b&&null!=f){let a=cG(f);Array.isArray(a)&&(a=a.map(a=>c2(a))),bU(b,["contents"],a)}let g=bV(a,["systemInstruction"]);void 0!==b&&null!=g&&bU(b,["systemInstruction"],c2(cE(g)));let h=bV(a,["tools"]);if(void 0!==b&&null!=h){let a=h;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["retrieval"]);null!=c&&bU(b,["retrieval"],c);let d=bV(a,["computerUse"]);if(null!=d&&bU(b,["computerUse"],function(a){let b={},c=bV(a,["environment"]);null!=c&&bU(b,["environment"],c);let d=bV(a,["excludedPredefinedFunctions"]);null!=d&&bU(b,["excludedPredefinedFunctions"],d);let e=bV(a,["enablePromptInjectionDetection"]);if(null!=e&&bU(b,["enablePromptInjectionDetection"],e),void 0!==bV(a,["disabledSafetyPolicies"]))throw Error("disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(d)),void 0!==bV(a,["fileSearch"]))throw Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let e=bV(a,["googleSearch"]);null!=e&&bU(b,["googleSearch"],e);let f=bV(a,["googleMaps"]);null!=f&&bU(b,["googleMaps"],f);let g=bV(a,["codeExecution"]);null!=g&&bU(b,["codeExecution"],g);let h=bV(a,["enterpriseWebSearch"]);null!=h&&bU(b,["enterpriseWebSearch"],h);let i=bV(a,["functionDeclarations"]);if(null!=i){let a=i;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["functionDeclarations"],a)}let j=bV(a,["googleSearchRetrieval"]);null!=j&&bU(b,["googleSearchRetrieval"],j);let k=bV(a,["parallelAiSearch"]);null!=k&&bU(b,["parallelAiSearch"],k);let l=bV(a,["urlContext"]);null!=l&&bU(b,["urlContext"],l);let m=bV(a,["mcpServers"]);if(null!=m){let a=m;Array.isArray(a)&&(a=a.map(a=>(function(a){if(void 0!==bV(a,["name"]))throw Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["streamableHttpTransport"]))throw Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return{}})(a))),bU(b,["mcpServers"],a)}return b})(a))),bU(b,["tools"],a)}let i=bV(a,["toolConfig"]);void 0!==b&&null!=i&&bU(b,["toolConfig"],function(a){let b={},c=bV(a,["retrievalConfig"]);null!=c&&bU(b,["retrievalConfig"],c);let d=bV(a,["functionCallingConfig"]);if(null!=d&&bU(b,["functionCallingConfig"],d),void 0!==bV(a,["includeServerSideToolInvocations"]))throw Error("includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(i));let j=bV(a,["kmsKeyName"]);void 0!==b&&null!=j&&bU(b,["encryption_spec","kmsKeyName"],j)}(g,d),d);return h=bT("cachedContents",j._url),i=j._query,delete j._url,delete j._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(j),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>a)}{let b,c,f,j=(g=this.apiClient,b={},null!=(c=bV(a,["model"]))&&bU(b,["model"],cu(g,c)),null!=(f=bV(a,["config"]))&&function(a,b){var c;let d,e,f,g,h=bV(a,["ttl"]);void 0!==b&&null!=h&&bU(b,["ttl"],h);let i=bV(a,["expireTime"]);void 0!==b&&null!=i&&bU(b,["expireTime"],i);let j=bV(a,["displayName"]);void 0!==b&&null!=j&&bU(b,["displayName"],j);let k=bV(a,["contents"]);if(void 0!==b&&null!=k){let a=cG(k);Array.isArray(a)&&(a=a.map(a=>c1(a))),bU(b,["contents"],a)}let l=bV(a,["systemInstruction"]);void 0!==b&&null!=l&&bU(b,["systemInstruction"],c1(cE(l)));let m=bV(a,["tools"]);if(void 0!==b&&null!=m){let a=m;Array.isArray(a)&&(a=a.map(a=>(function(a){let b,c,d,e={};if(void 0!==bV(a,["retrieval"]))throw Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let f=bV(a,["computerUse"]);null!=f&&bU(e,["computerUse"],f);let g=bV(a,["fileSearch"]);null!=g&&bU(e,["fileSearch"],g);let h=bV(a,["googleSearch"]);null!=h&&bU(e,["googleSearch"],function(a){let b={},c=bV(a,["searchTypes"]);if(null!=c&&bU(b,["searchTypes"],c),void 0!==bV(a,["blockingConfidence"]))throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["excludeDomains"]))throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["timeRangeFilter"]);return null!=d&&bU(b,["timeRangeFilter"],d),b}(h));let i=bV(a,["googleMaps"]);null!=i&&bU(e,["googleMaps"],(b={},null!=(c=bV(i,["authConfig"]))&&bU(b,["authConfig"],function(a){let b={},c=bV(a,["apiKey"]);if(null!=c&&bU(b,["apiKey"],c),void 0!==bV(a,["apiKeyConfig"]))throw Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["authType"]))throw Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["googleServiceAccountConfig"]))throw Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["httpBasicAuthConfig"]))throw Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["oauthConfig"]))throw Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["oidcConfig"]))throw Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(c)),null!=(d=bV(i,["enableWidget"]))&&bU(b,["enableWidget"],d),b));let j=bV(a,["codeExecution"]);if(null!=j&&bU(e,["codeExecution"],j),void 0!==bV(a,["enterpriseWebSearch"]))throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let k=bV(a,["functionDeclarations"]);if(null!=k){let a=k;Array.isArray(a)&&(a=a.map(a=>a)),bU(e,["functionDeclarations"],a)}let l=bV(a,["googleSearchRetrieval"]);if(null!=l&&bU(e,["googleSearchRetrieval"],l),void 0!==bV(a,["parallelAiSearch"]))throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let m=bV(a,["urlContext"]);null!=m&&bU(e,["urlContext"],m);let n=bV(a,["mcpServers"]);if(null!=n){let a=n;Array.isArray(a)&&(a=a.map(a=>a)),bU(e,["mcpServers"],a)}return e})(a))),bU(b,["tools"],a)}let n=bV(a,["toolConfig"]);if(void 0!==b&&null!=n&&bU(b,["toolConfig"],(d={},null!=(e=bV(c=n,["retrievalConfig"]))&&bU(d,["retrievalConfig"],e),null!=(f=bV(c,["functionCallingConfig"]))&&bU(d,["functionCallingConfig"],function(a){let b={},c=bV(a,["allowedFunctionNames"]);null!=c&&bU(b,["allowedFunctionNames"],c);let d=bV(a,["mode"]);if(null!=d&&bU(b,["mode"],d),void 0!==bV(a,["streamFunctionCallArguments"]))throw Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(f)),null!=(g=bV(c,["includeServerSideToolInvocations"]))&&bU(d,["includeServerSideToolInvocations"],g),d)),void 0!==bV(a,["kmsKeyName"]))throw Error("kmsKeyName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.")}(f,b),b);return h=bT("cachedContents",j._url),i=j._query,delete j._url,delete j._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(j),httpMethod:"POST",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json()).then(a=>a)}}async get(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g=(f=this.apiClient,d={},null!=(e=bV(a,["name"]))&&bU(d,["_url","name"],cM(f,e)),d);return h=bT("{name}",g._url),i=g._query,delete g._url,delete g._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(g),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>a)}{let b,c,f=(g=this.apiClient,b={},null!=(c=bV(a,["name"]))&&bU(b,["_url","name"],cM(g,c)),b);return h=bT("{name}",f._url),i=f._query,delete f._url,delete f._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(f),httpMethod:"GET",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json()).then(a=>a)}}async delete(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g=(f=this.apiClient,d={},null!=(e=bV(a,["name"]))&&bU(d,["_url","name"],cM(f,e)),d);return h=bT("{name}",g._url),i=g._query,delete g._url,delete g._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(g),httpMethod:"DELETE",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),b),e=new cf;return Object.assign(e,d),e})}{let b,c,f=(g=this.apiClient,b={},null!=(c=bV(a,["name"]))&&bU(b,["_url","name"],cM(g,c)),b);return h=bT("{name}",f._url),i=f._query,delete f._url,delete f._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(f),httpMethod:"DELETE",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),b),e=new cf;return Object.assign(e,d),e})}}async update(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g,j,k,l=(f=this.apiClient,d={},null!=(e=bV(a,["name"]))&&bU(d,["_url","name"],cM(f,e)),null!=(g=bV(a,["config"]))&&(j=bV(g,["ttl"]),void 0!==d&&null!=j&&bU(d,["ttl"],j),k=bV(g,["expireTime"]),void 0!==d&&null!=k&&bU(d,["expireTime"],k)),d);return h=bT("{name}",l._url),i=l._query,delete l._url,delete l._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(l),httpMethod:"PATCH",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>a)}{let b,c,f,j,k,l=(g=this.apiClient,b={},null!=(c=bV(a,["name"]))&&bU(b,["_url","name"],cM(g,c)),null!=(f=bV(a,["config"]))&&(j=bV(f,["ttl"]),void 0!==b&&null!=j&&bU(b,["ttl"],j),k=bV(f,["expireTime"]),void 0!==b&&null!=k&&bU(b,["expireTime"],k)),b);return h=bT("{name}",l._url),i=l._query,delete l._url,delete l._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(l),httpMethod:"PATCH",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json()).then(a=>a)}}async listInternal(a){var b,c,d,e;let f="",g={};if(this.apiClient.isVertexAI()){let d,e,h,i,j=(d={},null!=(e=bV(a,["config"]))&&(h=bV(e,["pageSize"]),void 0!==d&&null!=h&&bU(d,["_query","pageSize"],h),i=bV(e,["pageToken"]),void 0!==d&&null!=i&&bU(d,["_query","pageToken"],i)),d);return f=bT("cachedContents",j._url),g=j._query,delete j._url,delete j._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(j),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["nextPageToken"]);null!=d&&bU(b,["nextPageToken"],d);let e=bV(a,["cachedContents"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["cachedContents"],a)}return b}(a),c=new cg;return Object.assign(c,b),c})}{let b,c,h,i,j=(b={},null!=(c=bV(a,["config"]))&&(h=bV(c,["pageSize"]),void 0!==b&&null!=h&&bU(b,["_query","pageSize"],h),i=bV(c,["pageToken"]),void 0!==b&&null!=i&&bU(b,["_query","pageToken"],i)),b);return f=bT("cachedContents",j._url),g=j._query,delete j._url,delete j._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(j),httpMethod:"GET",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["nextPageToken"]);null!=d&&bU(b,["nextPageToken"],d);let e=bV(a,["cachedContents"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["cachedContents"],a)}return b}(a),c=new cg;return Object.assign(c,b),c})}}}function c4(a,b){var c={};for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&0>b.indexOf(d)&&(c[d]=a[d]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols)for(var e=0,d=Object.getOwnPropertySymbols(a);e<d.length;e++)0>b.indexOf(d[e])&&Object.prototype.propertyIsEnumerable.call(a,d[e])&&(c[d[e]]=a[d[e]]);return c}function c5(a){return this instanceof c5?(this.v=a,this):new c5(a)}function c6(a,b,c){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var d,e=c.apply(a,b||[]),f=[];return d=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),g("next"),g("throw"),g("return",function(a){return function(b){return Promise.resolve(b).then(a,j)}}),d[Symbol.asyncIterator]=function(){return this},d;function g(a,b){e[a]&&(d[a]=function(b){return new Promise(function(c,d){f.push([a,b,c,d])>1||h(a,b)})},b&&(d[a]=b(d[a])))}function h(a,b){try{var c;(c=e[a](b)).value instanceof c5?Promise.resolve(c.value.v).then(i,j):k(f[0][2],c)}catch(a){k(f[0][3],a)}}function i(a){h("next",a)}function j(a){h("throw",a)}function k(a,b){a(b),f.shift(),f.length&&h(f[0][0],f[0][1])}}function c7(a){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var b,c=a[Symbol.asyncIterator];return c?c.call(a):(a=function(a){var b="function"==typeof Symbol&&Symbol.iterator,c=b&&a[b],d=0;if(c)return c.call(a);if(a&&"number"==typeof a.length)return{next:function(){return a&&d>=a.length&&(a=void 0),{value:a&&a[d++],done:!a}}};throw TypeError(b?"Object is not iterable.":"Symbol.iterator is not defined.")}(a),b={},d("next"),d("throw"),d("return"),b[Symbol.asyncIterator]=function(){return this},b);function d(c){b[c]=a[c]&&function(b){return new Promise(function(d,e){var f,g,h;f=d,g=e,h=(b=a[c](b)).done,Promise.resolve(b.value).then(function(a){f({value:a,done:h})},g)})}}}function c8(a){if(void 0===a.parts||0===a.parts.length)return!1;for(let b of a.parts)if(void 0===b||0===Object.keys(b).length)return!1;return!0}function c9(a){if(void 0===a||0===a.length)return[];let b=[],c=a.length,d=0;for(;d<c;)if("user"===a[d].role)b.push(a[d]),d++;else{let e=[],f=!0;for(;d<c&&"model"===a[d].role;)e.push(a[d]),f&&!c8(a[d])&&(f=!1),d++;f?b.push(...e):b.pop()}return b}"function"==typeof SuppressedError&&SuppressedError;class da{constructor(a,b){this.modelsModule=a,this.apiClient=b}create(a){return new db(this.apiClient,this.modelsModule,a.model,a.config,structuredClone(a.history))}}class db{constructor(a,b,c,d={},e=[]){this.apiClient=a,this.modelsModule=b,this.model=c,this.config=d,this.history=e,this.sendPromise=Promise.resolve(),function(a){if(0!==a.length){for(let b of a)if("user"!==b.role&&"model"!==b.role)throw Error(`Role must be user or model, but got ${b.role}.`)}}(e)}async sendMessage(a){var b;await this.sendPromise;let c=cE(a.message),d=this.modelsModule.generateContent({model:this.model,contents:this.getHistory(!0).concat(c),config:null!=(b=a.config)?b:this.config});return this.sendPromise=(async()=>{var a,b,e;let f=await d,g=null==(b=null==(a=f.candidates)?void 0:a[0])?void 0:b.content,h=f.automaticFunctionCallingHistory,i=this.getHistory(!0).length,j=[];null!=h&&(j=null!=(e=h.slice(i))?e:[]),this.recordHistory(c,g?[g]:[],j)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),d}async sendMessageStream(a){var b;await this.sendPromise;let c=cE(a.message),d=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(c),config:null!=(b=a.config)?b:this.config});this.sendPromise=d.then(()=>void 0).catch(()=>void 0);let e=await d;return this.processStreamResponse(e,c)}getHistory(a=!1){return structuredClone(a?c9(this.history):this.history)}processStreamResponse(a,b){return c6(this,arguments,function*(){let c=[];try{for(var d,e,f,g,h,i,j,k=!0,l=c7(a);!(d=(j=yield c5(l.next())).done);k=!0){if(g=j.value,k=!1,function(a){var b;if(void 0==a.candidates||0===a.candidates.length)return!1;let c=null==(b=a.candidates[0])?void 0:b.content;return void 0!==c&&c8(c)}(g)){let a=null==(i=null==(h=g.candidates)?void 0:h[0])?void 0:i.content;void 0!==a&&c.push(a)}yield yield c5(g)}}catch(a){e={error:a}}finally{try{!k&&!d&&(f=l.return)&&(yield c5(f.call(l)))}finally{if(e)throw e.error}}this.recordHistory(b,c)})}recordHistory(a,b,c){let d=[];b.length>0&&b.every(a=>void 0!==a.role)?d=b:d.push({role:"model",parts:[]}),c&&c.length>0?this.history.push(...c9(c)):this.history.push(a),this.history.push(...d)}}class dc extends Error{constructor(a){super(a.message),this.name="ApiError",this.status=a.status,Object.setPrototypeOf(this,dc.prototype)}}class dd extends bS{constructor(a){super(),this.apiClient=a,this.list=async(a={})=>new c_(bH.PAGED_ITEM_FILES,a=>this.listInternal(a),await this.listInternal(a),a)}async upload(a){if(this.apiClient.isVertexAI())throw Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files. You can share files through a GCS bucket.");return this.apiClient.uploadFile(a.file,a.config).then(a=>a)}async download(a){await this.apiClient.downloadFile(a)}async registerFiles(a){throw Error("registerFiles is only supported in Node.js environments.")}async _registerFiles(a){return this.registerFilesInternal(a)}async listInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h,i,j=(f={},null!=(g=bV(a,["config"]))&&(h=bV(g,["pageSize"]),void 0!==f&&null!=h&&bU(f,["_query","pageSize"],h),i=bV(g,["pageToken"]),void 0!==f&&null!=i&&bU(f,["_query","pageToken"],i)),f);return d=bT("files",j._url),e=j._query,delete j._url,delete j._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(j),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["nextPageToken"]);null!=d&&bU(b,["nextPageToken"],d);let e=bV(a,["files"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["files"],a)}return b}(a),c=new cl;return Object.assign(c,b),c})}}async createInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h=(f={},null!=(g=bV(a,["file"]))&&bU(f,["file"],g),f);return d=bT("upload/v1beta/files",h._url),e=h._query,delete h._url,delete h._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(h),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>{let b,c,d=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),b),e=new cm;return Object.assign(e,d),e})}}async get(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h=(f={},null!=(g=bV(a,["name"]))&&bU(f,["_url","file"],cQ(g)),f);return d=bT("files/{file}",h._url),e=h._query,delete h._url,delete h._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(h),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>a)}}async delete(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h=(f={},null!=(g=bV(a,["name"]))&&bU(f,["_url","file"],cQ(g)),f);return d=bT("files/{file}",h._url),e=h._query,delete h._url,delete h._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(h),httpMethod:"DELETE",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),b),e=new cn;return Object.assign(e,d),e})}}async registerFilesInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h=(f={},null!=(g=bV(a,["uris"]))&&bU(f,["uris"],g),f);return d=bT("files:register",h._url),e=h._query,delete h._url,delete h._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(h),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["files"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["files"],a)}return b}(a),c=new co;return Object.assign(c,b),c})}}}function de(a){let b={};if(void 0!==bV(a,["languageCodes"]))throw Error("languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=bV(a,["languageAuto"]);null!=c&&bU(b,["languageAuto"],c);let d=bV(a,["languageHints"]);null!=d&&bU(b,["languageHints"],d);let e=bV(a,["adaptationPhrases"]);return null!=e&&bU(b,["adaptationPhrases"],e),b}function df(a){let b={},c=bV(a,["data"]);if(null!=c&&bU(b,["data"],c),void 0!==bV(a,["displayName"]))throw Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["mimeType"]);return null!=d&&bU(b,["mimeType"],d),b}function dg(a,b){let c={},d=bV(a,["parts"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;return c={},null!=(d=bV(b=a,["mediaResolution"]))&&bU(c,["mediaResolution"],d),null!=(e=bV(b,["codeExecutionResult"]))&&bU(c,["codeExecutionResult"],e),null!=(f=bV(b,["executableCode"]))&&bU(c,["executableCode"],f),null!=(g=bV(b,["fileData"]))&&bU(c,["fileData"],function(a){let b={};if(void 0!==bV(a,["displayName"]))throw Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=bV(a,["fileUri"]);null!=c&&bU(b,["fileUri"],c);let d=bV(a,["mimeType"]);return null!=d&&bU(b,["mimeType"],d),b}(g)),null!=(h=bV(b,["functionCall"]))&&bU(c,["functionCall"],function(a){let b={},c=bV(a,["id"]);null!=c&&bU(b,["id"],c);let d=bV(a,["args"]);null!=d&&bU(b,["args"],d);let e=bV(a,["name"]);if(null!=e&&bU(b,["name"],e),void 0!==bV(a,["partialArgs"]))throw Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["willContinue"]))throw Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(h)),null!=(i=bV(b,["functionResponse"]))&&bU(c,["functionResponse"],i),null!=(j=bV(b,["inlineData"]))&&bU(c,["inlineData"],function(a){let b={},c=bV(a,["data"]);if(null!=c&&bU(b,["data"],c),void 0!==bV(a,["displayName"]))throw Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["mimeType"]);return null!=d&&bU(b,["mimeType"],d),b}(j)),null!=(k=bV(b,["text"]))&&bU(c,["text"],k),null!=(l=bV(b,["thought"]))&&bU(c,["thought"],l),null!=(m=bV(b,["thoughtSignature"]))&&bU(c,["thoughtSignature"],m),null!=(n=bV(b,["videoMetadata"]))&&bU(c,["videoMetadata"],n),null!=(o=bV(b,["toolCall"]))&&bU(c,["toolCall"],o),null!=(p=bV(b,["toolResponse"]))&&bU(c,["toolResponse"],p),null!=(q=bV(b,["partMetadata"]))&&bU(c,["partMetadata"],q),c})),bU(c,["parts"],a)}let e=bV(a,["role"]);return null!=e&&bU(c,["role"],e),c}function dh(a,b){let c={},d=bV(a,["parts"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["mediaResolution"]);null!=c&&bU(b,["mediaResolution"],c);let d=bV(a,["codeExecutionResult"]);null!=d&&bU(b,["codeExecutionResult"],function(a){let b={},c=bV(a,["outcome"]);null!=c&&bU(b,["outcome"],c);let d=bV(a,["output"]);if(null!=d&&bU(b,["output"],d),void 0!==bV(a,["id"]))throw Error("id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(d));let e=bV(a,["executableCode"]);null!=e&&bU(b,["executableCode"],function(a){let b={},c=bV(a,["code"]);null!=c&&bU(b,["code"],c);let d=bV(a,["language"]);if(null!=d&&bU(b,["language"],d),void 0!==bV(a,["id"]))throw Error("id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(e));let f=bV(a,["fileData"]);null!=f&&bU(b,["fileData"],f);let g=bV(a,["functionCall"]);null!=g&&bU(b,["functionCall"],g);let h=bV(a,["functionResponse"]);null!=h&&bU(b,["functionResponse"],h);let i=bV(a,["inlineData"]);null!=i&&bU(b,["inlineData"],i);let j=bV(a,["text"]);null!=j&&bU(b,["text"],j);let k=bV(a,["thought"]);null!=k&&bU(b,["thought"],k);let l=bV(a,["thoughtSignature"]);null!=l&&bU(b,["thoughtSignature"],l);let m=bV(a,["videoMetadata"]);if(null!=m&&bU(b,["videoMetadata"],m),void 0!==bV(a,["toolCall"]))throw Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["toolResponse"]))throw Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["partMetadata"]))throw Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b})(a))),bU(c,["parts"],a)}let e=bV(a,["role"]);return null!=e&&bU(c,["role"],e),c}function di(a,b,c){let d={},e=bV(b,["model"]);null!=e&&bU(d,["_url","model"],ct(a,e));let f=bV(b,["contents"]);if(null!=f){let a=cG(f);Array.isArray(a)&&(a=a.map(a=>dg(a))),bU(d,["contents"],a)}let g=bV(b,["config"]);return null!=g&&bU(d,["generationConfig"],function(a,b,c){var d;let e,f,g,h,i={},j=bV(b,["systemInstruction"]);void 0!==c&&null!=j&&bU(c,["systemInstruction"],dg(cE(j)));let k=bV(b,["temperature"]);null!=k&&bU(i,["temperature"],k);let l=bV(b,["topP"]);null!=l&&bU(i,["topP"],l);let m=bV(b,["topK"]);null!=m&&bU(i,["topK"],m);let n=bV(b,["candidateCount"]);null!=n&&bU(i,["candidateCount"],n);let o=bV(b,["maxOutputTokens"]);null!=o&&bU(i,["maxOutputTokens"],o);let p=bV(b,["stopSequences"]);null!=p&&bU(i,["stopSequences"],p);let q=bV(b,["responseLogprobs"]);null!=q&&bU(i,["responseLogprobs"],q);let r=bV(b,["logprobs"]);null!=r&&bU(i,["logprobs"],r);let s=bV(b,["presencePenalty"]);null!=s&&bU(i,["presencePenalty"],s);let t=bV(b,["frequencyPenalty"]);null!=t&&bU(i,["frequencyPenalty"],t);let u=bV(b,["seed"]);null!=u&&bU(i,["seed"],u);let v=bV(b,["responseMimeType"]);null!=v&&bU(i,["responseMimeType"],v);let w=bV(b,["responseSchema"]);null!=w&&bU(i,["responseSchema"],cH(w));let x=bV(b,["responseJsonSchema"]);if(null!=x&&bU(i,["responseJsonSchema"],x),void 0!==bV(b,["routingConfig"]))throw Error("routingConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(b,["modelSelectionConfig"]))throw Error("modelSelectionConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let y=bV(b,["safetySettings"]);if(void 0!==c&&null!=y){let a=y;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["category"]);if(null!=c&&bU(b,["category"],c),void 0!==bV(a,["method"]))throw Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["threshold"]);return null!=d&&bU(b,["threshold"],d),b})(a))),bU(c,["safetySettings"],a)}let z=bV(b,["tools"]);if(void 0!==c&&null!=z){let a=cL(z);Array.isArray(a)&&(a=a.map(a=>(function(a){let b,c,d,e={};if(void 0!==bV(a,["retrieval"]))throw Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let f=bV(a,["computerUse"]);null!=f&&bU(e,["computerUse"],f);let g=bV(a,["fileSearch"]);null!=g&&bU(e,["fileSearch"],g);let h=bV(a,["googleSearch"]);null!=h&&bU(e,["googleSearch"],function(a){let b={},c=bV(a,["searchTypes"]);if(null!=c&&bU(b,["searchTypes"],c),void 0!==bV(a,["blockingConfidence"]))throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["excludeDomains"]))throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["timeRangeFilter"]);return null!=d&&bU(b,["timeRangeFilter"],d),b}(h));let i=bV(a,["googleMaps"]);null!=i&&bU(e,["googleMaps"],(b={},null!=(c=bV(i,["authConfig"]))&&bU(b,["authConfig"],function(a){let b={},c=bV(a,["apiKey"]);if(null!=c&&bU(b,["apiKey"],c),void 0!==bV(a,["apiKeyConfig"]))throw Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["authType"]))throw Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["googleServiceAccountConfig"]))throw Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["httpBasicAuthConfig"]))throw Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["oauthConfig"]))throw Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["oidcConfig"]))throw Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(c)),null!=(d=bV(i,["enableWidget"]))&&bU(b,["enableWidget"],d),b));let j=bV(a,["codeExecution"]);if(null!=j&&bU(e,["codeExecution"],j),void 0!==bV(a,["enterpriseWebSearch"]))throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let k=bV(a,["functionDeclarations"]);if(null!=k){let a=k;Array.isArray(a)&&(a=a.map(a=>a)),bU(e,["functionDeclarations"],a)}let l=bV(a,["googleSearchRetrieval"]);if(null!=l&&bU(e,["googleSearchRetrieval"],l),void 0!==bV(a,["parallelAiSearch"]))throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let m=bV(a,["urlContext"]);null!=m&&bU(e,["urlContext"],m);let n=bV(a,["mcpServers"]);if(null!=n){let a=n;Array.isArray(a)&&(a=a.map(a=>a)),bU(e,["mcpServers"],a)}return e})(cK(a)))),bU(c,["tools"],a)}let A=bV(b,["toolConfig"]);if(void 0!==c&&null!=A&&bU(c,["toolConfig"],(e={},null!=(f=bV(d=A,["retrievalConfig"]))&&bU(e,["retrievalConfig"],f),null!=(g=bV(d,["functionCallingConfig"]))&&bU(e,["functionCallingConfig"],function(a){let b={},c=bV(a,["allowedFunctionNames"]);null!=c&&bU(b,["allowedFunctionNames"],c);let d=bV(a,["mode"]);if(null!=d&&bU(b,["mode"],d),void 0!==bV(a,["streamFunctionCallArguments"]))throw Error("streamFunctionCallArguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(g)),null!=(h=bV(d,["includeServerSideToolInvocations"]))&&bU(e,["includeServerSideToolInvocations"],h),e)),void 0!==bV(b,["labels"]))throw Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let B=bV(b,["cachedContent"]);void 0!==c&&null!=B&&bU(c,["cachedContent"],cM(a,B));let C=bV(b,["responseModalities"]);null!=C&&bU(i,["responseModalities"],C);let D=bV(b,["mediaResolution"]);null!=D&&bU(i,["mediaResolution"],D);let E=bV(b,["speechConfig"]);if(null!=E&&bU(i,["speechConfig"],cI(E)),void 0!==bV(b,["audioTimestamp"]))throw Error("audioTimestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let F=bV(b,["thinkingConfig"]);null!=F&&bU(i,["thinkingConfig"],F);let G=bV(b,["imageConfig"]);null!=G&&bU(i,["imageConfig"],function(a){let b={},c=bV(a,["aspectRatio"]);null!=c&&bU(b,["aspectRatio"],c);let d=bV(a,["imageSize"]);if(null!=d&&bU(b,["imageSize"],d),void 0!==bV(a,["personGeneration"]))throw Error("personGeneration parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["prominentPeople"]))throw Error("prominentPeople parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["outputMimeType"]))throw Error("outputMimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["outputCompressionQuality"]))throw Error("outputCompressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["imageOutputOptions"]))throw Error("imageOutputOptions parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(G));let H=bV(b,["enableEnhancedCivicAnswers"]);if(null!=H&&bU(i,["enableEnhancedCivicAnswers"],H),void 0!==bV(b,["modelArmorConfig"]))throw Error("modelArmorConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let I=bV(b,["serviceTier"]);return void 0!==c&&null!=I&&bU(c,["serviceTier"],I),i}(a,g,d)),d}function dj(a,b,c){let d={},e=bV(b,["model"]);null!=e&&bU(d,["_url","model"],ct(a,e));let f=bV(b,["contents"]);if(null!=f){let a=cG(f);Array.isArray(a)&&(a=a.map(a=>dh(a))),bU(d,["contents"],a)}let g=bV(b,["config"]);return null!=g&&bU(d,["generationConfig"],function(a,b,c){var d;let e,f,g,h,i,j,k,l,m={},n=bV(b,["systemInstruction"]);void 0!==c&&null!=n&&bU(c,["systemInstruction"],dh(cE(n)));let o=bV(b,["temperature"]);null!=o&&bU(m,["temperature"],o);let p=bV(b,["topP"]);null!=p&&bU(m,["topP"],p);let q=bV(b,["topK"]);null!=q&&bU(m,["topK"],q);let r=bV(b,["candidateCount"]);null!=r&&bU(m,["candidateCount"],r);let s=bV(b,["maxOutputTokens"]);null!=s&&bU(m,["maxOutputTokens"],s);let t=bV(b,["stopSequences"]);null!=t&&bU(m,["stopSequences"],t);let u=bV(b,["responseLogprobs"]);null!=u&&bU(m,["responseLogprobs"],u);let v=bV(b,["logprobs"]);null!=v&&bU(m,["logprobs"],v);let w=bV(b,["presencePenalty"]);null!=w&&bU(m,["presencePenalty"],w);let x=bV(b,["frequencyPenalty"]);null!=x&&bU(m,["frequencyPenalty"],x);let y=bV(b,["seed"]);null!=y&&bU(m,["seed"],y);let z=bV(b,["responseMimeType"]);null!=z&&bU(m,["responseMimeType"],z);let A=bV(b,["responseSchema"]);null!=A&&bU(m,["responseSchema"],cH(A));let B=bV(b,["responseJsonSchema"]);null!=B&&bU(m,["responseJsonSchema"],B);let C=bV(b,["routingConfig"]);null!=C&&bU(m,["routingConfig"],C);let D=bV(b,["modelSelectionConfig"]);null!=D&&bU(m,["modelConfig"],D);let E=bV(b,["safetySettings"]);if(void 0!==c&&null!=E){let a=E;Array.isArray(a)&&(a=a.map(a=>a)),bU(c,["safetySettings"],a)}let F=bV(b,["tools"]);if(void 0!==c&&null!=F){let a=cL(F);Array.isArray(a)&&(a=a.map(a=>dv(cK(a)))),bU(c,["tools"],a)}let G=bV(b,["toolConfig"]);void 0!==c&&null!=G&&bU(c,["toolConfig"],function(a){let b={},c=bV(a,["retrievalConfig"]);null!=c&&bU(b,["retrievalConfig"],c);let d=bV(a,["functionCallingConfig"]);if(null!=d&&bU(b,["functionCallingConfig"],d),void 0!==bV(a,["includeServerSideToolInvocations"]))throw Error("includeServerSideToolInvocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(G));let H=bV(b,["labels"]);void 0!==c&&null!=H&&bU(c,["labels"],H);let I=bV(b,["cachedContent"]);void 0!==c&&null!=I&&bU(c,["cachedContent"],cM(a,I));let J=bV(b,["responseModalities"]);null!=J&&bU(m,["responseModalities"],J);let K=bV(b,["mediaResolution"]);null!=K&&bU(m,["mediaResolution"],K);let L=bV(b,["speechConfig"]);null!=L&&bU(m,["speechConfig"],cI(L));let M=bV(b,["audioTimestamp"]);null!=M&&bU(m,["audioTimestamp"],M);let N=bV(b,["thinkingConfig"]);null!=N&&bU(m,["thinkingConfig"],N);let O=bV(b,["imageConfig"]);if(null!=O&&bU(m,["imageConfig"],(e={},null!=(f=bV(d=O,["aspectRatio"]))&&bU(e,["aspectRatio"],f),null!=(g=bV(d,["imageSize"]))&&bU(e,["imageSize"],g),null!=(h=bV(d,["personGeneration"]))&&bU(e,["personGeneration"],h),null!=(i=bV(d,["prominentPeople"]))&&bU(e,["prominentPeople"],i),null!=(j=bV(d,["outputMimeType"]))&&bU(e,["imageOutputOptions","mimeType"],j),null!=(k=bV(d,["outputCompressionQuality"]))&&bU(e,["imageOutputOptions","compressionQuality"],k),null!=(l=bV(d,["imageOutputOptions"]))&&bU(e,["imageOutputOptions"],l),e)),void 0!==bV(b,["enableEnhancedCivicAnswers"]))throw Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let P=bV(b,["modelArmorConfig"]);void 0!==c&&null!=P&&bU(c,["modelArmorConfig"],P);let Q=bV(b,["serviceTier"]);return void 0!==c&&null!=Q&&bU(c,["serviceTier"],Q),m}(a,g,d)),d}function dk(a,b){let c={},d=bV(a,["sdkHttpResponse"]);null!=d&&bU(c,["sdkHttpResponse"],d);let e=bV(a,["candidates"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["content"]);null!=c&&bU(b,["content"],c);let d=bV(a,["citationMetadata"]);null!=d&&bU(b,["citationMetadata"],function(a){let b={},c=bV(a,["citationSources"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["citations"],a)}return b}(d));let e=bV(a,["tokenCount"]);null!=e&&bU(b,["tokenCount"],e);let f=bV(a,["finishReason"]);null!=f&&bU(b,["finishReason"],f);let g=bV(a,["groundingMetadata"]);null!=g&&bU(b,["groundingMetadata"],g);let h=bV(a,["avgLogprobs"]);null!=h&&bU(b,["avgLogprobs"],h);let i=bV(a,["index"]);null!=i&&bU(b,["index"],i);let j=bV(a,["logprobsResult"]);null!=j&&bU(b,["logprobsResult"],j);let k=bV(a,["safetyRatings"]);if(null!=k){let a=k;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["safetyRatings"],a)}let l=bV(a,["urlContextMetadata"]);return null!=l&&bU(b,["urlContextMetadata"],l),b})(a))),bU(c,["candidates"],a)}let f=bV(a,["modelVersion"]);null!=f&&bU(c,["modelVersion"],f);let g=bV(a,["promptFeedback"]);null!=g&&bU(c,["promptFeedback"],g);let h=bV(a,["responseId"]);null!=h&&bU(c,["responseId"],h);let i=bV(a,["usageMetadata"]);null!=i&&bU(c,["usageMetadata"],i);let j=bV(a,["modelStatus"]);return null!=j&&bU(c,["modelStatus"],j),c}function dl(a,b){let c={},d=bV(a,["sdkHttpResponse"]);null!=d&&bU(c,["sdkHttpResponse"],d);let e=bV(a,["candidates"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>a)),bU(c,["candidates"],a)}let f=bV(a,["createTime"]);null!=f&&bU(c,["createTime"],f);let g=bV(a,["modelVersion"]);null!=g&&bU(c,["modelVersion"],g);let h=bV(a,["promptFeedback"]);null!=h&&bU(c,["promptFeedback"],h);let i=bV(a,["responseId"]);null!=i&&bU(c,["responseId"],i);let j=bV(a,["usageMetadata"]);return null!=j&&bU(c,["usageMetadata"],j),c}function dm(a,b){let c={},d=bV(a,["_self"]);null!=d&&bU(c,["image"],dn(d));let e=bV(a,["raiFilteredReason"]);null!=e&&bU(c,["raiFilteredReason"],e);let f=bV(a,["_self"]);null!=f&&bU(c,["safetyAttributes"],du(f));let g=bV(a,["prompt"]);return null!=g&&bU(c,["enhancedPrompt"],g),c}function dn(a,b){let c={},d=bV(a,["gcsUri"]);null!=d&&bU(c,["gcsUri"],d);let e=bV(a,["bytesBase64Encoded"]);null!=e&&bU(c,["imageBytes"],bW(e));let f=bV(a,["mimeType"]);return null!=f&&bU(c,["mimeType"],f),c}function dp(a,b){let c={};if(void 0!==bV(a,["gcsUri"]))throw Error("gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["imageBytes"]);null!=d&&bU(c,["bytesBase64Encoded"],bW(d));let e=bV(a,["mimeType"]);return null!=e&&bU(c,["mimeType"],e),c}function dq(a,b){let c={},d=bV(a,["gcsUri"]);null!=d&&bU(c,["gcsUri"],d);let e=bV(a,["imageBytes"]);null!=e&&bU(c,["bytesBase64Encoded"],bW(e));let f=bV(a,["mimeType"]);return null!=f&&bU(c,["mimeType"],f),c}function dr(a,b){var c;let d,e,f,g,h={},i=bV(a,["name"]);null!=i&&bU(h,["name"],i);let j=bV(a,["displayName"]);null!=j&&bU(h,["displayName"],j);let k=bV(a,["description"]);null!=k&&bU(h,["description"],k);let l=bV(a,["version"]);null!=l&&bU(h,["version"],l);let m=bV(a,["_self"]);null!=m&&bU(h,["tunedModelInfo"],(d={},null!=(e=bV(c=m,["baseModel"]))&&bU(d,["baseModel"],e),null!=(f=bV(c,["createTime"]))&&bU(d,["createTime"],f),null!=(g=bV(c,["updateTime"]))&&bU(d,["updateTime"],g),d));let n=bV(a,["inputTokenLimit"]);null!=n&&bU(h,["inputTokenLimit"],n);let o=bV(a,["outputTokenLimit"]);null!=o&&bU(h,["outputTokenLimit"],o);let p=bV(a,["supportedGenerationMethods"]);null!=p&&bU(h,["supportedActions"],p);let q=bV(a,["temperature"]);null!=q&&bU(h,["temperature"],q);let r=bV(a,["maxTemperature"]);null!=r&&bU(h,["maxTemperature"],r);let s=bV(a,["topP"]);null!=s&&bU(h,["topP"],s);let t=bV(a,["topK"]);null!=t&&bU(h,["topK"],t);let u=bV(a,["thinking"]);return null!=u&&bU(h,["thinking"],u),h}function ds(a,b){var c;let d,e,f,g,h={},i=bV(a,["name"]);null!=i&&bU(h,["name"],i);let j=bV(a,["displayName"]);null!=j&&bU(h,["displayName"],j);let k=bV(a,["description"]);null!=k&&bU(h,["description"],k);let l=bV(a,["versionId"]);null!=l&&bU(h,["version"],l);let m=bV(a,["deployedModels"]);if(null!=m){let a=m;Array.isArray(a)&&(a=a.map(a=>{let b,c,d;return b={},null!=(c=bV(a,["endpoint"]))&&bU(b,["name"],c),null!=(d=bV(a,["deployedModelId"]))&&bU(b,["deployedModelId"],d),b})),bU(h,["endpoints"],a)}let n=bV(a,["labels"]);null!=n&&bU(h,["labels"],n);let o=bV(a,["_self"]);null!=o&&bU(h,["tunedModelInfo"],(d={},null!=(e=bV(c=o,["labels","google-vertex-llm-tuning-base-model-id"]))&&bU(d,["baseModel"],e),null!=(f=bV(c,["createTime"]))&&bU(d,["createTime"],f),null!=(g=bV(c,["updateTime"]))&&bU(d,["updateTime"],g),d));let p=bV(a,["defaultCheckpointId"]);null!=p&&bU(h,["defaultCheckpointId"],p);let q=bV(a,["checkpoints"]);if(null!=q){let a=q;Array.isArray(a)&&(a=a.map(a=>a)),bU(h,["checkpoints"],a)}return h}function dt(a,b){let c={},d=bV(a,["safetyAttributes","categories"]);null!=d&&bU(c,["categories"],d);let e=bV(a,["safetyAttributes","scores"]);null!=e&&bU(c,["scores"],e);let f=bV(a,["contentType"]);return null!=f&&bU(c,["contentType"],f),c}function du(a,b){let c={},d=bV(a,["safetyAttributes","categories"]);null!=d&&bU(c,["categories"],d);let e=bV(a,["safetyAttributes","scores"]);null!=e&&bU(c,["scores"],e);let f=bV(a,["contentType"]);return null!=f&&bU(c,["contentType"],f),c}function dv(a,b){let c={},d=bV(a,["retrieval"]);null!=d&&bU(c,["retrieval"],d);let e=bV(a,["computerUse"]);if(null!=e&&bU(c,["computerUse"],function(a){let b={},c=bV(a,["environment"]);null!=c&&bU(b,["environment"],c);let d=bV(a,["excludedPredefinedFunctions"]);null!=d&&bU(b,["excludedPredefinedFunctions"],d);let e=bV(a,["enablePromptInjectionDetection"]);if(null!=e&&bU(b,["enablePromptInjectionDetection"],e),void 0!==bV(a,["disabledSafetyPolicies"]))throw Error("disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(e)),void 0!==bV(a,["fileSearch"]))throw Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let f=bV(a,["googleSearch"]);null!=f&&bU(c,["googleSearch"],f);let g=bV(a,["googleMaps"]);null!=g&&bU(c,["googleMaps"],g);let h=bV(a,["codeExecution"]);null!=h&&bU(c,["codeExecution"],h);let i=bV(a,["enterpriseWebSearch"]);null!=i&&bU(c,["enterpriseWebSearch"],i);let j=bV(a,["functionDeclarations"]);if(null!=j){let a=j;Array.isArray(a)&&(a=a.map(a=>a)),bU(c,["functionDeclarations"],a)}let k=bV(a,["googleSearchRetrieval"]);null!=k&&bU(c,["googleSearchRetrieval"],k);let l=bV(a,["parallelAiSearch"]);null!=l&&bU(c,["parallelAiSearch"],l);let m=bV(a,["urlContext"]);null!=m&&bU(c,["urlContext"],m);let n=bV(a,["mcpServers"]);if(null!=n){let a=n;Array.isArray(a)&&(a=a.map(a=>(function(a){if(void 0!==bV(a,["name"]))throw Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["streamableHttpTransport"]))throw Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return{}})(a))),bU(c,["mcpServers"],a)}return c}function dw(a,b){let c={},d=bV(a,["uri"]);null!=d&&bU(c,["uri"],d);let e=bV(a,["videoBytes"]);null!=e&&bU(c,["encodedVideo"],bW(e));let f=bV(a,["mimeType"]);return null!=f&&bU(c,["encoding"],f),c}function dx(a,b){let c={},d=bV(a,["uri"]);null!=d&&bU(c,["gcsUri"],d);let e=bV(a,["videoBytes"]);null!=e&&bU(c,["bytesBase64Encoded"],bW(e));let f=bV(a,["mimeType"]);return null!=f&&bU(c,["mimeType"],f),c}function dy(a,b){let c=bV(a,["mimeType"]);void 0!==b&&null!=c&&bU(b,["mimeType"],c);let d=bV(a,["displayName"]);void 0!==b&&null!=d&&bU(b,["displayName"],d);let e=bV(a,["customMetadata"]);if(void 0!==b&&null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["customMetadata"],a)}let f=bV(a,["chunkingConfig"]);return void 0!==b&&null!=f&&bU(b,["chunkingConfig"],f),{}}let dz="x-goog-api-client",dA=new Set(["us","eu"]),dB=[408,429,500,502,503,504];class dC{constructor(a){var b,c,d;this.clientOptions=Object.assign({},a),this.customBaseUrl=null==(b=a.httpOptions)?void 0:b.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));const e={};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.");const b=a.project&&a.location||!!a.apiKey;this.customBaseUrl&&!b?(e.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0):this.clientOptions.apiKey||"global"===this.clientOptions.location?e.baseUrl="https://aiplatform.googleapis.com/":this.clientOptions.project&&this.clientOptions.location&&dA.has(this.clientOptions.location)?e.baseUrl=`https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`:this.clientOptions.project&&this.clientOptions.location&&(e.baseUrl=`https://${this.clientOptions.location}-aiplatform.googleapis.com/`),e.apiVersion=null!=(c=this.clientOptions.apiVersion)?c:"v1beta1"}else this.clientOptions.apiKey||console.warn("API key should be set when using the Gemini API."),e.apiVersion=null!=(d=this.clientOptions.apiVersion)?d:"v1beta",e.baseUrl="https://generativelanguage.googleapis.com/";e.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=e,a.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(e,a.httpOptions))}isVertexAI(){var a;return null!=(a=this.clientOptions.vertexai)&&a}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getCustomBaseUrl(){return this.customBaseUrl}async getAuthHeaders(){let a=new Headers;return await this.clientOptions.auth.addAuthHeaders(a),a}getApiVersion(){if(this.clientOptions.httpOptions&&void 0!==this.clientOptions.httpOptions.apiVersion)return this.clientOptions.httpOptions.apiVersion;throw Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&void 0!==this.clientOptions.httpOptions.baseUrl)return this.clientOptions.httpOptions.baseUrl;throw Error("Base URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&void 0!==this.clientOptions.httpOptions.headers)return this.clientOptions.httpOptions.headers;throw Error("Headers are not set.")}getRequestUrlInternal(a){if(!a||void 0===a.baseUrl||void 0===a.apiVersion)throw Error("HTTP options are not correctly set.");let b=[a.baseUrl.endsWith("/")?a.baseUrl.slice(0,-1):a.baseUrl];return a.apiVersion&&""!==a.apiVersion&&b.push(a.apiVersion),b.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){let a=new URL(this.getBaseUrl());return a.protocol="http:"==a.protocol?"ws":"wss",a.toString()}setBaseUrl(a){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=a;else throw Error("HTTP options are not correctly set.")}constructUrl(a,b,c){let d=[this.getRequestUrlInternal(b)];return c&&d.push(this.getBaseResourcePath()),""!==a&&d.push(a),new URL(`${d.join("/")}`)}shouldPrependVertexProjectPath(a,b){return!(b.baseUrl&&b.baseUrlResourceScope===bd.COLLECTION||this.clientOptions.apiKey||!this.clientOptions.vertexai||a.path.startsWith("projects/")||"GET"===a.httpMethod&&a.path.startsWith("publishers/google/models"))}async request(a){let b=this.clientOptions.httpOptions;a.httpOptions&&(b=this.patchHttpOptions(this.clientOptions.httpOptions,a.httpOptions));let c=this.shouldPrependVertexProjectPath(a,b),d=this.constructUrl(a.path,b,c);if(a.queryParams)for(let[b,c]of Object.entries(a.queryParams))d.searchParams.append(b,String(c));let e={};if("GET"===a.httpMethod){if(a.body&&"{}"!==a.body)throw Error("Request body should be empty for GET request, but got non empty request body")}else e.body=a.body;return e=await this.includeExtraHttpOptionsToRequestInit(e,b,d.toString(),a.abortSignal),this.unaryApiCall(d,e,a.httpMethod)}patchHttpOptions(a,b){let c=JSON.parse(JSON.stringify(a));for(let[a,d]of Object.entries(b))"object"==typeof d?c[a]=Object.assign(Object.assign({},c[a]),d):void 0!==d&&(c[a]=d);return c}async requestStream(a){let b=this.clientOptions.httpOptions;a.httpOptions&&(b=this.patchHttpOptions(this.clientOptions.httpOptions,a.httpOptions));let c=this.shouldPrependVertexProjectPath(a,b),d=this.constructUrl(a.path,b,c);d.searchParams.has("alt")&&"sse"===d.searchParams.get("alt")||d.searchParams.set("alt","sse");let e={};return e.body=a.body,e=await this.includeExtraHttpOptionsToRequestInit(e,b,d.toString(),a.abortSignal),this.streamApiCall(d,e,a.httpMethod)}async includeExtraHttpOptionsToRequestInit(a,b,c,d){if(b&&b.timeout||d){let c=new AbortController,e=c.signal;if(b.timeout&&(null==b?void 0:b.timeout)>0){let a=Symbol.for("undici.globalDispatcher.1"),d=globalThis[a];if(d)for(let a of Object.getOwnPropertySymbols(d)){let c=a.description;if((null==c?void 0:c.includes("headers timeout"))||(null==c?void 0:c.includes("body timeout"))){let c=d[a];"number"==typeof c&&(d[a]=Math.max(c,b.timeout))}}let e=setTimeout(()=>c.abort(),b.timeout);e&&"function"==typeof e.unref&&e.unref()}d&&d.addEventListener("abort",()=>{c.abort()}),a.signal=e}return b&&null!==b.extraBody&&function(a,b){if(!b||0===Object.keys(b).length)return;if(a.body instanceof Blob)return console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");let c={};if("string"==typeof a.body&&a.body.length>0)try{let b=JSON.parse(a.body);if("object"!=typeof b||null===b||Array.isArray(b))return void console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying extraBody to the request body.");c=b}catch(a){console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}a.body=JSON.stringify(function a(b,c){let d=Object.assign({},b);for(let b in c)if(Object.prototype.hasOwnProperty.call(c,b)){let e=c[b],f=d[b];e&&"object"==typeof e&&!Array.isArray(e)&&f&&"object"==typeof f&&!Array.isArray(f)?d[b]=a(f,e):(f&&e&&typeof f!=typeof e&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${b}". Original type: ${typeof f}, New type: ${typeof e}. Overwriting.`),d[b]=e)}return d}(c,b))}(a,b.extraBody),a.headers=await this.getHeadersInternal(b,c),a}async unaryApiCall(a,b,c){return this.apiCall(a.toString(),Object.assign(Object.assign({},b),{method:c})).then(async a=>(await dD(a),new b_(a))).catch(a=>{if(a instanceof Error)throw a;throw Error(`exception ${a} sending request`,{cause:a})})}async streamApiCall(a,b,c){return this.apiCall(a.toString(),Object.assign(Object.assign({},b),{method:c})).then(async a=>(await dD(a),this.processStreamResponse(a))).catch(a=>{if(a instanceof Error)throw a;throw Error(`exception ${a} sending request`,{cause:a})})}processStreamResponse(a){return c6(this,arguments,function*(){var b;let c=null==(b=null==a?void 0:a.body)?void 0:b.getReader(),d=new TextDecoder("utf-8");if(!c)throw Error("Response body is empty");try{let b="",e="data:",f=["\n\n","\r\r","\r\n\r\n"];for(;;){let{done:g,value:h}=yield c5(c.read());if(g){if(b.trim().length>0)throw Error("Incomplete JSON segment at the end");break}let i=d.decode(h,{stream:!0});try{let a=JSON.parse(i);if("error"in a){let b=JSON.parse(JSON.stringify(a.error)),c=b.status,d=b.code,e=`got status: ${c}. ${JSON.stringify(a)}`;if(d>=400&&d<600)throw new dc({message:e,status:d})}}catch(a){if("ApiError"===a.name)throw a}b+=i;let j=-1,k=0;for(;;){for(let a of(j=-1,k=0,f)){let c=b.indexOf(a);-1!==c&&(-1===j||c<j)&&(j=c,k=a.length)}if(-1===j)break;let c=b.substring(0,j);b=b.substring(j+k);let d=c.trim();if(d.startsWith(e)){let b=d.substring(e.length).trim();try{let c=new Response(b,{headers:null==a?void 0:a.headers,status:null==a?void 0:a.status,statusText:null==a?void 0:a.statusText});yield yield c5(new b_(c))}catch(a){throw Error(`exception parsing stream chunk ${b}. ${a}`)}}}}}finally{c.releaseLock()}})}async apiCall(a,b){var c;if(!this.clientOptions.httpOptions||!this.clientOptions.httpOptions.retryOptions)return fetch(a,b);let d=this.clientOptions.httpOptions.retryOptions,e=async()=>{let c=await fetch(a,b);if(c.ok)return c;if(dB.includes(c.status))throw Error(`Retryable HTTP Error: ${c.statusText}`);throw new bK.AbortError(`Non-retryable exception ${c.statusText} sending request`)};return bK(e,{retries:(null!=(c=d.attempts)?c:5)-1})}getDefaultHeaders(){let a={},b="google-genai-sdk/2.10.0 "+this.clientOptions.userAgentExtra;return a["User-Agent"]=b,a[dz]=b,a["Content-Type"]="application/json",a}async getHeadersInternal(a,b){let c=new Headers;if(a&&a.headers)for(let[b,d]of Object.entries(a.headers))c.append(b,d);return(null==a?void 0:a.timeout)&&a.timeout>0&&c.append("X-Server-Timeout",String(Math.ceil(a.timeout/1e3))),await this.clientOptions.auth.addAuthHeaders(c,b),c}getFileName(a){var b;let c="";return"string"==typeof a&&(c=null!=(b=(c=a.replace(/[/\\]+$/,"")).split(/[/\\]/).pop())?b:""),c}async uploadFile(a,b){var c;let d={};null!=b&&(d.mimeType=b.mimeType,d.name=b.name,d.displayName=b.displayName),d.name&&!d.name.startsWith("files/")&&(d.name=`files/${d.name}`);let e=this.clientOptions.uploader,f=await e.stat(a);d.sizeBytes=String(f.size);let g=null!=(c=null==b?void 0:b.mimeType)?c:f.type;if(void 0===g||""===g)throw Error("Can not determine mimeType. Please provide mimeType in the config.");d.mimeType=g;let h={file:d},i=this.getFileName(a),j=bT("upload/v1beta/files",h._url),k=await this.fetchUploadUrl(j,d.sizeBytes,d.mimeType,i,h,null==b?void 0:b.httpOptions);return e.upload(a,k,this)}async uploadFileToFileSearchStore(a,b,c){var d;let e=this.clientOptions.uploader,f=await e.stat(b),g=String(f.size),h=null!=(d=null==c?void 0:c.mimeType)?d:f.type;if(void 0===h||""===h)throw Error("Can not determine mimeType. Please provide mimeType in the config.");let i=`upload/v1beta/${a}:uploadToFileSearchStore`,j=this.getFileName(b),k={};null!=c&&dy(c,k);let l=await this.fetchUploadUrl(i,g,h,j,k,null==c?void 0:c.httpOptions);return e.uploadToFileSearchStore(b,l,this)}async downloadFile(a){let b=this.clientOptions.downloader;await b.download(a,this)}async fetchUploadUrl(a,b,c,d,e,f){var g;let h={};h=f||{apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${b}`,"X-Goog-Upload-Header-Content-Type":`${c}`},d?{"X-Goog-Upload-File-Name":d}:{})};let i=await this.request({path:a,body:JSON.stringify(e),httpMethod:"POST",httpOptions:h});if(!i||!(null==i?void 0:i.headers))throw Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");let j=null==(g=null==i?void 0:i.headers)?void 0:g["x-goog-upload-url"];if(void 0===j)throw Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return j}}async function dD(a){var b;if(void 0===a)throw Error("response is undefined");if(!a.ok){let c=a.status,d=JSON.stringify((null==(b=a.headers.get("content-type"))?void 0:b.includes("application/json"))?await a.json():{error:{message:await a.text(),code:a.status,status:a.statusText}});if(c>=400&&c<600)throw new dc({message:d,status:c});throw Error(d)}}function dE(a){for(let c of a){var b;if(null!==(b=c)&&"object"==typeof b&&b instanceof dG||"object"==typeof c&&"inputSchema"in c)return!0}return!1}function dF(a){var b;let c=null!=(b=a[dz])?b:"";a[dz]=(c+" mcp_used/unknown").trimStart()}class dG{constructor(a=[],b){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=a,this.config=b}static create(a,b){return new dG(a,b)}async initialize(){var a,b,c,d;if(this.mcpTools.length>0)return;let e={},f=[];for(let j of this.mcpClients)try{for(var g,h=!0,i=(b=void 0,c7(function(a){return c6(this,arguments,function*(a,b=100){let c,d=0;for(;d<b;){let b=yield c5(a.listTools({cursor:c}));for(let a of b.tools)yield yield c5(a),d++;if(!b.nextCursor)break;c=b.nextCursor}})}(j)));!(a=(g=await i.next()).done);h=!0){d=g.value,h=!1,f.push(d);let a=d.name;if(e[a])throw Error(`Duplicate function name ${a} found in MCP tools. Please ensure function names are unique.`);e[a]=j}}catch(a){b={error:a}}finally{try{!h&&!a&&(c=i.return)&&await c.call(i)}finally{if(b)throw b.error}}this.mcpTools=f,this.functionNameToMcpClient=e}async tool(){return await this.initialize(),function(a,b={}){let c=[],d=new Set;for(let e of a){let a=e.name;if(d.has(a))throw Error(`Duplicate function name ${a} found in MCP tools. Please ensure function names are unique.`);d.add(a);let f=function(a,b={}){let c={name:a.name,description:a.description,parametersJsonSchema:a.inputSchema};return a.outputSchema&&(c.responseJsonSchema=a.outputSchema),b.behavior&&(c.behavior=b.behavior),{functionDeclarations:[c]}}(e,b);f.functionDeclarations&&c.push(...f.functionDeclarations)}return{functionDeclarations:c}}(this.mcpTools,this.config)}async callTool(a){await this.initialize();let b=[];for(let c of a)if(c.name in this.functionNameToMcpClient){let a,d=this.functionNameToMcpClient[c.name];this.config.timeout&&(a={timeout:this.config.timeout});let e=await d.callTool({name:c.name,arguments:c.args},void 0,a);b.push({functionResponse:{name:c.name,response:e.isError?{error:e}:e}})}return b}}async function dH(a,b,c){let d=new cr;Object.assign(d,c.data instanceof Blob?JSON.parse(await c.data.text()):JSON.parse(c.data)),b(d)}class dI{constructor(a,b,c){this.apiClient=a,this.auth=b,this.webSocketFactory=c}async connect(a){var b,c;let d;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 e=this.apiClient.getWebsocketBaseUrl(),f=this.apiClient.getApiVersion(),g=function(a){let b=new Headers;for(let[c,d]of Object.entries(a))b.append(c,d);return b}(this.apiClient.getDefaultHeaders()),h=this.apiClient.getApiKey(),i=`${e}/ws/google.ai.generativelanguage.${f}.GenerativeService.BidiGenerateMusic?key=${h}`,j=()=>{},k=new Promise(a=>{j=a}),l=a.callbacks,m=this.apiClient,n={onopen:function(){j({})},onmessage:a=>{dH(m,l.onmessage,a)},onerror:null!=(b=null==l?void 0:l.onerror)?b:function(a){},onclose:null!=(c=null==l?void 0:l.onclose)?c:function(a){}},o=this.webSocketFactory.create(i,(d={},g.forEach((a,b)=>{d[b]=a}),d),n);o.connect(),await k;let p=ct(this.apiClient,a.model);return o.send(JSON.stringify({setup:{model:p}})),new dJ(o,this.apiClient)}}class dJ{constructor(a,b){this.conn=a,this.apiClient=b}async setWeightedPrompts(a){if(!a.weightedPrompts||0===Object.keys(a.weightedPrompts).length)throw Error("Weighted prompts must be set and contain at least one entry.");let b=function(a){let b={},c=bV(a,["weightedPrompts"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["weightedPrompts"],a)}return b}(a);this.conn.send(JSON.stringify({clientContent:b}))}async setMusicGenerationConfig(a){let b,c;a.musicGenerationConfig||(a.musicGenerationConfig={});let d=(b={},null!=(c=bV(a,["musicGenerationConfig"]))&&bU(b,["musicGenerationConfig"],c),b);this.conn.send(JSON.stringify(d))}sendPlaybackControl(a){this.conn.send(JSON.stringify({playbackControl:a}))}play(){this.sendPlaybackControl(bG.PLAY)}pause(){this.sendPlaybackControl(bG.PAUSE)}stop(){this.sendPlaybackControl(bG.STOP)}resetContext(){this.sendPlaybackControl(bG.RESET_CONTEXT)}close(){this.conn.close()}}async function dK(a,b,c){let d=new cq,e=JSON.parse(c.data instanceof Blob?await c.data.text():c.data instanceof ArrayBuffer?new TextDecoder().decode(c.data):c.data);if(a.isVertexAI()){var f;let a,b,c,g,h,i,j,k,l,m,n,o,p;Object.assign(d,(a={},null!=(b=bV(e,["setupComplete"]))&&bU(a,["setupComplete"],b),null!=(c=bV(e,["serverContent"]))&&bU(a,["serverContent"],c),null!=(g=bV(e,["toolCall"]))&&bU(a,["toolCall"],g),null!=(h=bV(e,["toolCallCancellation"]))&&bU(a,["toolCallCancellation"],h),null!=(i=bV(e,["usageMetadata"]))&&bU(a,["usageMetadata"],function(a){let b={},c=bV(a,["promptTokenCount"]);null!=c&&bU(b,["promptTokenCount"],c);let d=bV(a,["cachedContentTokenCount"]);null!=d&&bU(b,["cachedContentTokenCount"],d);let e=bV(a,["candidatesTokenCount"]);null!=e&&bU(b,["responseTokenCount"],e);let f=bV(a,["toolUsePromptTokenCount"]);null!=f&&bU(b,["toolUsePromptTokenCount"],f);let g=bV(a,["thoughtsTokenCount"]);null!=g&&bU(b,["thoughtsTokenCount"],g);let h=bV(a,["totalTokenCount"]);null!=h&&bU(b,["totalTokenCount"],h);let i=bV(a,["promptTokensDetails"]);if(null!=i){let a=i;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["promptTokensDetails"],a)}let j=bV(a,["cacheTokensDetails"]);if(null!=j){let a=j;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["cacheTokensDetails"],a)}let k=bV(a,["candidatesTokensDetails"]);if(null!=k){let a=k;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["responseTokensDetails"],a)}let l=bV(a,["toolUsePromptTokensDetails"]);if(null!=l){let a=l;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["toolUsePromptTokensDetails"],a)}let m=bV(a,["trafficType"]);return null!=m&&bU(b,["trafficType"],m),b}(i)),null!=(j=bV(e,["goAway"]))&&bU(a,["goAway"],j),null!=(k=bV(e,["sessionResumptionUpdate"]))&&bU(a,["sessionResumptionUpdate"],k),null!=(l=bV(e,["voiceActivityDetectionSignal"]))&&bU(a,["voiceActivityDetectionSignal"],l),null!=(m=bV(e,["voiceActivity"]))&&bU(a,["voiceActivity"],(n={},null!=(o=bV(f=m,["type"]))&&bU(n,["voiceActivityType"],o),null!=(p=bV(f,["audioOffset"]))&&bU(n,["audioOffset"],p),n)),a))}else Object.assign(d,e);b(d)}class dL{constructor(a,b,c){this.apiClient=a,this.auth=b,this.webSocketFactory=c,this.music=new dI(this.apiClient,this.auth,this.webSocketFactory)}async connect(a){var b,c,d,e,f,g,h,i;let j,k;if(a.config&&a.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 l=this.apiClient.getWebsocketBaseUrl(),m=this.apiClient.getApiVersion(),n=this.apiClient.getHeaders();a.config&&a.config.tools&&dE(a.config.tools)&&dF(n);let o=function(a){let b=new Headers;for(let[c,d]of Object.entries(a))b.append(c,d);return b}(n);if(this.apiClient.isVertexAI()){let a=this.apiClient.getProject(),b=this.apiClient.getLocation(),c=this.apiClient.getApiKey();this.apiClient.getCustomBaseUrl()&&!(a&&b||c)?j=l:(j=`${l}/ws/google.cloud.aiplatform.${m}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(o,j))}else{let a=this.apiClient.getApiKey(),b="BidiGenerateContent",c="key";(null==a?void 0:a.startsWith("auth_tokens/"))&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),"v1alpha"!==m&&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."),b="BidiGenerateContentConstrained",c="access_token"),j=`${l}/ws/google.ai.generativelanguage.${m}.GenerativeService.${b}?${c}=${a}`}let p=()=>{},q=new Promise(a=>{p=a}),r=a.callbacks,s=this.apiClient,t={onopen:function(){var a;null==(a=null==r?void 0:r.onopen)||a.call(r),p({})},onmessage:a=>{dK(s,r.onmessage,a)},onerror:null!=(b=null==r?void 0:r.onerror)?b:function(a){},onclose:null!=(c=null==r?void 0:r.onclose)?c:function(a){}},u=this.webSocketFactory.create(j,(k={},o.forEach((a,b)=>{k[b]=a}),k),t);u.connect(),await q;let v=ct(this.apiClient,a.model);if(this.apiClient.isVertexAI()&&v.startsWith("publishers/")){let a=this.apiClient.getProject(),b=this.apiClient.getLocation();a&&b&&(v=`projects/${a}/locations/${b}/`+v)}let w={};this.apiClient.isVertexAI()&&(null==(d=a.config)?void 0:d.responseModalities)===void 0&&(void 0===a.config?a.config={responseModalities:[a_.AUDIO]}:a.config.responseModalities=[a_.AUDIO]),(null==(e=a.config)?void 0:e.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 x=null!=(g=null==(f=a.config)?void 0:f.tools)?g:[],y=[];for(let a of x)this.isCallableTool(a)?y.push(await a.tool()):y.push(a);y.length>0&&(a.config.tools=y);let z={model:v,config:a.config,callbacks:a.callbacks};if(this.apiClient.isVertexAI()){let a,b,c;h=this.apiClient,a={},null!=(b=bV(z,["model"]))&&bU(a,["setup","model"],ct(h,b)),null!=(c=bV(z,["config"]))&&bU(a,["config"],function(a,b){let c=bV(a,["generationConfig"]);void 0!==b&&null!=c&&bU(b,["setup","generationConfig"],function(a){let b={},c=bV(a,["modelSelectionConfig"]);null!=c&&bU(b,["modelConfig"],c);let d=bV(a,["responseJsonSchema"]);null!=d&&bU(b,["responseJsonSchema"],d);let e=bV(a,["audioTimestamp"]);null!=e&&bU(b,["audioTimestamp"],e);let f=bV(a,["candidateCount"]);null!=f&&bU(b,["candidateCount"],f);let g=bV(a,["enableAffectiveDialog"]);null!=g&&bU(b,["enableAffectiveDialog"],g);let h=bV(a,["frequencyPenalty"]);null!=h&&bU(b,["frequencyPenalty"],h);let i=bV(a,["logprobs"]);null!=i&&bU(b,["logprobs"],i);let j=bV(a,["maxOutputTokens"]);null!=j&&bU(b,["maxOutputTokens"],j);let k=bV(a,["mediaResolution"]);null!=k&&bU(b,["mediaResolution"],k);let l=bV(a,["presencePenalty"]);null!=l&&bU(b,["presencePenalty"],l);let m=bV(a,["responseLogprobs"]);null!=m&&bU(b,["responseLogprobs"],m);let n=bV(a,["responseMimeType"]);null!=n&&bU(b,["responseMimeType"],n);let o=bV(a,["responseModalities"]);null!=o&&bU(b,["responseModalities"],o);let p=bV(a,["responseSchema"]);null!=p&&bU(b,["responseSchema"],p);let q=bV(a,["routingConfig"]);null!=q&&bU(b,["routingConfig"],q);let r=bV(a,["seed"]);null!=r&&bU(b,["seed"],r);let s=bV(a,["speechConfig"]);null!=s&&bU(b,["speechConfig"],s);let t=bV(a,["stopSequences"]);null!=t&&bU(b,["stopSequences"],t);let u=bV(a,["temperature"]);null!=u&&bU(b,["temperature"],u);let v=bV(a,["thinkingConfig"]);null!=v&&bU(b,["thinkingConfig"],v);let w=bV(a,["topK"]);null!=w&&bU(b,["topK"],w);let x=bV(a,["topP"]);if(null!=x&&bU(b,["topP"],x),void 0!==bV(a,["enableEnhancedCivicAnswers"]))throw Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(c));let d=bV(a,["responseModalities"]);void 0!==b&&null!=d&&bU(b,["setup","generationConfig","responseModalities"],d);let e=bV(a,["temperature"]);void 0!==b&&null!=e&&bU(b,["setup","generationConfig","temperature"],e);let f=bV(a,["topP"]);void 0!==b&&null!=f&&bU(b,["setup","generationConfig","topP"],f);let g=bV(a,["topK"]);void 0!==b&&null!=g&&bU(b,["setup","generationConfig","topK"],g);let h=bV(a,["maxOutputTokens"]);void 0!==b&&null!=h&&bU(b,["setup","generationConfig","maxOutputTokens"],h);let i=bV(a,["mediaResolution"]);void 0!==b&&null!=i&&bU(b,["setup","generationConfig","mediaResolution"],i);let j=bV(a,["seed"]);void 0!==b&&null!=j&&bU(b,["setup","generationConfig","seed"],j);let k=bV(a,["speechConfig"]);void 0!==b&&null!=k&&bU(b,["setup","generationConfig","speechConfig"],cJ(k));let l=bV(a,["thinkingConfig"]);void 0!==b&&null!=l&&bU(b,["setup","generationConfig","thinkingConfig"],l);let m=bV(a,["enableAffectiveDialog"]);void 0!==b&&null!=m&&bU(b,["setup","generationConfig","enableAffectiveDialog"],m);let n=bV(a,["systemInstruction"]);void 0!==b&&null!=n&&bU(b,["setup","systemInstruction"],function(a){let b={},c=bV(a,["parts"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["mediaResolution"]);null!=c&&bU(b,["mediaResolution"],c);let d=bV(a,["codeExecutionResult"]);null!=d&&bU(b,["codeExecutionResult"],function(a){let b={},c=bV(a,["outcome"]);null!=c&&bU(b,["outcome"],c);let d=bV(a,["output"]);if(null!=d&&bU(b,["output"],d),void 0!==bV(a,["id"]))throw Error("id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(d));let e=bV(a,["executableCode"]);null!=e&&bU(b,["executableCode"],function(a){let b={},c=bV(a,["code"]);null!=c&&bU(b,["code"],c);let d=bV(a,["language"]);if(null!=d&&bU(b,["language"],d),void 0!==bV(a,["id"]))throw Error("id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(e));let f=bV(a,["fileData"]);null!=f&&bU(b,["fileData"],f);let g=bV(a,["functionCall"]);null!=g&&bU(b,["functionCall"],g);let h=bV(a,["functionResponse"]);null!=h&&bU(b,["functionResponse"],h);let i=bV(a,["inlineData"]);null!=i&&bU(b,["inlineData"],i);let j=bV(a,["text"]);null!=j&&bU(b,["text"],j);let k=bV(a,["thought"]);null!=k&&bU(b,["thought"],k);let l=bV(a,["thoughtSignature"]);null!=l&&bU(b,["thoughtSignature"],l);let m=bV(a,["videoMetadata"]);if(null!=m&&bU(b,["videoMetadata"],m),void 0!==bV(a,["toolCall"]))throw Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["toolResponse"]))throw Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["partMetadata"]))throw Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b})(a))),bU(b,["parts"],a)}let d=bV(a,["role"]);return null!=d&&bU(b,["role"],d),b}(cE(n)));let o=bV(a,["tools"]);if(void 0!==b&&null!=o){let a=cL(o);Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["retrieval"]);null!=c&&bU(b,["retrieval"],c);let d=bV(a,["computerUse"]);if(null!=d&&bU(b,["computerUse"],function(a){let b={},c=bV(a,["environment"]);null!=c&&bU(b,["environment"],c);let d=bV(a,["excludedPredefinedFunctions"]);null!=d&&bU(b,["excludedPredefinedFunctions"],d);let e=bV(a,["enablePromptInjectionDetection"]);if(null!=e&&bU(b,["enablePromptInjectionDetection"],e),void 0!==bV(a,["disabledSafetyPolicies"]))throw Error("disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(d)),void 0!==bV(a,["fileSearch"]))throw Error("fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let e=bV(a,["googleSearch"]);null!=e&&bU(b,["googleSearch"],e);let f=bV(a,["googleMaps"]);null!=f&&bU(b,["googleMaps"],f);let g=bV(a,["codeExecution"]);null!=g&&bU(b,["codeExecution"],g);let h=bV(a,["enterpriseWebSearch"]);null!=h&&bU(b,["enterpriseWebSearch"],h);let i=bV(a,["functionDeclarations"]);if(null!=i){let a=i;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["functionDeclarations"],a)}let j=bV(a,["googleSearchRetrieval"]);null!=j&&bU(b,["googleSearchRetrieval"],j);let k=bV(a,["parallelAiSearch"]);null!=k&&bU(b,["parallelAiSearch"],k);let l=bV(a,["urlContext"]);null!=l&&bU(b,["urlContext"],l);let m=bV(a,["mcpServers"]);if(null!=m){let a=m;Array.isArray(a)&&(a=a.map(a=>(function(a){if(void 0!==bV(a,["name"]))throw Error("name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["streamableHttpTransport"]))throw Error("streamableHttpTransport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return{}})(a))),bU(b,["mcpServers"],a)}return b})(cK(a)))),bU(b,["setup","tools"],a)}let p=bV(a,["sessionResumption"]);void 0!==b&&null!=p&&bU(b,["setup","sessionResumption"],p);let q=bV(a,["inputAudioTranscription"]);void 0!==b&&null!=q&&bU(b,["setup","inputAudioTranscription"],q);let r=bV(a,["outputAudioTranscription"]);void 0!==b&&null!=r&&bU(b,["setup","outputAudioTranscription"],r);let s=bV(a,["realtimeInputConfig"]);void 0!==b&&null!=s&&bU(b,["setup","realtimeInputConfig"],s);let t=bV(a,["contextWindowCompression"]);void 0!==b&&null!=t&&bU(b,["setup","contextWindowCompression"],t);let u=bV(a,["proactivity"]);void 0!==b&&null!=u&&bU(b,["setup","proactivity"],u);let v=bV(a,["explicitVadSignal"]);void 0!==b&&null!=v&&bU(b,["setup","explicitVadSignal"],v);let w=bV(a,["avatarConfig"]);void 0!==b&&null!=w&&bU(b,["setup","avatarConfig"],w);let x=bV(a,["safetySettings"]);if(void 0!==b&&null!=x){let a=x;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["setup","safetySettings"],a)}if(void 0!==bV(a,["translationConfig"]))throw Error("translationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return{}}(c,a)),w=a}else{let a,b,c;i=this.apiClient,a={},null!=(b=bV(z,["model"]))&&bU(a,["setup","model"],ct(i,b)),null!=(c=bV(z,["config"]))&&bU(a,["config"],function(a,b){let c=bV(a,["generationConfig"]);void 0!==b&&null!=c&&bU(b,["setup","generationConfig"],c);let d=bV(a,["responseModalities"]);void 0!==b&&null!=d&&bU(b,["setup","generationConfig","responseModalities"],d);let e=bV(a,["temperature"]);void 0!==b&&null!=e&&bU(b,["setup","generationConfig","temperature"],e);let f=bV(a,["topP"]);void 0!==b&&null!=f&&bU(b,["setup","generationConfig","topP"],f);let g=bV(a,["topK"]);void 0!==b&&null!=g&&bU(b,["setup","generationConfig","topK"],g);let h=bV(a,["maxOutputTokens"]);void 0!==b&&null!=h&&bU(b,["setup","generationConfig","maxOutputTokens"],h);let i=bV(a,["mediaResolution"]);void 0!==b&&null!=i&&bU(b,["setup","generationConfig","mediaResolution"],i);let j=bV(a,["seed"]);void 0!==b&&null!=j&&bU(b,["setup","generationConfig","seed"],j);let k=bV(a,["speechConfig"]);void 0!==b&&null!=k&&bU(b,["setup","generationConfig","speechConfig"],cJ(k));let l=bV(a,["thinkingConfig"]);void 0!==b&&null!=l&&bU(b,["setup","generationConfig","thinkingConfig"],l);let m=bV(a,["enableAffectiveDialog"]);void 0!==b&&null!=m&&bU(b,["setup","generationConfig","enableAffectiveDialog"],m);let n=bV(a,["systemInstruction"]);void 0!==b&&null!=n&&bU(b,["setup","systemInstruction"],function(a){let b={},c=bV(a,["parts"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;return c={},null!=(d=bV(b=a,["mediaResolution"]))&&bU(c,["mediaResolution"],d),null!=(e=bV(b,["codeExecutionResult"]))&&bU(c,["codeExecutionResult"],e),null!=(f=bV(b,["executableCode"]))&&bU(c,["executableCode"],f),null!=(g=bV(b,["fileData"]))&&bU(c,["fileData"],function(a){let b={};if(void 0!==bV(a,["displayName"]))throw Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=bV(a,["fileUri"]);null!=c&&bU(b,["fileUri"],c);let d=bV(a,["mimeType"]);return null!=d&&bU(b,["mimeType"],d),b}(g)),null!=(h=bV(b,["functionCall"]))&&bU(c,["functionCall"],function(a){let b={},c=bV(a,["id"]);null!=c&&bU(b,["id"],c);let d=bV(a,["args"]);null!=d&&bU(b,["args"],d);let e=bV(a,["name"]);if(null!=e&&bU(b,["name"],e),void 0!==bV(a,["partialArgs"]))throw Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["willContinue"]))throw Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(h)),null!=(i=bV(b,["functionResponse"]))&&bU(c,["functionResponse"],i),null!=(j=bV(b,["inlineData"]))&&bU(c,["inlineData"],df(j)),null!=(k=bV(b,["text"]))&&bU(c,["text"],k),null!=(l=bV(b,["thought"]))&&bU(c,["thought"],l),null!=(m=bV(b,["thoughtSignature"]))&&bU(c,["thoughtSignature"],m),null!=(n=bV(b,["videoMetadata"]))&&bU(c,["videoMetadata"],n),null!=(o=bV(b,["toolCall"]))&&bU(c,["toolCall"],o),null!=(p=bV(b,["toolResponse"]))&&bU(c,["toolResponse"],p),null!=(q=bV(b,["partMetadata"]))&&bU(c,["partMetadata"],q),c})),bU(b,["parts"],a)}let d=bV(a,["role"]);return null!=d&&bU(b,["role"],d),b}(cE(n)));let o=bV(a,["tools"]);if(void 0!==b&&null!=o){let a=cL(o);Array.isArray(a)&&(a=a.map(a=>(function(a){let b,c,d,e={};if(void 0!==bV(a,["retrieval"]))throw Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let f=bV(a,["computerUse"]);null!=f&&bU(e,["computerUse"],f);let g=bV(a,["fileSearch"]);null!=g&&bU(e,["fileSearch"],g);let h=bV(a,["googleSearch"]);null!=h&&bU(e,["googleSearch"],function(a){let b={},c=bV(a,["searchTypes"]);if(null!=c&&bU(b,["searchTypes"],c),void 0!==bV(a,["blockingConfidence"]))throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["excludeDomains"]))throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["timeRangeFilter"]);return null!=d&&bU(b,["timeRangeFilter"],d),b}(h));let i=bV(a,["googleMaps"]);null!=i&&bU(e,["googleMaps"],(b={},null!=(c=bV(i,["authConfig"]))&&bU(b,["authConfig"],function(a){let b={},c=bV(a,["apiKey"]);if(null!=c&&bU(b,["apiKey"],c),void 0!==bV(a,["apiKeyConfig"]))throw Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["authType"]))throw Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["googleServiceAccountConfig"]))throw Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["httpBasicAuthConfig"]))throw Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["oauthConfig"]))throw Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["oidcConfig"]))throw Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(c)),null!=(d=bV(i,["enableWidget"]))&&bU(b,["enableWidget"],d),b));let j=bV(a,["codeExecution"]);if(null!=j&&bU(e,["codeExecution"],j),void 0!==bV(a,["enterpriseWebSearch"]))throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let k=bV(a,["functionDeclarations"]);if(null!=k){let a=k;Array.isArray(a)&&(a=a.map(a=>a)),bU(e,["functionDeclarations"],a)}let l=bV(a,["googleSearchRetrieval"]);if(null!=l&&bU(e,["googleSearchRetrieval"],l),void 0!==bV(a,["parallelAiSearch"]))throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let m=bV(a,["urlContext"]);null!=m&&bU(e,["urlContext"],m);let n=bV(a,["mcpServers"]);if(null!=n){let a=n;Array.isArray(a)&&(a=a.map(a=>a)),bU(e,["mcpServers"],a)}return e})(cK(a)))),bU(b,["setup","tools"],a)}let p=bV(a,["sessionResumption"]);void 0!==b&&null!=p&&bU(b,["setup","sessionResumption"],function(a){let b={},c=bV(a,["handle"]);if(null!=c&&bU(b,["handle"],c),void 0!==bV(a,["transparent"]))throw Error("transparent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(p));let q=bV(a,["inputAudioTranscription"]);void 0!==b&&null!=q&&bU(b,["setup","inputAudioTranscription"],de(q));let r=bV(a,["outputAudioTranscription"]);void 0!==b&&null!=r&&bU(b,["setup","outputAudioTranscription"],de(r));let s=bV(a,["realtimeInputConfig"]);void 0!==b&&null!=s&&bU(b,["setup","realtimeInputConfig"],s);let t=bV(a,["contextWindowCompression"]);void 0!==b&&null!=t&&bU(b,["setup","contextWindowCompression"],t);let u=bV(a,["proactivity"]);if(void 0!==b&&null!=u&&bU(b,["setup","proactivity"],u),void 0!==bV(a,["explicitVadSignal"]))throw Error("explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let v=bV(a,["avatarConfig"]);void 0!==b&&null!=v&&bU(b,["setup","avatarConfig"],v);let w=bV(a,["safetySettings"]);if(void 0!==b&&null!=w){let a=w;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["category"]);if(null!=c&&bU(b,["category"],c),void 0!==bV(a,["method"]))throw Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["threshold"]);return null!=d&&bU(b,["threshold"],d),b})(a))),bU(b,["setup","safetySettings"],a)}let x=bV(a,["translationConfig"]);return void 0!==b&&null!=x&&bU(b,["setup","generationConfig","translationConfig"],x),{}}(c,a)),w=a}return delete w.config,u.send(JSON.stringify(w)),new dN(u,this.apiClient)}isCallableTool(a){return"callTool"in a&&"function"==typeof a.callTool}}let dM={turnComplete:!0};class dN{constructor(a,b){this.conn=a,this.apiClient=b}tLiveClientContent(a,b){if(null!==b.turns&&void 0!==b.turns){let c=[];try{c=cG(b.turns),a.isVertexAI()||(c=c.map(a=>dg(a)))}catch(a){throw Error(`Failed to parse client content "turns", type: '${typeof b.turns}'`)}return{clientContent:{turns:c,turnComplete:b.turnComplete}}}return{clientContent:{turnComplete:b.turnComplete}}}tLiveClienttToolResponse(a,b){let c=[];if(null==b.functionResponses||0===(c=Array.isArray(b.functionResponses)?b.functionResponses:[b.functionResponses]).length)throw Error("functionResponses is required.");for(let b of c){if("object"!=typeof b||null===b||!("name"in b)||!("response"in b))throw Error(`Could not parse function response, type '${typeof b}'.`);if(!a.isVertexAI()&&!("id"in b))throw Error("FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.")}return{toolResponse:{functionResponses:c}}}sendClientContent(a){a=Object.assign(Object.assign({},dM),a);let b=this.tLiveClientContent(this.apiClient,a);this.conn.send(JSON.stringify(b))}sendRealtimeInput(a){let b={};b=this.apiClient.isVertexAI()?{realtimeInput:function(a){let b={},c=bV(a,["media"]);if(null!=c){let a=cv(c);Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["mediaChunks"],a)}let d=bV(a,["audio"]);null!=d&&bU(b,["audio"],cy(d));let e=bV(a,["audioStreamEnd"]);null!=e&&bU(b,["audioStreamEnd"],e);let f=bV(a,["video"]);null!=f&&bU(b,["video"],cx(f));let g=bV(a,["text"]);null!=g&&bU(b,["text"],g);let h=bV(a,["activityStart"]);null!=h&&bU(b,["activityStart"],h);let i=bV(a,["activityEnd"]);return null!=i&&bU(b,["activityEnd"],i),b}(a)}:{realtimeInput:function(a){let b={},c=bV(a,["media"]);if(null!=c){let a=cv(c);Array.isArray(a)&&(a=a.map(a=>df(a))),bU(b,["mediaChunks"],a)}let d=bV(a,["audio"]);null!=d&&bU(b,["audio"],df(cy(d)));let e=bV(a,["audioStreamEnd"]);null!=e&&bU(b,["audioStreamEnd"],e);let f=bV(a,["video"]);null!=f&&bU(b,["video"],df(cx(f)));let g=bV(a,["text"]);null!=g&&bU(b,["text"],g);let h=bV(a,["activityStart"]);null!=h&&bU(b,["activityStart"],h);let i=bV(a,["activityEnd"]);return null!=i&&bU(b,["activityEnd"],i),b}(a)},this.conn.send(JSON.stringify(b))}sendToolResponse(a){if(null==a.functionResponses)throw Error("Tool response parameters are required.");let b=this.tLiveClienttToolResponse(this.apiClient,a);this.conn.send(JSON.stringify(b))}close(){this.conn.close()}}function dO(a){var b,c,d;if(null==(b=null==a?void 0:a.automaticFunctionCalling)?void 0:b.disable)return!0;let e=!1;for(let b of null!=(c=null==a?void 0:a.tools)?c:[])if(dP(b)){e=!0;break}if(!e)return!0;let f=null==(d=null==a?void 0:a.automaticFunctionCalling)?void 0:d.maximumRemoteCalls;return(!(!f||!(f<0)&&Number.isInteger(f))||0==f)&&(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:",f),!0)}function dP(a){return"callTool"in a&&"function"==typeof a.callTool}function dQ(a){var b;let c=[];return(null==(b=null==a?void 0:a.config)?void 0:b.tools)&&a.config.tools.forEach((a,b)=>{dP(a)||a.functionDeclarations&&a.functionDeclarations.length>0&&c.push(b)}),c}function dR(a){var b;return!(null==(b=null==a?void 0:a.automaticFunctionCalling)?void 0:b.ignoreCallHistory)}class dS extends bS{constructor(a){super(),this.apiClient=a,this.embedContent=async a=>{if(!this.apiClient.isVertexAI())return a.model.includes("gemini-embedding-2")&&(a.contents=cG(a.contents)),await this.embedContentInternal(a);if(a.model.includes("gemini")&&"gemini-embedding-001"!==a.model||a.model.includes("maas")){let b=cG(a.contents);if(b.length>1)throw Error("The embedContent API for this model only supports one content at a time.");let c=Object.assign(Object.assign({},a),{content:b[0],embeddingApiType:bf.EMBED_CONTENT});return await this.embedContentInternal(c)}{let b=Object.assign(Object.assign({},a),{embeddingApiType:bf.PREDICT});return await this.embedContentInternal(b)}},this.generateContent=async a=>{var b,c,d,e,f,g,h,i;let j,k,l=await this.processParamsMaybeAddMcpUsage(a);if(this.maybeMoveToResponseJsonSchema(a),!(null!=(i=null==(h=null==(g=a.config)?void 0:g.tools)?void 0:h.some(a=>dP(a)))&&i)||dO(a.config))return await this.generateContentInternal(l);let m=dQ(a);if(m.length>0){let a=m.map(a=>`tools[${a}]`).join(", ");throw Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${a}.`)}let n=cG(l.contents),o=null!=(d=null==(c=null==(b=l.config)?void 0:b.automaticFunctionCalling)?void 0:c.maximumRemoteCalls)?d:10,p=0;for(;p<o&&(j=await this.generateContentInternal(l)).functionCalls&&0!==j.functionCalls.length;){let b=j.candidates[0].content,c=[];for(let b of null!=(f=null==(e=a.config)?void 0:e.tools)?f:[])if(dP(b)){let a=await b.callTool(j.functionCalls);c.push(...a)}p++,k={role:"user",parts:c},l.contents=cG(l.contents),l.contents.push(b),l.contents.push(k),dR(l.config)&&(n.push(b),n.push(k))}return dR(l.config)&&(j.automaticFunctionCallingHistory=n),j},this.generateContentStream=async a=>{var b,c,d,e,f;if(this.maybeMoveToResponseJsonSchema(a),dO(a.config)){let b=await this.processParamsMaybeAddMcpUsage(a);return await this.generateContentStreamInternal(b)}let g=dQ(a);if(g.length>0){let a=g.map(a=>`tools[${a}]`).join(", ");throw Error(`Incompatible tools found at ${a}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}let h=null==(d=null==(c=null==(b=null==a?void 0:a.config)?void 0:b.toolConfig)?void 0:c.functionCallingConfig)?void 0:d.streamFunctionCallArguments,i=null==(f=null==(e=null==a?void 0:a.config)?void 0:e.automaticFunctionCalling)?void 0:f.disable;if(h&&!i)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(a)},this.generateImages=async a=>await this.generateImagesInternal(a).then(a=>{var b;let c,d=[];if(null==a?void 0:a.generatedImages)for(let e of a.generatedImages)e&&(null==e?void 0:e.safetyAttributes)&&(null==(b=null==e?void 0:e.safetyAttributes)?void 0:b.contentType)==="Positive Prompt"?c=null==e?void 0:e.safetyAttributes:d.push(e);return c?{generatedImages:d,positivePromptSafetyAttributes:c,sdkHttpResponse:a.sdkHttpResponse}:{generatedImages:d,sdkHttpResponse:a.sdkHttpResponse}}),this.list=async a=>{var b;let c={config:Object.assign(Object.assign({},{queryBase:!0}),null==a?void 0:a.config)};if(this.apiClient.isVertexAI()&&!c.config.queryBase)if(null==(b=c.config)?void 0:b.filter)throw Error("Filtering tuned models list is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");else c.config.filter="labels.tune-type:*";return new c_(bH.PAGED_ITEM_MODELS,a=>this.listInternal(a),await this.listInternal(c),c)},this.editImage=async a=>{let b={model:a.model,prompt:a.prompt,referenceImages:[],config:a.config};return a.referenceImages&&a.referenceImages&&(b.referenceImages=a.referenceImages.map(a=>a.toReferenceImageAPI())),await this.editImageInternal(b)},this.upscaleImage=async a=>{let b={numberOfImages:1,mode:"upscale"};a.config&&(b=Object.assign(Object.assign({},b),a.config));let c={model:a.model,image:a.image,upscaleFactor:a.upscaleFactor,config:b};return await this.upscaleImageInternal(c)},this.generateVideos=async a=>{var b,c,d,e,f,g;if((a.prompt||a.image||a.video)&&a.source)throw Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return!this.apiClient.isVertexAI()&&((null==(b=a.video)?void 0:b.uri)&&(null==(c=a.video)?void 0:c.videoBytes)?a.video={uri:a.video.uri,mimeType:a.video.mimeType}:(null==(e=null==(d=a.source)?void 0:d.video)?void 0:e.uri)&&(null==(g=null==(f=a.source)?void 0:f.video)?void 0:g.videoBytes)&&(a.source.video={uri:a.source.video.uri,mimeType:a.source.video.mimeType})),await this.generateVideosInternal(a)}}maybeMoveToResponseJsonSchema(a){a.config&&a.config.responseSchema&&!a.config.responseJsonSchema&&Object.keys(a.config.responseSchema).includes("$schema")&&(a.config.responseJsonSchema=a.config.responseSchema,delete a.config.responseSchema)}async processParamsMaybeAddMcpUsage(a){var b,c,d;let e=null==(b=a.config)?void 0:b.tools;if(!e)return a;let f=await Promise.all(e.map(async a=>dP(a)?await a.tool():a)),g={model:a.model,contents:a.contents,config:Object.assign(Object.assign({},a.config),{tools:f})};if(g.config.tools=f,a.config&&a.config.tools&&dE(a.config.tools)){let b=Object.assign({},null!=(d=null==(c=a.config.httpOptions)?void 0:c.headers)?d:{});0===Object.keys(b).length&&(b=this.apiClient.getDefaultHeaders()),dF(b),g.config.httpOptions=Object.assign(Object.assign({},a.config.httpOptions),{headers:b})}return g}async initAfcToolsMap(a){var b,c,d;let e=new Map;for(let f of null!=(c=null==(b=a.config)?void 0:b.tools)?c:[])if(dP(f))for(let a of null!=(d=(await f.tool()).functionDeclarations)?d:[]){if(!a.name)throw Error("Function declaration name is required.");if(e.has(a.name))throw Error(`Duplicate tool declaration name: ${a.name}`);e.set(a.name,f)}return e}async processAfcStream(a){var b,c,d;let e=null!=(d=null==(c=null==(b=a.config)?void 0:b.automaticFunctionCalling)?void 0:c.maximumRemoteCalls)?d:10,f=!1,g=0;return function(a,b,c){return c6(this,arguments,function*(){for(;g<e;){f&&(g++,f=!1);let p=yield c5(a.processParamsMaybeAddMcpUsage(c)),q=yield c5(a.generateContentStreamInternal(p)),r=[],s=[];try{for(var d,h,i,j,k,l,m,n=!0,o=(h=void 0,c7(q));!(d=(m=yield c5(o.next())).done);n=!0)if(j=m.value,n=!1,yield yield c5(j),j.candidates&&(null==(k=j.candidates[0])?void 0:k.content)){for(let a of(s.push(j.candidates[0].content),null!=(l=j.candidates[0].content.parts)?l:[]))if(g<e&&a.functionCall){if(!a.functionCall.name)throw Error("Function call name was not returned by the model.");if(b.has(a.functionCall.name)){let c=yield c5(b.get(a.functionCall.name).callTool([a.functionCall]));r.push(...c)}else throw Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${b.keys()}, missing tool: ${a.functionCall.name}`)}}}catch(a){h={error:a}}finally{try{!n&&!d&&(i=o.return)&&(yield c5(i.call(o)))}finally{if(h)throw h.error}}if(r.length>0){f=!0;let a=new b0;a.candidates=[{content:{role:"user",parts:r}}],yield yield c5(a);let b=[];b.push(...s),b.push({role:"user",parts:r});let d=cG(c.contents).concat(b);c.contents=d}else break}})}(this,await this.initAfcToolsMap(a),a)}async generateContentInternal(a){var b,c,d,e;let f="",g={};if(this.apiClient.isVertexAI()){let d=dj(this.apiClient,a);return f=bT("{model}:generateContent",d._url),g=d._query,delete d._url,delete d._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(d),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=dl(a),c=new b0;return Object.assign(c,b),c})}{let b=di(this.apiClient,a);return f=bT("{model}:generateContent",b._url),g=b._query,delete b._url,delete b._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(b),httpMethod:"POST",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=dk(a),c=new b0;return Object.assign(c,b),c})}}async generateContentStreamInternal(a){var b,c,d,e;let f="",g={};if(this.apiClient.isVertexAI()){let d=dj(this.apiClient,a);return f=bT("{model}:streamGenerateContent?alt=sse",d._url),g=d._query,delete d._url,delete d._query,this.apiClient.requestStream({path:f,queryParams:g,body:JSON.stringify(d),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(function(b){return c6(this,arguments,function*(){var c,d,e,f;try{for(var g,h=!0,i=c7(b);!(c=(g=yield c5(i.next())).done);h=!0){f=g.value,h=!1;let b=dl((yield c5(f.json())),a);b.sdkHttpResponse={headers:f.headers};let c=new b0;Object.assign(c,b),yield yield c5(c)}}catch(a){d={error:a}}finally{try{!h&&!c&&(e=i.return)&&(yield c5(e.call(i)))}finally{if(d)throw d.error}}})})}{let b=di(this.apiClient,a);return f=bT("{model}:streamGenerateContent?alt=sse",b._url),g=b._query,delete b._url,delete b._query,this.apiClient.requestStream({path:f,queryParams:g,body:JSON.stringify(b),httpMethod:"POST",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(function(b){return c6(this,arguments,function*(){var c,d,e,f;try{for(var g,h=!0,i=c7(b);!(c=(g=yield c5(i.next())).done);h=!0){f=g.value,h=!1;let b=dk((yield c5(f.json())),a);b.sdkHttpResponse={headers:f.headers};let c=new b0;Object.assign(c,b),yield yield c5(c)}}catch(a){d={error:a}}finally{try{!h&&!c&&(e=i.return)&&(yield c5(e.call(i)))}finally{if(d)throw d.error}}})})}}async embedContentInternal(a){var b,c,d,e,f;let g="",h={};if(this.apiClient.isVertexAI()){let d=function(a,b,c){let d={},e=bV(b,["model"]);null!=e&&bU(d,["_url","model"],ct(a,e));let f=bV(c,["embeddingApiType"]);if(void 0===f&&(f="PREDICT"),"PREDICT"===f){let c=bV(b,["contents"]);if(null!=c){let b=cF(a,c);Array.isArray(b)&&(b=b.map(a=>a)),bU(d,["instances[]","content"],b)}}let g=bV(c,["embeddingApiType"]);if(void 0===g&&(g="PREDICT"),"EMBED_CONTENT"===g){let a=bV(b,["content"]);null!=a&&bU(d,["content"],dh(cE(a)))}let h=bV(b,["config"]);return null!=h&&function(a,b,c){let d=bV(c,["embeddingApiType"]);if(void 0===d&&(d="PREDICT"),"PREDICT"===d){let c=bV(a,["taskType"]);void 0!==b&&null!=c&&bU(b,["instances[]","task_type"],c)}else if("EMBED_CONTENT"===d){let c=bV(a,["taskType"]);void 0!==b&&null!=c&&bU(b,["embedContentConfig","taskType"],c)}let e=bV(c,["embeddingApiType"]);if(void 0===e&&(e="PREDICT"),"PREDICT"===e){let c=bV(a,["title"]);void 0!==b&&null!=c&&bU(b,["instances[]","title"],c)}else if("EMBED_CONTENT"===e){let c=bV(a,["title"]);void 0!==b&&null!=c&&bU(b,["embedContentConfig","title"],c)}let f=bV(c,["embeddingApiType"]);if(void 0===f&&(f="PREDICT"),"PREDICT"===f){let c=bV(a,["outputDimensionality"]);void 0!==b&&null!=c&&bU(b,["parameters","outputDimensionality"],c)}else if("EMBED_CONTENT"===f){let c=bV(a,["outputDimensionality"]);void 0!==b&&null!=c&&bU(b,["embedContentConfig","outputDimensionality"],c)}let g=bV(c,["embeddingApiType"]);if(void 0===g&&(g="PREDICT"),"PREDICT"===g){let c=bV(a,["mimeType"]);void 0!==b&&null!=c&&bU(b,["instances[]","mimeType"],c)}let h=bV(c,["embeddingApiType"]);if(void 0===h&&(h="PREDICT"),"PREDICT"===h){let c=bV(a,["autoTruncate"]);void 0!==b&&null!=c&&bU(b,["parameters","autoTruncate"],c)}else if("EMBED_CONTENT"===h){let c=bV(a,["autoTruncate"]);void 0!==b&&null!=c&&bU(b,["embedContentConfig","autoTruncate"],c)}let i=bV(c,["embeddingApiType"]);if(void 0===i&&(i="PREDICT"),"EMBED_CONTENT"===i){let c=bV(a,["documentOcr"]);void 0!==b&&null!=c&&bU(b,["embedContentConfig","documentOcr"],c)}let j=bV(c,["embeddingApiType"]);if(void 0===j&&(j="PREDICT"),"EMBED_CONTENT"===j){let c=bV(a,["audioTrackExtraction"]);void 0!==b&&null!=c&&bU(b,["embedContentConfig","audioTrackExtraction"],c)}}(h,d,c),d}(this.apiClient,a,a);return g=bT((f=a.model).includes("gemini")&&"gemini-embedding-001"!==f||f.includes("maas")?"{model}:embedContent":"{model}:predict",d._url),h=d._query,delete d._url,delete d._query,this.apiClient.request({path:g,queryParams:h,body:JSON.stringify(d),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(b=>{let c=function(a,b){let c={},d=bV(a,["sdkHttpResponse"]);null!=d&&bU(c,["sdkHttpResponse"],d);let e=bV(a,["predictions[]","embeddings"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f,g,h;return c={},null!=(d=bV(a,["values"]))&&bU(c,["values"],d),null!=(e=bV(a,["statistics"]))&&bU(c,["statistics"],(f={},null!=(g=bV(b=e,["truncated"]))&&bU(f,["truncated"],g),null!=(h=bV(b,["token_count"]))&&bU(f,["tokenCount"],h),f)),c})),bU(c,["embeddings"],a)}let f=bV(a,["metadata"]);if(null!=f&&bU(c,["metadata"],f),b&&"EMBED_CONTENT"===bV(b,["embeddingApiType"])){let b=bV(a,["embedding"]),d=bV(a,["usageMetadata"]),e=bV(a,["truncated"]);if(b){let a={};d&&d.promptTokenCount&&(a.tokenCount=d.promptTokenCount),e&&(a.truncated=e),b.statistics=a,bU(c,["embeddings"],[b])}}return c}(b,a),d=new b1;return Object.assign(d,c),d})}{let b=function(a,b){let c={},d=bV(b,["model"]);null!=d&&bU(c,["_url","model"],ct(a,d));let e=bV(b,["contents"]);if(null!=e){let b=cF(a,e);Array.isArray(b)&&(b=b.map(a=>a)),bU(c,["requests[]","content"],b)}let f=bV(b,["content"]);null!=f&&dg(cE(f));let g=bV(b,["config"]);null!=g&&function(a,b){let c=bV(a,["taskType"]);void 0!==b&&null!=c&&bU(b,["requests[]","taskType"],c);let d=bV(a,["title"]);void 0!==b&&null!=d&&bU(b,["requests[]","title"],d);let e=bV(a,["outputDimensionality"]);if(void 0!==b&&null!=e&&bU(b,["requests[]","outputDimensionality"],e),void 0!==bV(a,["mimeType"]))throw Error("mimeType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["autoTruncate"]))throw Error("autoTruncate parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["documentOcr"]))throw Error("documentOcr parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["audioTrackExtraction"]))throw Error("audioTrackExtraction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.")}(g,c);let h=bV(b,["model"]);return void 0!==h&&bU(c,["requests[]","model"],ct(a,h)),c}(this.apiClient,a);return g=bT("{model}:batchEmbedContents",b._url),h=b._query,delete b._url,delete b._query,this.apiClient.request({path:g,queryParams:h,body:JSON.stringify(b),httpMethod:"POST",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["embeddings"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["embeddings"],a)}let e=bV(a,["metadata"]);return null!=e&&bU(b,["metadata"],e),b}(a),c=new b1;return Object.assign(c,b),c})}}async generateImagesInternal(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=(f=this.apiClient,d={},null!=(e=bV(a,["model"]))&&bU(d,["_url","model"],ct(f,e)),null!=(g=bV(a,["prompt"]))&&bU(d,["instances[0]","prompt"],g),null!=(j=bV(a,["config"]))&&(k=bV(j,["outputGcsUri"]),void 0!==d&&null!=k&&bU(d,["parameters","storageUri"],k),l=bV(j,["negativePrompt"]),void 0!==d&&null!=l&&bU(d,["parameters","negativePrompt"],l),m=bV(j,["numberOfImages"]),void 0!==d&&null!=m&&bU(d,["parameters","sampleCount"],m),n=bV(j,["aspectRatio"]),void 0!==d&&null!=n&&bU(d,["parameters","aspectRatio"],n),o=bV(j,["guidanceScale"]),void 0!==d&&null!=o&&bU(d,["parameters","guidanceScale"],o),p=bV(j,["seed"]),void 0!==d&&null!=p&&bU(d,["parameters","seed"],p),q=bV(j,["safetyFilterLevel"]),void 0!==d&&null!=q&&bU(d,["parameters","safetySetting"],q),r=bV(j,["personGeneration"]),void 0!==d&&null!=r&&bU(d,["parameters","personGeneration"],r),s=bV(j,["includeSafetyAttributes"]),void 0!==d&&null!=s&&bU(d,["parameters","includeSafetyAttributes"],s),t=bV(j,["includeRaiReason"]),void 0!==d&&null!=t&&bU(d,["parameters","includeRaiReason"],t),u=bV(j,["language"]),void 0!==d&&null!=u&&bU(d,["parameters","language"],u),v=bV(j,["outputMimeType"]),void 0!==d&&null!=v&&bU(d,["parameters","outputOptions","mimeType"],v),w=bV(j,["outputCompressionQuality"]),void 0!==d&&null!=w&&bU(d,["parameters","outputOptions","compressionQuality"],w),x=bV(j,["addWatermark"]),void 0!==d&&null!=x&&bU(d,["parameters","addWatermark"],x),y=bV(j,["labels"]),void 0!==d&&null!=y&&bU(d,["labels"],y),z=bV(j,["imageSize"]),void 0!==d&&null!=z&&bU(d,["parameters","sampleImageSize"],z),A=bV(j,["enhancePrompt"]),void 0!==d&&null!=A&&bU(d,["parameters","enhancePrompt"],A)),d);return h=bT("{model}:predict",B._url),i=B._query,delete B._url,delete B._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(B),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["predictions"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>dm(a))),bU(b,["generatedImages"],a)}let e=bV(a,["positivePromptSafetyAttributes"]);return null!=e&&bU(b,["positivePromptSafetyAttributes"],du(e)),b}(a),c=new b2;return Object.assign(c,b),c})}{let b,c,f,j,k=(g=this.apiClient,b={},null!=(c=bV(a,["model"]))&&bU(b,["_url","model"],ct(g,c)),null!=(f=bV(a,["prompt"]))&&bU(b,["instances[0]","prompt"],f),null!=(j=bV(a,["config"]))&&function(a,b){if(void 0!==bV(a,["outputGcsUri"]))throw Error("outputGcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["negativePrompt"]))throw Error("negativePrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=bV(a,["numberOfImages"]);void 0!==b&&null!=c&&bU(b,["parameters","sampleCount"],c);let d=bV(a,["aspectRatio"]);void 0!==b&&null!=d&&bU(b,["parameters","aspectRatio"],d);let e=bV(a,["guidanceScale"]);if(void 0!==b&&null!=e&&bU(b,["parameters","guidanceScale"],e),void 0!==bV(a,["seed"]))throw Error("seed parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let f=bV(a,["safetyFilterLevel"]);void 0!==b&&null!=f&&bU(b,["parameters","safetySetting"],f);let g=bV(a,["personGeneration"]);void 0!==b&&null!=g&&bU(b,["parameters","personGeneration"],g);let h=bV(a,["includeSafetyAttributes"]);void 0!==b&&null!=h&&bU(b,["parameters","includeSafetyAttributes"],h);let i=bV(a,["includeRaiReason"]);void 0!==b&&null!=i&&bU(b,["parameters","includeRaiReason"],i);let j=bV(a,["language"]);void 0!==b&&null!=j&&bU(b,["parameters","language"],j);let k=bV(a,["outputMimeType"]);void 0!==b&&null!=k&&bU(b,["parameters","outputOptions","mimeType"],k);let l=bV(a,["outputCompressionQuality"]);if(void 0!==b&&null!=l&&bU(b,["parameters","outputOptions","compressionQuality"],l),void 0!==bV(a,["addWatermark"]))throw Error("addWatermark parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["labels"]))throw Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let m=bV(a,["imageSize"]);if(void 0!==b&&null!=m&&bU(b,["parameters","sampleImageSize"],m),void 0!==bV(a,["enhancePrompt"]))throw Error("enhancePrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.")}(j,b),b);return h=bT("{model}:predict",k._url),i=k._query,delete k._url,delete k._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(k),httpMethod:"POST",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["predictions"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>{var b,c;let d,e,f,g,h,i,j;return d={},null!=(e=bV(b=a,["_self"]))&&bU(d,["image"],(f={},null!=(g=bV(c=e,["bytesBase64Encoded"]))&&bU(f,["imageBytes"],bW(g)),null!=(h=bV(c,["mimeType"]))&&bU(f,["mimeType"],h),f)),null!=(i=bV(b,["raiFilteredReason"]))&&bU(d,["raiFilteredReason"],i),null!=(j=bV(b,["_self"]))&&bU(d,["safetyAttributes"],dt(j)),d})),bU(b,["generatedImages"],a)}let e=bV(a,["positivePromptSafetyAttributes"]);return null!=e&&bU(b,["positivePromptSafetyAttributes"],dt(e)),b}(a),c=new b2;return Object.assign(c,b),c})}}async editImageInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI()){let f=function(a,b){let c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t={},u=bV(b,["model"]);null!=u&&bU(t,["_url","model"],ct(a,u));let v=bV(b,["prompt"]);null!=v&&bU(t,["instances[0]","prompt"],v);let w=bV(b,["referenceImages"]);if(null!=w){let a=w;Array.isArray(a)&&(a=a.map(a=>(function(a){let b,c,d,e,f,g,h,i={},j=bV(a,["referenceImage"]);null!=j&&bU(i,["referenceImage"],dq(j));let k=bV(a,["referenceId"]);null!=k&&bU(i,["referenceId"],k);let l=bV(a,["referenceType"]);null!=l&&bU(i,["referenceType"],l);let m=bV(a,["maskImageConfig"]);null!=m&&bU(i,["maskImageConfig"],(b={},null!=(c=bV(m,["maskMode"]))&&bU(b,["maskMode"],c),null!=(d=bV(m,["segmentationClasses"]))&&bU(b,["maskClasses"],d),null!=(e=bV(m,["maskDilation"]))&&bU(b,["dilation"],e),b));let n=bV(a,["controlImageConfig"]);null!=n&&bU(i,["controlImageConfig"],(f={},null!=(g=bV(n,["controlType"]))&&bU(f,["controlType"],g),null!=(h=bV(n,["enableControlImageComputation"]))&&bU(f,["computeControl"],h),f));let o=bV(a,["styleImageConfig"]);null!=o&&bU(i,["styleImageConfig"],o);let p=bV(a,["subjectImageConfig"]);return null!=p&&bU(i,["subjectImageConfig"],p),i})(a))),bU(t,["instances[0]","referenceImages"],a)}let x=bV(b,["config"]);return null!=x&&(c=bV(x,["outputGcsUri"]),void 0!==t&&null!=c&&bU(t,["parameters","storageUri"],c),d=bV(x,["negativePrompt"]),void 0!==t&&null!=d&&bU(t,["parameters","negativePrompt"],d),e=bV(x,["numberOfImages"]),void 0!==t&&null!=e&&bU(t,["parameters","sampleCount"],e),f=bV(x,["aspectRatio"]),void 0!==t&&null!=f&&bU(t,["parameters","aspectRatio"],f),g=bV(x,["guidanceScale"]),void 0!==t&&null!=g&&bU(t,["parameters","guidanceScale"],g),h=bV(x,["seed"]),void 0!==t&&null!=h&&bU(t,["parameters","seed"],h),i=bV(x,["safetyFilterLevel"]),void 0!==t&&null!=i&&bU(t,["parameters","safetySetting"],i),j=bV(x,["personGeneration"]),void 0!==t&&null!=j&&bU(t,["parameters","personGeneration"],j),k=bV(x,["includeSafetyAttributes"]),void 0!==t&&null!=k&&bU(t,["parameters","includeSafetyAttributes"],k),l=bV(x,["includeRaiReason"]),void 0!==t&&null!=l&&bU(t,["parameters","includeRaiReason"],l),m=bV(x,["language"]),void 0!==t&&null!=m&&bU(t,["parameters","language"],m),n=bV(x,["outputMimeType"]),void 0!==t&&null!=n&&bU(t,["parameters","outputOptions","mimeType"],n),o=bV(x,["outputCompressionQuality"]),void 0!==t&&null!=o&&bU(t,["parameters","outputOptions","compressionQuality"],o),p=bV(x,["addWatermark"]),void 0!==t&&null!=p&&bU(t,["parameters","addWatermark"],p),q=bV(x,["labels"]),void 0!==t&&null!=q&&bU(t,["labels"],q),r=bV(x,["editMode"]),void 0!==t&&null!=r&&bU(t,["parameters","editMode"],r),s=bV(x,["baseSteps"]),void 0!==t&&null!=s&&bU(t,["parameters","editConfig","baseSteps"],s)),t}(this.apiClient,a);return d=bT("{model}:predict",f._url),e=f._query,delete f._url,delete f._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(f),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["predictions"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>dm(a))),bU(b,["generatedImages"],a)}return b}(a),c=new b3;return Object.assign(c,b),c})}throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async upscaleImageInternal(a){var b,c,d;let e="",f={};if(this.apiClient.isVertexAI()){let g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w=(d=this.apiClient,g={},null!=(h=bV(a,["model"]))&&bU(g,["_url","model"],ct(d,h)),null!=(i=bV(a,["image"]))&&bU(g,["instances[0]","image"],dq(i)),null!=(j=bV(a,["upscaleFactor"]))&&bU(g,["parameters","upscaleConfig","upscaleFactor"],j),null!=(k=bV(a,["config"]))&&(l=bV(k,["outputGcsUri"]),void 0!==g&&null!=l&&bU(g,["parameters","storageUri"],l),m=bV(k,["safetyFilterLevel"]),void 0!==g&&null!=m&&bU(g,["parameters","safetySetting"],m),n=bV(k,["personGeneration"]),void 0!==g&&null!=n&&bU(g,["parameters","personGeneration"],n),o=bV(k,["includeRaiReason"]),void 0!==g&&null!=o&&bU(g,["parameters","includeRaiReason"],o),p=bV(k,["outputMimeType"]),void 0!==g&&null!=p&&bU(g,["parameters","outputOptions","mimeType"],p),q=bV(k,["outputCompressionQuality"]),void 0!==g&&null!=q&&bU(g,["parameters","outputOptions","compressionQuality"],q),r=bV(k,["enhanceInputImage"]),void 0!==g&&null!=r&&bU(g,["parameters","upscaleConfig","enhanceInputImage"],r),s=bV(k,["imagePreservationFactor"]),void 0!==g&&null!=s&&bU(g,["parameters","upscaleConfig","imagePreservationFactor"],s),t=bV(k,["labels"]),void 0!==g&&null!=t&&bU(g,["labels"],t),u=bV(k,["numberOfImages"]),void 0!==g&&null!=u&&bU(g,["parameters","sampleCount"],u),v=bV(k,["mode"]),void 0!==g&&null!=v&&bU(g,["parameters","mode"],v)),g);return e=bT("{model}:predict",w._url),f=w._query,delete w._url,delete w._query,this.apiClient.request({path:e,queryParams:f,body:JSON.stringify(w),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["predictions"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>dm(a))),bU(b,["generatedImages"],a)}return b}(a),c=new b4;return Object.assign(c,b),c})}throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async recontextImage(a){var b,c,d;let e="",f={};if(this.apiClient.isVertexAI()){let g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=(d=this.apiClient,g={},null!=(h=bV(a,["model"]))&&bU(g,["_url","model"],ct(d,h)),null!=(i=bV(a,["source"]))&&function(a,b){let c=bV(a,["prompt"]);void 0!==b&&null!=c&&bU(b,["instances[0]","prompt"],c);let d=bV(a,["personImage"]);void 0!==b&&null!=d&&bU(b,["instances[0]","personImage","image"],dq(d));let e=bV(a,["productImages"]);if(void 0!==b&&null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>{let b,c;return b={},null!=(c=bV(a,["productImage"]))&&bU(b,["image"],dq(c)),b})),bU(b,["instances[0]","productImages"],a)}}(i,g),null!=(j=bV(a,["config"]))&&(k=bV(j,["numberOfImages"]),void 0!==g&&null!=k&&bU(g,["parameters","sampleCount"],k),l=bV(j,["baseSteps"]),void 0!==g&&null!=l&&bU(g,["parameters","baseSteps"],l),m=bV(j,["outputGcsUri"]),void 0!==g&&null!=m&&bU(g,["parameters","storageUri"],m),n=bV(j,["seed"]),void 0!==g&&null!=n&&bU(g,["parameters","seed"],n),o=bV(j,["safetyFilterLevel"]),void 0!==g&&null!=o&&bU(g,["parameters","safetySetting"],o),p=bV(j,["personGeneration"]),void 0!==g&&null!=p&&bU(g,["parameters","personGeneration"],p),q=bV(j,["addWatermark"]),void 0!==g&&null!=q&&bU(g,["parameters","addWatermark"],q),r=bV(j,["outputMimeType"]),void 0!==g&&null!=r&&bU(g,["parameters","outputOptions","mimeType"],r),s=bV(j,["outputCompressionQuality"]),void 0!==g&&null!=s&&bU(g,["parameters","outputOptions","compressionQuality"],s),t=bV(j,["enhancePrompt"]),void 0!==g&&null!=t&&bU(g,["parameters","enhancePrompt"],t),u=bV(j,["labels"]),void 0!==g&&null!=u&&bU(g,["labels"],u)),g);return e=bT("{model}:predict",v._url),f=v._query,delete v._url,delete v._query,this.apiClient.request({path:e,queryParams:f,body:JSON.stringify(v),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>{let b=function(a){let b={},c=bV(a,["predictions"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>dm(a))),bU(b,["generatedImages"],a)}return b}(a),c=new b5;return Object.assign(c,b),c})}throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async segmentImage(a){var b,c,d,e,f;let g="",h={};if(this.apiClient.isVertexAI()){let i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x=(d=this.apiClient,n={},null!=(o=bV(a,["model"]))&&bU(n,["_url","model"],ct(d,o)),null!=(p=bV(a,["source"]))&&(e=p,f=n,k=bV(e,["prompt"]),void 0!==f&&null!=k&&bU(f,["instances[0]","prompt"],k),l=bV(e,["image"]),void 0!==f&&null!=l&&bU(f,["instances[0]","image"],dq(l)),m=bV(e,["scribbleImage"]),void 0!==f&&null!=m&&bU(f,["instances[0]","scribble"],(i={},null!=(j=bV(m,["image"]))&&bU(i,["image"],dq(j)),i))),null!=(q=bV(a,["config"]))&&(r=bV(q,["mode"]),void 0!==n&&null!=r&&bU(n,["parameters","mode"],r),s=bV(q,["maxPredictions"]),void 0!==n&&null!=s&&bU(n,["parameters","maxPredictions"],s),t=bV(q,["confidenceThreshold"]),void 0!==n&&null!=t&&bU(n,["parameters","confidenceThreshold"],t),u=bV(q,["maskDilation"]),void 0!==n&&null!=u&&bU(n,["parameters","maskDilation"],u),v=bV(q,["binaryColorThreshold"]),void 0!==n&&null!=v&&bU(n,["parameters","binaryColorThreshold"],v),w=bV(q,["labels"]),void 0!==n&&null!=w&&bU(n,["labels"],w)),n);return g=bT("{model}:predict",x._url),h=x._query,delete x._url,delete x._query,this.apiClient.request({path:g,queryParams:h,body:JSON.stringify(x),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>{let b=function(a){let b={},c=bV(a,["predictions"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["_self"]);null!=c&&bU(b,["mask"],dn(c));let d=bV(a,["labels"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["labels"],a)}return b})(a))),bU(b,["generatedMasks"],a)}return b}(a),c=new b6;return Object.assign(c,b),c})}throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async get(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g=(f=this.apiClient,d={},null!=(e=bV(a,["model"]))&&bU(d,["_url","name"],ct(f,e)),d);return h=bT("{name}",g._url),i=g._query,delete g._url,delete g._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(g),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>ds(a))}{let b,c,f=(g=this.apiClient,b={},null!=(c=bV(a,["model"]))&&bU(b,["_url","name"],ct(g,c)),b);return h=bT("{name}",f._url),i=f._query,delete f._url,delete f._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(f),httpMethod:"GET",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json()).then(a=>dr(a))}}async listInternal(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g,j,k,l,m=(f=this.apiClient,d={},null!=(e=bV(a,["config"]))&&(g=bV(e,["pageSize"]),void 0!==d&&null!=g&&bU(d,["_query","pageSize"],g),j=bV(e,["pageToken"]),void 0!==d&&null!=j&&bU(d,["_query","pageToken"],j),k=bV(e,["filter"]),void 0!==d&&null!=k&&bU(d,["_query","filter"],k),l=bV(e,["queryBase"]),void 0!==d&&null!=l&&bU(d,["_url","models_url"],cR(f,l))),d);return h=bT("{models_url}",m._url),i=m._query,delete m._url,delete m._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(m),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["nextPageToken"]);null!=d&&bU(b,["nextPageToken"],d);let e=bV(a,["_self"]);if(null!=e){let a=cS(e);Array.isArray(a)&&(a=a.map(a=>ds(a))),bU(b,["models"],a)}return b}(a),c=new b7;return Object.assign(c,b),c})}{let b,c,f,j,k,l,m=(g=this.apiClient,b={},null!=(c=bV(a,["config"]))&&(f=bV(c,["pageSize"]),void 0!==b&&null!=f&&bU(b,["_query","pageSize"],f),j=bV(c,["pageToken"]),void 0!==b&&null!=j&&bU(b,["_query","pageToken"],j),k=bV(c,["filter"]),void 0!==b&&null!=k&&bU(b,["_query","filter"],k),l=bV(c,["queryBase"]),void 0!==b&&null!=l&&bU(b,["_url","models_url"],cR(g,l))),b);return h=bT("{models_url}",m._url),i=m._query,delete m._url,delete m._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(m),httpMethod:"GET",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["nextPageToken"]);null!=d&&bU(b,["nextPageToken"],d);let e=bV(a,["_self"]);if(null!=e){let a=cS(e);Array.isArray(a)&&(a=a.map(a=>dr(a))),bU(b,["models"],a)}return b}(a),c=new b7;return Object.assign(c,b),c})}}async update(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g,j,k,l,m=(f=this.apiClient,d={},null!=(e=bV(a,["model"]))&&bU(d,["_url","model"],ct(f,e)),null!=(g=bV(a,["config"]))&&(j=bV(g,["displayName"]),void 0!==d&&null!=j&&bU(d,["displayName"],j),k=bV(g,["description"]),void 0!==d&&null!=k&&bU(d,["description"],k),l=bV(g,["defaultCheckpointId"]),void 0!==d&&null!=l&&bU(d,["defaultCheckpointId"],l)),d);return h=bT("{model}",m._url),i=m._query,delete m._url,delete m._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(m),httpMethod:"PATCH",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>ds(a))}{let b,c,f,j,k,l,m=(g=this.apiClient,b={},null!=(c=bV(a,["model"]))&&bU(b,["_url","name"],ct(g,c)),null!=(f=bV(a,["config"]))&&(j=bV(f,["displayName"]),void 0!==b&&null!=j&&bU(b,["displayName"],j),k=bV(f,["description"]),void 0!==b&&null!=k&&bU(b,["description"],k),l=bV(f,["defaultCheckpointId"]),void 0!==b&&null!=l&&bU(b,["defaultCheckpointId"],l)),b);return h=bT("{name}",m._url),i=m._query,delete m._url,delete m._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(m),httpMethod:"PATCH",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json()).then(a=>dr(a))}}async delete(a){var b,c,d,e,f,g;let h="",i={};if(this.apiClient.isVertexAI()){let d,e,g=(f=this.apiClient,d={},null!=(e=bV(a,["model"]))&&bU(d,["_url","name"],ct(f,e)),d);return h=bT("{name}",g._url),i=g._query,delete g._url,delete g._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(g),httpMethod:"DELETE",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),b),e=new b8;return Object.assign(e,d),e})}{let b,c,f=(g=this.apiClient,b={},null!=(c=bV(a,["model"]))&&bU(b,["_url","name"],ct(g,c)),b);return h=bT("{name}",f._url),i=f._query,delete f._url,delete f._query,this.apiClient.request({path:h,queryParams:i,body:JSON.stringify(f),httpMethod:"DELETE",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),b),e=new b8;return Object.assign(e,d),e})}}async countTokens(a){var b,c,d,e;let f="",g={};if(this.apiClient.isVertexAI()){let d=function(a,b){let c={},d=bV(b,["model"]);null!=d&&bU(c,["_url","model"],ct(a,d));let e=bV(b,["contents"]);if(null!=e){let a=cG(e);Array.isArray(a)&&(a=a.map(a=>dh(a))),bU(c,["contents"],a)}let f=bV(b,["config"]);return null!=f&&function(a,b){let c=bV(a,["systemInstruction"]);void 0!==b&&null!=c&&bU(b,["systemInstruction"],dh(cE(c)));let d=bV(a,["tools"]);if(void 0!==b&&null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>dv(a))),bU(b,["tools"],a)}let e=bV(a,["generationConfig"]);void 0!==b&&null!=e&&bU(b,["generationConfig"],function(a){let b={},c=bV(a,["modelSelectionConfig"]);null!=c&&bU(b,["modelConfig"],c);let d=bV(a,["responseJsonSchema"]);null!=d&&bU(b,["responseJsonSchema"],d);let e=bV(a,["audioTimestamp"]);null!=e&&bU(b,["audioTimestamp"],e);let f=bV(a,["candidateCount"]);null!=f&&bU(b,["candidateCount"],f);let g=bV(a,["enableAffectiveDialog"]);null!=g&&bU(b,["enableAffectiveDialog"],g);let h=bV(a,["frequencyPenalty"]);null!=h&&bU(b,["frequencyPenalty"],h);let i=bV(a,["logprobs"]);null!=i&&bU(b,["logprobs"],i);let j=bV(a,["maxOutputTokens"]);null!=j&&bU(b,["maxOutputTokens"],j);let k=bV(a,["mediaResolution"]);null!=k&&bU(b,["mediaResolution"],k);let l=bV(a,["presencePenalty"]);null!=l&&bU(b,["presencePenalty"],l);let m=bV(a,["responseLogprobs"]);null!=m&&bU(b,["responseLogprobs"],m);let n=bV(a,["responseMimeType"]);null!=n&&bU(b,["responseMimeType"],n);let o=bV(a,["responseModalities"]);null!=o&&bU(b,["responseModalities"],o);let p=bV(a,["responseSchema"]);null!=p&&bU(b,["responseSchema"],p);let q=bV(a,["routingConfig"]);null!=q&&bU(b,["routingConfig"],q);let r=bV(a,["seed"]);null!=r&&bU(b,["seed"],r);let s=bV(a,["speechConfig"]);null!=s&&bU(b,["speechConfig"],s);let t=bV(a,["stopSequences"]);null!=t&&bU(b,["stopSequences"],t);let u=bV(a,["temperature"]);null!=u&&bU(b,["temperature"],u);let v=bV(a,["thinkingConfig"]);null!=v&&bU(b,["thinkingConfig"],v);let w=bV(a,["topK"]);null!=w&&bU(b,["topK"],w);let x=bV(a,["topP"]);if(null!=x&&bU(b,["topP"],x),void 0!==bV(a,["enableEnhancedCivicAnswers"]))throw Error("enableEnhancedCivicAnswers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(e))}(f,c),c}(this.apiClient,a);return f=bT("{model}:countTokens",d._url),g=d._query,delete d._url,delete d._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(d),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d,e=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),null!=(d=bV(a,["totalTokens"]))&&bU(b,["totalTokens"],d),b),f=new b9;return Object.assign(f,e),f})}{let b=function(a,b){let c={},d=bV(b,["model"]);null!=d&&bU(c,["_url","model"],ct(a,d));let e=bV(b,["contents"]);if(null!=e){let a=cG(e);Array.isArray(a)&&(a=a.map(a=>dg(a))),bU(c,["contents"],a)}let f=bV(b,["config"]);return null!=f&&function(a){if(void 0!==bV(a,["systemInstruction"]))throw Error("systemInstruction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["tools"]))throw Error("tools parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["generationConfig"]))throw Error("generationConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.")}(f),c}(this.apiClient,a);return f=bT("{model}:countTokens",b._url),g=b._query,delete b._url,delete b._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(b),httpMethod:"POST",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d,e,f=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),null!=(d=bV(a,["totalTokens"]))&&bU(b,["totalTokens"],d),null!=(e=bV(a,["cachedContentTokenCount"]))&&bU(b,["cachedContentTokenCount"],e),b),g=new b9;return Object.assign(g,f),g})}}async computeTokens(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI()){let f=function(a,b){let c={},d=bV(b,["model"]);null!=d&&bU(c,["_url","model"],ct(a,d));let e=bV(b,["contents"]);if(null!=e){let a=cG(e);Array.isArray(a)&&(a=a.map(a=>dh(a))),bU(c,["contents"],a)}return c}(this.apiClient,a);return d=bT("{model}:computeTokens",f._url),e=f._query,delete f._url,delete f._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(f),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["tokensInfo"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["tokensInfo"],a)}return b}(a),c=new ca;return Object.assign(c,b),c})}throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async generateVideosInternal(a){var b,c,d,e,f,g,h,i,j,k;let l="",m={};if(this.apiClient.isVertexAI()){let d,e,g,j,k,n,o,p,q,r,s=(f=this.apiClient,j={},null!=(k=bV(a,["model"]))&&bU(j,["_url","model"],ct(f,k)),null!=(n=bV(a,["prompt"]))&&bU(j,["instances[0]","prompt"],n),null!=(o=bV(a,["image"]))&&bU(j,["instances[0]","image"],dq(o)),null!=(p=bV(a,["video"]))&&bU(j,["instances[0]","video"],dx(p)),null!=(q=bV(a,["source"]))&&(h=q,i=j,d=bV(h,["prompt"]),void 0!==i&&null!=d&&bU(i,["instances[0]","prompt"],d),e=bV(h,["image"]),void 0!==i&&null!=e&&bU(i,["instances[0]","image"],dq(e)),g=bV(h,["video"]),void 0!==i&&null!=g&&bU(i,["instances[0]","video"],dx(g))),null!=(r=bV(a,["config"]))&&function(a,b){var c;let d,e,f,g=bV(a,["numberOfVideos"]);void 0!==b&&null!=g&&bU(b,["parameters","sampleCount"],g);let h=bV(a,["outputGcsUri"]);void 0!==b&&null!=h&&bU(b,["parameters","storageUri"],h);let i=bV(a,["fps"]);void 0!==b&&null!=i&&bU(b,["parameters","fps"],i);let j=bV(a,["durationSeconds"]);void 0!==b&&null!=j&&bU(b,["parameters","durationSeconds"],j);let k=bV(a,["seed"]);void 0!==b&&null!=k&&bU(b,["parameters","seed"],k);let l=bV(a,["aspectRatio"]);void 0!==b&&null!=l&&bU(b,["parameters","aspectRatio"],l);let m=bV(a,["resolution"]);void 0!==b&&null!=m&&bU(b,["parameters","resolution"],m);let n=bV(a,["personGeneration"]);void 0!==b&&null!=n&&bU(b,["parameters","personGeneration"],n);let o=bV(a,["pubsubTopic"]);void 0!==b&&null!=o&&bU(b,["parameters","pubsubTopic"],o);let p=bV(a,["negativePrompt"]);void 0!==b&&null!=p&&bU(b,["parameters","negativePrompt"],p);let q=bV(a,["enhancePrompt"]);void 0!==b&&null!=q&&bU(b,["parameters","enhancePrompt"],q);let r=bV(a,["generateAudio"]);void 0!==b&&null!=r&&bU(b,["parameters","generateAudio"],r);let s=bV(a,["lastFrame"]);void 0!==b&&null!=s&&bU(b,["instances[0]","lastFrame"],dq(s));let t=bV(a,["referenceImages"]);if(void 0!==b&&null!=t){let a=t;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e;return c={},null!=(d=bV(b=a,["image"]))&&bU(c,["image"],dq(d)),null!=(e=bV(b,["referenceType"]))&&bU(c,["referenceType"],e),c})),bU(b,["instances[0]","referenceImages"],a)}let u=bV(a,["mask"]);void 0!==b&&null!=u&&bU(b,["instances[0]","mask"],(d={},null!=(e=bV(c=u,["image"]))&&bU(d,["_self"],dq(e)),null!=(f=bV(c,["maskMode"]))&&bU(d,["maskMode"],f),d));let v=bV(a,["compressionQuality"]);void 0!==b&&null!=v&&bU(b,["parameters","compressionQuality"],v);let w=bV(a,["labels"]);if(void 0!==b&&null!=w&&bU(b,["labels"],w),void 0!==bV(a,["webhookConfig"]))throw Error("webhookConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");let x=bV(a,["resizeMode"]);void 0!==b&&null!=x&&bU(b,["parameters","resizeMode"],x)}(r,j),j);return l=bT("{model}:predictLongRunning",s._url),m=s._query,delete s._url,delete s._query,this.apiClient.request({path:l,queryParams:m,body:JSON.stringify(s),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>{let b,c,d,e,f,g,h=(b={},null!=(c=bV(a,["name"]))&&bU(b,["name"],c),null!=(d=bV(a,["metadata"]))&&bU(b,["metadata"],d),null!=(e=bV(a,["done"]))&&bU(b,["done"],e),null!=(f=bV(a,["error"]))&&bU(b,["error"],f),null!=(g=bV(a,["response"]))&&bU(b,["response"],function(a){let b={},c=bV(a,["videos"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f,g,h;return c={},null!=(d=bV(a,["_self"]))&&bU(c,["video"],(e={},null!=(f=bV(b=d,["gcsUri"]))&&bU(e,["uri"],f),null!=(g=bV(b,["bytesBase64Encoded"]))&&bU(e,["videoBytes"],bW(g)),null!=(h=bV(b,["mimeType"]))&&bU(e,["mimeType"],h),e)),c})),bU(b,["generatedVideos"],a)}let d=bV(a,["raiMediaFilteredCount"]);null!=d&&bU(b,["raiMediaFilteredCount"],d);let e=bV(a,["raiMediaFilteredReasons"]);return null!=e&&bU(b,["raiMediaFilteredReasons"],e),b}(g)),b),i=new cb;return Object.assign(i,h),i})}{let b,c,f,h,i,n,o,p,q,r,s=(g=this.apiClient,h={},null!=(i=bV(a,["model"]))&&bU(h,["_url","model"],ct(g,i)),null!=(n=bV(a,["prompt"]))&&bU(h,["instances[0]","prompt"],n),null!=(o=bV(a,["image"]))&&bU(h,["instances[0]","image"],dp(o)),null!=(p=bV(a,["video"]))&&bU(h,["instances[0]","video"],dw(p)),null!=(q=bV(a,["source"]))&&(j=q,k=h,b=bV(j,["prompt"]),void 0!==k&&null!=b&&bU(k,["instances[0]","prompt"],b),c=bV(j,["image"]),void 0!==k&&null!=c&&bU(k,["instances[0]","image"],dp(c)),f=bV(j,["video"]),void 0!==k&&null!=f&&bU(k,["instances[0]","video"],dw(f))),null!=(r=bV(a,["config"]))&&function(a,b){let c=bV(a,["numberOfVideos"]);if(void 0!==b&&null!=c&&bU(b,["parameters","sampleCount"],c),void 0!==bV(a,["outputGcsUri"]))throw Error("outputGcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["fps"]))throw Error("fps parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["durationSeconds"]);if(void 0!==b&&null!=d&&bU(b,["parameters","durationSeconds"],d),void 0!==bV(a,["seed"]))throw Error("seed parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let e=bV(a,["aspectRatio"]);void 0!==b&&null!=e&&bU(b,["parameters","aspectRatio"],e);let f=bV(a,["resolution"]);void 0!==b&&null!=f&&bU(b,["parameters","resolution"],f);let g=bV(a,["personGeneration"]);if(void 0!==b&&null!=g&&bU(b,["parameters","personGeneration"],g),void 0!==bV(a,["pubsubTopic"]))throw Error("pubsubTopic parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let h=bV(a,["negativePrompt"]);void 0!==b&&null!=h&&bU(b,["parameters","negativePrompt"],h);let i=bV(a,["enhancePrompt"]);if(void 0!==b&&null!=i&&bU(b,["parameters","enhancePrompt"],i),void 0!==bV(a,["generateAudio"]))throw Error("generateAudio parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let j=bV(a,["lastFrame"]);void 0!==b&&null!=j&&bU(b,["instances[0]","lastFrame"],dp(j));let k=bV(a,["referenceImages"]);if(void 0!==b&&null!=k){let a=k;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e;return c={},null!=(d=bV(b=a,["image"]))&&bU(c,["image"],dp(d)),null!=(e=bV(b,["referenceType"]))&&bU(c,["referenceType"],e),c})),bU(b,["instances[0]","referenceImages"],a)}if(void 0!==bV(a,["mask"]))throw Error("mask parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["compressionQuality"]))throw Error("compressionQuality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["labels"]))throw Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let l=bV(a,["webhookConfig"]);if(void 0!==b&&null!=l&&bU(b,["webhookConfig"],l),void 0!==bV(a,["resizeMode"]))throw Error("resizeMode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.")}(r,h),h);return l=bT("{model}:predictLongRunning",s._url),m=s._query,delete s._url,delete s._query,this.apiClient.request({path:l,queryParams:m,body:JSON.stringify(s),httpMethod:"POST",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json()).then(a=>{let b,c,d,e,f,g,h=(b={},null!=(c=bV(a,["name"]))&&bU(b,["name"],c),null!=(d=bV(a,["metadata"]))&&bU(b,["metadata"],d),null!=(e=bV(a,["done"]))&&bU(b,["done"],e),null!=(f=bV(a,["error"]))&&bU(b,["error"],f),null!=(g=bV(a,["response","generateVideoResponse"]))&&bU(b,["response"],function(a){let b={},c=bV(a,["generatedSamples"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f,g,h;return c={},null!=(d=bV(a,["video"]))&&bU(c,["video"],(e={},null!=(f=bV(b=d,["uri"]))&&bU(e,["uri"],f),null!=(g=bV(b,["encodedVideo"]))&&bU(e,["videoBytes"],bW(g)),null!=(h=bV(b,["encoding"]))&&bU(e,["mimeType"],h),e)),c})),bU(b,["generatedVideos"],a)}let d=bV(a,["raiMediaFilteredCount"]);null!=d&&bU(b,["raiMediaFilteredCount"],d);let e=bV(a,["raiMediaFilteredReasons"]);return null!=e&&bU(b,["raiMediaFilteredReasons"],e),b}(g)),b),i=new cb;return Object.assign(i,h),i})}}}class dT extends bS{constructor(a){super(),this.apiClient=a}async getVideosOperation(a){let b=a.operation,c=a.config;if(void 0===b.name||""===b.name)throw Error("Operation name is required.");if(this.apiClient.isVertexAI()){let a,d=b.name.split("/operations/")[0];c&&"httpOptions"in c&&(a=c.httpOptions);let e=await this.fetchPredictVideosOperationInternal({operationName:b.name,resourceName:d,config:{httpOptions:a}});return b._fromAPIResponse({apiResponse:e,_isVertexAI:!0})}{let a=await this.getVideosOperationInternal({operationName:b.name,config:c});return b._fromAPIResponse({apiResponse:a,_isVertexAI:!1})}}async get(a){let b=a.operation,c=a.config;if(void 0===b.name||""===b.name)throw Error("Operation name is required.");if(this.apiClient.isVertexAI()){let a,d=b.name.split("/operations/")[0];c&&"httpOptions"in c&&(a=c.httpOptions);let e=await this.fetchPredictVideosOperationInternal({operationName:b.name,resourceName:d,config:{httpOptions:a}});return b._fromAPIResponse({apiResponse:e,_isVertexAI:!0})}{let a=await this.getVideosOperationInternal({operationName:b.name,config:c});return b._fromAPIResponse({apiResponse:a,_isVertexAI:!1})}}async getVideosOperationInternal(a){var b,c,d,e;let f="",g={};if(this.apiClient.isVertexAI()){let d,e,h=(d={},null!=(e=bV(a,["operationName"]))&&bU(d,["_url","operationName"],e),d);return f=bT("{operationName}",h._url),g=h._query,delete h._url,delete h._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(h),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json())}{let b,c,h=(b={},null!=(c=bV(a,["operationName"]))&&bU(b,["_url","operationName"],c),b);return f=bT("{operationName}",h._url),g=h._query,delete h._url,delete h._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(h),httpMethod:"GET",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json())}}async fetchPredictVideosOperationInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI()){let f,g,h,i=(f={},null!=(g=bV(a,["operationName"]))&&bU(f,["operationName"],g),null!=(h=bV(a,["resourceName"]))&&bU(f,["_url","resourceName"],h),f);return d=bT("{resourceName}:fetchPredictOperation",i._url),e=i._query,delete i._url,delete i._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(i),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json())}throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}}function dU(a){let b={};if(void 0!==bV(a,["languageCodes"]))throw Error("languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=bV(a,["languageAuto"]);null!=c&&bU(b,["languageAuto"],c);let d=bV(a,["languageHints"]);null!=d&&bU(b,["languageHints"],d);let e=bV(a,["adaptationPhrases"]);return null!=e&&bU(b,["adaptationPhrases"],e),b}class dV extends bS{constructor(a){super(),this.apiClient=a}async create(a){var b,c,d,e,f;let g="",h={};if(this.apiClient.isVertexAI())throw Error("The client.tokens.create method is only supported by the Gemini Developer API.");{let i,j,k,l,m,n,o,p,q,r,s=(d=this.apiClient,l={},null!=(m=bV(a,["config"]))&&bU(l,["config"],(n=bV(m,["expireTime"]),void 0!==l&&null!=n&&bU(l,["expireTime"],n),o=bV(m,["newSessionExpireTime"]),void 0!==l&&null!=o&&bU(l,["newSessionExpireTime"],o),p=bV(m,["uses"]),void 0!==l&&null!=p&&bU(l,["uses"],p),q=bV(m,["liveConnectConstraints"]),void 0!==l&&null!=q&&bU(l,["bidiGenerateContentSetup"],(e=d,i={},null!=(j=bV(f=q,["model"]))&&bU(i,["setup","model"],ct(e,j)),null!=(k=bV(f,["config"]))&&bU(i,["config"],function(a,b){let c=bV(a,["generationConfig"]);void 0!==b&&null!=c&&bU(b,["setup","generationConfig"],c);let d=bV(a,["responseModalities"]);void 0!==b&&null!=d&&bU(b,["setup","generationConfig","responseModalities"],d);let e=bV(a,["temperature"]);void 0!==b&&null!=e&&bU(b,["setup","generationConfig","temperature"],e);let f=bV(a,["topP"]);void 0!==b&&null!=f&&bU(b,["setup","generationConfig","topP"],f);let g=bV(a,["topK"]);void 0!==b&&null!=g&&bU(b,["setup","generationConfig","topK"],g);let h=bV(a,["maxOutputTokens"]);void 0!==b&&null!=h&&bU(b,["setup","generationConfig","maxOutputTokens"],h);let i=bV(a,["mediaResolution"]);void 0!==b&&null!=i&&bU(b,["setup","generationConfig","mediaResolution"],i);let j=bV(a,["seed"]);void 0!==b&&null!=j&&bU(b,["setup","generationConfig","seed"],j);let k=bV(a,["speechConfig"]);void 0!==b&&null!=k&&bU(b,["setup","generationConfig","speechConfig"],cJ(k));let l=bV(a,["thinkingConfig"]);void 0!==b&&null!=l&&bU(b,["setup","generationConfig","thinkingConfig"],l);let m=bV(a,["enableAffectiveDialog"]);void 0!==b&&null!=m&&bU(b,["setup","generationConfig","enableAffectiveDialog"],m);let n=bV(a,["systemInstruction"]);void 0!==b&&null!=n&&bU(b,["setup","systemInstruction"],function(a){let b={},c=bV(a,["parts"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>{var b;let c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;return c={},null!=(d=bV(b=a,["mediaResolution"]))&&bU(c,["mediaResolution"],d),null!=(e=bV(b,["codeExecutionResult"]))&&bU(c,["codeExecutionResult"],e),null!=(f=bV(b,["executableCode"]))&&bU(c,["executableCode"],f),null!=(g=bV(b,["fileData"]))&&bU(c,["fileData"],function(a){let b={};if(void 0!==bV(a,["displayName"]))throw Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=bV(a,["fileUri"]);null!=c&&bU(b,["fileUri"],c);let d=bV(a,["mimeType"]);return null!=d&&bU(b,["mimeType"],d),b}(g)),null!=(h=bV(b,["functionCall"]))&&bU(c,["functionCall"],function(a){let b={},c=bV(a,["id"]);null!=c&&bU(b,["id"],c);let d=bV(a,["args"]);null!=d&&bU(b,["args"],d);let e=bV(a,["name"]);if(null!=e&&bU(b,["name"],e),void 0!==bV(a,["partialArgs"]))throw Error("partialArgs parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["willContinue"]))throw Error("willContinue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(h)),null!=(i=bV(b,["functionResponse"]))&&bU(c,["functionResponse"],i),null!=(j=bV(b,["inlineData"]))&&bU(c,["inlineData"],function(a){let b={},c=bV(a,["data"]);if(null!=c&&bU(b,["data"],c),void 0!==bV(a,["displayName"]))throw Error("displayName parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["mimeType"]);return null!=d&&bU(b,["mimeType"],d),b}(j)),null!=(k=bV(b,["text"]))&&bU(c,["text"],k),null!=(l=bV(b,["thought"]))&&bU(c,["thought"],l),null!=(m=bV(b,["thoughtSignature"]))&&bU(c,["thoughtSignature"],m),null!=(n=bV(b,["videoMetadata"]))&&bU(c,["videoMetadata"],n),null!=(o=bV(b,["toolCall"]))&&bU(c,["toolCall"],o),null!=(p=bV(b,["toolResponse"]))&&bU(c,["toolResponse"],p),null!=(q=bV(b,["partMetadata"]))&&bU(c,["partMetadata"],q),c})),bU(b,["parts"],a)}let d=bV(a,["role"]);return null!=d&&bU(b,["role"],d),b}(cE(n)));let o=bV(a,["tools"]);if(void 0!==b&&null!=o){let a=cL(o);Array.isArray(a)&&(a=a.map(a=>(function(a){let b,c,d,e={};if(void 0!==bV(a,["retrieval"]))throw Error("retrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let f=bV(a,["computerUse"]);null!=f&&bU(e,["computerUse"],f);let g=bV(a,["fileSearch"]);null!=g&&bU(e,["fileSearch"],g);let h=bV(a,["googleSearch"]);null!=h&&bU(e,["googleSearch"],function(a){let b={},c=bV(a,["searchTypes"]);if(null!=c&&bU(b,["searchTypes"],c),void 0!==bV(a,["blockingConfidence"]))throw Error("blockingConfidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["excludeDomains"]))throw Error("excludeDomains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["timeRangeFilter"]);return null!=d&&bU(b,["timeRangeFilter"],d),b}(h));let i=bV(a,["googleMaps"]);null!=i&&bU(e,["googleMaps"],(b={},null!=(c=bV(i,["authConfig"]))&&bU(b,["authConfig"],function(a){let b={},c=bV(a,["apiKey"]);if(null!=c&&bU(b,["apiKey"],c),void 0!==bV(a,["apiKeyConfig"]))throw Error("apiKeyConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["authType"]))throw Error("authType parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["googleServiceAccountConfig"]))throw Error("googleServiceAccountConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["httpBasicAuthConfig"]))throw Error("httpBasicAuthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["oauthConfig"]))throw Error("oauthConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["oidcConfig"]))throw Error("oidcConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(c)),null!=(d=bV(i,["enableWidget"]))&&bU(b,["enableWidget"],d),b));let j=bV(a,["codeExecution"]);if(null!=j&&bU(e,["codeExecution"],j),void 0!==bV(a,["enterpriseWebSearch"]))throw Error("enterpriseWebSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let k=bV(a,["functionDeclarations"]);if(null!=k){let a=k;Array.isArray(a)&&(a=a.map(a=>a)),bU(e,["functionDeclarations"],a)}let l=bV(a,["googleSearchRetrieval"]);if(null!=l&&bU(e,["googleSearchRetrieval"],l),void 0!==bV(a,["parallelAiSearch"]))throw Error("parallelAiSearch parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let m=bV(a,["urlContext"]);null!=m&&bU(e,["urlContext"],m);let n=bV(a,["mcpServers"]);if(null!=n){let a=n;Array.isArray(a)&&(a=a.map(a=>a)),bU(e,["mcpServers"],a)}return e})(cK(a)))),bU(b,["setup","tools"],a)}let p=bV(a,["sessionResumption"]);void 0!==b&&null!=p&&bU(b,["setup","sessionResumption"],function(a){let b={},c=bV(a,["handle"]);if(null!=c&&bU(b,["handle"],c),void 0!==bV(a,["transparent"]))throw Error("transparent parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");return b}(p));let q=bV(a,["inputAudioTranscription"]);void 0!==b&&null!=q&&bU(b,["setup","inputAudioTranscription"],dU(q));let r=bV(a,["outputAudioTranscription"]);void 0!==b&&null!=r&&bU(b,["setup","outputAudioTranscription"],dU(r));let s=bV(a,["realtimeInputConfig"]);void 0!==b&&null!=s&&bU(b,["setup","realtimeInputConfig"],s);let t=bV(a,["contextWindowCompression"]);void 0!==b&&null!=t&&bU(b,["setup","contextWindowCompression"],t);let u=bV(a,["proactivity"]);if(void 0!==b&&null!=u&&bU(b,["setup","proactivity"],u),void 0!==bV(a,["explicitVadSignal"]))throw Error("explicitVadSignal parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let v=bV(a,["avatarConfig"]);void 0!==b&&null!=v&&bU(b,["setup","avatarConfig"],v);let w=bV(a,["safetySettings"]);if(void 0!==b&&null!=w){let a=w;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["category"]);if(null!=c&&bU(b,["category"],c),void 0!==bV(a,["method"]))throw Error("method parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["threshold"]);return null!=d&&bU(b,["threshold"],d),b})(a))),bU(b,["setup","safetySettings"],a)}let x=bV(a,["translationConfig"]);return void 0!==b&&null!=x&&bU(b,["setup","generationConfig","translationConfig"],x),{}}(k,i)),i)),r=bV(m,["lockAdditionalFields"]),void 0!==l&&null!=r&&bU(l,["fieldMask"],r),{})),l);g=bT("auth_tokens",s._url),h=s._query,delete s.config,delete s._url,delete s._query;let t=function(a,b){let c=null,d=a.bidiGenerateContentSetup;if("object"==typeof d&&null!==d&&"setup"in d){let b=d.setup;"object"==typeof b&&null!==b?(a.bidiGenerateContentSetup=b,c=b):delete a.bidiGenerateContentSetup}else void 0!==d&&delete a.bidiGenerateContentSetup;let e=a.fieldMask;if(c){let d=function(a){let b=[];for(let c in a)if(Object.prototype.hasOwnProperty.call(a,c)){let d=a[c];if("object"==typeof d&&null!=d&&Object.keys(d).length>0){let a=Object.keys(d).map(a=>`${c}.${a}`);b.push(...a)}else b.push(c)}return b.join(",")}(c);if(Array.isArray(null==b?void 0:b.lockAdditionalFields)&&(null==b?void 0:b.lockAdditionalFields.length)===0)d?a.fieldMask=d:delete a.fieldMask;else if((null==b?void 0:b.lockAdditionalFields)&&b.lockAdditionalFields.length>0&&null!==e&&Array.isArray(e)&&e.length>0){let b=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"],c=[];e.length>0&&(c=e.map(a=>b.includes(a)?`generationConfig.${a}`:a));let f=[];d&&f.push(d),c.length>0&&f.push(...c),f.length>0?a.fieldMask=f.join(","):delete a.fieldMask}else delete a.fieldMask}else null!==e&&Array.isArray(e)&&e.length>0?a.fieldMask=e.join(","):delete a.fieldMask;return a}(s,a.config);return this.apiClient.request({path:g,queryParams:h,body:JSON.stringify(t),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>a)}}}class dW extends bS{constructor(a){super(),this.apiClient=a,this.list=async a=>new c_(bH.PAGED_ITEM_DOCUMENTS,b=>this.listInternal({parent:a.parent,config:b.config}),await this.listInternal(a),a)}async get(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h=(f={},null!=(g=bV(a,["name"]))&&bU(f,["_url","name"],g),f);return d=bT("{name}",h._url),e=h._query,delete h._url,delete h._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(h),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>a)}}async delete(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h,i,j=(f={},null!=(g=bV(a,["name"]))&&bU(f,["_url","name"],g),null!=(h=bV(a,["config"]))&&(i=bV(h,["force"]),void 0!==f&&null!=i&&bU(f,["_query","force"],i)),f);d=bT("{name}",j._url),e=j._query,delete j._url,delete j._query,await this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(j),httpMethod:"DELETE",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal})}}async listInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h,i,j,k=(f={},null!=(g=bV(a,["parent"]))&&bU(f,["_url","parent"],g),null!=(h=bV(a,["config"]))&&(i=bV(h,["pageSize"]),void 0!==f&&null!=i&&bU(f,["_query","pageSize"],i),j=bV(h,["pageToken"]),void 0!==f&&null!=j&&bU(f,["_query","pageToken"],j)),f);return d=bT("{parent}/documents",k._url),e=k._query,delete k._url,delete k._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(k),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["nextPageToken"]);null!=d&&bU(b,["nextPageToken"],d);let e=bV(a,["documents"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["documents"],a)}return b}(a),c=new ch;return Object.assign(c,b),c})}}}class dX extends bS{constructor(a,b=new dW(a)){super(),this.apiClient=a,this.documents=b,this.list=async(a={})=>new c_(bH.PAGED_ITEM_FILE_SEARCH_STORES,a=>this.listInternal(a),await this.listInternal(a),a)}async uploadToFileSearchStore(a){if(this.apiClient.isVertexAI())throw Error("Gemini Enterprise Agent Platform (previously known as Vertex AI) does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(a.fileSearchStoreName,a.file,a.config)}async downloadMedia(a,b){if(this.apiClient.isVertexAI())throw Error("This method is only supported in the Gemini Developer client.");let c=new URL(a,"http://dummy.com"),d=c.pathname;if(d.startsWith("/")&&(d=d.slice(1)),!d.includes("/media/"))throw Error(`Invalid uri format: ${a}. Expected to contain /media/`);let e={};c.searchParams.forEach((a,b)=>{e[b]=a}),e.alt="media";let f=Object.assign({},null==b?void 0:b.httpOptions),g=await this.apiClient.request({path:d,httpMethod:"GET",queryParams:e,httpOptions:f});if(g instanceof b_)return new Uint8Array(await g.responseInternal.arrayBuffer());throw Error("Unexpected response type from downloadMedia")}async create(a){var b,c,d;let e="",f={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let g,h,i,j,k=(d=this.apiClient,g={},null!=(h=bV(a,["config"]))&&(i=bV(h,["displayName"]),void 0!==g&&null!=i&&bU(g,["displayName"],i),j=bV(h,["embeddingModel"]),void 0!==g&&null!=j&&bU(g,["embeddingModel"],ct(d,j))),g);return e=bT("fileSearchStores",k._url),f=k._query,delete k._url,delete k._query,this.apiClient.request({path:e,queryParams:f,body:JSON.stringify(k),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>a)}}async get(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h=(f={},null!=(g=bV(a,["name"]))&&bU(f,["_url","name"],g),f);return d=bT("{name}",h._url),e=h._query,delete h._url,delete h._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(h),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>a)}}async delete(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h,i,j=(f={},null!=(g=bV(a,["name"]))&&bU(f,["_url","name"],g),null!=(h=bV(a,["config"]))&&(i=bV(h,["force"]),void 0!==f&&null!=i&&bU(f,["_query","force"],i)),f);d=bT("{name}",j._url),e=j._query,delete j._url,delete j._query,await this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(j),httpMethod:"DELETE",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal})}}async listInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h,i,j=(f={},null!=(g=bV(a,["config"]))&&(h=bV(g,["pageSize"]),void 0!==f&&null!=h&&bU(f,["_query","pageSize"],h),i=bV(g,["pageToken"]),void 0!==f&&null!=i&&bU(f,["_query","pageToken"],i)),f);return d=bT("fileSearchStores",j._url),e=j._query,delete j._url,delete j._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(j),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["nextPageToken"]);null!=d&&bU(b,["nextPageToken"],d);let e=bV(a,["fileSearchStores"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["fileSearchStores"],a)}return b}(a),c=new ci;return Object.assign(c,b),c})}}async uploadToFileSearchStoreInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h,i=(f={},null!=(g=bV(a,["fileSearchStoreName"]))&&bU(f,["_url","file_search_store_name"],g),null!=(h=bV(a,["config"]))&&dy(h,f),f);return d=bT("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",i._url),e=i._query,delete i._url,delete i._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(i),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>{let b,c,d=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),b),e=new cj;return Object.assign(e,d),e})}}async importFile(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h,i,j=(f={},null!=(g=bV(a,["fileSearchStoreName"]))&&bU(f,["_url","file_search_store_name"],g),null!=(h=bV(a,["fileName"]))&&bU(f,["fileName"],h),null!=(i=bV(a,["config"]))&&function(a,b){let c=bV(a,["customMetadata"]);if(void 0!==b&&null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>a)),bU(b,["customMetadata"],a)}let d=bV(a,["chunkingConfig"]);void 0!==b&&null!=d&&bU(b,["chunkingConfig"],d)}(i,f),f);return d=bT("{file_search_store_name}:importFile",j._url),e=j._query,delete j._url,delete j._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(j),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json()).then(a=>{var b;let c,d,e,f,g,h,i,j,k,l,m=(g={},null!=(h=bV(a,["name"]))&&bU(g,["name"],h),null!=(i=bV(a,["metadata"]))&&bU(g,["metadata"],i),null!=(j=bV(a,["done"]))&&bU(g,["done"],j),null!=(k=bV(a,["error"]))&&bU(g,["error"],k),null!=(l=bV(a,["response"]))&&bU(g,["response"],(c={},null!=(d=bV(b=l,["sdkHttpResponse"]))&&bU(c,["sdkHttpResponse"],d),null!=(e=bV(b,["parent"]))&&bU(c,["parent"],e),null!=(f=bV(b,["documentName"]))&&bU(c,["documentName"],f),c)),g),n=new ck;return Object.assign(n,m),n})}}}function dY(){var a,b,c,d,e,g;if(f)return f;let h=globalThis;return f=("Deno"in globalThis?0:1)?null!=(g=null==(e=h.process)?void 0:e.env)?g:{}:null!=(d=null==(c=null==(b=null==(a=h.Deno)?void 0:a.env)?void 0:b.toObject)?void 0:c.call(b))?d:{}}class dZ{constructor(a){this.options=a}getDefaultHeaders(){return this.options.defaultHeaders}async resolveGoogleGenAISecurity(a){return function(a){var b,c;let d={};for(let[b,c]of a){let a=b.toLowerCase();"authorization"!==a&&"x-goog-api-key"!==a&&(d[b]=c)}let e={access_token:null!=(b=a.get("authorization"))?b:void 0,api_key:null!=(c=a.get("x-goog-api-key"))?c:void 0,default_headers:Object.keys(d).length?d:void 0};return d4(e)?e:void 0}(await this.options.getAuthHeaders(a))}}class d${beforeCreateRequest(a,b){return Object.assign(Object.assign({},b),{url:function(a){let[,b,...c]=a.pathname.split("/");if(!b)return a;let d=decodeURIComponent(b);if(!d.includes("/"))return a;let e=new URL(a);return e.pathname=`/${d}/${c.join("/")}`,e}(b.url)})}async beforeRequest(a,b){var c,d,e,f,g,h,i,j,k;if(d1(b.headers,d3(c=a.security_source)?null!=(e=null==(d=c.getDefaultHeaders)?void 0:d.call(c))?e:c.defaultHeaders:d2(c)?c.default_headers:void 0),f=a,null===(g=b.headers).get("api-revision")&&g.set("Api-Revision",null!=(h=f.options.api_revision)?h:"2026-05-20"),i=a,j=b.headers,void 0!==i.options.user_project&&null===j.get("x-goog-user-project")&&j.set("x-goog-user-project",i.options.user_project),null!==(k=b.headers).get("authorization")||null!==k.get("x-goog-api-key"))return b;let l=await d_(a.security_source,b.url);return d1(b.headers,null==l?void 0:l.default_headers),function(a,b){if(b){var c;if(b.api_key)return a.set("x-goog-api-key",b.api_key);b.access_token&&a.set("Authorization","bearer "===(c=b.access_token).slice(0,7).toLowerCase()?c:`Bearer ${c}`)}}(b.headers,l),b}}async function d_(a,b){if(d3(a))return a.resolveGoogleGenAISecurity(b);let c="function"==typeof a?await a():a;return d2(c)?d0(c):d0(void 0)}function d0(a){var b,c;let d=dY(),e=Object.assign(Object.assign({},a),{api_key:null!=(b=null==a?void 0:a.api_key)?b:d.GOOGLE_GENAI_API_KEY,access_token:null!=(c=null==a?void 0:a.access_token)?c:d.GOOGLE_GENAI_ACCESS_TOKEN});return d4(e)?e:void 0}function d1(a,b){if(b)for(let[c,d]of new Headers(b))null===a.get(c)&&a.set(c,d)}function d2(a){return"object"==typeof a&&null!==a}function d3(a){return"object"==typeof a&&null!==a&&"resolveGoogleGenAISecurity"in a&&"function"==typeof a.resolveGoogleGenAISecurity}function d4(a){return void 0!==a.api_key||void 0!==a.access_token||void 0!==a.default_headers}class d5 extends Error{constructor(a,b){let c=a;(null==b?void 0:b.cause)&&(c+=`: ${b.cause}`),super(c,b),this.name="HTTPClientError",void 0===this.cause&&(this.cause=null==b?void 0:b.cause)}}class d6 extends d5{constructor(){super(...arguments),this.name="UnexpectedClientError"}}class d7 extends d5{constructor(){super(...arguments),this.name="InvalidRequestError"}}class d8 extends d5{constructor(){super(...arguments),this.name="RequestAbortedError"}}class d9 extends d5{constructor(){super(...arguments),this.name="RequestTimeoutError"}}class ea extends d5{constructor(){super(...arguments),this.name="ConnectionError"}}class eb extends Error{constructor(a,b){var c,d,e,f;super(a),this.statusCode=null==(c=null==b?void 0:b.response)?void 0:c.status,this.body=null!=(d=null==b?void 0:b.body)?d:"",this.headers=null==(e=null==b?void 0:b.response)?void 0:e.headers,this.contentType=(null==(f=null==b?void 0:b.response)?void 0:f.headers.get("content-type"))||"",this.rawResponse=null==b?void 0:b.response,this.name="GoogleGenAiError"}}class ec extends Error{}class ed extends ec{constructor(a,b,c,d){super(ed.makeMessage(a,b,c)),this.status=a,this.headers=d,this.error=b,this.statusCode=a,this.body=er(b),this.contentType=(null==d?void 0:d.get("content-type"))||"",this.rawResponse=void 0,this.cause=void 0,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}static makeMessage(a,b,c){var d,e;let f=b&&null!==(e=b)&&"object"==typeof e&&!Array.isArray(e)&&"string"==typeof b.message?b.message:void 0,g=er(b),h=null!=(d=null!=f?f:c)?d:g||"An error occurred",i=a?`${a} `:"";return`${i}${h}`}static generate(a,b,c,d){return a&&d?400===a?new eh(a,b,c,d):401===a?new ei(a,b,c,d):403===a?new ej(a,b,c,d):404===a?new ek(a,b,c,d):409===a?new el(a,b,c,d):422===a?new em(a,b,c,d):429===a?new en(a,b,c,d):a>=500?new eo(a,b,c,d):new ed(a,b,c,d):new ef({message:c,cause:b instanceof Error?b:void 0})}}class ee extends ed{constructor({message:a}={}){super(void 0,void 0,a||"Request was aborted.",void 0)}}class ef extends ed{constructor({message:a,cause:b}){super(void 0,void 0,a||"Connection error.",void 0),this.cause=b}}class eg extends ef{constructor({message:a}={}){super({message:a||"Request timed out. This is a client-side timeout. You can increase the timeout by setting the `timeout` argument in your request or client http options."})}}class eh extends ed{}class ei extends ed{}class ej extends ed{}class ek extends ed{}class el extends ed{}class em extends ed{}class en extends ed{}class eo extends ed{}function ep(a){var b,c,d;let e,f;return"object"==typeof(b=a)&&null!==b&&ed.prototype.isPrototypeOf(b)?a:a instanceof eb?(e=function(a){let b=eq(a,"data$");if(b&&"object"==typeof b)return b;try{let b=JSON.parse(a.body);if(b&&"object"==typeof b)return b}catch(a){}let c=eq(a,"error");return c&&"object"==typeof c?c:void 0}(c=a),es(f=ed.generate(c.statusCode,e,c.message,c.headers),"body",c.body),es(f,"contentType",c.contentType),es(f,"rawResponse",c.rawResponse),es(f,"statusCode",c.statusCode),es(f,"cause",c),f):a instanceof d5?(d=a)instanceof d9?new eg({message:d.message}):d instanceof d8?new ee({message:d.message}):(d instanceof ea,new ef({message:d.message,cause:d})):a}function eq(a,b){return a&&"object"==typeof a?a[b]:void 0}function er(a){if(!a)return"";try{return JSON.stringify(a)}catch(b){return String(a)}}function es(a,b,c){Object.defineProperty(a,b,{configurable:!0,enumerable:!0,value:c,writable:!1})}class et{constructor(){for(const a of(this.sdkInitHooks=[],this.beforeCreateRequestHooks=[],this.beforeRequestHooks=[],this.afterSuccessHooks=[],this.afterErrorHooks=[],[]))"sdkInit"in a&&this.registerSDKInitHook(a),"beforeCreateRequest"in a&&this.registerBeforeCreateRequestHook(a),"beforeRequest"in a&&this.registerBeforeRequestHook(a),"afterSuccess"in a&&this.registerAfterSuccessHook(a),"afterError"in a&&this.registerAfterErrorHook(a);!function(a){let b=new d$;a.registerBeforeCreateRequestHook(b),a.registerBeforeRequestHook(b)}(this)}registerSDKInitHook(a){this.sdkInitHooks.push(a)}registerBeforeCreateRequestHook(a){this.beforeCreateRequestHooks.push(a)}registerBeforeRequestHook(a){this.beforeRequestHooks.push(a)}registerAfterSuccessHook(a){this.afterSuccessHooks.push(a)}registerAfterErrorHook(a){this.afterErrorHooks.push(a)}sdkInit(a){return this.sdkInitHooks.reduce((a,b)=>b.sdkInit(a),a)}beforeCreateRequest(a,b){let c=b;for(let b of this.beforeCreateRequestHooks)c=b.beforeCreateRequest(a,c);return c}async beforeRequest(a,b){let c=b;for(let b of this.beforeRequestHooks)c=await b.beforeRequest(a,c);return c}async afterSuccess(a,b){let c=b;for(let b of this.afterSuccessHooks)c=await b.afterSuccess(a,c);return c}async afterError(a,b,c){let d=b,e=c;for(let b of this.afterErrorHooks){let c=await b.afterError(a,d,e);d=c.response,e=c.error}return{response:d,error:e}}}function eu(a){return{ok:!0,value:a}}function ev(a){return{ok:!1,error:a}}function ew(a){return btoa(String.fromCodePoint(...a))}let ex=Object.prototype.hasOwnProperty;function ey(a,b){let c=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(b={}){return a.replace(c,function(a,c){if(!ex.call(b,c))throw Error(`Parameter '${c}' is required`);let d=b[c];if("string"!=typeof d&&"number"!=typeof d)throw Error(`Parameter '${c}' must be a string or number`);return`${d}`}).replace(/^\/+/,"")}}let ez=["https://generativelanguage.googleapis.com"];function eA(a){let b={};for(let[c,d]of Object.entries(a))void 0!==d&&(b[c]=d);return b}function eB(a){if(null===a||"object"!=typeof a||"[object Object]"!==Object.prototype.toString.call(a))return!1;let b=Object.getPrototypeOf(a);if(null===b||b===Object.prototype)return!0;try{return null===Object.getPrototypeOf(b)}catch(a){return!1}}let eC=(a,b,c)=>{let d="",e=(null==c?void 0:c.explode)?eF(a,b):[[a,b]];if(e.every(([a,b])=>null==b))return;let f=a=>(null==c?void 0:c.charEncoding)==="percent"?encodeURIComponent(a):a,g=f(",");return e.forEach(([a,b])=>{var c,e;let h="",i=null;null!=b&&(null==(i=Array.isArray(b)?null==(c=eI(b,a=>`${f(eG(a))}`))?void 0:c.join(g):eB(b)?null==(e=eJ(Object.entries(b),([a,b])=>`${f(a)}${g}${f(eG(b))}`))?void 0:e.join(g):`${f(eG(b))}`)||(h=`${f(a)}=${i}`)&&"="!==h&&(d+=`&${h}`))}),d.slice(1)};function eD(a,b,c){if(void 0===b)return;let d=a=>(null==c?void 0:c.charEncoding)==="percent"?encodeURIComponent(a):a,e=d(JSON.stringify(b,eH));return(null==c?void 0:c.explode)?e:`${d(a)}=${e}`}let eE=(a,b,c)=>{let d="",e=(null==c?void 0:c.explode)?eF(a,b):[[a,b]];if(e.every(([a,b])=>null==b))return;let f=a=>(null==c?void 0:c.charEncoding)==="percent"?encodeURIComponent(a):a;return e.forEach(([a,e])=>{var g;let h="";if(null!=e){if(Array.isArray(e))h=null==(g=eI(e,a=>`${f(eG(a))}`))?void 0:g.join(",");else if(eB(e)){let a=eJ(Object.entries(e),([a,b])=>`,${f(a)},${f(eG(b))}`);h=null==a?void 0:a.join("").slice(1)}else{let d=(null==c?void 0:c.explode)&&eB(b)?`${a}=`:"";h=`${d}${f(eG(e))}`}d+=h?`,${h}`:""}}),d.slice(1)};function eF(a,b){return Array.isArray(b)?b.map(b=>[a,b]):eB(b)?Object.entries(null!=b?b:{}).map(([a,b])=>[a,b]):[[a,b]]}function eG(a){return null==a?"":a instanceof Date?a.toISOString():a instanceof Uint8Array?ew(a):"object"==typeof a?JSON.stringify(a,eH):`${a}`}function eH(a,b){return b instanceof Uint8Array?ew(b):b}function eI(a,b){let c=a.reduce((a,c)=>{if(null==c)return a;let d=b(c);return null==d||a.push(d),a},[]);return c.length?c:null}function eJ(a,b){let c=[];for(let[d,e]of a){if(null==e)continue;let a=b([d,e]);null!=a&&c.push(a)}return c.length?c:null}let eK=function(a,b){var c,d,e;let f=Object.assign(Object.assign({},b),{explode:null==(c=null==b?void 0:b.explode)||c,charEncoding:null!=(d=null==b?void 0:b.charEncoding)?d:"percent"}),g=new Set(null!=(e=null==b?void 0:b.allowEmptyValue)?e:[]);return function(...a){return a.filter(Boolean).join("&")}(...Object.entries(a).map(([a,b])=>g.has(a)&&(null==b||""===b||Array.isArray(b)&&0===b.length)?`${encodeURIComponent(a)}=`:eC(a,b,f)))},eL=(a,b)=>null==b?fetch(a):fetch(a,b);class eM{constructor(a={}){this.options=a,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=a.fetcher||eL}async request(a){let b=a;for(let a of this.requestHooks){let c=await a(b);c&&(b=c)}try{let a=await this.fetcher(b);for(let c of this.responseHooks)await c(a,b);return a}catch(a){for(let c of this.requestErrorHooks)await c(a,b);throw a}}addHook(...a){if("beforeRequest"===a[0])this.requestHooks.push(a[1]);else if("requestError"===a[0])this.requestErrorHooks.push(a[1]);else if("response"===a[0])this.responseHooks.push(a[1]);else throw Error(`Invalid hook type: ${a[0]}`);return this}removeHook(...a){let b;if("beforeRequest"===a[0])b=this.requestHooks;else if("requestError"===a[0])b=this.requestErrorHooks;else if("response"===a[0])b=this.responseHooks;else throw Error(`Invalid hook type: ${a[0]}`);let c=b.findIndex(b=>b===a[1]);return c>=0&&b.splice(c,1),this}clone(){let a=new eM(this.options);return a.requestHooks=this.requestHooks.slice(),a.requestErrorHooks=this.requestErrorHooks.slice(),a.responseHooks=this.responseHooks.slice(),a}}let eN=/\s*;\s*/g;function eO(a,b){var c;if("*"===b)return!0;let d=(null==(c=a.headers.get("content-type"))?void 0:c.trim())||"application/octet-stream";d=d.toLowerCase();let[e="",...f]=b.toLowerCase().trim().split(eN);if(2!==e.split("/").length)return!1;let[g="",...h]=d.split(eN),[i="",j=""]=g.split("/");if(!i||!j||"*/*"!==e&&g!==e&&`${i}/*`!==e&&`*/${j}`!==e||h.length<f.length)return!1;let k=new Set(h);for(let a of f)if(!k.has(a))return!1;return!0}let eP=RegExp("^[0-9]xx$","i");function eQ(a,b){let c=`${a.status}`,d=Array.isArray(b)?b:[b];return!!d.length&&d.some(a=>{let b=`${a}`;if("default"===b)return!0;if(!eP.test(`${b}`))return b===c;let d=b.charAt(0);if(!d)throw Error("Invalid status code range");let e=c.charAt(0);if(!e)throw Error(`Invalid response status code: ${c}`);return e===d})}function eR(a){if("object"!=typeof a||null==a)return!1;let b=a instanceof TypeError&&a.message.toLowerCase().startsWith("failed to fetch"),c=a instanceof TypeError&&a.message.toLowerCase().startsWith("fetch failed"),d="name"in a&&"ConnectionError"===a.name,e="code"in a&&"string"==typeof a.code&&"econnreset"===a.code.toLowerCase();return b||c||e||d}function eS(a){if("object"!=typeof a||null==a)return!1;let b="name"in a&&"TimeoutError"===a.name,c="code"in a&&23===a.code,d="code"in a&&"string"==typeof a.code&&"econnaborted"===a.code.toLowerCase();return b||c||d}let eT={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5};class eU extends Error{constructor(a,b){let c=a;(null==b?void 0:b.cause)&&(c+=`: ${b.cause}`),super(c,b),this.name="PermanentError",void 0===this.cause&&(this.cause=null==b?void 0:b.cause),Object.setPrototypeOf(this,eU.prototype)}}class eV extends Error{constructor(a,b){super(a),this.response=b,this.name="TemporaryError",Object.setPrototypeOf(this,eV.prototype)}}async function eW(a,b){var c;switch(b.config.strategy){case"backoff":return eZ(eX(a,{statusCodes:b.statusCodes,retryConnectionErrors:!!b.config.retryConnectionErrors}),null!=(c=b.config.backoff)?c:eT);case"attempt-count-backoff":return e$(eX(a,{statusCodes:b.statusCodes,retryConnectionErrors:!!b.config.retryConnectionErrors}),Object.assign(Object.assign({},eT),b.config.backoff),b.config);default:return await a(0)}}function eX(a,b){return async c=>{try{var d,e;let f,g=await a(c);if(d=g,e=b.statusCodes,f=`${d.status}`,e.some(a=>{if(!eY.test(a))return a===f;let b=a.charAt(0);if(!b)throw Error("Invalid status code range");let c=f.charAt(0);if(!c)throw Error(`Invalid response status code: ${f}`);return c===b}))throw new eV("Response failed with retryable status code",g);return g}catch(a){if(a instanceof eV||b.retryConnectionErrors&&(eS(a)||eR(a)))throw a;throw new eU("Permanent error",{cause:a})}}}let eY=RegExp("^[0-9]xx$","i");async function eZ(a,b){let{maxElapsedTime:c,initialInterval:d,exponent:e,maxInterval:f}=b,g=Date.now(),h=0;for(;;)try{return await a(h)}catch(i){if(i instanceof eU)throw i.cause;if(Date.now()-g>c){if(i instanceof eV)return i.response;throw i}let a=0;i instanceof eV&&(a=e_(i.response)),a<=0&&(a=d*Math.pow(h,e)+1e3*Math.random());let b=Math.min(a,f);await e0(b),h++}}async function e$(a,b,c){let d=0;for(;;)try{return await a(d)}catch(f){if(f instanceof eU)throw f.cause;if(d>=c.maxRetries){if(f instanceof eV)return f.response;throw f}let a=0;f instanceof eV&&(a=e_(f.response)),a<=0&&(a=b.initialInterval*Math.pow(b.exponent,d)*(1-.25*Math.random()));let e=Math.min(a,b.maxInterval);await e0(e),d++}}function e_(a){let b=a.headers.get("retry-after-ms");if(b){let a=Number(b);if(Number.isFinite(a)&&a>=0)return a}let c=a.headers.get("retry-after")||"";if(!c)return 0;let d=Number(c);if(Number.isInteger(d))return 1e3*d;let e=Date.parse(c);if(Number.isInteger(e)){let a=e-Date.now();return a>0?Math.ceil(a):0}return 0}async function e0(a){return new Promise(b=>setTimeout(b,a))}let e1="u"<typeof globalThis?null:globalThis,e2="object"==typeof e1&&null!=e1&&"importScripts"in e1&&"function"==typeof e1.importScripts||"u">typeof navigator&&"serviceWorker"in navigator||"object"==typeof window&&void 0!==window.document;class e3{constructor(a={}){const b=a;"object"==typeof b&&null!=b&&"hooks"in b&&b.hooks instanceof et?this._hooks=b.hooks:this._hooks=new et;const c=new eM;a.http_client=a.http_client||c;const d=function(a){var b;let c=a.server_url;if(!c){let d=null!=(b=a.server_idx)?b:0;if(d<0||d>=ez.length)throw Error(`Invalid server index ${d}`);c=ez[d]||""}return new URL(ey(c)({}))}(a=this._hooks.sdkInit(a));d&&(d.pathname=d.pathname.replace(/\/+$/,"")+"/"),this._baseURL=d,this._httpClient=a.http_client||c,this._options=Object.assign(Object.assign({},function(a){let b=Object.assign({},a),c=dY();return void 0!==c.GOOGLE_GENAI_API_VERSION&&(null!=b.api_version||(b.api_version=c.GOOGLE_GENAI_API_VERSION)),void 0!==c.GOOGLE_GENAI_API_REVISION&&(null!=b.api_revision||(b.api_revision=c.GOOGLE_GENAI_API_REVISION)),void 0!==c.GOOGLE_GENAI_USER_PROJECT&&(null!=b.user_project||(b.user_project=c.GOOGLE_GENAI_USER_PROJECT)),b}(a)),{hooks:this._hooks}),this._logger=this._options.debug_logger,!this._logger&&dY().GOOGLE_GENAI_DEBUG&&(this._logger=console)}_createRequest(a,b,c){var d,e,f,g,h,i;let j,k,{method:l,path:m,query:n,headers:o,security:p}=b,q=null!=(d=b.baseURL)?d:this._baseURL;if(!q)return ev(new d7("No base URL provided for operation"));let r=new URL(q);m?(r.pathname=r.pathname.replace(/\/+$/,"")+"/",!(j=new URL(m,r)).search&&r.search&&(j.search=r.search)):j=r,j.hash="";let s=a=>Object.entries(a).map(([a,b])=>{if(null==b)return;let c=eB(b)?JSON.stringify(b):b;return eC(a,c,{explode:Array.isArray(c),charEncoding:"percent"})}).filter(a=>void 0!==a).join("&"),t=[n||"",s((null==c?void 0:c.extra_query)||{}),s((null==p?void 0:p.queryParams)||{})].reduce((a,b)=>{if(!b)return a;let c=new Set(b.split("&").filter(a=>""!==a).map(a=>{var b;return null!=(b=a.split("=")[0])?b:""}));return[...a.split("&").filter(a=>{var b;return""!==a&&!c.has(null!=(b=a.split("=")[0])?b:"")}),b].join("&")},j.search.slice(1));t&&(j.search=`?${t}`);let u=new Headers(o),v=null==p?void 0:p.basic.username,w=null==p?void 0:p.basic.password;if(null!=v||null!=w){let a=ew((i=[v||"",w||""].join(":"),new TextEncoder().encode(i)));u.set("Authorization",`Basic ${a}`)}for(let[a,b]of new Headers((null==p?void 0:p.headers)||{}))u.set(a,b);let x=u.get("cookie")||"";for(let[a,b]of Object.entries((null==p?void 0:p.cookies)||{}))x+=`; ${a}=${b}`;for(let[a,b]of(x=x.startsWith("; ")?x.slice(2):x,u.set("cookie",x),new Headers(null!=(e=null==c?void 0:c.headers)?e:null==(f=null==c?void 0:c.fetch_options)?void 0:f.headers)))u.set(a,b);e2||u.set(null!=(g=b.uaHeader)?g:"user-agent",null!=(h=b.userAgent)?h:"speakeasy-sdk/typescript 2.4.1-preview.4 2.911.0 v1beta @google/genai");let y=b.body,z=Object.fromEntries(Object.entries((null==c?void 0:c.extra_body)||{}).filter(([,a])=>void 0!==a));if(Object.keys(z).length>0){let a,b=new Headers(o).get("content-type")||"";if(!/^(application|text)\/([^+]+\+)*json/.test(b)||"string"!=typeof y&&null!=y)return ev(new d7("extra_body can only be merged into JSON object request bodies"));try{a=y?JSON.parse(y):{}}catch(a){return ev(new d7("extra_body can only be merged into JSON object request bodies",{cause:a}))}if(!eB(a))return ev(new d7("extra_body can only be merged into JSON object request bodies"));y=JSON.stringify(Object.assign(Object.assign({},a),z)),u.delete("content-length")}let A=Object.assign(Object.assign({},null==c?void 0:c.fetch_options),c);(null==A?void 0:A.signal)||null==b.timeout_ms||!(b.timeout_ms>0)||(a.timeout_ms=b.timeout_ms),b.body instanceof ReadableStream&&Object.assign(A,{duplex:"half"});try{k=this._hooks.beforeCreateRequest(a,{url:j,options:Object.assign(Object.assign({},A),{body:null!=y?y:null,headers:u,method:l})})}catch(a){return ev(new d6("Create request hook failed to execute",{cause:a}))}return eu(new Request(k.url,k.options))}async _do(a,b){let{context:c,isErrorStatusCode:d}=b,e=c.timeout_ms;return eW(async()=>{var b;let f=a.clone(),g=f;if(null!=e&&e>0){let a=AbortSignal.timeout(e),c=null!=(b=function(...a){let b=[];for(let c of a)c&&b.push(c);switch(b.length){case 0:case 1:return b[0]||null;default:if("any"in AbortSignal&&"function"==typeof AbortSignal.any)return AbortSignal.any(b);var c=b;let d=new AbortController,e=d.signal;if(!c.length)return d.signal;if(1===c.length)return c[0]||d.signal;for(let a of c)if(a.aborted)return a;function f(){d.abort(this.reason),function(){for(let a of g){let b=a.deref();b&&b.removeEventListener("abort",f)}}()}let g=[];for(let a of c)g.push(new WeakRef(a)),a.addEventListener("abort",f);return e}}(f.signal,a))?b:a;g=new Request(f,{signal:c})}let h=await this._hooks.beforeRequest(c,g);await e6(this._logger,h).catch(a=>{var b;return null==(b=this._logger)?void 0:b.log("Failed to log request:",a)});let i=await this._httpClient.request(h);try{if(d(i.status)){let a=await this._hooks.afterError(c,i,null);if(a.error)throw a.error;i=a.response||i}else i=await this._hooks.afterSuccess(c,i)}finally{await e7(this._logger,i,h).catch(a=>{var b;return null==(b=this._logger)?void 0:b.log("Failed to log response:",a)})}return i},{config:b.retryConfig,statusCodes:b.retryCodes}).then(a=>eu(a),a=>{switch(!0){case function(a){if("object"!=typeof a||null==a)return!1;let b="name"in a&&"AbortError"===a.name,c="code"in a&&20===a.code,d="code"in a&&"string"==typeof a.code&&"econnaborted"===a.code.toLowerCase();return b||c||d}(a):return ev(new d8("Request aborted by client",{cause:a}));case eS(a):return ev(new d9("Request timed out",{cause:a}));case eR(a):return ev(new ea("Unable to make request",{cause:a}));default:return ev(new d6("Unexpected HTTP client error",{cause:a}))}})}}let e4=/^(application|text)\/([^+]+\+)*json.*/,e5=/^(application|text)\/([^+]+\+)*(jsonl|x-ndjson)\b.*/;async function e6(a,b){if(!a)return;let c=b.headers.get("content-type"),d=(null==c?void 0:c.split(";")[0])||"";for(let[c,d]of(a.group(`> Request: ${b.method} ${b.url}`),a.group("Headers:"),b.headers.entries()))a.log(`${c}: ${d}`);switch(a.groupEnd(),a.group("Body:"),!0){case e4.test(d):a.log(await b.clone().json());break;case d.startsWith("text/"):a.log(await b.clone().text());break;case"multipart/form-data"===d:for(let[c,d]of(await b.clone().formData())){let b=d instanceof Blob?"<Blob>":d;a.log(`${c}: ${b}`)}break;default:a.log(`<${c}>`)}a.groupEnd(),a.groupEnd()}async function e7(a,b,c){if(!a)return;let d=b.headers.get("content-type"),e=(null==d?void 0:d.split(";")[0])||"";for(let[d,e]of(a.group(`< Response: ${c.method} ${c.url}`),a.log("Status Code:",b.status,b.statusText),a.group("Headers:"),b.headers.entries()))a.log(`${d}: ${e}`);switch(a.groupEnd(),a.group("Body:"),!0){case eO(b,"application/json")||e4.test(e)&&!e5.test(e):a.log(await b.clone().json());break;case eO(b,"application/jsonl")||e5.test(e):case eO(b,"text/event-stream"):a.log(`<${d}>`);break;case eO(b,"text/*"):a.log(await b.clone().text());break;case eO(b,"multipart/form-data"):for(let[c,d]of(await b.clone().formData())){let b=d instanceof Blob?"<Blob>":d;a.log(`${c}: ${b}`)}break;default:a.log(`<${d}>`)}a.groupEnd(),a.groupEnd()}class e8 extends eb{constructor(a,b){a&&(a+=": "),a+=`Status ${b.response.status}`;const c=b.response.headers.get("content-type")||'""';"application/json"!==c&&(a+=` Content-Type ${c.includes(" ")?`"${c}"`:c}`);const d=b.body||'""';a+=d.length>100?"\n":". ";let e=d;if(d.length>1e4){const a=d.substring(0,1e4),b=d.length-1e4;e=`${a}...and ${b} more chars`}a+=`Body: ${e}`,super(a=a.trim(),b),this.name="GoogleGenAiDefaultError"}}function e9(a){try{return JSON.parse(a)}catch(b){return a}}class fa extends ReadableStream{constructor(a,b,c){var d;const e=a.getReader();let f=new Uint8Array(4096),g=0,h=0;const i={eventId:void 0},j=null==(d=null==c?void 0:c.dataRequired)||d;super({async pull(a){try{for(;;){let c=function(a,b,c){for(let d=c;d<b;d++)if(13===a[d]||10===a[d])for(let c of fb){if(d+c.length>b)continue;let e=!0;for(let b=0;b<c.length;b++)if(a[d+b]!==c[b]){e=!1;break}if(e)return{index:d,length:c.length}}return null}(f,g,h);if(!c){h=Math.max(0,g-fc+1);let b=await e.read();if(b.done)return a.close();if(g+b.value.length>f.length){let a=new Uint8Array(Math.max(2*f.length,g+b.value.length));a.set(f.subarray(0,g)),f=a}f.set(b.value,g),g+=b.value.length;continue}let d=f.slice(0,c.index);if(f.copyWithin(0,c.index+c.length,g),g-=c.index+c.length,f.length>4096&&g<=f.length>>2){let a=new Uint8Array(Math.max(4096,2*g));a.set(f.subarray(0,g)),f=a}h=0;let k=function(a,b,c,d){let e=new TextDecoder().decode(a).split(/\r\n|\r|\n/),f=[],g={},h=!0;for(let a of e){if(!a||a.startsWith(":"))continue;h=!1;let b=a.indexOf(":"),d=a,e="";b>0&&(d=a.slice(0,b),e=" "===a[b+1]?a.slice(b+2):a.slice(b+1)),"data"===d?f.push(e):"event"===d?g.event=e:"id"!==d||e.includes("\0")?"retry"===d&&/^\d+$/.test(e)&&(g.retry=Number(e)):c.eventId=e}if(!h){if(g.id=c.eventId,f.length)g.data=f.join("\n");else if(d)return;return b(g)}}(d,b,i,j);if(k&&!k.done)return a.enqueue(k.value);if(null==k?void 0:k.done)return await e.cancel("done"),a.close()}}catch(b){a.error(b),await e.cancel(b)}},cancel:a=>e.cancel(a)})}[Symbol.asyncIterator](a){let b=ReadableStream.prototype[Symbol.asyncIterator];if("function"==typeof b)return b.call(this,a);let c=this.getReader(),d={next:async()=>{let a=await c.read();return a.done?(c.releaseLock(),{done:!0,value:void 0}):{done:!1,value:a.value}},throw:async a=>(await c.cancel(a),c.releaseLock(),{done:!0,value:void 0}),return:async()=>(await c.cancel("done"),c.releaseLock(),{done:!0,value:void 0}),[Symbol.asyncIterator](){return this}},e=Symbol.asyncDispose;return e&&(d[e]=async()=>{var a;await (null==(a=d.return)?void 0:a.call(d))}),d}values(a){return this[Symbol.asyncIterator](a)}}let fb=[[13,10,13,10],[13,10,13],[13,10,10],[13,13,10],[10,13,10],[13,13],[10,13],[10,10]],fc=fb.reduce((a,b)=>Math.max(a,b.length),0),fd={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function fe(a,b,c){return Object.assign(Object.assign({},c),{err:!0,enc:"json",codes:a,errorClass:b})}function ff(a,b){return Object.assign(Object.assign({},b),{enc:"json",codes:a})}function fg(a,b,c){return Object.assign(Object.assign(Object.assign({},c),{enc:"sse",codes:a}),b?{sse:b}:{})}function fh(a){return{enc:"fail",codes:a}}function fi(...a){return async function(b,c,d){let e,f,g;for(let c of a){let{codes:a}=c,d="ctype"in c?c.ctype:fd[c.enc];if(d&&eQ(b,a)&&eO(b,d)||!d&&eQ(b,a)){f=c;break}}if(!f)return[{ok:!1,error:new e8("Unexpected Status or Content-Type",{response:b,request:c,body:await b.text().catch(()=>"")})},e];let h=f.enc,i="";switch(h){case"json":i=await b.text();try{e=JSON.parse(i)}catch(a){if(!("err"in f))throw a;e=i}break;case"jsonl":case"stream":e=b.body;break;case"bytes":e=new Uint8Array(await b.arrayBuffer());break;case"text":case"fail":e=i=await b.text();break;case"sse":if(b.body){let a="sse"in f&&f.sse||{};e=function(a,b={}){var c,d;let e=!0===b.flattened,f=null!=(c=b.sentinel)?c:"";return new fa(a,a=>""!==f&&a.data===f?{done:!0,value:void 0}:e?{done:!1,value:null==a.data?void 0:e9(a.data)}:{done:!1,value:Object.assign(Object.assign({},a),{data:null==a.data?a.data:e9(a.data)})},{dataRequired:null==(d=b.dataRequired)||d})}(b.body,a)}else e=null;break;case"nil":i=await b.text(),e=void 0;break;default:throw Error(`Unsupported response type: ${h}`)}if("fail"===f.enc)return[{ok:!1,error:new e8("API error occurred",{request:c,response:b,body:i})},e];let j=f.key||(null==d?void 0:d.resultKey),k=f.hdrs?{headers:function(a){let b={};for(let[c,d]of a.entries())b[c]=d.split(fj);return b}(b.headers)}:null;return(g="err"in f?Object.assign(Object.assign(Object.assign({},null==d?void 0:d.extraFields),k),eB(e)?e:null):j?Object.assign(Object.assign(Object.assign({},null==d?void 0:d.extraFields),k),{[j]:e}):f.hdrs?Object.assign(Object.assign(Object.assign({},null==d?void 0:d.extraFields),k),eB(e)?e:null):e,"err"in f)?[{ok:!1,error:f.errorClass?new f.errorClass(g,{request:c,response:b,body:i}):g},e]:[{ok:!0,value:g},e]}}let fj=/, */;(ay=bI||(bI={})).Incomplete="incomplete",ay.UnrecognisedSecurityType="unrecognized_security_type";class fk extends Error{constructor(a,b){super(b),this.code=a,this.name="SecurityError"}static incomplete(){return new fk(bI.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(a){return new fk(bI.UnrecognisedSecurityType,`Unrecognised security type: ${a}`)}}function fl(a,b){var c,d;return function(...a){let b={basic:{},headers:{},queryParams:{},cookies:{},oauth2:{type:"none"}},c=a.find(a=>a.every(a=>{if(null==a.value)return!1;if("http:basic"===a.type)return null!=a.value.username||null!=a.value.password;if("http:custom"===a.type)return null;if("oauth2:password"===a.type)return"string"==typeof a.value&&!!a.value;if("oauth2:client_credentials"===a.type)return"string"==typeof a.value?!!a.value:null!=a.value.client_id||null!=a.value.client_secret;else if("string"==typeof a.value)return!!a.value;else throw Error(`Unrecognized security type: ${a.type} (value type: ${typeof a.value})`)}));return null==c?null:(c.forEach(a=>{if(null==a.value)return;let{type:c}=a;switch(c){case"apiKey:header":b.headers[a.fieldName]=a.value;break;case"apiKey:query":b.queryParams[a.fieldName]=a.value;break;case"apiKey:cookie":b.cookies[a.fieldName]=a.value;break;case"http:basic":var d,e;d=b,null!=(e=a).value&&(d.basic=e.value);break;case"http:custom":case"oauth2:client_credentials":break;case"http:bearer":case"oauth2":case"oauth2:password":case"openIdConnect":!function(a,b){if("string"!=typeof b.value||!b.value)return;let c=b.value;"bearer "!==c.slice(0,7).toLowerCase()&&(c=`Bearer ${c}`),void 0!==b.fieldName&&(a.headers[b.fieldName]=c)}(b,a);break;default:throw fk.unrecognizedType(c)}}),b)}([{fieldName:"apiKey",type:"http:custom",value:null!=(c=null==a?void 0:a.api_key)?c:dY().GOOGLE_GENAI_API_KEY},{fieldName:"accessToken",type:"http:custom",value:null!=(d=null==a?void 0:a.access_token)?d:dY().GOOGLE_GENAI_ACCESS_TOKEN},{fieldName:"defaultHeaders",type:"http:custom",value:null==a?void 0:a.default_headers}])}async function fm(a){if(null!=a)return"function"==typeof a?a():a}class fn{constructor(a,b){this[bJ]="APIPromise",this._promise=a instanceof Promise?a:Promise.resolve(a),this._unwrapped=a instanceof Promise?null:Promise.resolve(a[0]),this._callSource=null!=b?b:null}_getUnwrapped(){var a;return null!=(a=this._unwrapped)?a:this._unwrapped=this._promise.then(([a])=>a)}then(a,b){return this._promise.then(a?([b])=>a(b):void 0,b)}catch(a){return this._getUnwrapped().catch(a)}finally(a){return this._getUnwrapped().finally(a)}$inspect(){return this._promise}asResponse(){var a;return(null!=(a=this._callSource)?a:this._callSource=this._promise.then(([,a])=>a)).then(a=>{if(!a.response)throw Error("APIPromise.asResponse: response unavailable");return a.response})}async withResponse(){let[[a],b]=await Promise.all([this._promise,this.asResponse()]);return{data:a,response:b}}_thenUnwrap(a){var b;let c=this._promise.then(([b,c])=>[a(b),c]);return c.catch(()=>{}),new fn(c,null!=(b=this._callSource)?b:void 0)}}function fo(a){let b=a.$inspect(),c=b.then(([a,b])=>{if(!a.ok)throw a.error;return[a.value,b]}),d=b.then(([a,b])=>{var c;if(!a.ok&&!(null==(c=b.response)?void 0:c.ok))throw a.error;return b});return c.catch(()=>{}),d.catch(()=>{}),new fn(c,d)}async function fp(a,b,c,d){var e,f;let g=eD("body",b,{explode:!0}),h={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"})},i=ey("/{api_version}/agents")(h),j=new Headers(eA({"Content-Type":"application/json",Accept:"application/json"})),k=fl(await fm(a._options.security)),l={options:a._options,base_url:null!=(f=null!=(e=null==d?void 0:d.server_url)?e:a._baseURL)?f:"",operation_id:"CreateAgent",o_auth2_scopes:null,resolved_security:k,security_source:a._options.security,retry_config:(null==d?void 0:d.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==d?void 0:d.retry_codes)||["408","409","429","5XX"]},m=a._createRequest(l,{security:k,method:"POST",baseURL:null==d?void 0:d.server_url,path:i,headers:j,body:g,userAgent:a._options.user_agent,timeout_ms:(null==d?void 0:d.timeout_ms)||a._options.timeout_ms||-1},d);if(!m.ok)return[m,{status:"invalid"}];let n=m.value,o=await a._do(n,{context:l,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:l.retry_config,retryCodes:l.retry_codes});if(!o.ok)return[o,{status:"request-error",request:n}];let p=o.value,[q]=await fi(fh("4XX"),fh("5XX"),ff("default"))(p,n);return!q.ok,[q,{status:"complete",request:n,response:p}]}async function fq(a,b,c,d){var e,f;let g={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"}),id:eE("id",b,{explode:!1,charEncoding:"percent"})},h=ey("/{api_version}/agents/{id}")(g),i=new Headers(eA({Accept:"application/json"})),j=fl(await fm(a._options.security)),k={options:a._options,base_url:null!=(f=null!=(e=null==d?void 0:d.server_url)?e:a._baseURL)?f:"",operation_id:"DeleteAgent",o_auth2_scopes:null,resolved_security:j,security_source:a._options.security,retry_config:(null==d?void 0:d.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==d?void 0:d.retry_codes)||["408","409","429","5XX"]},l=a._createRequest(k,{security:j,method:"DELETE",baseURL:null==d?void 0:d.server_url,path:h,headers:i,body:null,userAgent:a._options.user_agent,timeout_ms:(null==d?void 0:d.timeout_ms)||a._options.timeout_ms||-1},d);if(!l.ok)return[l,{status:"invalid"}];let m=l.value,n=await a._do(m,{context:k,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:k.retry_config,retryCodes:k.retry_codes});if(!n.ok)return[n,{status:"request-error",request:m}];let o=n.value,[p]=await fi(fh("4XX"),fh("5XX"),ff("default"))(o,m);return!p.ok,[p,{status:"complete",request:m,response:o}]}async function fr(a,b,c,d){var e,f;let g={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"}),id:eE("id",b,{explode:!1,charEncoding:"percent"})},h=ey("/{api_version}/agents/{id}")(g),i=new Headers(eA({Accept:"application/json"})),j=fl(await fm(a._options.security)),k={options:a._options,base_url:null!=(f=null!=(e=null==d?void 0:d.server_url)?e:a._baseURL)?f:"",operation_id:"GetAgent",o_auth2_scopes:null,resolved_security:j,security_source:a._options.security,retry_config:(null==d?void 0:d.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==d?void 0:d.retry_codes)||["408","409","429","5XX"]},l=a._createRequest(k,{security:j,method:"GET",baseURL:null==d?void 0:d.server_url,path:h,headers:i,body:null,userAgent:a._options.user_agent,timeout_ms:(null==d?void 0:d.timeout_ms)||a._options.timeout_ms||-1},d);if(!l.ok)return[l,{status:"invalid"}];let m=l.value,n=await a._do(m,{context:k,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:k.retry_config,retryCodes:k.retry_codes});if(!n.ok)return[n,{status:"request-error",request:m}];let o=n.value,[p]=await fi(fh("4XX"),fh("5XX"),ff("default"))(o,m);return!p.ok,[p,{status:"complete",request:m,response:o}]}async function fs(a,b,c,d,e,f){var g,h,i;let j={api_version:b,page_size:c,page_token:d,parent:e},k={api_version:eE("api_version",null!=(g=null==j?void 0:j.api_version)?g:a._options.api_version,{explode:!1,charEncoding:"percent"})},l=ey("/{api_version}/agents")(k),m=eK({page_size:null==j?void 0:j.page_size,page_token:null==j?void 0:j.page_token,parent:null==j?void 0:j.parent}),n=new Headers(eA({Accept:"application/json"})),o=fl(await fm(a._options.security)),p={options:a._options,base_url:null!=(i=null!=(h=null==f?void 0:f.server_url)?h:a._baseURL)?i:"",operation_id:"ListAgents",o_auth2_scopes:null,resolved_security:o,security_source:a._options.security,retry_config:(null==f?void 0:f.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==f?void 0:f.retry_codes)||["408","409","429","5XX"]},q=a._createRequest(p,{security:o,method:"GET",baseURL:null==f?void 0:f.server_url,path:l,headers:n,query:m,body:null,userAgent:a._options.user_agent,timeout_ms:(null==f?void 0:f.timeout_ms)||a._options.timeout_ms||-1},f);if(!q.ok)return[q,{status:"invalid"}];let r=q.value,s=await a._do(r,{context:p,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:p.retry_config,retryCodes:p.retry_codes});if(!s.ok)return[s,{status:"request-error",request:r}];let t=s.value,[u]=await fi(fh("4XX"),fh("5XX"),ff("default"))(t,r);return!u.ok,[u,{status:"complete",request:r,response:t}]}bJ=Symbol.toStringTag;class ft extends e3{create(a,b){let{api_version:c}=a;return fo(new fn(fp(this,c4(a,["api_version"]),c,b)))}list(a,b){var c,d,e;return fo((c=null==a?void 0:a.api_version,d=null==a?void 0:a.page_size,e=null==a?void 0:a.page_token,new fn(fs(this,c,d,e,null==a?void 0:a.parent,b))))}get(a,b,c){return fo(new fn(fr(this,a,null==b?void 0:b.api_version,c)))}delete(a,b,c){return fo(new fn(fq(this,a,null==b?void 0:b.api_version,c)))}}class fu extends eb{constructor(a,b){var c;super((null==(c=a.error)?void 0:c.message)||`API error occurred: ${JSON.stringify(a)}`,b),this.data$=a,this.error=a.error,this.name="CancelInteractionByIdServerError"}}class fv extends eb{constructor(a,b){var c;super((null==(c=a.error)?void 0:c.message)||`API error occurred: ${JSON.stringify(a)}`,b),this.data$=a,this.error=a.error,this.name="CancelInteractionByIdClientError"}}class fw extends eb{constructor(a,b){var c;super((null==(c=a.error)?void 0:c.message)||`API error occurred: ${JSON.stringify(a)}`,b),this.data$=a,this.error=a.error,this.name="CreateInteractionServerError"}}class fx extends eb{constructor(a,b){var c;super((null==(c=a.error)?void 0:c.message)||`API error occurred: ${JSON.stringify(a)}`,b),this.data$=a,this.error=a.error,this.name="CreateInteractionClientError"}}class fy extends eb{constructor(a,b){var c;super((null==(c=a.error)?void 0:c.message)||`API error occurred: ${JSON.stringify(a)}`,b),this.data$=a,this.error=a.error,this.name="DeleteInteractionServerError"}}class fz extends eb{constructor(a,b){var c;super((null==(c=a.error)?void 0:c.message)||`API error occurred: ${JSON.stringify(a)}`,b),this.data$=a,this.error=a.error,this.name="DeleteInteractionClientError"}}class fA extends eb{constructor(a,b){var c;super((null==(c=a.error)?void 0:c.message)||`API error occurred: ${JSON.stringify(a)}`,b),this.data$=a,this.error=a.error,this.name="GetInteractionByIdServerError"}}class fB extends eb{constructor(a,b){var c;super((null==(c=a.error)?void 0:c.message)||`API error occurred: ${JSON.stringify(a)}`,b),this.data$=a,this.error=a.error,this.name="GetInteractionByIdClientError"}}async function fC(a,b,c,d){var e,f;let g={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"}),id:eE("id",b,{explode:!1,charEncoding:"percent"})},h=ey("/{api_version}/interactions/{id}/cancel")(g),i=new Headers(eA({Accept:"application/json"})),j=fl(await fm(a._options.security)),k={options:a._options,base_url:null!=(f=null!=(e=null==d?void 0:d.server_url)?e:a._baseURL)?f:"",operation_id:"cancelInteractionById",o_auth2_scopes:null,resolved_security:j,security_source:a._options.security,retry_config:(null==d?void 0:d.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==d?void 0:d.retry_codes)||["408","409","429","5XX"]},l=a._createRequest(k,{security:j,method:"POST",baseURL:null==d?void 0:d.server_url,path:h,headers:i,body:null,userAgent:a._options.user_agent,timeout_ms:(null==d?void 0:d.timeout_ms)||a._options.timeout_ms||-1},d);if(!l.ok)return[l,{status:"invalid"}];let m=l.value,n=await a._do(m,{context:k,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:k.retry_config,retryCodes:k.retry_codes});if(!n.ok)return[n,{status:"request-error",request:m}];let o=n.value,[p]=await fi(ff(200),fe("4XX",fv),fe("5XX",fu))(o,m,{extraFields:{httpMeta:{response:o,request:m}}});return!p.ok,[p,{status:"complete",request:m,response:o}]}async function fD(a,b,c,d){var e,f,g,h;let i={body:b,api_version:c},j=eD("body",i.body,{explode:!0}),k={api_version:eE("api_version",null!=(e=i.api_version)?e:a._options.api_version,{explode:!1,charEncoding:"percent"})},l=ey("/{api_version}/interactions")(k),m=new Headers(eA({"Content-Type":"application/json",Accept:(null==(f=null==i?void 0:i.body)?void 0:f.stream)?"text/event-stream":"application/json"})),n=fl(await fm(a._options.security)),o={options:a._options,base_url:null!=(h=null!=(g=null==d?void 0:d.server_url)?g:a._baseURL)?h:"",operation_id:"CreateInteraction",o_auth2_scopes:null,resolved_security:n,security_source:a._options.security,retry_config:(null==d?void 0:d.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==d?void 0:d.retry_codes)||["408","409","429","5XX"]},p=a._createRequest(o,{security:n,method:"POST",baseURL:null==d?void 0:d.server_url,path:l,headers:m,body:j,userAgent:a._options.user_agent,timeout_ms:(null==d?void 0:d.timeout_ms)||a._options.timeout_ms||-1},d);if(!p.ok)return[p,{status:"invalid"}];let q=p.value,r=await a._do(q,{context:o,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:o.retry_config,retryCodes:o.retry_codes});if(!r.ok)return[r,{status:"request-error",request:q}];let s=r.value,[t]=await fi(ff(200),fg(200,{sentinel:"[DONE]",flattened:!0}),fe("4XX",fx),fe("5XX",fw))(s,q,{extraFields:{httpMeta:{response:s,request:q}}});return!t.ok,[t,{status:"complete",request:q,response:s}]}async function fE(a,b,c,d){var e,f;let g={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"}),id:eE("id",b,{explode:!1,charEncoding:"percent"})},h=ey("/{api_version}/interactions/{id}")(g),i=new Headers(eA({Accept:"application/json"})),j=fl(await fm(a._options.security)),k={options:a._options,base_url:null!=(f=null!=(e=null==d?void 0:d.server_url)?e:a._baseURL)?f:"",operation_id:"deleteInteraction",o_auth2_scopes:null,resolved_security:j,security_source:a._options.security,retry_config:(null==d?void 0:d.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==d?void 0:d.retry_codes)||["408","409","429","5XX"]},l=a._createRequest(k,{security:j,method:"DELETE",baseURL:null==d?void 0:d.server_url,path:h,headers:i,body:null,userAgent:a._options.user_agent,timeout_ms:(null==d?void 0:d.timeout_ms)||a._options.timeout_ms||-1},d);if(!l.ok)return[l,{status:"invalid"}];let m=l.value,n=await a._do(m,{context:k,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:k.retry_config,retryCodes:k.retry_codes});if(!n.ok)return[n,{status:"request-error",request:m}];let o=n.value,[p]=await fi(Object.assign(Object.assign({},void 0),{enc:"nil",codes:200}),fe("4XX",fz),fe("5XX",fy))(o,m,{extraFields:{httpMeta:{response:o,request:m}}});return!p.ok,[p,{status:"complete",request:m,response:o}]}async function fF(a,b,c,d,e,f,g){var h,i,j;let k={id:b,stream:c,last_event_id:d,include_input:e,api_version:f},l={api_version:eE("api_version",null!=(h=k.api_version)?h:a._options.api_version,{explode:!1,charEncoding:"percent"}),id:eE("id",k.id,{explode:!1,charEncoding:"percent"})},m=ey("/{api_version}/interactions/{id}")(l),n=eK({include_input:k.include_input,last_event_id:k.last_event_id,stream:k.stream}),o=new Headers(eA({Accept:(null==k?void 0:k.stream)?"text/event-stream":"application/json"})),p=fl(await fm(a._options.security)),q={options:a._options,base_url:null!=(j=null!=(i=null==g?void 0:g.server_url)?i:a._baseURL)?j:"",operation_id:"getInteractionById",o_auth2_scopes:null,resolved_security:p,security_source:a._options.security,retry_config:(null==g?void 0:g.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==g?void 0:g.retry_codes)||["408","409","429","5XX"]},r=a._createRequest(q,{security:p,method:"GET",baseURL:null==g?void 0:g.server_url,path:m,headers:o,query:n,body:null,userAgent:a._options.user_agent,timeout_ms:(null==g?void 0:g.timeout_ms)||a._options.timeout_ms||-1},g);if(!r.ok)return[r,{status:"invalid"}];let s=r.value,t=await a._do(s,{context:q,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:q.retry_config,retryCodes:q.retry_codes});if(!t.ok)return[t,{status:"request-error",request:s}];let u=t.value,[v]=await fi(ff(200),fg(200,{sentinel:"[DONE]",flattened:!0}),fe("4XX",fB),fe("5XX",fA))(u,s,{extraFields:{httpMeta:{response:u,request:s}}});return!v.ok,[v,{status:"complete",request:s,response:u}]}class fG extends e3{create(a,b){let{api_version:c}=a;return fo(new fn(fD(this,c4(a,["api_version"]),c,b)))}get(a,b,c){var d,e,f;return fo((d=null==b?void 0:b.stream,e=null==b?void 0:b.last_event_id,f=null==b?void 0:b.include_input,new fn(fF(this,a,d,e,f,null==b?void 0:b.api_version,c))))}delete(a,b,c){return fo(new fn(fE(this,a,null==b?void 0:b.api_version,c)))}cancel(a,b,c){return fo(new fn(fC(this,a,null==b?void 0:b.api_version,c)))}}async function fH(a,b,c,d){var e,f;let g=eD("body",b,{explode:!0}),h={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"})},i=ey("/{api_version}/webhooks")(h),j=new Headers(eA({"Content-Type":"application/json",Accept:"application/json"})),k=fl(await fm(a._options.security)),l={options:a._options,base_url:null!=(f=null!=(e=null==d?void 0:d.server_url)?e:a._baseURL)?f:"",operation_id:"CreateWebhook",o_auth2_scopes:null,resolved_security:k,security_source:a._options.security,retry_config:(null==d?void 0:d.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==d?void 0:d.retry_codes)||["408","409","429","5XX"]},m=a._createRequest(l,{security:k,method:"POST",baseURL:null==d?void 0:d.server_url,path:i,headers:j,body:g,userAgent:a._options.user_agent,timeout_ms:(null==d?void 0:d.timeout_ms)||a._options.timeout_ms||-1},d);if(!m.ok)return[m,{status:"invalid"}];let n=m.value,o=await a._do(n,{context:l,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:l.retry_config,retryCodes:l.retry_codes});if(!o.ok)return[o,{status:"request-error",request:n}];let p=o.value,[q]=await fi(fh("4XX"),fh("5XX"),ff("default"))(p,n);return!q.ok,[q,{status:"complete",request:n,response:p}]}async function fI(a,b,c,d){var e,f;let g={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"}),id:eE("id",b,{explode:!1,charEncoding:"percent"})},h=ey("/{api_version}/webhooks/{id}")(g),i=new Headers(eA({Accept:"application/json"})),j=fl(await fm(a._options.security)),k={options:a._options,base_url:null!=(f=null!=(e=null==d?void 0:d.server_url)?e:a._baseURL)?f:"",operation_id:"DeleteWebhook",o_auth2_scopes:null,resolved_security:j,security_source:a._options.security,retry_config:(null==d?void 0:d.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==d?void 0:d.retry_codes)||["408","409","429","5XX"]},l=a._createRequest(k,{security:j,method:"DELETE",baseURL:null==d?void 0:d.server_url,path:h,headers:i,body:null,userAgent:a._options.user_agent,timeout_ms:(null==d?void 0:d.timeout_ms)||a._options.timeout_ms||-1},d);if(!l.ok)return[l,{status:"invalid"}];let m=l.value,n=await a._do(m,{context:k,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:k.retry_config,retryCodes:k.retry_codes});if(!n.ok)return[n,{status:"request-error",request:m}];let o=n.value,[p]=await fi(fh("4XX"),fh("5XX"),ff("default"))(o,m);return!p.ok,[p,{status:"complete",request:m,response:o}]}async function fJ(a,b,c,d){var e,f;let g={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"}),id:eE("id",b,{explode:!1,charEncoding:"percent"})},h=ey("/{api_version}/webhooks/{id}")(g),i=new Headers(eA({Accept:"application/json"})),j=fl(await fm(a._options.security)),k={options:a._options,base_url:null!=(f=null!=(e=null==d?void 0:d.server_url)?e:a._baseURL)?f:"",operation_id:"GetWebhook",o_auth2_scopes:null,resolved_security:j,security_source:a._options.security,retry_config:(null==d?void 0:d.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==d?void 0:d.retry_codes)||["408","409","429","5XX"]},l=a._createRequest(k,{security:j,method:"GET",baseURL:null==d?void 0:d.server_url,path:h,headers:i,body:null,userAgent:a._options.user_agent,timeout_ms:(null==d?void 0:d.timeout_ms)||a._options.timeout_ms||-1},d);if(!l.ok)return[l,{status:"invalid"}];let m=l.value,n=await a._do(m,{context:k,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:k.retry_config,retryCodes:k.retry_codes});if(!n.ok)return[n,{status:"request-error",request:m}];let o=n.value,[p]=await fi(fh("4XX"),fh("5XX"),ff("default"))(o,m);return!p.ok,[p,{status:"complete",request:m,response:o}]}async function fK(a,b,c,d,e){var f,g,h;let i={api_version:b,page_size:c,page_token:d},j={api_version:eE("api_version",null!=(f=null==i?void 0:i.api_version)?f:a._options.api_version,{explode:!1,charEncoding:"percent"})},k=ey("/{api_version}/webhooks")(j),l=eK({page_size:null==i?void 0:i.page_size,page_token:null==i?void 0:i.page_token}),m=new Headers(eA({Accept:"application/json"})),n=fl(await fm(a._options.security)),o={options:a._options,base_url:null!=(h=null!=(g=null==e?void 0:e.server_url)?g:a._baseURL)?h:"",operation_id:"ListWebhooks",o_auth2_scopes:null,resolved_security:n,security_source:a._options.security,retry_config:(null==e?void 0:e.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==e?void 0:e.retry_codes)||["408","409","429","5XX"]},p=a._createRequest(o,{security:n,method:"GET",baseURL:null==e?void 0:e.server_url,path:k,headers:m,query:l,body:null,userAgent:a._options.user_agent,timeout_ms:(null==e?void 0:e.timeout_ms)||a._options.timeout_ms||-1},e);if(!p.ok)return[p,{status:"invalid"}];let q=p.value,r=await a._do(q,{context:o,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:o.retry_config,retryCodes:o.retry_codes});if(!r.ok)return[r,{status:"request-error",request:q}];let s=r.value,[t]=await fi(fh("4XX"),fh("5XX"),ff("default"))(s,q);return!t.ok,[t,{status:"complete",request:q,response:s}]}async function fL(a,b,c,d,e){var f,g;let h=eD("body",d,{explode:!0}),i={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"}),id:eE("id",b,{explode:!1,charEncoding:"percent"})},j=ey("/{api_version}/webhooks/{id}:ping")(i),k=new Headers(eA({"Content-Type":"application/json",Accept:"application/json"})),l=fl(await fm(a._options.security)),m={options:a._options,base_url:null!=(g=null!=(f=null==e?void 0:e.server_url)?f:a._baseURL)?g:"",operation_id:"PingWebhook",o_auth2_scopes:null,resolved_security:l,security_source:a._options.security,retry_config:(null==e?void 0:e.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==e?void 0:e.retry_codes)||["408","409","429","5XX"]},n=a._createRequest(m,{security:l,method:"POST",baseURL:null==e?void 0:e.server_url,path:j,headers:k,body:h,userAgent:a._options.user_agent,timeout_ms:(null==e?void 0:e.timeout_ms)||a._options.timeout_ms||-1},e);if(!n.ok)return[n,{status:"invalid"}];let o=n.value,p=await a._do(o,{context:m,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:m.retry_config,retryCodes:m.retry_codes});if(!p.ok)return[p,{status:"request-error",request:o}];let q=p.value,[r]=await fi(fh("4XX"),fh("5XX"),ff("default"))(q,o);return!r.ok,[r,{status:"complete",request:o,response:q}]}async function fM(a,b,c,d,e){var f,g;let h=eD("body",d,{explode:!0}),i={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"}),id:eE("id",b,{explode:!1,charEncoding:"percent"})},j=ey("/{api_version}/webhooks/{id}:rotateSigningSecret")(i),k=new Headers(eA({"Content-Type":"application/json",Accept:"application/json"})),l=fl(await fm(a._options.security)),m={options:a._options,base_url:null!=(g=null!=(f=null==e?void 0:e.server_url)?f:a._baseURL)?g:"",operation_id:"RotateSigningSecret",o_auth2_scopes:null,resolved_security:l,security_source:a._options.security,retry_config:(null==e?void 0:e.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==e?void 0:e.retry_codes)||["408","409","429","5XX"]},n=a._createRequest(m,{security:l,method:"POST",baseURL:null==e?void 0:e.server_url,path:j,headers:k,body:h,userAgent:a._options.user_agent,timeout_ms:(null==e?void 0:e.timeout_ms)||a._options.timeout_ms||-1},e);if(!n.ok)return[n,{status:"invalid"}];let o=n.value,p=await a._do(o,{context:m,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:m.retry_config,retryCodes:m.retry_codes});if(!p.ok)return[p,{status:"request-error",request:o}];let q=p.value,[r]=await fi(fh("4XX"),fh("5XX"),ff("default"))(q,o);return!r.ok,[r,{status:"complete",request:o,response:q}]}async function fN(a,b,c,d,e,f){var g,h;let i=eD("body",e,{explode:!0}),j={api_version:eE("api_version",null!=c?c:a._options.api_version,{explode:!1,charEncoding:"percent"}),id:eE("id",b,{explode:!1,charEncoding:"percent"})},k=ey("/{api_version}/webhooks/{id}")(j),l=eK({update_mask:d}),m=new Headers(eA({"Content-Type":"application/json",Accept:"application/json"})),n=fl(await fm(a._options.security)),o={options:a._options,base_url:null!=(h=null!=(g=null==f?void 0:f.server_url)?g:a._baseURL)?h:"",operation_id:"UpdateWebhook",o_auth2_scopes:null,resolved_security:n,security_source:a._options.security,retry_config:(null==f?void 0:f.retries)||a._options.retry_config||{strategy:"attempt-count-backoff",backoff:{initialInterval:500,maxInterval:8e3,exponent:2,maxElapsedTime:3e4},retryConnectionErrors:!0,maxRetries:4},retry_codes:(null==f?void 0:f.retry_codes)||["408","409","429","5XX"]},p=a._createRequest(o,{security:n,method:"PATCH",baseURL:null==f?void 0:f.server_url,path:k,headers:m,query:l,body:i,userAgent:a._options.user_agent,timeout_ms:(null==f?void 0:f.timeout_ms)||a._options.timeout_ms||-1},f);if(!p.ok)return[p,{status:"invalid"}];let q=p.value,r=await a._do(q,{context:o,isErrorStatusCode:a=>eQ({status:a},["4XX","5XX"]),retryConfig:o.retry_config,retryCodes:o.retry_codes});if(!r.ok)return[r,{status:"request-error",request:q}];let s=r.value,[t]=await fi(fh("4XX"),fh("5XX"),ff("default"))(s,q);return!t.ok,[t,{status:"complete",request:q,response:s}]}class fO extends e3{create(a,b){let{api_version:c}=a;return fo(new fn(fH(this,c4(a,["api_version"]),c,b)))}list(a,b){var c,d;return fo((c=null==a?void 0:a.api_version,d=null==a?void 0:a.page_size,new fn(fK(this,c,d,null==a?void 0:a.page_token,b))))}get(a,b,c){return fo(new fn(fJ(this,a,null==b?void 0:b.api_version,c)))}update(a,b,c){let d=null!=b?b:{},{api_version:e,update_mask:f}=d,g=c4(d,["api_version","update_mask"]);return fo(new fn(fN(this,a,e,f,void 0===b||0===Object.keys(g).length?void 0:g,c)))}delete(a,b,c){return fo(new fn(fI(this,a,null==b?void 0:b.api_version,c)))}rotateSigningSecret(a,b,c,d){return fo(new fn(fM(this,a,b,c,d)))}ping(a,b,c,d){return fo(new fn(fL(this,a,b,c,d)))}}let fP=class extends e3{get interactions(){var a;return null!=(a=this._interactions)?a:this._interactions=new fG(this._options)}get webhooks(){var a;return null!=(a=this._webhooks)?a:this._webhooks=new fO(this._options)}get agents(){var a;return null!=(a=this._agents)?a:this._agents=new ft(this._options)}},fQ=new Set(["lyria-3-pro-preview","lyria-3-clip-preview"]);function fR(a,b={}){var c,d,e,f;let g,h,i;return new fP(Object.assign(Object.assign({},b),{api_version:null!=(c=b.api_version)?c:(g=a.getApiVersion().replace(/^\/+|\/+$/g,""),h=a.getProject(),i=a.getLocation(),a.isVertexAI()&&g&&h&&i?`${g}/projects/${encodeURIComponent(h)}/locations/${encodeURIComponent(i)}`:g),security:null!=(d=b.security)?d:new dZ({defaultHeaders:null==(e=a.getDefaultHeaders)?void 0:e.call(a),getAuthHeaders:b=>a.getAuthHeaders(b)}),server_url:null!=(f=b.server_url)?f:function(a){let b=a.getBaseUrl();if(!b)throw Error("Base URL must be set.");return b.replace(/\/+$/,"")}(a)}))}class fS{constructor(a){this.parentClient=a}async create(a,b){let{api_version:c}=a,d=c4(a,["api_version"]);return!0===d.stream?fZ(await fY(()=>this.getClient(c).interactions.create(Object.assign(Object.assign({},d),{stream:!0,api_version:c}),fV(b,!0)))):f$(await fX(new fn(fD(this.getClient(c),d,c,fV(b)))))}async get(a,b={},c){let{api_version:d,stream:e=!1,last_event_id:f,include_input:g}=null!=b?b:{};return!0===e?fZ(await fY(()=>this.getClient(d).interactions.get(a,{stream:e,last_event_id:f,include_input:g,api_version:d},fV(c,!0)))):f$(await fX(new fn(fF(this.getClient(d),a,e,f,g,d,fV(c)))))}async delete(a,b={},c){return fY(()=>this.getClient(null==b?void 0:b.api_version).interactions.delete(a,{api_version:null==b?void 0:b.api_version},fV(c)))}async cancel(a,b={},c){var d;return f$(await fX((d=this.getClient(null==b?void 0:b.api_version),new fn(fC(d,a,null==b?void 0:b.api_version,fV(c))))))}getClient(a){return a?fR(this.parentClient,{api_version:a}):(null!=this.sdk||(this.sdk=fR(this.parentClient)),this.sdk)}}class fT{constructor(a){this.parentClient=a}async create(a={},b){let c=null!=a?a:{},{api_version:d}=c,e=c4(c,["api_version"]);return fX(new fn(fp(this.getClient(d),e,d,fV(b))))}async list(a={},b){let{api_version:c,pageSize:d,pageToken:e,parent:f}=null!=a?a:{};return fX(new fn(fs(this.getClient(c),c,d,e,f,fV(b))))}async get(a,b={},c){var d;return fX((d=this.getClient(null==b?void 0:b.api_version),new fn(fr(d,a,null==b?void 0:b.api_version,fV(c)))))}async delete(a,b={},c){var d;return fX((d=this.getClient(null==b?void 0:b.api_version),new fn(fq(d,a,null==b?void 0:b.api_version,fV(c)))))}getClient(a){return a?fR(this.parentClient,{api_version:a}):(null!=this.sdk||(this.sdk=fR(this.parentClient)),this.sdk)}}class fU{constructor(a){this.parentClient=a}async create(a,b){let{api_version:c}=a,d=c4(a,["api_version"]);return fX(new fn(fH(this.getClient(),d,c,fV(b))))}async list(a={},b){let{api_version:c,page_size:d,page_token:e}=null!=a?a:{};return fX(new fn(fK(this.getClient(),c,d,e,fV(b))))}async get(a,b={},c){var d;return fX((d=this.getClient(),new fn(fJ(d,a,null==b?void 0:b.api_version,fV(c)))))}async update(a,b={},c){let d=null!=b?b:{},{api_version:e,update_mask:f}=d,g=c4(d,["api_version","update_mask"]);return fX(new fn(fN(this.getClient(),a,e,f,g,fV(c))))}async delete(a,b={},c){var d;return fX((d=this.getClient(),new fn(fI(d,a,null==b?void 0:b.api_version,fV(c)))))}async rotateSigningSecret(a,b={},c){let d=null!=b?b:{},{api_version:e}=d,f=c4(d,["api_version"]);return fX(new fn(fM(this.getClient(),a,e,f,fV(c))))}async ping(a,b,c){let{api_version:d,body:e}=null!=b?b:{};return fX(new fn(fL(this.getClient(),a,d,e,fV(c))))}getClient(){return null!=this.sdk||(this.sdk=fR(this.parentClient)),this.sdk}}function fV(a,b=!1){var c,d,e,f;if(!a&&!b)return;let g=null!=a?a:{},{timeout:h,maxRetries:i,defaultBaseURL:j,query:k,body:l,fetchOptions:m}=g,n=c4(g,["timeout","maxRetries","defaultBaseURL","query","body","fetchOptions"]),o=Object.assign({},n);f_(k)?o.extra_query=k:fW("query",k),f_(l)?o.extra_body=l:fW("body",l);let p=null!=(c=n.fetch_options)?c:m;p&&(o.fetch_options=p);let q=null!=(d=n.server_url)?d:j;q&&(o.server_url=q);let r=null!=(e=n.timeout_ms)?e:h;if(void 0!==r&&(o.timeout_ms=r),void 0!==i&&(o.retries={strategy:"attempt-count-backoff",retryConnectionErrors:!0,maxRetries:i}),b){let a=new Headers(null!=(f=o.headers)?f:null==p?void 0:p.headers);a.set("Accept","text/event-stream"),o.headers=a}return o}function fW(a,b){null!=b&&console.warn(`GoogleGenAI.interactions: request option ${a} is not supported by the Google GenAI interactions bridge and will be ignored.`)}async function fX(a){var b,c;let[d,e]=await a.$inspect();if(!d.ok)throw ep(d.error);return b=d.value,c=e,f_(b)&&"complete"===c.status?Object.assign(Object.assign({},b),{sdkHttpResponse:function(a,b){let c={};for(let[b,d]of a.headers.entries())c[b]=d;return{headers:c,responseInternal:a,json:async()=>b}}(c.response,b)}):b}async function fY(a){try{return await a()}catch(a){throw ep(a)}}function fZ(a){return new Proxy(a,{get(b,c){if(c!==Symbol.asyncIterator){let a=Reflect.get(b,c,b);return"function"==typeof a?a.bind(b):a}return function(){let b=a[Symbol.asyncIterator]();return{async next(...a){try{return await b.next(...a)}catch(a){throw ep(a)}},async return(a){if(!b.return)return{done:!0,value:a};try{return await b.return(a)}catch(a){throw ep(a)}},async throw(a){if(!b.throw)throw ep(a);try{return await b.throw(a)}catch(a){throw ep(a)}},[Symbol.asyncIterator](){return this}}}}})}function f$(a){let b=function(a){if(f_(a)){let b;if(Array.isArray(a.steps))return a;if("string"==typeof(b=a.model)&&fQ.has(b)){let b=a.outputs;if(Array.isArray(b)){let{outputs:c}=a;return Object.assign(Object.assign({},c4(a,["outputs"])),{steps:[{type:"model_output",content:b}]})}}return Object.assign(Object.assign({},a),{steps:[]})}}(a);return b?function(a){var b,c,d;let e,f,g,h=Object.assign(Object.assign({},d=a),{created:f0(d.created),updated:f0(d.updated)}),i=null!=(b=h.steps)?b:[],j=[],k=!1;a:for(let a=i.length-1;a>=0;a--){let b=i[a];if("user_input"===b.type)break;if("model_output"!==b.type||!b.content){if(k)break;continue}let d=b.content;for(let a=d.length-1;a>=0;a--){let b=d[a];if("text"===b.type)k=!0,j.push(null!=(c=b.text)?c:"");else if(k)break a}}for(let a=i.length-1;a>=0;a--){let b=i[a];if("user_input"===b.type)break;if("model_output"===b.type&&b.content)for(let a=b.content.length-1;a>=0;a--){let c=b.content[a];"image"!==c.type||e||(e=c),"audio"!==c.type||f||(f=c),"video"!==c.type||g||(g=c)}}let l=j.reverse().join("");return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},h),l&&{output_text:l}),e?{output_image:e}:{}),f?{output_audio:f}:{}),g?{output_video:g}:{})}(b):a}function f_(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function f0(a){return a instanceof Date?a.toISOString():a}let f1="x-goog-api-key",f2="https://www.googleapis.com/auth/cloud-platform";class f3{constructor(a){if(void 0!==a.apiKey){this.apiKey=a.apiKey;return}const b=function(a){let b;if(!a)return{scopes:[f2]};if((b=a).scopes){if("string"==typeof b.scopes&&b.scopes!==f2||Array.isArray(b.scopes)&&0>b.scopes.indexOf(f2))throw Error(`Invalid auth scopes. Scopes must include: ${f2}`)}else b.scopes=[f2];return b}(a.googleAuthOptions);this.googleAuth=new bL.GoogleAuth(b)}async addAuthHeaders(a,b){if(void 0!==this.apiKey){if(this.apiKey.startsWith("auth_tokens/"))throw Error("Ephemeral tokens are only supported by the live API.");this.addKeyHeader(a);return}return this.addGoogleAuthHeaders(a,b)}addKeyHeader(a){if(null===a.get(f1)){if(void 0===this.apiKey)throw Error("Trying to set API key header but apiKey is not set");a.append(f1,this.apiKey)}}async addGoogleAuthHeaders(a,b){if(void 0===this.googleAuth)throw Error("Trying to set google-auth headers but googleAuth is unset");for(let[c,d]of(await this.googleAuth.getRequestHeaders(b)))null===a.get(c)&&a.append(c,d)}}class f4{async download(a,b){if(a.downloadPath){let c=await f5(a,b);if(c instanceof b_){let b=(0,bM.createWriteStream)(a.downloadPath);bO.Readable.fromWeb(c.responseInternal.body).pipe(b),await (0,bP.finished)(b)}else try{await (0,bN.writeFile)(a.downloadPath,c,{encoding:"base64"})}catch(b){throw Error(`Failed to write file to ${a.downloadPath}: ${b}`)}}}}async function f5(a,b){var c,d,e;let f=cQ(a.file);if(void 0!==f)return await b.request({path:`files/${f}:download`,httpMethod:"GET",queryParams:{alt:"media"},httpOptions:null==(c=a.config)?void 0:c.httpOptions,abortSignal:null==(d=a.config)?void 0:d.abortSignal});if(cO(a.file)){let b=null==(e=a.file.video)?void 0:e.videoBytes;if("string"==typeof b)return b;throw Error("Failed to download generated video, Uri or videoBytes not found.")}if(cP(a.file)){let b=a.file.videoBytes;if("string"==typeof b)return b;throw Error("Failed to download video, Uri or videoBytes not found.")}throw Error("Unsupported file type")}class f6{create(a,b,c){return new f7(a,b,c)}}class f7{constructor(a,b,c){this.url=a,this.headers=b,this.callbacks=c}connect(){this.ws=new bQ(this.url,{headers:this.headers}),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(a){if(void 0===this.ws)throw Error("WebSocket is not connected");this.ws.send(a)}close(){if(void 0===this.ws)throw Error("WebSocket is not connected");this.ws.close()}}function f8(a,b){let c={},d=bV(a,["parts"]);if(null!=d){let a=d;Array.isArray(a)&&(a=a.map(a=>(function(a){let b={},c=bV(a,["mediaResolution"]);null!=c&&bU(b,["mediaResolution"],c);let d=bV(a,["codeExecutionResult"]);null!=d&&bU(b,["codeExecutionResult"],function(a){let b={},c=bV(a,["outcome"]);null!=c&&bU(b,["outcome"],c);let d=bV(a,["output"]);if(null!=d&&bU(b,["output"],d),void 0!==bV(a,["id"]))throw Error("id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(d));let e=bV(a,["executableCode"]);null!=e&&bU(b,["executableCode"],function(a){let b={},c=bV(a,["code"]);null!=c&&bU(b,["code"],c);let d=bV(a,["language"]);if(null!=d&&bU(b,["language"],d),void 0!==bV(a,["id"]))throw Error("id parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b}(e));let f=bV(a,["fileData"]);null!=f&&bU(b,["fileData"],f);let g=bV(a,["functionCall"]);null!=g&&bU(b,["functionCall"],g);let h=bV(a,["functionResponse"]);null!=h&&bU(b,["functionResponse"],h);let i=bV(a,["inlineData"]);null!=i&&bU(b,["inlineData"],i);let j=bV(a,["text"]);null!=j&&bU(b,["text"],j);let k=bV(a,["thought"]);null!=k&&bU(b,["thought"],k);let l=bV(a,["thoughtSignature"]);null!=l&&bU(b,["thoughtSignature"],l);let m=bV(a,["videoMetadata"]);if(null!=m&&bU(b,["videoMetadata"],m),void 0!==bV(a,["toolCall"]))throw Error("toolCall parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["toolResponse"]))throw Error("toolResponse parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");if(void 0!==bV(a,["partMetadata"]))throw Error("partMetadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.");return b})(a))),bU(c,["parts"],a)}let e=bV(a,["role"]);return null!=e&&bU(c,["role"],e),c}function f9(a,b){var c;let d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A={},B=bV(a,["adapterSize"]);null!=B&&bU(A,["adapterSize"],B);let C=bV(a,["epochCount"]);null!=C&&bU(A,["epochCount"],C);let D=bV(a,["learningRateMultiplier"]);null!=D&&bU(A,["learningRateMultiplier"],D);let E=bV(a,["generationConfig"]);null!=E&&bU(A,["generationConfig"],(d={},null!=(e=bV(c=E,["modelConfig"]))&&bU(d,["modelSelectionConfig"],e),null!=(f=bV(c,["responseJsonSchema"]))&&bU(d,["responseJsonSchema"],f),null!=(g=bV(c,["audioTimestamp"]))&&bU(d,["audioTimestamp"],g),null!=(h=bV(c,["candidateCount"]))&&bU(d,["candidateCount"],h),null!=(i=bV(c,["enableAffectiveDialog"]))&&bU(d,["enableAffectiveDialog"],i),null!=(j=bV(c,["frequencyPenalty"]))&&bU(d,["frequencyPenalty"],j),null!=(k=bV(c,["logprobs"]))&&bU(d,["logprobs"],k),null!=(l=bV(c,["maxOutputTokens"]))&&bU(d,["maxOutputTokens"],l),null!=(m=bV(c,["mediaResolution"]))&&bU(d,["mediaResolution"],m),null!=(n=bV(c,["presencePenalty"]))&&bU(d,["presencePenalty"],n),null!=(o=bV(c,["responseLogprobs"]))&&bU(d,["responseLogprobs"],o),null!=(p=bV(c,["responseMimeType"]))&&bU(d,["responseMimeType"],p),null!=(q=bV(c,["responseModalities"]))&&bU(d,["responseModalities"],q),null!=(r=bV(c,["responseSchema"]))&&bU(d,["responseSchema"],r),null!=(s=bV(c,["routingConfig"]))&&bU(d,["routingConfig"],s),null!=(t=bV(c,["seed"]))&&bU(d,["seed"],t),null!=(u=bV(c,["speechConfig"]))&&bU(d,["speechConfig"],u),null!=(v=bV(c,["stopSequences"]))&&bU(d,["stopSequences"],v),null!=(w=bV(c,["temperature"]))&&bU(d,["temperature"],w),null!=(x=bV(c,["thinkingConfig"]))&&bU(d,["thinkingConfig"],x),null!=(y=bV(c,["topK"]))&&bU(d,["topK"],y),null!=(z=bV(c,["topP"]))&&bU(d,["topP"],z),d));let F=bV(a,["learningRate"]);null!=F&&bU(A,["learningRate"],F);let G=bV(a,["batchSize"]);return null!=G&&bU(A,["batchSize"],G),A}function ga(a,b){let c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s={},t=bV(a,["sdkHttpResponse"]);null!=t&&bU(s,["sdkHttpResponse"],t);let u=bV(a,["name"]);null!=u&&bU(s,["name"],u);let v=bV(a,["state"]);null!=v&&bU(s,["state"],cN(v));let w=bV(a,["createTime"]);null!=w&&bU(s,["createTime"],w);let x=bV(a,["startTime"]);null!=x&&bU(s,["startTime"],x);let y=bV(a,["endTime"]);null!=y&&bU(s,["endTime"],y);let z=bV(a,["updateTime"]);null!=z&&bU(s,["updateTime"],z);let A=bV(a,["error"]);null!=A&&bU(s,["error"],A);let B=bV(a,["description"]);null!=B&&bU(s,["description"],B);let C=bV(a,["baseModel"]);null!=C&&bU(s,["baseModel"],C);let D=bV(a,["tunedModel"]);null!=D&&bU(s,["tunedModel"],D);let E=bV(a,["preTunedModel"]);null!=E&&bU(s,["preTunedModel"],E);let F=bV(a,["supervisedTuningSpec"]);null!=F&&bU(s,["supervisedTuningSpec"],F);let G=bV(a,["preferenceOptimizationSpec"]);null!=G&&bU(s,["preferenceOptimizationSpec"],G);let H=bV(a,["distillationSpec"]);null!=H&&bU(s,["distillationSpec"],(c={},null!=(d=bV(H,["promptDatasetUri"]))&&bU(c,["promptDatasetUri"],d),null!=(e=bV(H,["baseTeacherModel"]))&&bU(c,["baseTeacherModel"],e),null!=(f=bV(H,["hyperParameters"]))&&bU(c,["hyperParameters"],f9(f)),null!=(g=bV(H,["pipelineRootDirectory"]))&&bU(c,["pipelineRootDirectory"],g),null!=(h=bV(H,["studentModel"]))&&bU(c,["studentModel"],h),null!=(i=bV(H,["trainingDatasetUri"]))&&bU(c,["trainingDatasetUri"],i),null!=(j=bV(H,["tunedTeacherModelSource"]))&&bU(c,["tunedTeacherModelSource"],j),null!=(k=bV(H,["validationDatasetUri"]))&&bU(c,["validationDatasetUri"],k),null!=(l=bV(H,["tuningMode"]))&&bU(c,["tuningMode"],l),c));let I=bV(a,["reinforcementTuningSpec"]);null!=I&&bU(s,["reinforcementTuningSpec"],I);let J=bV(a,["tuningDataStats"]);null!=J&&bU(s,["tuningDataStats"],J);let K=bV(a,["encryptionSpec"]);null!=K&&bU(s,["encryptionSpec"],K);let L=bV(a,["partnerModelTuningSpec"]);null!=L&&bU(s,["partnerModelTuningSpec"],L);let M=bV(a,["customBaseModel"]);null!=M&&bU(s,["customBaseModel"],M);let N=bV(a,["evaluateDatasetRuns"]);if(null!=N){let a=N;Array.isArray(a)&&(a=a.map(a=>a)),bU(s,["evaluateDatasetRuns"],a)}let O=bV(a,["experiment"]);null!=O&&bU(s,["experiment"],O);let P=bV(a,["fullFineTuningSpec"]);null!=P&&bU(s,["fullFineTuningSpec"],P);let Q=bV(a,["labels"]);null!=Q&&bU(s,["labels"],Q);let R=bV(a,["outputUri"]);null!=R&&bU(s,["outputUri"],R);let S=bV(a,["pipelineJob"]);null!=S&&bU(s,["pipelineJob"],S);let T=bV(a,["serviceAccount"]);null!=T&&bU(s,["serviceAccount"],T);let U=bV(a,["tunedModelDisplayName"]);null!=U&&bU(s,["tunedModelDisplayName"],U);let V=bV(a,["tuningJobState"]);null!=V&&bU(s,["tuningJobState"],V);let W=bV(a,["veoTuningSpec"]);null!=W&&bU(s,["veoTuningSpec"],W);let X=bV(a,["tuningJobMetadata"]);null!=X&&bU(s,["tuningJobMetadata"],X);let Y=bV(a,["veoLoraTuningSpec"]);null!=Y&&bU(s,["veoLoraTuningSpec"],Y);let Z=bV(a,["distillationSamplingSpec"]);return null!=Z&&bU(s,["distillationSamplingSpec"],(m={},null!=(n=bV(Z,["baseTeacherModel"]))&&bU(m,["baseTeacherModel"],n),null!=(o=bV(Z,["tunedTeacherModelSource"]))&&bU(m,["tunedTeacherModelSource"],o),null!=(p=bV(Z,["validationDatasetUri"]))&&bU(m,["validationDatasetUri"],p),null!=(q=bV(Z,["promptDatasetUri"]))&&bU(m,["promptDatasetUri"],q),null!=(r=bV(Z,["hyperparameters"]))&&bU(m,["hyperparameters"],f9(r)),m)),s}function gb(a,b){let c={},d=bV(a,["gcsUri"]);null!=d&&bU(c,["validationDatasetUri"],d);let e=bV(a,["vertexDatasetResource"]);return null!=e&&bU(c,["validationDatasetUri"],e),c}class gc extends bS{constructor(a){super(),this.apiClient=a,this.list=async(a={})=>new c_(bH.PAGED_ITEM_TUNING_JOBS,a=>this.listInternal(a),await this.listInternal(a),a),this.get=async a=>await this.getInternal(a),this.tune=async a=>{var b;if(this.apiClient.isVertexAI())if(a.baseModel.startsWith("projects/")){let c={tunedModelName:a.baseModel};(null==(b=a.config)?void 0:b.preTunedModelCheckpointId)&&(c.checkpointId=a.config.preTunedModelCheckpointId);let d=Object.assign(Object.assign({},a),{preTunedModel:c});return d.baseModel=void 0,await this.tuneInternal(d)}else{let b=Object.assign({},a);return await this.tuneInternal(b)}{let b=Object.assign({},a),c=await this.tuneMldevInternal(b),d="";return void 0!==c.metadata&&void 0!==c.metadata.tunedModel?d=c.metadata.tunedModel:void 0!==c.name&&c.name.includes("/operations/")&&(d=c.name.split("/operations/")[0]),{name:d,state:a2.JOB_STATE_QUEUED}}}}async getInternal(a){var b,c,d,e;let f="",g={};if(this.apiClient.isVertexAI()){let d,e,h=(d={},null!=(e=bV(a,["name"]))&&bU(d,["_url","name"],e),d);return f=bT("{name}",h._url),g=h._query,delete h._url,delete h._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(h),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>ga(a))}{let b,c,h=(b={},null!=(c=bV(a,["name"]))&&bU(b,["_url","name"],c),b);return f=bT("{name}",h._url),g=h._query,delete h._url,delete h._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(h),httpMethod:"GET",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d,e,f,g,h,i,j,k,l,m,n,o;return b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),null!=(d=bV(a,["name"]))&&bU(b,["name"],d),null!=(e=bV(a,["state"]))&&bU(b,["state"],cN(e)),null!=(f=bV(a,["createTime"]))&&bU(b,["createTime"],f),null!=(g=bV(a,["tuningTask","startTime"]))&&bU(b,["startTime"],g),null!=(h=bV(a,["tuningTask","completeTime"]))&&bU(b,["endTime"],h),null!=(i=bV(a,["updateTime"]))&&bU(b,["updateTime"],i),null!=(j=bV(a,["description"]))&&bU(b,["description"],j),null!=(k=bV(a,["baseModel"]))&&bU(b,["baseModel"],k),null!=(l=bV(a,["_self"]))&&bU(b,["tunedModel"],(m={},null!=(n=bV(l,["name"]))&&bU(m,["model"],n),null!=(o=bV(l,["name"]))&&bU(m,["endpoint"],o),m)),b})}}async listInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI()){let f,g,h,i,j,k=(f={},null!=(g=bV(a,["config"]))&&(h=bV(g,["pageSize"]),void 0!==f&&null!=h&&bU(f,["_query","pageSize"],h),i=bV(g,["pageToken"]),void 0!==f&&null!=i&&bU(f,["_query","pageToken"],i),j=bV(g,["filter"]),void 0!==f&&null!=j&&bU(f,["_query","filter"],j)),f);return d=bT("tuningJobs",k._url),e=k._query,delete k._url,delete k._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(k),httpMethod:"GET",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b=function(a){let b={},c=bV(a,["sdkHttpResponse"]);null!=c&&bU(b,["sdkHttpResponse"],c);let d=bV(a,["nextPageToken"]);null!=d&&bU(b,["nextPageToken"],d);let e=bV(a,["tuningJobs"]);if(null!=e){let a=e;Array.isArray(a)&&(a=a.map(a=>ga(a))),bU(b,["tuningJobs"],a)}return b}(a),c=new cc;return Object.assign(c,b),c})}throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async cancel(a){var b,c,d,e;let f="",g={};if(this.apiClient.isVertexAI()){let d,e,h=(d={},null!=(e=bV(a,["name"]))&&bU(d,["_url","name"],e),d);return f=bT("{name}:cancel",h._url),g=h._query,delete h._url,delete h._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(h),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),b),e=new cd;return Object.assign(e,d),e})}{let b,c,h=(b={},null!=(c=bV(a,["name"]))&&bU(b,["_url","name"],c),b);return f=bT("{name}:cancel",h._url),g=h._query,delete h._url,delete h._query,this.apiClient.request({path:f,queryParams:g,body:JSON.stringify(h),httpMethod:"POST",httpOptions:null==(d=a.config)?void 0:d.httpOptions,abortSignal:null==(e=a.config)?void 0:e.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),b),e=new cd;return Object.assign(e,d),e})}}async tuneInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI()){let f,g,h,i,j,k=(f={},null!=(g=bV(a,["baseModel"]))&&bU(f,["baseModel"],g),null!=(h=bV(a,["preTunedModel"]))&&bU(f,["preTunedModel"],h),null!=(i=bV(a,["trainingDataset"]))&&function(a,b,c){let d=bV(c,["config","method"]);if(void 0===d&&(d="SUPERVISED_FINE_TUNING"),"SUPERVISED_FINE_TUNING"===d){let c=bV(a,["gcsUri"]);void 0!==b&&null!=c&&bU(b,["supervisedTuningSpec","trainingDatasetUri"],c)}else if("PREFERENCE_TUNING"===d){let c=bV(a,["gcsUri"]);void 0!==b&&null!=c&&bU(b,["preferenceOptimizationSpec","trainingDatasetUri"],c)}else if("DISTILLATION"===d){let c=bV(a,["gcsUri"]);void 0!==b&&null!=c&&bU(b,["distillationSpec","promptDatasetUri"],c)}else if("REINFORCEMENT_TUNING"===d){let c=bV(a,["gcsUri"]);void 0!==b&&null!=c&&bU(b,["reinforcementTuningSpec","trainingDatasetUri"],c)}let e=bV(c,["config","method"]);if(void 0===e&&(e="SUPERVISED_FINE_TUNING"),"SUPERVISED_FINE_TUNING"===e){let c=bV(a,["vertexDatasetResource"]);void 0!==b&&null!=c&&bU(b,["supervisedTuningSpec","trainingDatasetUri"],c)}else if("PREFERENCE_TUNING"===e){let c=bV(a,["vertexDatasetResource"]);void 0!==b&&null!=c&&bU(b,["preferenceOptimizationSpec","trainingDatasetUri"],c)}else if("DISTILLATION"===e){let c=bV(a,["vertexDatasetResource"]);void 0!==b&&null!=c&&bU(b,["distillationSpec","promptDatasetUri"],c)}else if("REINFORCEMENT_TUNING"===e){let c=bV(a,["vertexDatasetResource"]);void 0!==b&&null!=c&&bU(b,["reinforcementTuningSpec","trainingDatasetUri"],c)}if(void 0!==bV(a,["examples"]))throw Error("examples parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.")}(i,f,a),null!=(j=bV(a,["config"]))&&function(a,b,c){let d=bV(c,["config","method"]);if(void 0===d&&(d="SUPERVISED_FINE_TUNING"),"SUPERVISED_FINE_TUNING"===d){let c=bV(a,["validationDataset"]);void 0!==b&&null!=c&&bU(b,["supervisedTuningSpec"],gb(c))}else if("PREFERENCE_TUNING"===d){let c=bV(a,["validationDataset"]);void 0!==b&&null!=c&&bU(b,["preferenceOptimizationSpec"],gb(c))}else if("DISTILLATION"===d){let c=bV(a,["validationDataset"]);void 0!==b&&null!=c&&bU(b,["distillationSpec"],gb(c))}else if("REINFORCEMENT_TUNING"===d){let c=bV(a,["validationDataset"]);void 0!==b&&null!=c&&bU(b,["reinforcementTuningSpec"],gb(c))}let e=bV(a,["tunedModelDisplayName"]);void 0!==b&&null!=e&&bU(b,["tunedModelDisplayName"],e);let f=bV(a,["description"]);void 0!==b&&null!=f&&bU(b,["description"],f);let g=bV(c,["config","method"]);if(void 0===g&&(g="SUPERVISED_FINE_TUNING"),"SUPERVISED_FINE_TUNING"===g){let c=bV(a,["epochCount"]);void 0!==b&&null!=c&&bU(b,["supervisedTuningSpec","hyperParameters","epochCount"],c)}else if("PREFERENCE_TUNING"===g){let c=bV(a,["epochCount"]);void 0!==b&&null!=c&&bU(b,["preferenceOptimizationSpec","hyperParameters","epochCount"],c)}else if("DISTILLATION"===g){let c=bV(a,["epochCount"]);void 0!==b&&null!=c&&bU(b,["distillationSpec","hyperParameters","epochCount"],c)}else if("REINFORCEMENT_TUNING"===g){let c=bV(a,["epochCount"]);void 0!==b&&null!=c&&bU(b,["reinforcementTuningSpec","hyperParameters","epochCount"],c)}let h=bV(c,["config","method"]);if(void 0===h&&(h="SUPERVISED_FINE_TUNING"),"SUPERVISED_FINE_TUNING"===h){let c=bV(a,["learningRateMultiplier"]);void 0!==b&&null!=c&&bU(b,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],c)}else if("PREFERENCE_TUNING"===h){let c=bV(a,["learningRateMultiplier"]);void 0!==b&&null!=c&&bU(b,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],c)}else if("DISTILLATION"===h){let c=bV(a,["learningRateMultiplier"]);void 0!==b&&null!=c&&bU(b,["distillationSpec","hyperParameters","learningRateMultiplier"],c)}else if("REINFORCEMENT_TUNING"===h){let c=bV(a,["learningRateMultiplier"]);void 0!==b&&null!=c&&bU(b,["reinforcementTuningSpec","hyperParameters","learningRateMultiplier"],c)}let i=bV(c,["config","method"]);if(void 0===i&&(i="SUPERVISED_FINE_TUNING"),"SUPERVISED_FINE_TUNING"===i){let c=bV(a,["exportLastCheckpointOnly"]);void 0!==b&&null!=c&&bU(b,["supervisedTuningSpec","exportLastCheckpointOnly"],c)}else if("PREFERENCE_TUNING"===i){let c=bV(a,["exportLastCheckpointOnly"]);void 0!==b&&null!=c&&bU(b,["preferenceOptimizationSpec","exportLastCheckpointOnly"],c)}else if("DISTILLATION"===i){let c=bV(a,["exportLastCheckpointOnly"]);void 0!==b&&null!=c&&bU(b,["distillationSpec","exportLastCheckpointOnly"],c)}let j=bV(c,["config","method"]);if(void 0===j&&(j="SUPERVISED_FINE_TUNING"),"SUPERVISED_FINE_TUNING"===j){let c=bV(a,["adapterSize"]);void 0!==b&&null!=c&&bU(b,["supervisedTuningSpec","hyperParameters","adapterSize"],c)}else if("PREFERENCE_TUNING"===j){let c=bV(a,["adapterSize"]);void 0!==b&&null!=c&&bU(b,["preferenceOptimizationSpec","hyperParameters","adapterSize"],c)}else if("DISTILLATION"===j){let c=bV(a,["adapterSize"]);void 0!==b&&null!=c&&bU(b,["distillationSpec","hyperParameters","adapterSize"],c)}else if("REINFORCEMENT_TUNING"===j){let c=bV(a,["adapterSize"]);void 0!==b&&null!=c&&bU(b,["reinforcementTuningSpec","hyperParameters","adapterSize"],c)}let k=bV(c,["config","method"]);if(void 0===k&&(k="SUPERVISED_FINE_TUNING"),"SUPERVISED_FINE_TUNING"===k){let c=bV(a,["tuningMode"]);void 0!==b&&null!=c&&bU(b,["supervisedTuningSpec","tuningMode"],c)}else if("DISTILLATION"===k){let c=bV(a,["tuningMode"]);void 0!==b&&null!=c&&bU(b,["distillationSpec","tuningMode"],c)}let l=bV(a,["customBaseModel"]);void 0!==b&&null!=l&&bU(b,["customBaseModel"],l);let m=bV(c,["config","method"]);if(void 0===m&&(m="SUPERVISED_FINE_TUNING"),"SUPERVISED_FINE_TUNING"===m){let c=bV(a,["batchSize"]);void 0!==b&&null!=c&&bU(b,["supervisedTuningSpec","hyperParameters","batchSize"],c)}else if("DISTILLATION"===m){let c=bV(a,["batchSize"]);void 0!==b&&null!=c&&bU(b,["distillationSpec","hyperParameters","batchSize"],c)}else if("REINFORCEMENT_TUNING"===m){let c=bV(a,["batchSize"]);void 0!==b&&null!=c&&bU(b,["reinforcementTuningSpec","hyperParameters","batchSize"],c)}let n=bV(c,["config","method"]);if(void 0===n&&(n="SUPERVISED_FINE_TUNING"),"SUPERVISED_FINE_TUNING"===n){let c=bV(a,["learningRate"]);void 0!==b&&null!=c&&bU(b,["supervisedTuningSpec","hyperParameters","learningRate"],c)}else if("DISTILLATION"===n){let c=bV(a,["learningRate"]);void 0!==b&&null!=c&&bU(b,["distillationSpec","hyperParameters","learningRate"],c)}let o=bV(a,["labels"]);void 0!==b&&null!=o&&bU(b,["labels"],o);let p=bV(a,["beta"]);void 0!==b&&null!=p&&bU(b,["preferenceOptimizationSpec","hyperParameters","beta"],p);let q=bV(a,["baseTeacherModel"]);void 0!==b&&null!=q&&bU(b,["distillationSpec","baseTeacherModel"],q);let r=bV(a,["tunedTeacherModelSource"]);void 0!==b&&null!=r&&bU(b,["distillationSpec","tunedTeacherModelSource"],r);let s=bV(a,["sftLossWeightMultiplier"]);void 0!==b&&null!=s&&bU(b,["distillationSpec","hyperParameters","sftLossWeightMultiplier"],s);let t=bV(a,["outputUri"]);void 0!==b&&null!=t&&bU(b,["outputUri"],t);let u=bV(a,["encryptionSpec"]);void 0!==b&&null!=u&&bU(b,["encryptionSpec"],u);let v=bV(a,["rewardConfig"]);void 0!==b&&null!=v&&bU(b,["reinforcementTuningSpec","singleRewardConfig"],v);let w=bV(a,["compositeRewardConfig"]);void 0!==b&&null!=w&&bU(b,["reinforcementTuningSpec","compositeRewardConfig"],w);let x=bV(a,["samplesPerPrompt"]);void 0!==b&&null!=x&&bU(b,["reinforcementTuningSpec","hyperParameters","samplesPerPrompt"],x);let y=bV(a,["evaluateInterval"]);void 0!==b&&null!=y&&bU(b,["reinforcementTuningSpec","hyperParameters","evaluateInterval"],y);let z=bV(a,["checkpointInterval"]);void 0!==b&&null!=z&&bU(b,["reinforcementTuningSpec","hyperParameters","checkpointInterval"],z);let A=bV(a,["maxOutputTokens"]);void 0!==b&&null!=A&&bU(b,["reinforcementTuningSpec","hyperParameters","maxOutputTokens"],A);let B=bV(a,["thinkingLevel"]);void 0!==b&&null!=B&&bU(b,["reinforcementTuningSpec","hyperParameters","thinkingLevel"],B);let C=bV(a,["validationDatasetUri"]);void 0!==b&&null!=C&&bU(b,["reinforcementTuningSpec","validationDatasetUri"],C)}(j,f,a),f);return d=bT("tuningJobs",k._url),e=k._query,delete k._url,delete k._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(k),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>ga(a))}throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}async tuneMldevInternal(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI())throw Error("This method is only supported by the Gemini Developer API.");{let f,g,h,i,j,k=(f={},null!=(g=bV(a,["baseModel"]))&&bU(f,["baseModel"],g),null!=(h=bV(a,["preTunedModel"]))&&bU(f,["preTunedModel"],h),null!=(i=bV(a,["trainingDataset"]))&&function(a){if(void 0!==bV(a,["gcsUri"]))throw Error("gcsUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["vertexDatasetResource"]))throw Error("vertexDatasetResource parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let b=bV(a,["examples"]);if(null!=b){let a=b;Array.isArray(a)&&(a=a.map(a=>a)),bU({},["examples","examples"],a)}}(i),null!=(j=bV(a,["config"]))&&function(a,b){if(void 0!==bV(a,["validationDataset"]))throw Error("validationDataset parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let c=bV(a,["tunedModelDisplayName"]);if(void 0!==b&&null!=c&&bU(b,["displayName"],c),void 0!==bV(a,["description"]))throw Error("description parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let d=bV(a,["epochCount"]);void 0!==b&&null!=d&&bU(b,["tuningTask","hyperparameters","epochCount"],d);let e=bV(a,["learningRateMultiplier"]);if(null!=e&&bU({},["tuningTask","hyperparameters","learningRateMultiplier"],e),void 0!==bV(a,["exportLastCheckpointOnly"]))throw Error("exportLastCheckpointOnly parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["preTunedModelCheckpointId"]))throw Error("preTunedModelCheckpointId parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["adapterSize"]))throw Error("adapterSize parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["tuningMode"]))throw Error("tuningMode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["customBaseModel"]))throw Error("customBaseModel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");let f=bV(a,["batchSize"]);void 0!==b&&null!=f&&bU(b,["tuningTask","hyperparameters","batchSize"],f);let g=bV(a,["learningRate"]);if(void 0!==b&&null!=g&&bU(b,["tuningTask","hyperparameters","learningRate"],g),void 0!==bV(a,["labels"]))throw Error("labels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["beta"]))throw Error("beta parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["baseTeacherModel"]))throw Error("baseTeacherModel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["tunedTeacherModelSource"]))throw Error("tunedTeacherModelSource parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["sftLossWeightMultiplier"]))throw Error("sftLossWeightMultiplier parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["outputUri"]))throw Error("outputUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["encryptionSpec"]))throw Error("encryptionSpec parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["rewardConfig"]))throw Error("rewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["compositeRewardConfig"]))throw Error("compositeRewardConfig parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["samplesPerPrompt"]))throw Error("samplesPerPrompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["evaluateInterval"]))throw Error("evaluateInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["checkpointInterval"]))throw Error("checkpointInterval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["maxOutputTokens"]))throw Error("maxOutputTokens parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["thinkingLevel"]))throw Error("thinkingLevel parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.");if(void 0!==bV(a,["validationDatasetUri"]))throw Error("validationDatasetUri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.")}(j,f),f);return d=bT("tunedModels",k._url),e=k._query,delete k._url,delete k._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(k),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d,e,f,g;return b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),null!=(d=bV(a,["name"]))&&bU(b,["name"],d),null!=(e=bV(a,["metadata"]))&&bU(b,["metadata"],e),null!=(f=bV(a,["done"]))&&bU(b,["done"],f),null!=(g=bV(a,["error"]))&&bU(b,["error"],g),b})}}async validateReward(a){var b,c;let d="",e={};if(this.apiClient.isVertexAI()){let f,g,h,i,j,k,l=(f={},null!=(g=bV(a,["parent"]))&&bU(f,["_url","parent"],g),null!=(h=bV(a,["sampleResponse"]))&&bU(f,["sampleResponse"],f8(h)),null!=(i=bV(a,["example"]))&&bU(f,["example"],function(a){let b={},c=bV(a,["contents"]);if(null!=c){let a=c;Array.isArray(a)&&(a=a.map(a=>f8(a))),bU(b,["contents"],a)}let d=bV(a,["references"]);null!=d&&bU(b,["references"],d);let e=bV(a,["systemInstruction"]);return null!=e&&bU(b,["systemInstruction"],f8(e)),b}(i)),null!=(j=bV(a,["singleRewardConfig"]))&&bU(f,["singleRewardConfig"],j),null!=(k=bV(a,["compositeRewardConfig"]))&&bU(f,["compositeRewardConfig"],k),f);return d=bT("{parent}/tuningJobs:validateReinforcementTuningReward",l._url),e=l._query,delete l._url,delete l._query,this.apiClient.request({path:d,queryParams:e,body:JSON.stringify(l),httpMethod:"POST",httpOptions:null==(b=a.config)?void 0:b.httpOptions,abortSignal:null==(c=a.config)?void 0:c.abortSignal}).then(a=>a.json().then(b=>(b.sdkHttpResponse={headers:a.headers},b))).then(a=>{let b,c,d,e,f,g=(b={},null!=(c=bV(a,["sdkHttpResponse"]))&&bU(b,["sdkHttpResponse"],c),null!=(d=bV(a,["overallReward"]))&&bU(b,["overallReward"],d),null!=(e=bV(a,["error"]))&&bU(b,["error"],e),null!=(f=bV(a,["rewardInfoDetails"]))&&bU(b,["rewardInfoDetails"],f),b),h=new ce;return Object.assign(h,g),h})}throw Error("This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).")}}let gd="x-goog-upload-status";async function ge(a,b,c,d){var e;let f=await gg(a,b,c,d),g=await (null==f?void 0:f.json());if((null==(e=null==f?void 0:f.headers)?void 0:e[gd])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return g.file}async function gf(a,b,c,d){var e;let f=await gg(a,b,c,d),g=await (null==f?void 0:f.json());if((null==(e=null==f?void 0:f.headers)?void 0:e[gd])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let h=bX(g),i=new cs;return Object.assign(i,h),i}async function gg(a,b,c,d){var e,f,g;let h=b,i=(null==d?void 0:d.baseUrl)||(null==(e=c.clientOptions.httpOptions)?void 0:e.baseUrl);if(i){let a=new URL(i),c=new URL(b);c.protocol=a.protocol,c.host=a.host,c.port=a.port,h=c.toString()}let j=0,k=0,l=new b_(new Response),m="upload";for(j=a.size;k<j;){let b=Math.min(8388608,j-k),e=a.slice(k,k+b);k+b>=j&&(m+=", finalize");let i=0,n=1e3;for(;i<3;){let a=Object.assign(Object.assign({},(null==d?void 0:d.headers)||{}),{"X-Goog-Upload-Command":m,"X-Goog-Upload-Offset":String(k),"Content-Length":String(b)});if(null==(f=null==(l=await c.request({path:"",body:e,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},d),{apiVersion:"",baseUrl:h,headers:a})}))?void 0:l.headers)?void 0:f[gd])break;i++,await gi(n),n*=2}if(k+=b,(null==(g=null==l?void 0:l.headers)?void 0:g[gd])!=="active")break;if(j<=k)throw Error("All content has been uploaded, but the upload status is not finalized.")}return l}async function gh(a){return{size:a.size,type:a.type}}function gi(a){return new Promise(b=>setTimeout(b,a))}class gj{async stat(a){let b={size:0,type:void 0};return"string"==typeof a?(b.size=(await bN.stat(a)).size,b.type=this.inferMimeType(a),b):await gh(a)}async upload(a,b,c,d){return"string"==typeof a?await this.uploadFileFromPath(a,b,c,d):ge(a,b,c,d)}async uploadToFileSearchStore(a,b,c,d){return"string"==typeof a?await this.uploadFileToFileSearchStoreFromPath(a,b,c,d):gf(a,b,c,d)}inferMimeType(a){return({aac:"audio/aac",abw:"application/x-abiword",arc:"application/x-freearc",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bmp:"image/bmp",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",css:"text/css",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gz:"application/gzip",gif:"image/gif",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",ics:"text/calendar",jar:"application/java-archive",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz+xml",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",png:"image/png",pdf:"application/pdf",php:"application/x-httpd-php",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",rar:"application/vnd.rar",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xml:"application/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2","7z":"application/x-7z-compressed"})[a.slice(a.lastIndexOf(".")+1).toLowerCase()]}async uploadFileFromPath(a,b,c,d){var e;let f=await this.uploadFileFromPathInternal(a,b,c,d),g=await (null==f?void 0:f.json());if((null==(e=null==f?void 0:f.headers)?void 0:e[gd])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");return g.file}async uploadFileToFileSearchStoreFromPath(a,b,c,d){var e;let f=await this.uploadFileFromPathInternal(a,b,c,d),g=await (null==f?void 0:f.json());if((null==(e=null==f?void 0:f.headers)?void 0:e[gd])!=="final")throw Error("Failed to upload file: Upload status is not finalized.");let h=bX(g),i=new cs;return Object.assign(i,h),i}async uploadFileFromPathInternal(a,b,c,d){var e,f,g;let h,i=b,j=(null==d?void 0:d.baseUrl)||(null==(e=c.clientOptions.httpOptions)?void 0:e.baseUrl);if(j){let a=new URL(j),c=new URL(b);c.protocol=a.protocol,c.host=a.host,c.port=a.port,i=c.toString()}let k=0,l=0,m=new b_(new Response),n="upload",o=bR.basename(a);try{if(!(h=await bN.open(a,"r")))throw Error("Failed to open file");for(k=(await h.stat()).size;l<k;){let a=Math.min(8388608,k-l);l+a>=k&&(n+=", finalize");let b=new Uint8Array(a),{bytesRead:e}=await h.read(b,0,a,l);if(e!==a)throw Error(`Failed to read ${a} bytes from file at offset ${l}. bytes actually read: ${e}`);let j=new Blob([b]),p=0,q=1e3;for(;p<3;){let a=Object.assign(Object.assign({},(null==d?void 0:d.headers)||{}),{"X-Goog-Upload-Command":n,"X-Goog-Upload-Offset":String(l),"Content-Length":String(e),"X-Goog-Upload-File-Name":o});if(null==(f=null==(m=await c.request({path:"",body:j,httpMethod:"POST",httpOptions:Object.assign(Object.assign({},d),{apiVersion:"",baseUrl:i,headers:a})}))?void 0:m.headers)?void 0:f[gd])break;p++,await gi(q),q*=2}if(l+=e,(null==(g=null==m?void 0:m.headers)?void 0:g[gd])!=="active")break;if(k<=l)throw Error("All content has been uploaded, but the upload status is not finalized.")}return m}finally{h&&await h.close()}}}class gk extends dd{async registerFiles(a){if("u"<typeof process||!process.versions||!process.versions.node)throw Error("registerFiles is only supported in Node.js environments.");let b=a.auth,c=await b.getRequestHeaders(),d=a.config||{},e=d.httpOptions||{},f=Object.assign({},e.headers||{});if(c)if("function"==typeof c[Symbol.iterator])for(let[a,b]of c)f[a]=b;else for(let[a,b]of Object.entries(c))f[a]=b;return this._registerFiles({uris:a.uris,config:Object.assign(Object.assign({},d),{httpOptions:Object.assign(Object.assign({},e),{headers:f})})})}}class gl{getNextGenClient(){let a=this.httpOptions;return void 0===this._nextGenClient&&(this._nextGenClient=fR(this.apiClient,{timeout_ms:null==a?void 0:a.timeout})),(null==a?void 0:a.extraBody)&&console.warn("GoogleGenAI: Client level httpOptions.extraBody is not supported by the Gemini NextGen client and will be ignored."),this._nextGenClient}get interactions(){return void 0!==this._interactions||(this._interactions=new fS(this.apiClient)),this._interactions}get webhooks(){return void 0!==this._webhooks||(this._webhooks=new fU(this.apiClient)),this._webhooks}get agents(){return void 0!==this._agents||(console.warn("GoogleGenAI.agents: Agents usage is experimental and may change in future versions."),this._agents=new fT(this.apiClient)),this._agents}constructor(a){var b,c,f,g;if((a.project||a.location)&&a.apiKey)throw Error("Project/location and API key are mutually exclusive in the client initializer.");this.vertexai=function(a){var b;if(void 0!==a.enterprise||void 0!==a.vertexai){if(void 0!==a.enterprise&&void 0!==a.vertexai&&a.enterprise!==a.vertexai)throw Error("enterprise and vertexAI flags have conflicting values, please set enterprise value only.");return null!=(b=a.enterprise)?b:a.vertexai}let c=gm("GOOGLE_GENAI_USE_ENTERPRISE"),d=gm("GOOGLE_GENAI_USE_VERTEXAI"),e=gn(c),f=gn(d);return(void 0!==c&&void 0!==d&&e!==f&&console.warn("Warning: Both GOOGLE_GENAI_USE_ENTERPRISE and GOOGLE_GENAI_USE_VERTEXAI are set with conflicting values. The value of GOOGLE_GENAI_USE_ENTERPRISE will be used."),void 0!==c)?e:void 0!==d&&f}(a);const h=function(){let a=gm("GOOGLE_API_KEY"),b=gm("GEMINI_API_KEY");return a&&b&&console.warn("Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY."),a||b||void 0}(),i=gm("GOOGLE_CLOUD_PROJECT"),j=gm("GOOGLE_CLOUD_LOCATION");this.apiKey=null!=(b=a.apiKey)?b:h,this.project=null!=(c=a.project)?c:i,this.location=null!=(f=a.location)?f:j,this.vertexai||this.apiKey||console.warn("API key should be set when using the Gemini API."),this.vertexai&&((null==(g=a.googleAuthOptions)?void 0:g.credentials)&&(console.debug("The user provided Google Cloud credentials will take precedence over the API key from the environment variable."),this.apiKey=void 0),(i||j)&&a.apiKey?(console.debug("The user provided Vertex AI API key will take precedence over the project/location from the environment variables."),this.project=void 0,this.location=void 0):(a.project||a.location)&&h?(console.debug("The user provided project/location will take precedence over the API key from the environment variables."),this.apiKey=void 0):(i||j)&&h&&(console.debug("The project/location from the environment variables will take precedence over the API key from the environment variables."),this.apiKey=void 0),this.location||this.apiKey||(this.location="global"));const k=function(a,b,c,f){return(null==a?void 0:a.baseUrl)?a.baseUrl:b?null!=e?e:c:null!=d?d:f}(a.httpOptions,this.vertexai,gm("GOOGLE_VERTEX_BASE_URL"),gm("GOOGLE_GEMINI_BASE_URL"));k&&(a.httpOptions?a.httpOptions.baseUrl=k:a.httpOptions={baseUrl:k}),this.apiVersion=a.apiVersion,this.httpOptions=a.httpOptions;const l=new f3({apiKey:this.apiKey,googleAuthOptions:a.googleAuthOptions});this.apiClient=new dC({auth:l,project:this.project,location:this.location,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:"gl-node/"+process.version,uploader:new gj,downloader:new f4}),this.models=new dS(this.apiClient),this.live=new dL(this.apiClient,l,new f6),this.batches=new c0(this.apiClient),this.chats=new da(this.models,this.apiClient),this.caches=new c3(this.apiClient),this.files=new gk(this.apiClient),this.operations=new dT(this.apiClient),this.authTokens=new dV(this.apiClient),this.tunings=new gc(this.apiClient),this.fileSearchStores=new dX(this.apiClient)}}function gm(a){var b,c,d;return null!=(d=null==(c=null==(b=null==process?void 0:process.env)?void 0:b[a])?void 0:c.trim())?d:void 0}function gn(a){return void 0!==a&&"true"===a.toLowerCase()}},45813:(a,b,c)=>{"use strict";var d,e;let f;Object.defineProperty(b,"__esModule",{value:!0}),b.GCPEnv=void 0,b.clear=function(){f=void 0},b.getEnv=h;let g=c(18240);async function h(){return f||(f=i())}async function i(){d.NONE;return process.env.GAE_SERVICE||process.env.GAE_MODULE_NAME?d.APP_ENGINE:process.env.FUNCTION_NAME||process.env.FUNCTION_TARGET?d.CLOUD_FUNCTIONS:await k()?await j()?d.KUBERNETES_ENGINE:process.env.K_CONFIGURATION?d.CLOUD_RUN:process.env.CLOUD_RUN_JOB?d.CLOUD_RUN_JOBS:d.COMPUTE_ENGINE:d.NONE}async function j(){try{return await g.instance("attributes/cluster-name"),!0}catch(a){return!1}}async function k(){return g.isAvailable()}(e=d||(b.GCPEnv=d={})).APP_ENGINE="APP_ENGINE",e.KUBERNETES_ENGINE="KUBERNETES_ENGINE",e.CLOUD_FUNCTIONS="CLOUD_FUNCTIONS",e.COMPUTE_ENGINE="COMPUTE_ENGINE",e.CLOUD_RUN="CLOUD_RUN",e.CLOUD_RUN_JOBS="CLOUD_RUN_JOBS",e.NONE="NONE"},45920:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.LRUCache=void 0,b.snakeToCamel=h,b.originalOrCamelOptions=function(a){return{get:function(b){let c=a||{};return c[b]??c[h(b)]}}},b.removeUndefinedValuesInObject=function(a){return Object.entries(a).forEach(([b,c])=>{(void 0===c||"undefined"===c)&&delete a[b]}),a},b.isValidFile=j,b.getWellKnownCertificateConfigFileLocation=function(){let a=process.env.CLOUDSDK_CONFIG||(e.platform().startsWith("win")?f.join(process.env.APPDATA||"",g):f.join(process.env.HOME||"",".config",g));return f.join(a,"certificate_config.json")};let d=c(29021),e=c(21820),f=c(33873),g="gcloud";function h(a){return a.replace(/([_][^_])/g,a=>a.slice(1).toUpperCase())}class i{capacity;#j=new Map;maxAge;constructor(a){this.capacity=a.capacity,this.maxAge=a.maxAge}#k(a,b){this.#j.delete(a),this.#j.set(a,{value:b,lastAccessed:Date.now()})}set(a,b){this.#k(a,b),this.#l()}get(a){let b=this.#j.get(a);if(b)return this.#k(a,b.value),this.#l(),b.value}#l(){let a=this.maxAge?Date.now()-this.maxAge:0,b=this.#j.entries().next();for(;!b.done&&(this.#j.size>this.capacity||b.value[1].lastAccessed<a);)this.#j.delete(b.value[0]),b=this.#j.entries().next()}}async function j(a){try{return(await d.promises.lstat(a)).isFile()}catch(a){return!1}}b.LRUCache=i},50091:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.OAuthClientAuthHandler=void 0,b.getErrorFromOAuthErrorResponse=function(a,b){let c=a.error,d=a.error_description,e=a.error_uri,f=`Error code ${c}`;void 0!==d&&(f+=`: ${d}`),void 0!==e&&(f+=` - ${e}`);let g=Error(f);if(b){let a=Object.keys(b);b.stack&&a.push("stack"),a.forEach(a=>{"message"!==a&&Object.defineProperty(g,a,{value:b[a],writable:!1,enumerable:!0})})}return g};let d=c(27064),e=c(55661),f=["PUT","POST","PATCH"];class g{#m=(0,e.createCrypto)();#n;transporter;constructor(a){a&&"clientId"in a?(this.#n=a,this.transporter=new d.Gaxios):(this.#n=a?.clientAuthentication,this.transporter=a?.transporter||new d.Gaxios)}applyClientAuthenticationOptions(a,b){a.headers=d.Gaxios.mergeHeaders(a.headers),this.injectAuthenticatedHeaders(a,b),b||this.injectAuthenticatedRequestBody(a)}injectAuthenticatedHeaders(a,b){if(b)a.headers=d.Gaxios.mergeHeaders(a.headers,{authorization:`Bearer ${b}`});else if(this.#n?.confidentialClientType==="basic"){a.headers=d.Gaxios.mergeHeaders(a.headers);let b=this.#n.clientId,c=this.#n.clientSecret||"",e=this.#m.encodeBase64StringUtf8(`${b}:${c}`);d.Gaxios.mergeHeaders(a.headers,{authorization:`Basic ${e}`})}}injectAuthenticatedRequestBody(a){if(this.#n?.confidentialClientType==="request-body"){let b=(a.method||"GET").toUpperCase();if(!f.includes(b))throw Error(`${b} HTTP method does not support ${this.#n.confidentialClientType} client authentication`);let c=new Headers(a.headers).get("content-type");if(c?.startsWith("application/x-www-form-urlencoded")||a.data instanceof URLSearchParams){let b=new URLSearchParams(a.data??"");b.append("client_id",this.#n.clientId),b.append("client_secret",this.#n.clientSecret||""),a.data=b}else if(c?.startsWith("application/json"))a.data=a.data||{},Object.assign(a.data,{client_id:this.#n.clientId,client_secret:this.#n.clientSecret||""});else throw Error(`${c} content-types are not supported with ${this.#n.confidentialClientType} client authentication`)}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}}b.OAuthClientAuthHandler=g},51047:function(a,b,c){"use strict";var d=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(b,"__esModule",{value:!0}),b.GaxiosError=b.GAXIOS_ERROR_SYMBOL=void 0,b.defaultErrorRedactor=function a(b){let c="<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.";function d(a){a&&a.forEach((b,d)=>{(/^authentication$/i.test(d)||/^authorization$/i.test(d)||/secret/i.test(d))&&a.set(d,c)})}function e(a,b){if("object"==typeof a&&null!==a&&"string"==typeof a[b]){let d=a[b];(/grant_type=/i.test(d)||/assertion=/i.test(d)||/secret/i.test(d))&&(a[b]=c)}}function f(a){!a||"object"!=typeof a||(a instanceof FormData||a instanceof URLSearchParams||"forEach"in a&&"set"in a?a.forEach((b,d)=>{(["grant_type","assertion"].includes(d)||/secret/.test(d))&&a.set(d,c)}):("grant_type"in a&&(a.grant_type=c),"assertion"in a&&(a.assertion=c),"client_secret"in a&&(a.client_secret=c)))}return b.config&&(d(b.config.headers),e(b.config,"data"),f(b.config.data),e(b.config,"body"),f(b.config.body),b.config.url.searchParams.has("token")&&b.config.url.searchParams.set("token",c),b.config.url.searchParams.has("client_secret")&&b.config.url.searchParams.set("client_secret",c)),b.response&&(a({config:b.response.config}),d(b.response.headers),b.response.bodyUsed&&(e(b.response,"data"),f(b.response.data))),b};let e=d(c(78814)),f=d(c(84315)).default.pkg;b.GAXIOS_ERROR_SYMBOL=Symbol.for(`${f.name}-gaxios-error`);class g extends Error{config;response;code;status;error;[b.GAXIOS_ERROR_SYMBOL]=f.version;static[Symbol.hasInstance](a){return!!a&&"object"==typeof a&&b.GAXIOS_ERROR_SYMBOL in a&&a[b.GAXIOS_ERROR_SYMBOL]===f.version||Function.prototype[Symbol.hasInstance].call(g,a)}constructor(a,b,c,d){if(super(a,{cause:d}),this.config=b,this.response=c,this.error=d instanceof Error?d:void 0,this.config=(0,e.default)(!0,{},b),this.response&&(this.response.config=(0,e.default)(!0,{},this.response.config)),this.response){try{this.response.data=function(a,b){switch(a){case"stream":default:return b;case"json":return JSON.parse(JSON.stringify(b));case"arraybuffer":return JSON.parse(Buffer.from(b).toString("utf8"));case"blob":return JSON.parse(b.text())}}(this.config.responseType,this.response?.bodyUsed?this.response?.data:void 0)}catch{}this.status=this.response.status}d instanceof DOMException?this.code=d.name:d&&"object"==typeof d&&"code"in d&&("string"==typeof d.code||"number"==typeof d.code)&&(this.code=d.code)}static extractAPIErrorFromResponse(a,b="The request failed"){let c=b;if("string"==typeof a.data&&(c=a.data),a.data&&"object"==typeof a.data&&"error"in a.data&&a.data.error&&!a.ok){if("string"==typeof a.data.error)return{message:a.data.error,code:a.status,status:a.statusText};if("object"==typeof a.data.error){c="message"in a.data.error&&"string"==typeof a.data.error.message?a.data.error.message:c;let b="status"in a.data.error&&"string"==typeof a.data.error.status?a.data.error.status:a.statusText,d="code"in a.data.error&&"number"==typeof a.data.error.code?a.data.error.code:a.status;if("errors"in a.data.error&&Array.isArray(a.data.error.errors)){let e=[];for(let b of a.data.error.errors)"object"==typeof b&&"message"in b&&"string"==typeof b.message&&e.push(b.message);return Object.assign({message:e.join("\n")||c,code:d,status:b},a.data.error)}return Object.assign({message:c,code:d,status:b},a.data.error)}}return{message:c,code:a.status,status:a.statusText}}}b.GaxiosError=g},51638:(a,b,c)=>{var d=c(62760).Buffer,e=c(90157),f=c(572),g=c(27910),h=c(15876),i=c(28354),j=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function k(a){var b=a.split(".",1)[0],c=d.from(b,"base64").toString("binary");if("[object Object]"===Object.prototype.toString.call(c))return c;try{return JSON.parse(c)}catch(a){return}}function l(a){return a.split(".")[2]}function m(a){return j.test(a)&&!!k(a)}function n(a,b,c){if(!b){var d=Error("Missing algorithm parameter for jws.verify");throw d.code="MISSING_ALGORITHM",d}var e=l(a=h(a)),g=a.split(".",2).join(".");return f(b).verify(g,e,c)}function o(a,b){if(b=b||{},!m(a=h(a)))return null;var c,e,f=k(a);if(!f)return null;var g=(c=c||"utf8",e=a.split(".")[1],d.from(e,"base64").toString(c));return("JWT"===f.typ||b.json)&&(g=JSON.parse(g,b.encoding)),{header:f,payload:g,signature:l(a)}}function p(a){var b=(a=a||{}).secret;if(b=null==(b=null==b?a.publicKey:b)?a.key:b,!0===/^hs/i.test(a.algorithm)&&null==b)throw TypeError("secret must be a string or buffer or a KeyObject");var c=new e(b);this.readable=!0,this.algorithm=a.algorithm,this.encoding=a.encoding,this.secret=this.publicKey=this.key=c,this.signature=new e(a.signature),this.secret.once("close",(function(){!this.signature.writable&&this.readable&&this.verify()}).bind(this)),this.signature.once("close",(function(){!this.secret.writable&&this.readable&&this.verify()}).bind(this))}i.inherits(p,g),p.prototype.verify=function(){try{var a=n(this.signature.buffer,this.algorithm,this.key.buffer),b=o(this.signature.buffer,this.encoding);return this.emit("done",a,b),this.emit("data",a),this.emit("end"),this.readable=!1,a}catch(a){this.readable=!1,this.emit("error",a),this.emit("close")}},p.decode=o,p.isValid=m,p.verify=n,a.exports=p},53455:(a,b,c)=>{"use strict";let d,{Duplex:e}=c(27910),{randomFillSync:f}=c(55511),{types:{isUint8Array:g}}=c(28354),h=c(88634),{EMPTY_BUFFER:i,kWebSocket:j,NOOP:k}=c(17165),{isBlob:l,isValidStatusCode:m}=c(97861),{mask:n,toBuffer:o}=c(6361),p=Symbol("kByteLength"),q=Buffer.alloc(4),r=8192;class s{constructor(a,b,c){this._extensions=b||{},c&&(this._generateMask=c,this._maskBuffer=Buffer.alloc(4)),this._socket=a,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=k,this[j]=void 0}static frame(a,b){let c,e,g=!1,h=2,i=!1;b.mask&&(c=b.maskBuffer||q,b.generateMask?b.generateMask(c):(8192===r&&(void 0===d&&(d=Buffer.alloc(8192)),f(d,0,8192),r=0),c[0]=d[r++],c[1]=d[r++],c[2]=d[r++],c[3]=d[r++]),i=(c[0]|c[1]|c[2]|c[3])==0,h=6),"string"==typeof a?e=(!b.mask||i)&&void 0!==b[p]?b[p]:(a=Buffer.from(a)).length:(e=a.length,g=b.mask&&b.readOnly&&!i);let j=e;e>=65536?(h+=8,j=127):e>125&&(h+=2,j=126);let k=Buffer.allocUnsafe(g?e+h:h);return(k[0]=b.fin?128|b.opcode:b.opcode,b.rsv1&&(k[0]|=64),k[1]=j,126===j?k.writeUInt16BE(e,2):127===j&&(k[2]=k[3]=0,k.writeUIntBE(e,4,6)),b.mask)?(k[1]|=128,k[h-4]=c[0],k[h-3]=c[1],k[h-2]=c[2],k[h-1]=c[3],i)?[k,a]:g?(n(a,c,k,h,e),[k]):(n(a,c,a,0,e),[k,a]):[k,a]}close(a,b,c,d){let e;if(void 0===a)e=i;else if("number"==typeof a&&m(a))if(void 0!==b&&b.length){let c=Buffer.byteLength(b);if(c>123)throw RangeError("The message must not be greater than 123 bytes");if((e=Buffer.allocUnsafe(2+c)).writeUInt16BE(a,0),"string"==typeof b)e.write(b,2);else if(g(b))e.set(b,2);else throw TypeError("Second argument must be a string or a Uint8Array")}else(e=Buffer.allocUnsafe(2)).writeUInt16BE(a,0);else throw TypeError("First argument must be a valid error code number");let f={[p]:e.length,fin:!0,generateMask:this._generateMask,mask:c,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};0!==this._state?this.enqueue([this.dispatch,e,!1,f,d]):this.sendFrame(s.frame(e,f),d)}ping(a,b,c){let d,e;if("string"==typeof a?(d=Buffer.byteLength(a),e=!1):l(a)?(d=a.size,e=!1):(d=(a=o(a)).length,e=o.readOnly),d>125)throw RangeError("The data size must not be greater than 125 bytes");let f={[p]:d,fin:!0,generateMask:this._generateMask,mask:b,maskBuffer:this._maskBuffer,opcode:9,readOnly:e,rsv1:!1};l(a)?0!==this._state?this.enqueue([this.getBlobData,a,!1,f,c]):this.getBlobData(a,!1,f,c):0!==this._state?this.enqueue([this.dispatch,a,!1,f,c]):this.sendFrame(s.frame(a,f),c)}pong(a,b,c){let d,e;if("string"==typeof a?(d=Buffer.byteLength(a),e=!1):l(a)?(d=a.size,e=!1):(d=(a=o(a)).length,e=o.readOnly),d>125)throw RangeError("The data size must not be greater than 125 bytes");let f={[p]:d,fin:!0,generateMask:this._generateMask,mask:b,maskBuffer:this._maskBuffer,opcode:10,readOnly:e,rsv1:!1};l(a)?0!==this._state?this.enqueue([this.getBlobData,a,!1,f,c]):this.getBlobData(a,!1,f,c):0!==this._state?this.enqueue([this.dispatch,a,!1,f,c]):this.sendFrame(s.frame(a,f),c)}send(a,b,c){let d,e,f=this._extensions[h.extensionName],g=b.binary?2:1,i=b.compress;"string"==typeof a?(d=Buffer.byteLength(a),e=!1):l(a)?(d=a.size,e=!1):(d=(a=o(a)).length,e=o.readOnly),this._firstFragment?(this._firstFragment=!1,i&&f&&f.params[f._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=d>=f._threshold),this._compress=i):(i=!1,g=0),b.fin&&(this._firstFragment=!0);let j={[p]:d,fin:b.fin,generateMask:this._generateMask,mask:b.mask,maskBuffer:this._maskBuffer,opcode:g,readOnly:e,rsv1:i};l(a)?0!==this._state?this.enqueue([this.getBlobData,a,this._compress,j,c]):this.getBlobData(a,this._compress,j,c):0!==this._state?this.enqueue([this.dispatch,a,this._compress,j,c]):this.dispatch(a,this._compress,j,c)}getBlobData(a,b,c,d){this._bufferedBytes+=c[p],this._state=2,a.arrayBuffer().then(a=>{if(this._socket.destroyed){let a=Error("The socket was closed while the blob was being read");process.nextTick(t,this,a,d);return}this._bufferedBytes-=c[p];let e=o(a);b?this.dispatch(e,b,c,d):(this._state=0,this.sendFrame(s.frame(e,c),d),this.dequeue())}).catch(a=>{process.nextTick(u,this,a,d)})}dispatch(a,b,c,d){if(!b)return void this.sendFrame(s.frame(a,c),d);let e=this._extensions[h.extensionName];this._bufferedBytes+=c[p],this._state=1,e.compress(a,c.fin,(a,b)=>{this._socket.destroyed?t(this,Error("The socket was closed while data was being compressed"),d):(this._bufferedBytes-=c[p],this._state=0,c.readOnly=!1,this.sendFrame(s.frame(b,c),d),this.dequeue())})}dequeue(){for(;0===this._state&&this._queue.length;){let a=this._queue.shift();this._bufferedBytes-=a[3][p],Reflect.apply(a[0],this,a.slice(1))}}enqueue(a){this._bufferedBytes+=a[3][p],this._queue.push(a)}sendFrame(a,b){2===a.length?(this._socket.cork(),this._socket.write(a[0]),this._socket.write(a[1],b),this._socket.uncork()):this._socket.write(a[0],b)}}function t(a,b,c){"function"==typeof c&&c(b);for(let c=0;c<a._queue.length;c++){let d=a._queue[c],e=d[d.length-1];"function"==typeof e&&e(b)}}function u(a,b,c){t(a,b,c),a.onerror(b)}a.exports=s},54351:(a,b,c)=>{"use strict";let d=c(94735),e=c(81630),{Duplex:f}=c(27910),{createHash:g}=c(55511),h=c(24509),i=c(88634),j=c(72786),k=c(80123),{CLOSE_TIMEOUT:l,GUID:m,kWebSocket:n}=c(17165),o=/^[+/0-9A-Za-z]{22}==$/;class p extends d{constructor(a,b){if(super(),null==(a={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1048576,maxFragments:131072,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:l,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:k,...a}).port&&!a.server&&!a.noServer||null!=a.port&&(a.server||a.noServer)||a.server&&a.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=a.port?(this._server=e.createServer((a,b)=>{let c=e.STATUS_CODES[426];b.writeHead(426,{"Content-Length":c.length,"Content-Type":"text/plain"}),b.end(c)}),this._server.listen(a.port,a.host,a.backlog,b)):a.server&&(this._server=a.server),this._server){const a=this.emit.bind(this,"connection");this._removeListeners=function(a,b){for(let c of Object.keys(b))a.on(c,b[c]);return function(){for(let c of Object.keys(b))a.removeListener(c,b[c])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(b,c,d)=>{this.handleUpgrade(b,c,d,a)}})}!0===a.perMessageDeflate&&(a.perMessageDeflate={}),a.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=a,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(a){if(2===this._state){a&&this.once("close",()=>{a(Error("The server is not running"))}),process.nextTick(q,this);return}if(a&&this.once("close",a),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(q,this);else{let a=this._server;this._removeListeners(),this._removeListeners=this._server=null,a.close(()=>{q(this)})}}shouldHandle(a){if(this.options.path){let b=a.url.indexOf("?");if((-1!==b?a.url.slice(0,b):a.url)!==this.options.path)return!1}return!0}handleUpgrade(a,b,c,d){b.on("error",r);let e=a.headers["sec-websocket-key"],f=a.headers.upgrade,g=+a.headers["sec-websocket-version"];if("GET"!==a.method)return void t(this,a,b,405,"Invalid HTTP method");if(void 0===f||"websocket"!==f.toLowerCase())return void t(this,a,b,400,"Invalid Upgrade header");if(void 0===e||!o.test(e))return void t(this,a,b,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==g&&8!==g)return void t(this,a,b,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(a))return void s(b,400);let k=a.headers["sec-websocket-protocol"],l=new Set;if(void 0!==k)try{l=j.parse(k)}catch(c){t(this,a,b,400,"Invalid Sec-WebSocket-Protocol header");return}let m=a.headers["sec-websocket-extensions"],n={};if(this.options.perMessageDeflate&&void 0!==m){let c=new i({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let a=h.parse(m);a[i.extensionName]&&(c.accept(a[i.extensionName]),n[i.extensionName]=c)}catch(c){t(this,a,b,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:a.headers[`${8===g?"sec-websocket-origin":"origin"}`],secure:!!(a.socket.authorized||a.socket.encrypted),req:a};if(2===this.options.verifyClient.length)return void this.options.verifyClient(f,(f,g,h,i)=>{if(!f)return s(b,g||401,h,i);this.completeUpgrade(n,e,l,a,b,c,d)});if(!this.options.verifyClient(f))return s(b,401)}this.completeUpgrade(n,e,l,a,b,c,d)}completeUpgrade(a,b,c,d,e,f,j){if(!e.readable||!e.writable)return e.destroy();if(e[n])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return s(e,503);let k=g("sha1").update(b+m).digest("base64"),l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${k}`],o=new this.options.WebSocket(null,void 0,this.options);if(c.size){let a=this.options.handleProtocols?this.options.handleProtocols(c,d):c.values().next().value;a&&(l.push(`Sec-WebSocket-Protocol: ${a}`),o._protocol=a)}if(a[i.extensionName]){let b=a[i.extensionName].params,c=h.format({[i.extensionName]:[b]});l.push(`Sec-WebSocket-Extensions: ${c}`),o._extensions=a}this.emit("headers",l,d),e.write(l.concat("\r\n").join("\r\n")),e.removeListener("error",r),o.setSocket(e,f,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(o),o.on("close",()=>{this.clients.delete(o),this._shouldEmitClose&&!this.clients.size&&process.nextTick(q,this)})),j(o,d)}}function q(a){a._state=2,a.emit("close")}function r(){this.destroy()}function s(a,b,c,d){c=c||e.STATUS_CODES[b],d={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(c),...d},a.once("finish",a.destroy),a.end(`HTTP/1.1 ${b} ${e.STATUS_CODES[b]}\r
2
+ `+Object.keys(d).map(a=>`${a}: ${d[a]}`).join("\r\n")+"\r\n\r\n"+c)}function t(a,b,c,d,e,f){if(a.listenerCount("wsClientError")){let d=Error(e);Error.captureStackTrace(d,t),a.emit("wsClientError",d,c,b)}else s(c,d,e,f)}a.exports=p},54831:(a,b)=>{"use strict";b.byteLength=function(a){var b=i(a),c=b[0],d=b[1];return(c+d)*3/4-d},b.toByteArray=function(a){var b,c,f=i(a),g=f[0],h=f[1],j=new e((g+h)*3/4-h),k=0,l=h>0?g-4:g;for(c=0;c<l;c+=4)b=d[a.charCodeAt(c)]<<18|d[a.charCodeAt(c+1)]<<12|d[a.charCodeAt(c+2)]<<6|d[a.charCodeAt(c+3)],j[k++]=b>>16&255,j[k++]=b>>8&255,j[k++]=255&b;return 2===h&&(b=d[a.charCodeAt(c)]<<2|d[a.charCodeAt(c+1)]>>4,j[k++]=255&b),1===h&&(b=d[a.charCodeAt(c)]<<10|d[a.charCodeAt(c+1)]<<4|d[a.charCodeAt(c+2)]>>2,j[k++]=b>>8&255,j[k++]=255&b),j},b.fromByteArray=function(a){for(var b,d=a.length,e=d%3,f=[],g=0,h=d-e;g<h;g+=16383)f.push(function(a,b,d){for(var e,f=[],g=b;g<d;g+=3)e=(a[g]<<16&0xff0000)+(a[g+1]<<8&65280)+(255&a[g+2]),f.push(c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]);return f.join("")}(a,g,g+16383>h?h:g+16383));return 1===e?f.push(c[(b=a[d-1])>>2]+c[b<<4&63]+"=="):2===e&&f.push(c[(b=(a[d-2]<<8)+a[d-1])>>10]+c[b>>4&63]+c[b<<2&63]+"="),f.join("")};for(var c=[],d=[],e="u">typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=0,h=f.length;g<h;++g)c[g]=f[g],d[f.charCodeAt(g)]=g;function i(a){var b=a.length;if(b%4>0)throw Error("Invalid string. Length must be a multiple of 4");var c=a.indexOf("=");-1===c&&(c=b);var d=c===b?0:4-c%4;return[c,d]}d[45]=62,d[95]=63},55661:function(a,b,c){"use strict";var d=this&&this.__createBinding||(Object.create?function(a,b,c,d){void 0===d&&(d=c);var e=Object.getOwnPropertyDescriptor(b,c);(!e||("get"in e?!b.__esModule:e.writable||e.configurable))&&(e={enumerable:!0,get:function(){return b[c]}}),Object.defineProperty(a,d,e)}:function(a,b,c,d){void 0===d&&(d=c),a[d]=b[c]}),e=this&&this.__exportStar||function(a,b){for(var c in a)"default"===c||Object.prototype.hasOwnProperty.call(b,c)||d(b,a,c)};Object.defineProperty(b,"__esModule",{value:!0}),b.createCrypto=function(){return h()?new f.BrowserCrypto:new g.NodeCrypto},b.hasBrowserCrypto=h;let f=c(492),g=c(39370);function h(){return"u">typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle}e(c(18853),b)},56916:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.AuthClient=b.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=b.DEFAULT_UNIVERSE=void 0;let d=c(94735),e=c(27064),f=c(45920),g=c(15599),h=c(12586);b.DEFAULT_UNIVERSE="googleapis.com",b.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS=3e5;class i extends d.EventEmitter{apiKey;projectId;quotaProjectId;transporter;credentials={};eagerRefreshThresholdMillis=b.DEFAULT_EAGER_REFRESH_THRESHOLD_MILLIS;forceRefreshOnFailure=!1;universeDomain=b.DEFAULT_UNIVERSE;static RequestMethodNameSymbol=Symbol("request method name");static RequestLogIdSymbol=Symbol("request log id");constructor(a={}){super();const c=(0,f.originalOrCamelOptions)(a);this.apiKey=a.apiKey,this.projectId=c.get("project_id")??null,this.quotaProjectId=c.get("quota_project_id"),this.credentials=c.get("credentials")??{},this.universeDomain=c.get("universe_domain")??b.DEFAULT_UNIVERSE,this.transporter=a.transporter??new e.Gaxios(a.transporterOptions),!1!==c.get("useAuthRequestParameters")&&(this.transporter.interceptors.request.add(i.DEFAULT_REQUEST_INTERCEPTOR),this.transporter.interceptors.response.add(i.DEFAULT_RESPONSE_INTERCEPTOR)),a.eagerRefreshThresholdMillis&&(this.eagerRefreshThresholdMillis=a.eagerRefreshThresholdMillis),this.forceRefreshOnFailure=a.forceRefreshOnFailure??!1}fetch(...a){let b,c=a[0],d=a[1],f=new Headers;return("string"==typeof c?b=new URL(c):c instanceof URL?b=c:c&&c.url&&(b=new URL(c.url)),c&&"object"==typeof c&&"headers"in c&&e.Gaxios.mergeHeaders(f,c.headers),d&&e.Gaxios.mergeHeaders(f,new Headers(d.headers)),"object"!=typeof c||c instanceof URL)?this.request({...d,headers:f,url:b}):this.request({...d,...c,headers:f,url:b})}setCredentials(a){this.credentials=a}addSharedMetadataHeaders(a){return!a.has("x-goog-user-project")&&this.quotaProjectId&&a.set("x-goog-user-project",this.quotaProjectId),a}addUserProjectAndAuthHeaders(a,b){let c=b.get("x-goog-user-project"),d=b.get("authorization");return c&&a.set("x-goog-user-project",c),d&&a.set("authorization",d),a}static log=(0,g.log)("auth");static DEFAULT_REQUEST_INTERCEPTOR={resolved:async a=>{if(!a.headers.has("x-goog-api-client")){let b=process.version.replace(/^v/,"");a.headers.set("x-goog-api-client",`gl-node/${b}`)}let b=a.headers.get("User-Agent");b?b.includes(`${h.PRODUCT_NAME}/`)||a.headers.set("User-Agent",`${b} ${h.USER_AGENT}`):a.headers.set("User-Agent",h.USER_AGENT);try{let b=a[i.RequestMethodNameSymbol],c=`${Math.floor(1e3*Math.random())}`;a[i.RequestLogIdSymbol]=c;let d={url:a.url,headers:a.headers};b?i.log.info("%s [%s] request %j",b,c,d):i.log.info("[%s] request %j",c,d)}catch(a){}return a}};static DEFAULT_RESPONSE_INTERCEPTOR={resolved:async a=>{try{let b=a.config,c=b[i.RequestMethodNameSymbol],d=b[i.RequestLogIdSymbol];c?i.log.info("%s [%s] response %j",c,d,a.data):i.log.info("[%s] response %j",d,a.data)}catch(a){}return a},rejected:async a=>{try{let b=a.config,c=b[i.RequestMethodNameSymbol],d=b[i.RequestLogIdSymbol];c?i.log.info("%s [%s] error %j",c,d,a.response?.data):i.log.error("[%s] error %j",d,a.response?.data)}catch(a){}throw a}};static setMethodName(a,b){try{a[i.RequestMethodNameSymbol]=b}catch(a){}}static get RETRY_CONFIG(){return{retry:!0,retryConfig:{httpMethodsToRetry:["GET","PUT","POST","HEAD","OPTIONS","DELETE"]}}}}b.AuthClient=i},58545:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.AwsRequestSigner=void 0;let d=c(27064),e=c(55661),f="AWS4-HMAC-SHA256";class g{getCredentials;region;crypto;constructor(a,b){this.getCredentials=a,this.region=b,this.crypto=(0,e.createCrypto)()}async getRequestOptions(a){if(!a.url)throw RangeError('"url" is required in "amzOptions"');let b="object"==typeof a.data?JSON.stringify(a.data):a.data,c=a.url,e=a.method||"GET",f=a.body||b,g=a.headers,h=await this.getCredentials(),i=new URL(c);if("string"!=typeof f&&void 0!==f)throw TypeError(`'requestPayload' is expected to be a string if provided. Got: ${f}`);let k=await j({crypto:this.crypto,host:i.host,canonicalUri:i.pathname,canonicalQuerystring:i.search.slice(1),method:e,region:this.region,securityCredentials:h,requestPayload:f,additionalAmzHeaders:g}),l=d.Gaxios.mergeHeaders(k.amzDate?{"x-amz-date":k.amzDate}:{},{authorization:k.authorizationHeader,host:i.host},g||{});h.token&&d.Gaxios.mergeHeaders(l,{"x-amz-security-token":h.token});let m={url:c,method:e,headers:l};return void 0!==f&&(m.body=f),m}}async function h(a,b,c){return await a.signWithHmacSha256(b,c)}async function i(a,b,c,d,e){let f=await h(a,`AWS4${b}`,c),g=await h(a,f,d),i=await h(a,g,e);return await h(a,i,"aws4_request")}async function j(a){let b=d.Gaxios.mergeHeaders(a.additionalAmzHeaders),c=a.requestPayload||"",g=a.host.split(".")[0],j=new Date,k=j.toISOString().replace(/[-:]/g,"").replace(/\.[0-9]+/,""),l=j.toISOString().replace(/[-]/g,"").replace(/T.*/,"");a.securityCredentials.token&&b.set("x-amz-security-token",a.securityCredentials.token);let m=d.Gaxios.mergeHeaders({host:a.host},b.has("date")?{}:{"x-amz-date":k},b),n="",o=[...m.keys()].sort();o.forEach(a=>{n+=`${a}:${m.get(a)}
3
+ `});let p=o.join(";"),q=await a.crypto.sha256DigestHex(c),r=`${a.method.toUpperCase()}
4
+ ${a.canonicalUri}
5
+ ${a.canonicalQuerystring}
6
+ ${n}
7
+ ${p}
8
+ ${q}`,s=`${l}/${a.region}/${g}/aws4_request`,t=`${f}
9
+ ${k}
10
+ ${s}
11
+ `+await a.crypto.sha256DigestHex(r),u=await i(a.crypto,a.securityCredentials.secretAccessKey,l,a.region,g),v=await h(a.crypto,u,t),w=`${f} Credential=${a.securityCredentials.accessKeyId}/${s}, SignedHeaders=${p}, Signature=${(0,e.fromArrayBufferToHex)(v)}`;return{amzDate:b.has("date")?void 0:k,authorizationHeader:w,canonicalQuerystring:a.canonicalQuerystring}}b.AwsRequestSigner=g},59674:(a,b,c)=>{var d=c(6624);b.operation=function(a){return new d(b.timeouts(a),{forever:a&&(a.forever||a.retries===1/0),unref:a&&a.unref,maxRetryTime:a&&a.maxRetryTime})},b.timeouts=function(a){if(a instanceof Array)return[].concat(a);var b={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var c in a)b[c]=a[c];if(b.minTimeout>b.maxTimeout)throw Error("minTimeout is greater than maxTimeout");for(var d=[],e=0;e<b.retries;e++)d.push(this.createTimeout(e,b));return a&&a.forever&&!d.length&&d.push(this.createTimeout(e,b)),d.sort(function(a,b){return a-b}),d},b.createTimeout=function(a,b){var c=Math.round((b.randomize?Math.random()+1:1)*Math.max(b.minTimeout,1)*Math.pow(b.factor,a));return Math.min(c,b.maxTimeout)},b.wrap=function(a,c,d){if(c instanceof Array&&(d=c,c=null),!d)for(var e in d=[],a)"function"==typeof a[e]&&d.push(e);for(var f=0;f<d.length;f++){var g=d[f],h=a[g];a[g]=(function(d){var e=b.operation(c),f=Array.prototype.slice.call(arguments,1),g=f.pop();f.push(function(a){e.retry(a)||(a&&(arguments[0]=e.mainError()),g.apply(this,arguments))}),e.attempt(function(){d.apply(a,f)})}).bind(a,h),a[g].options=c}}},60446:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ExternalAccountAuthorizedUserClient=b.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;let d=c(56916),e=c(50091),f=c(27064),g=c(27910),h=c(82080);b.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";class i extends e.OAuthClientAuthHandler{#o;constructor(a){super(a),this.#o=a.tokenRefreshEndpoint}async refreshToken(a,b){let c={...i.RETRY_CONFIG,url:this.#o,method:"POST",headers:b,data:new URLSearchParams({grant_type:"refresh_token",refresh_token:a}),responseType:"json"};d.AuthClient.setMethodName(c,"refreshToken"),this.applyClientAuthenticationOptions(c);try{let a=await this.transporter.request(c),b=a.data;return b.res=a,b}catch(a){if(a instanceof f.GaxiosError&&a.response)throw(0,e.getErrorFromOAuthErrorResponse)(a.response.data,a);throw a}}}class j extends d.AuthClient{cachedAccessToken;externalAccountAuthorizedUserHandler;refreshToken;constructor(a){super(a),a.universe_domain&&(this.universeDomain=a.universe_domain),this.refreshToken=a.refresh_token;const b={confidentialClientType:"basic",clientId:a.client_id,clientSecret:a.client_secret};this.externalAccountAuthorizedUserHandler=new i({tokenRefreshEndpoint:a.token_url??"https://sts.{universeDomain}/v1/oauthtoken".replace("{universeDomain}",this.universeDomain),transporter:this.transporter,clientAuthentication:b}),this.cachedAccessToken=null,this.quotaProjectId=a.quota_project_id,"number"!=typeof a?.eagerRefreshThresholdMillis?this.eagerRefreshThresholdMillis=h.EXPIRATION_TIME_OFFSET:this.eagerRefreshThresholdMillis=a.eagerRefreshThresholdMillis,this.forceRefreshOnFailure=!!a?.forceRefreshOnFailure}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let a=await this.getAccessToken(),b=new Headers({authorization:`Bearer ${a.token}`});return this.addSharedMetadataHeaders(b)}request(a,b){if(!b)return this.requestAsync(a);this.requestAsync(a).then(a=>b(null,a),a=>b(a,a.response))}async requestAsync(a,b=!1){let c;try{let b=await this.getRequestHeaders();a.headers=f.Gaxios.mergeHeaders(a.headers),this.addUserProjectAndAuthHeaders(a.headers,b),c=await this.transporter.request(a)}catch(d){let c=d.response;if(c){let d=c.status,e=c.config.data instanceof g.Readable;if(!b&&(401===d||403===d)&&!e&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(a,!0)}throw d}return c}async refreshAccessTokenAsync(){let a=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);return this.cachedAccessToken={access_token:a.access_token,expiry_date:new Date().getTime()+1e3*a.expires_in,res:a.res},void 0!==a.refresh_token&&(this.refreshToken=a.refresh_token),this.cachedAccessToken}isExpired(a){let b=new Date().getTime();return!!a.expiry_date&&b>=a.expiry_date-this.eagerRefreshThresholdMillis}}b.ExternalAccountAuthorizedUserClient=j},62760:(a,b,c)=>{var d=c(79428),e=d.Buffer;function f(a,b){for(var c in a)b[c]=a[c]}function g(a,b,c){return e(a,b,c)}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?a.exports=d:(f(d,b),b.Buffer=g),g.prototype=Object.create(e.prototype),f(e,g),g.from=function(a,b,c){if("number"==typeof a)throw TypeError("Argument must not be a number");return e(a,b,c)},g.alloc=function(a,b,c){if("number"!=typeof a)throw TypeError("Argument must be a number");var d=e(a);return void 0!==b?"string"==typeof c?d.fill(b,c):d.fill(b):d.fill(0),d},g.allocUnsafe=function(a){if("number"!=typeof a)throw TypeError("Argument must be a number");return e(a)},g.allocUnsafeSlow=function(a){if("number"!=typeof a)throw TypeError("Argument must be a number");return d.SlowBuffer(a)}},65254:(a,b,c)=>{"use strict";var d=c(79428).Buffer,e=c(79428).SlowBuffer;function f(a,b){if(!d.isBuffer(a)||!d.isBuffer(b)||a.length!==b.length)return!1;for(var c=0,e=0;e<a.length;e++)c|=a[e]^b[e];return 0===c}a.exports=f,f.install=function(){d.prototype.equal=e.prototype.equal=function(a){return f(this,a)}};var g=d.prototype.equal,h=e.prototype.equal;f.restore=function(){d.prototype.equal=g,e.prototype.equal=h}},67201:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.InvalidSubjectTokenError=b.InvalidMessageFieldError=b.InvalidCodeFieldError=b.InvalidTokenTypeFieldError=b.InvalidExpirationTimeFieldError=b.InvalidSuccessFieldError=b.InvalidVersionFieldError=b.ExecutableResponseError=b.ExecutableResponse=void 0;let c="urn:ietf:params:oauth:token-type:saml2",d="urn:ietf:params:oauth:token-type:id_token",e="urn:ietf:params:oauth:token-type:jwt";class f{version;success;expirationTime;tokenType;errorCode;errorMessage;subjectToken;constructor(a){if(!a.version)throw new h("Executable response must contain a 'version' field.");if(void 0===a.success)throw new i("Executable response must contain a 'success' field.");if(this.version=a.version,this.success=a.success,this.success){if(this.expirationTime=a.expiration_time,this.tokenType=a.token_type,this.tokenType!==c&&this.tokenType!==d&&this.tokenType!==e)throw new k(`Executable response must contain a 'token_type' field when successful and it must be one of ${d}, ${e}, or ${c}.`);if(this.tokenType===c){if(!a.saml_response)throw new n(`Executable response must contain a 'saml_response' field when token_type=${c}.`);this.subjectToken=a.saml_response}else{if(!a.id_token)throw new n(`Executable response must contain a 'id_token' field when token_type=${d} or ${e}.`);this.subjectToken=a.id_token}}else{if(!a.code)throw new l("Executable response must contain a 'code' field when unsuccessful.");if(!a.message)throw new m("Executable response must contain a 'message' field when unsuccessful.");this.errorCode=a.code,this.errorMessage=a.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return void 0!==this.expirationTime&&this.expirationTime<Math.round(Date.now()/1e3)}}b.ExecutableResponse=f;class g extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}b.ExecutableResponseError=g;class h extends g{}b.InvalidVersionFieldError=h;class i extends g{}b.InvalidSuccessFieldError=i;class j extends g{}b.InvalidExpirationTimeFieldError=j;class k extends g{}b.InvalidTokenTypeFieldError=k;class l extends g{}b.InvalidCodeFieldError=l;class m extends g{}b.InvalidMessageFieldError=m;class n extends g{}b.InvalidSubjectTokenError=n},70592:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.buildPayloadForJwsSign=e,b.getJwsSign=function(a){let b=e(a);return(0,d.sign)({header:{alg:"RS256"},payload:b,secret:a.key})};let d=c(15394);function e(a){let b=Math.floor(new Date().getTime()/1e3);return{iss:a.iss,scope:a.scope,aud:"https://oauth2.googleapis.com/token",exp:b+3600,iat:b,sub:a.sub,...a.additionalClaims}}},71776:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.IdTokenClient=void 0;let d=c(16757);class e extends d.OAuth2Client{targetAudience;idTokenProvider;constructor(a){super(a),this.targetAudience=a.targetAudience,this.idTokenProvider=a.idTokenProvider}async getRequestMetadataAsync(){if(!this.credentials.id_token||!this.credentials.expiry_date||this.isTokenExpiring()){let a=await this.idTokenProvider.fetchIdToken(this.targetAudience);this.credentials={id_token:a,expiry_date:this.getIdTokenExpiryDate(a)}}return{headers:new Headers({authorization:"Bearer "+this.credentials.id_token})}}getIdTokenExpiryDate(a){let b=a.split(".")[1];if(b)return 1e3*JSON.parse(Buffer.from(b,"base64").toString("ascii")).exp}}b.IdTokenClient=e},72111:function(a,b,c){"use strict";var d,e=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(b,"__esModule",{value:!0}),b.Gaxios=void 0;let f=e(c(78814)),g=c(55591),h=c(51047),i=c(15638),j=c(27910),k=c(3783),l=async()=>globalThis.crypto?.randomUUID()||(await Promise.resolve().then(c.t.bind(c,55511,23))).randomUUID();class m{agentCache=new Map;defaults;interceptors;constructor(a){this.defaults=a||{},this.interceptors={request:new k.GaxiosInterceptorManager,response:new k.GaxiosInterceptorManager}}fetch(...a){let b,c=a[0],e=a[1],f=new Headers;return("string"==typeof c?b=new URL(c):c instanceof URL?b=c:c&&c.url&&(b=new URL(c.url)),c&&"object"==typeof c&&"headers"in c&&d.mergeHeaders(f,c.headers),e&&d.mergeHeaders(f,new Headers(e.headers)),"object"!=typeof c||c instanceof URL)?this.request({...e,headers:f,url:b}):this.request({...e,...c,headers:f,url:b})}async request(a={}){let b=await this.#p(a);return b=await this.#q(b),this.#r(this._request(b))}async _defaultAdapter(a){let b=a.fetchImplementation||this.defaults.fetchImplementation||await d.#s(),c={...a};delete c.data;let e=await b(a.url,c),f=await this.getResponseData(a,e);return Object.getOwnPropertyDescriptor(e,"data")?.configurable||Object.defineProperties(e,{data:{configurable:!0,writable:!0,enumerable:!0,value:f}}),Object.assign(e,{config:a,data:f})}async _request(a){try{let b;if(b=a.adapter?await a.adapter(a,this._defaultAdapter.bind(this)):await this._defaultAdapter(a),!a.validateStatus(b.status)){if("stream"===a.responseType){let a=[];for await(let c of b.data)a.push(c);b.data=a.toString()}let c=h.GaxiosError.extractAPIErrorFromResponse(b,`Request failed with status code ${b.status}`);throw new h.GaxiosError(c?.message,a,b,c)}return b}catch(e){let b;b=e instanceof h.GaxiosError?e:e instanceof Error?new h.GaxiosError(e.message,a,void 0,e):new h.GaxiosError("Unexpected Gaxios Error",a,void 0,e);let{shouldRetry:c,config:d}=await (0,i.getRetryConfig)(b);if(c&&d)return b.config.retryConfig.currentRetryAttempt=d.retryConfig.currentRetryAttempt,a.retryConfig=b.config?.retryConfig,this.#t(a),this._request(a);throw a.errorRedactor&&a.errorRedactor(b),b}}async getResponseData(a,b){if(204===b.status)return"";if(a.maxContentLength&&b.headers.has("content-length")&&a.maxContentLength<Number.parseInt(b.headers?.get("content-length")||""))throw new h.GaxiosError("Response's `Content-Length` is over the limit.",a,Object.assign(b,{config:a}));switch(a.responseType){case"stream":return b.body;case"json":{let a=await b.text();try{return JSON.parse(a)}catch{return a}}case"arraybuffer":return b.arrayBuffer();case"blob":return b.blob();case"text":return b.text();default:return this.getResponseDataFromContentType(b)}}#u(a,b=[]){let c=new URL(a),d=[...b];for(let a of(process.env.NO_PROXY??process.env.no_proxy)?.split(",")||[])d.push(a.trim());for(let a of d)if(a instanceof RegExp){if(a.test(c.toString()))return!1}else if(a instanceof URL){if(a.origin===c.origin)return!1}else if(a.startsWith("*.")||a.startsWith(".")){let b=a.replace(/^\*\./,".");if(c.hostname.endsWith(b))return!1}else if(a===c.origin||a===c.hostname||a===c.href)return!1;return!0}async #q(a){let b=Promise.resolve(a);for(let a of this.interceptors.request.values())a&&(b=b.then(a.resolved,a.rejected));return b}async #r(a){let b=Promise.resolve(a);for(let a of this.interceptors.response.values())a&&(b=b.then(a.resolved,a.rejected));return b}async #p(a){let b=new Headers(this.defaults.headers);d.mergeHeaders(b,a.headers);let c=(0,f.default)(!0,{},this.defaults,a);if(!c.url)throw Error("URL is required.");if(c.baseURL&&(c.url=new URL(c.url,c.baseURL)),c.url=new URL(c.url),c.params)if(c.paramsSerializer){let a=c.paramsSerializer(c.params);a.startsWith("?")&&(a=a.slice(1));let b=c.url.toString().includes("?")?"&":"?";c.url=c.url+b+a}else{let a=c.url instanceof URL?c.url:new URL(c.url);for(let[b,d]of new URLSearchParams(c.params))a.searchParams.append(b,d);c.url=a}"number"==typeof a.maxContentLength&&(c.size=a.maxContentLength),"number"==typeof a.maxRedirects&&(c.follow=a.maxRedirects);let e="string"==typeof c.data||c.data instanceof ArrayBuffer||c.data instanceof Blob||globalThis.File&&c.data instanceof File||c.data instanceof FormData||c.data instanceof j.Readable||c.data instanceof ReadableStream||c.data instanceof String||c.data instanceof URLSearchParams||ArrayBuffer.isView(c.data)||["Blob","File","FormData"].includes(c.data?.constructor?.name||"");if(c.multipart?.length){let a=await l();b.set("content-type",`multipart/related; boundary=${a}`),c.body=j.Readable.from(this.getMultipartRequest(c.multipart,a))}else e?c.body=c.data:"object"==typeof c.data?"application/x-www-form-urlencoded"===b.get("Content-Type")?c.body=c.paramsSerializer?c.paramsSerializer(c.data):new URLSearchParams(c.data):(b.has("content-type")||b.set("content-type","application/json"),c.body=JSON.stringify(c.data)):c.data&&(c.body=c.data);c.validateStatus=c.validateStatus||this.validateStatus,c.responseType=c.responseType||"unknown",b.has("accept")||"json"!==c.responseType||b.set("accept","application/json");let i=c.proxy||process?.env?.HTTPS_PROXY||process?.env?.https_proxy||process?.env?.HTTP_PROXY||process?.env?.http_proxy;if(c.agent);else if(i&&this.#u(c.url,c.noProxy)){let a=await d.#v();this.agentCache.has(i)?c.agent=this.agentCache.get(i):(c.agent=new a(i,{cert:c.cert,key:c.key}),this.agentCache.set(i,c.agent))}else c.cert&&c.key&&(this.agentCache.has(c.key)?c.agent=this.agentCache.get(c.key):(c.agent=new g.Agent({cert:c.cert,key:c.key}),this.agentCache.set(c.key,c.agent)));return"function"!=typeof c.errorRedactor&&!1!==c.errorRedactor&&(c.errorRedactor=h.defaultErrorRedactor),!c.body||"duplex"in c||(c.duplex="half"),this.#t(c),Object.assign(c,{headers:b,url:c.url instanceof URL?c.url:new URL(c.url)})}#t(a){if(a.timeout){let b=AbortSignal.timeout(a.timeout);a.signal&&!a.signal.aborted?a.signal=AbortSignal.any([a.signal,b]):a.signal=b}}validateStatus(a){return a>=200&&a<300}async getResponseDataFromContentType(a){let b=a.headers.get("Content-Type");if(null===b)return a.text();if((b=b.toLowerCase()).includes("application/json")){let b=await a.text();try{b=JSON.parse(b)}catch{}return b}return b.match(/^text\//)?a.text():a.blob()}async *getMultipartRequest(a,b){let c=`--${b}--`;for(let c of a){let a=c.headers.get("Content-Type")||"application/octet-stream",d=`--${b}\r
12
+ Content-Type: ${a}\r
13
+ \r
14
+ `;yield d,"string"==typeof c.content?yield c.content:yield*c.content,yield"\r\n"}yield c}static #w;static #x;static async #v(){return this.#w||=(await c.e(607).then(c.t.bind(c,1607,23))).HttpsProxyAgent,this.#w}static async #s(){let a="u">typeof window&&!!window;return this.#x||=a?window.fetch:(await c.e(915).then(c.bind(c,72915))).default,this.#x}static mergeHeaders(a,...b){for(let c of(a=a instanceof Headers?a:new Headers(a),b))(c instanceof Headers?c:new Headers(c)).forEach((b,c)=>{"set-cookie"===c?a.append(c,b):a.set(c,b)});return a}}b.Gaxios=m,d=m},72786:(a,b,c)=>{"use strict";let{tokenChars:d}=c(97861);a.exports={parse:function(a){let b=new Set,c=-1,e=-1,f=0;for(;f<a.length;f++){let g=a.charCodeAt(f);if(-1===e&&1===d[g])-1===c&&(c=f);else if(0!==f&&(32===g||9===g))-1===e&&-1!==c&&(e=f);else if(44===g){if(-1===c)throw SyntaxError(`Unexpected character at index ${f}`);-1===e&&(e=f);let d=a.slice(c,e);if(b.has(d))throw SyntaxError(`The "${d}" subprotocol is duplicated`);b.add(d),c=e=-1}else throw SyntaxError(`Unexpected character at index ${f}`)}if(-1===c||-1!==e)throw SyntaxError("Unexpected end of input");let g=a.slice(c,f);if(b.has(g))throw SyntaxError(`The "${g}" subprotocol is duplicated`);return b.add(g),b}}},75093:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ExternalAccountClient=void 0;let d=c(82080),e=c(25306),f=c(38087),g=c(31299);class h{constructor(){throw Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(a){return a&&a.type===d.EXTERNAL_ACCOUNT_TYPE?a.credential_source?.environment_id?new f.AwsClient(a):a.credential_source?.executable?new g.PluggableAuthClient(a):new e.IdentityPoolClient(a):null}}b.ExternalAccountClient=h},75357:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.UserRefreshClient=b.USER_REFRESH_ACCOUNT_TYPE=void 0;let d=c(16757),e=c(56916);b.USER_REFRESH_ACCOUNT_TYPE="authorized_user";class f extends d.OAuth2Client{_refreshToken;constructor(a,b,c,d,e){const f=a&&"object"==typeof a?a:{clientId:a,clientSecret:b,refreshToken:c,eagerRefreshThresholdMillis:d,forceRefreshOnFailure:e};super(f),this._refreshToken=f.refreshToken,this.credentials.refresh_token=f.refreshToken}async refreshTokenNoCache(){return super.refreshTokenNoCache(this._refreshToken)}async fetchIdToken(a){let b={...f.RETRY_CONFIG,url:this.endpoints.oauth2TokenUrl,method:"POST",data:new URLSearchParams({client_id:this._clientId,client_secret:this._clientSecret,grant_type:"refresh_token",refresh_token:this._refreshToken,target_audience:a}),responseType:"json"};return e.AuthClient.setMethodName(b,"fetchIdToken"),(await this.transporter.request(b)).data.id_token}fromJSON(a){if(!a)throw Error("Must pass in a JSON object containing the user refresh token");if("authorized_user"!==a.type)throw Error('The incoming JSON object does not have the "authorized_user" type');if(!a.client_id)throw Error("The incoming JSON object does not contain a client_id field");if(!a.client_secret)throw Error("The incoming JSON object does not contain a client_secret field");if(!a.refresh_token)throw Error("The incoming JSON object does not contain a refresh_token field");this._clientId=a.client_id,this._clientSecret=a.client_secret,this._refreshToken=a.refresh_token,this.credentials.refresh_token=a.refresh_token,this.quotaProjectId=a.quota_project_id,this.universeDomain=a.universe_domain||this.universeDomain}fromStream(a,b){if(!b)return this.fromStreamAsync(a);this.fromStreamAsync(a).then(()=>b(),b)}async fromStreamAsync(a){return new Promise((b,c)=>{if(!a)return c(Error("Must pass in a stream containing the user refresh token."));let d="";a.setEncoding("utf8").on("error",c).on("data",a=>d+=a).on("end",()=>{try{let a=JSON.parse(d);return this.fromJSON(a),b()}catch(a){return c(a)}})})}static fromJSON(a){let b=new f;return b.fromJSON(a),b}}b.UserRefreshClient=f},78814:a=>{"use strict";var b=Object.prototype.hasOwnProperty,c=Object.prototype.toString,d=Object.defineProperty,e=Object.getOwnPropertyDescriptor,f=function(a){return"function"==typeof Array.isArray?Array.isArray(a):"[object Array]"===c.call(a)},g=function(a){if(!a||"[object Object]"!==c.call(a))return!1;var d,e=b.call(a,"constructor"),f=a.constructor&&a.constructor.prototype&&b.call(a.constructor.prototype,"isPrototypeOf");if(a.constructor&&!e&&!f)return!1;for(d in a);return void 0===d||b.call(a,d)},h=function(a,b){d&&"__proto__"===b.name?d(a,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):a[b.name]=b.newValue},i=function(a,c){if("__proto__"===c){if(!b.call(a,c))return;else if(e)return e(a,c).value}return a[c]};a.exports=function a(){var b,c,d,e,j,k,l=arguments[0],m=1,n=arguments.length,o=!1;for("boolean"==typeof l&&(o=l,l=arguments[1]||{},m=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});m<n;++m)if(b=arguments[m],null!=b)for(c in b)d=i(l,c),l!==(e=i(b,c))&&(o&&e&&(g(e)||(j=f(e)))?(j?(j=!1,k=d&&f(d)?d:[]):k=d&&g(d)?d:{},h(l,{name:c,newValue:a(o,k,e)})):void 0!==e&&h(l,{name:c,newValue:e}));return l}},78900:(a,b,c)=>{"use strict";let{kForOnEventAttribute:d,kListener:e}=c(17165),f=Symbol("kCode"),g=Symbol("kData"),h=Symbol("kError"),i=Symbol("kMessage"),j=Symbol("kReason"),k=Symbol("kTarget"),l=Symbol("kType"),m=Symbol("kWasClean");class n{constructor(a){this[k]=null,this[l]=a}get target(){return this[k]}get type(){return this[l]}}Object.defineProperty(n.prototype,"target",{enumerable:!0}),Object.defineProperty(n.prototype,"type",{enumerable:!0});class o extends n{constructor(a,b={}){super(a),this[f]=void 0===b.code?0:b.code,this[j]=void 0===b.reason?"":b.reason,this[m]=void 0!==b.wasClean&&b.wasClean}get code(){return this[f]}get reason(){return this[j]}get wasClean(){return this[m]}}Object.defineProperty(o.prototype,"code",{enumerable:!0}),Object.defineProperty(o.prototype,"reason",{enumerable:!0}),Object.defineProperty(o.prototype,"wasClean",{enumerable:!0});class p extends n{constructor(a,b={}){super(a),this[h]=void 0===b.error?null:b.error,this[i]=void 0===b.message?"":b.message}get error(){return this[h]}get message(){return this[i]}}Object.defineProperty(p.prototype,"error",{enumerable:!0}),Object.defineProperty(p.prototype,"message",{enumerable:!0});class q extends n{constructor(a,b={}){super(a),this[g]=void 0===b.data?null:b.data}get data(){return this[g]}}function r(a,b,c){"object"==typeof a&&a.handleEvent?a.handleEvent.call(a,c):a.call(b,c)}Object.defineProperty(q.prototype,"data",{enumerable:!0}),a.exports={CloseEvent:o,ErrorEvent:p,Event:n,EventTarget:{addEventListener(a,b,c={}){let f;for(let f of this.listeners(a))if(!c[d]&&f[e]===b&&!f[d])return;if("message"===a)f=function(a,c){let d=new q("message",{data:c?a:a.toString()});d[k]=this,r(b,this,d)};else if("close"===a)f=function(a,c){let d=new o("close",{code:a,reason:c.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});d[k]=this,r(b,this,d)};else if("error"===a)f=function(a){let c=new p("error",{error:a,message:a.message});c[k]=this,r(b,this,c)};else{if("open"!==a)return;f=function(){let a=new n("open");a[k]=this,r(b,this,a)}}f[d]=!!c[d],f[e]=b,c.once?this.once(a,f):this.on(a,f)},removeEventListener(a,b){for(let c of this.listeners(a))if(c[e]===b&&!c[d]){this.removeListener(a,c);break}}},MessageEvent:q}},80123:(a,b,c)=>{"use strict";let d=c(94735),e=c(55591),f=c(81630),g=c(91645),h=c(34631),{randomBytes:i,createHash:j}=c(55511),{Duplex:k,Readable:l}=c(27910),{URL:m}=c(1932),n=c(88634),o=c(13259),p=c(53455),{isBlob:q}=c(97861),{BINARY_TYPES:r,CLOSE_TIMEOUT:s,EMPTY_BUFFER:t,GUID:u,kForOnEventAttribute:v,kListener:w,kStatusCode:x,kWebSocket:y,NOOP:z}=c(17165),{EventTarget:{addEventListener:A,removeEventListener:B}}=c(78900),{format:C,parse:D}=c(24509),{toBuffer:E}=c(6361),F=Symbol("kAborted"),G=[8,13],H=["CONNECTING","OPEN","CLOSING","CLOSED"],I=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class J extends d{constructor(a,b,c){super(),this._binaryType=r[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=t,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=J.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==a?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===b?b=[]:Array.isArray(b)||("object"==typeof b&&null!==b?(c=b,b=[]):b=[b]),function a(b,c,d,g){let h,k,l,o,p={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:s,protocolVersion:G[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...g,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(b._autoPong=p.autoPong,b._closeTimeout=p.closeTimeout,!G.includes(p.protocolVersion))throw RangeError(`Unsupported protocol version: ${p.protocolVersion} (supported versions: ${G.join(", ")})`);if(c instanceof m)h=c;else try{h=new m(c)}catch{throw SyntaxError(`Invalid URL: ${c}`)}"http:"===h.protocol?h.protocol="ws:":"https:"===h.protocol&&(h.protocol="wss:"),b._url=h.href;let q="wss:"===h.protocol,r="ws+unix:"===h.protocol;if("ws:"===h.protocol||q||r?r&&!h.pathname?k="The URL's pathname is empty":h.hash&&(k="The URL contains a fragment identifier"):k='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',k){let a=SyntaxError(k);if(0!==b._redirects)return void K(b,a);throw a}let t=q?443:80,v=i(16).toString("base64"),w=q?e.request:f.request,x=new Set;if(p.createConnection=p.createConnection||(q?M:L),p.defaultPort=p.defaultPort||t,p.port=h.port||t,p.host=h.hostname.startsWith("[")?h.hostname.slice(1,-1):h.hostname,p.headers={...p.headers,"Sec-WebSocket-Version":p.protocolVersion,"Sec-WebSocket-Key":v,Connection:"Upgrade",Upgrade:"websocket"},p.path=h.pathname+h.search,p.timeout=p.handshakeTimeout,p.perMessageDeflate&&(l=new n({...p.perMessageDeflate,isServer:!1,maxPayload:p.maxPayload}),p.headers["Sec-WebSocket-Extensions"]=C({[n.extensionName]:l.offer()})),d.length){for(let a of d){if("string"!=typeof a||!I.test(a)||x.has(a))throw SyntaxError("An invalid or duplicated subprotocol was specified");x.add(a)}p.headers["Sec-WebSocket-Protocol"]=d.join(",")}if(p.origin&&(p.protocolVersion<13?p.headers["Sec-WebSocket-Origin"]=p.origin:p.headers.Origin=p.origin),(h.username||h.password)&&(p.auth=`${h.username}:${h.password}`),r){let a=p.path.split(":");p.socketPath=a[0],p.path=a[1]}if(p.followRedirects){if(0===b._redirects){b._originalIpc=r,b._originalSecure=q,b._originalHostOrSocketPath=r?p.socketPath:h.host;let a=g&&g.headers;if(g={...g,headers:{}},a)for(let[b,c]of Object.entries(a))g.headers[b.toLowerCase()]=c}else if(0===b.listenerCount("redirect")){let a=r?!!b._originalIpc&&p.socketPath===b._originalHostOrSocketPath:!b._originalIpc&&h.host===b._originalHostOrSocketPath;a&&(!b._originalSecure||q)||(delete p.headers.authorization,delete p.headers.cookie,a||delete p.headers.host,p.auth=void 0)}p.auth&&!g.headers.authorization&&(g.headers.authorization="Basic "+Buffer.from(p.auth).toString("base64")),o=b._req=w(p),b._redirects&&b.emit("redirect",b.url,o)}else o=b._req=w(p);p.timeout&&o.on("timeout",()=>{N(b,o,"Opening handshake has timed out")}),o.on("error",a=>{null===o||o[F]||(o=b._req=null,K(b,a))}),o.on("response",e=>{let f=e.headers.location,h=e.statusCode;if(f&&p.followRedirects&&h>=300&&h<400){let e;if(++b._redirects>p.maxRedirects)return void N(b,o,"Maximum redirects exceeded");o.abort();try{e=new m(f,c)}catch(a){K(b,SyntaxError(`Invalid URL: ${f}`));return}a(b,e,d,g)}else b.emit("unexpected-response",o,e)||N(b,o,`Unexpected server response: ${e.statusCode}`)}),o.on("upgrade",(a,c,d)=>{let e;if(b.emit("upgrade",a),b.readyState!==J.CONNECTING)return;o=b._req=null;let f=a.headers.upgrade;if(void 0===f||"websocket"!==f.toLowerCase())return void N(b,c,"Invalid Upgrade header");let g=j("sha1").update(v+u).digest("base64");if(a.headers["sec-websocket-accept"]!==g)return void N(b,c,"Invalid Sec-WebSocket-Accept header");let h=a.headers["sec-websocket-protocol"];if(void 0!==h?x.size?x.has(h)||(e="Server sent an invalid subprotocol"):e="Server sent a subprotocol but none was requested":x.size&&(e="Server sent no subprotocol"),e)return void N(b,c,e);h&&(b._protocol=h);let i=a.headers["sec-websocket-extensions"];if(void 0!==i){let a;if(!l)return void N(b,c,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");try{a=D(i)}catch(a){N(b,c,"Invalid Sec-WebSocket-Extensions header");return}let d=Object.keys(a);if(1!==d.length||d[0]!==n.extensionName)return void N(b,c,"Server indicated an extension that was not requested");try{l.accept(a[n.extensionName])}catch(a){N(b,c,"Invalid Sec-WebSocket-Extensions header");return}b._extensions[n.extensionName]=l}b.setSocket(c,d,{allowSynchronousEvents:p.allowSynchronousEvents,generateMask:p.generateMask,maxBufferedChunks:p.maxBufferedChunks,maxFragments:p.maxFragments,maxPayload:p.maxPayload,skipUTF8Validation:p.skipUTF8Validation})}),p.finishRequest?p.finishRequest(o,b):o.end()}(this,a,b,c)):(this._autoPong=c.autoPong,this._closeTimeout=c.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(a){r.includes(a)&&(this._binaryType=a,this._receiver&&(this._receiver._binaryType=a))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(a,b,c){let d=new o({allowSynchronousEvents:c.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:c.maxBufferedChunks,maxFragments:c.maxFragments,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation}),e=new p(a,this._extensions,c.generateMask);this._receiver=d,this._sender=e,this._socket=a,d[y]=this,e[y]=this,a[y]=this,d.on("conclude",P),d.on("drain",Q),d.on("error",R),d.on("message",T),d.on("ping",U),d.on("pong",V),e.onerror=X,a.setTimeout&&a.setTimeout(0),a.setNoDelay&&a.setNoDelay(),b.length>0&&a.unshift(b),a.on("close",Z),a.on("data",$),a.on("end",_),a.on("error",aa),this._readyState=J.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=J.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[n.extensionName]&&this._extensions[n.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=J.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(a,b){if(this.readyState!==J.CLOSED){if(this.readyState===J.CONNECTING)return void N(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===J.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=J.CLOSING,this._sender.close(a,b,!this._isServer,a=>{!a&&(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Y(this)}}pause(){this.readyState!==J.CONNECTING&&this.readyState!==J.CLOSED&&(this._paused=!0,this._socket.pause())}ping(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof a?(c=a,a=b=void 0):"function"==typeof b&&(c=b,b=void 0),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)?O(this,a,c):(void 0===b&&(b=!this._isServer),this._sender.ping(a||t,b,c))}pong(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof a?(c=a,a=b=void 0):"function"==typeof b&&(c=b,b=void 0),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)?O(this,a,c):(void 0===b&&(b=!this._isServer),this._sender.pong(a||t,b,c))}resume(){this.readyState!==J.CONNECTING&&this.readyState!==J.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof b&&(c=b,b={}),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)return void O(this,a,c);let d={binary:"string"!=typeof a,mask:!this._isServer,compress:!0,fin:!0,...b};this._extensions[n.extensionName]||(d.compress=!1),this._sender.send(a||t,d,c)}terminate(){if(this.readyState!==J.CLOSED){if(this.readyState===J.CONNECTING)return void N(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=J.CLOSING,this._socket.destroy())}}}function K(a,b){a._readyState=J.CLOSING,a._errorEmitted=!0,a.emit("error",b),a.emitClose()}function L(a){return a.path=a.socketPath,g.connect(a)}function M(a){return a.path=void 0,a.servername||""===a.servername||(a.servername=g.isIP(a.host)?"":a.host),h.connect(a)}function N(a,b,c){a._readyState=J.CLOSING;let d=Error(c);Error.captureStackTrace(d,N),b.setHeader?(b[F]=!0,b.abort(),b.socket&&!b.socket.destroyed&&b.socket.destroy(),process.nextTick(K,a,d)):(b.destroy(d),b.once("error",a.emit.bind(a,"error")),b.once("close",a.emitClose.bind(a)))}function O(a,b,c){if(b){let c=q(b)?b.size:E(b).length;a._socket?a._sender._bufferedBytes+=c:a._bufferedAmount+=c}if(c){let b=Error(`WebSocket is not open: readyState ${a.readyState} (${H[a.readyState]})`);process.nextTick(c,b)}}function P(a,b){let c=this[y];c._closeFrameReceived=!0,c._closeMessage=b,c._closeCode=a,void 0!==c._socket[y]&&(c._socket.removeListener("data",$),process.nextTick(W,c._socket),1005===a?c.close():c.close(a,b))}function Q(){let a=this[y];a.isPaused||a._socket.resume()}function R(a){let b=this[y];void 0!==b._socket[y]&&(b._socket.removeListener("data",$),process.nextTick(W,b._socket),b.close(a[x])),b._errorEmitted||(b._errorEmitted=!0,b.emit("error",a))}function S(){this[y].emitClose()}function T(a,b){this[y].emit("message",a,b)}function U(a){let b=this[y];b._autoPong&&b.pong(a,!this._isServer,z),b.emit("ping",a)}function V(a){this[y].emit("pong",a)}function W(a){a.resume()}function X(a){let b=this[y];b.readyState!==J.CLOSED&&(b.readyState===J.OPEN&&(b._readyState=J.CLOSING,Y(b)),this._socket.end(),b._errorEmitted||(b._errorEmitted=!0,b.emit("error",a)))}function Y(a){a._closeTimer=setTimeout(a._socket.destroy.bind(a._socket),a._closeTimeout)}function Z(){let a=this[y];if(this.removeListener("close",Z),this.removeListener("data",$),this.removeListener("end",_),a._readyState=J.CLOSING,!this._readableState.endEmitted&&!a._closeFrameReceived&&!a._receiver._writableState.errorEmitted&&0!==this._readableState.length){let b=this.read(this._readableState.length);a._receiver.write(b)}a._receiver.end(),this[y]=void 0,clearTimeout(a._closeTimer),a._receiver._writableState.finished||a._receiver._writableState.errorEmitted?a.emitClose():(a._receiver.on("error",S),a._receiver.on("finish",S))}function $(a){this[y]._receiver.write(a)||this.pause()}function _(){let a=this[y];a._readyState=J.CLOSING,a._receiver.end(),this.end()}function aa(){let a=this[y];this.removeListener("error",aa),this.on("error",z),a&&(a._readyState=J.CLOSING,this.destroy())}Object.defineProperty(J,"CONNECTING",{enumerable:!0,value:H.indexOf("CONNECTING")}),Object.defineProperty(J.prototype,"CONNECTING",{enumerable:!0,value:H.indexOf("CONNECTING")}),Object.defineProperty(J,"OPEN",{enumerable:!0,value:H.indexOf("OPEN")}),Object.defineProperty(J.prototype,"OPEN",{enumerable:!0,value:H.indexOf("OPEN")}),Object.defineProperty(J,"CLOSING",{enumerable:!0,value:H.indexOf("CLOSING")}),Object.defineProperty(J.prototype,"CLOSING",{enumerable:!0,value:H.indexOf("CLOSING")}),Object.defineProperty(J,"CLOSED",{enumerable:!0,value:H.indexOf("CLOSED")}),Object.defineProperty(J.prototype,"CLOSED",{enumerable:!0,value:H.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(a=>{Object.defineProperty(J.prototype,a,{enumerable:!0})}),["open","error","close","message"].forEach(a=>{Object.defineProperty(J.prototype,`on${a}`,{enumerable:!0,get(){for(let b of this.listeners(a))if(b[v])return b[w];return null},set(b){for(let b of this.listeners(a))if(b[v]){this.removeListener(a,b);break}"function"==typeof b&&this.addEventListener(a,b,{[v]:!0})}})}),J.prototype.addEventListener=A,J.prototype.removeEventListener=B,a.exports=J},81664:(a,b,c)=>{a.exports=c(59674)},82080:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.BaseExternalAccountClient=b.CLOUD_RESOURCE_MANAGER=b.EXTERNAL_ACCOUNT_TYPE=b.EXPIRATION_TIME_OFFSET=void 0;let d=c(27064),e=c(27910),f=c(56916),g=c(12135),h=c(45920),i=c(12586),j="https://www.googleapis.com/auth/cloud-platform";b.EXPIRATION_TIME_OFFSET=3e5,b.EXTERNAL_ACCOUNT_TYPE="external_account",b.CLOUD_RESOURCE_MANAGER="https://cloudresourcemanager.googleapis.com/v1/projects/";class k extends f.AuthClient{scopes;projectNumber;audience;subjectTokenType;stsCredential;clientAuth;credentialSourceType;cachedAccessToken;serviceAccountImpersonationUrl;serviceAccountImpersonationLifetime;workforcePoolUserProject;configLifetimeRequested;tokenUrl;cloudResourceManagerURL;supplierContext;#y=null;constructor(a){super(a);const c=(0,h.originalOrCamelOptions)(a),d=c.get("type");if(d&&d!==b.EXTERNAL_ACCOUNT_TYPE)throw Error(`Expected "${b.EXTERNAL_ACCOUNT_TYPE}" type but received "${a.type}"`);const e=c.get("client_id"),f=c.get("client_secret");this.tokenUrl=c.get("token_url")??"https://sts.{universeDomain}/v1/token".replace("{universeDomain}",this.universeDomain);const i=c.get("subject_token_type"),k=c.get("workforce_pool_user_project"),l=c.get("service_account_impersonation_url"),m=c.get("service_account_impersonation"),n=(0,h.originalOrCamelOptions)(m).get("token_lifetime_seconds");this.cloudResourceManagerURL=new URL(c.get("cloud_resource_manager_url")||`https://cloudresourcemanager.${this.universeDomain}/v1/projects/`),e&&(this.clientAuth={confidentialClientType:"basic",clientId:e,clientSecret:f}),this.stsCredential=new g.StsCredentials({tokenExchangeEndpoint:this.tokenUrl,clientAuthentication:this.clientAuth}),this.scopes=c.get("scopes")||[j],this.cachedAccessToken=null,this.audience=c.get("audience"),this.subjectTokenType=i,this.workforcePoolUserProject=k;const o=RegExp("//iam\\.googleapis\\.com/locations/[^/]+/workforcePools/[^/]+/providers/.+");if(this.workforcePoolUserProject&&!this.audience.match(o))throw Error("workforcePoolUserProject should not be set for non-workforce pool credentials.");this.serviceAccountImpersonationUrl=l,this.serviceAccountImpersonationLifetime=n,this.serviceAccountImpersonationLifetime?this.configLifetimeRequested=!0:(this.configLifetimeRequested=!1,this.serviceAccountImpersonationLifetime=3600),this.projectNumber=this.getProjectNumber(this.audience),this.supplierContext={audience:this.audience,subjectTokenType:this.subjectTokenType,transporter:this.transporter}}getServiceAccountEmail(){if(this.serviceAccountImpersonationUrl){if(this.serviceAccountImpersonationUrl.length>256)throw RangeError(`URL is too long: ${this.serviceAccountImpersonationUrl}`);let a=/serviceAccounts\/(?<email>[^:]+):generateAccessToken$/.exec(this.serviceAccountImpersonationUrl);return a?.groups?.email||null}return null}setCredentials(a){super.setCredentials(a),this.cachedAccessToken=a}async getAccessToken(){return(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){let a=await this.getAccessToken(),b=new Headers({authorization:`Bearer ${a.token}`});return this.addSharedMetadataHeaders(b)}request(a,b){if(!b)return this.requestAsync(a);this.requestAsync(a).then(a=>b(null,a),a=>b(a,a.response))}async getProjectId(){let a=this.projectNumber||this.workforcePoolUserProject;if(this.projectId)return this.projectId;if(a){let b=await this.getRequestHeaders(),c={...k.RETRY_CONFIG,headers:b,url:`${this.cloudResourceManagerURL.toString()}${a}`,responseType:"json"};f.AuthClient.setMethodName(c,"getProjectId");let d=await this.transporter.request(c);return this.projectId=d.data.projectId,this.projectId}return null}async requestAsync(a,b=!1){let c;try{let b=await this.getRequestHeaders();a.headers=d.Gaxios.mergeHeaders(a.headers),this.addUserProjectAndAuthHeaders(a.headers,b),c=await this.transporter.request(a)}catch(d){let c=d.response;if(c){let d=c.status,f=c.config.data instanceof e.Readable;if(!b&&(401===d||403===d)&&!f&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(a,!0)}throw d}return c}async refreshAccessTokenAsync(){this.#y=this.#y||this.#z();try{return await this.#y}finally{this.#y=null}}async #z(){let a=await this.retrieveSubjectToken(),b={grantType:"urn:ietf:params:oauth:grant-type:token-exchange",audience:this.audience,requestedTokenType:"urn:ietf:params:oauth:token-type:access_token",subjectToken:a,subjectTokenType:this.subjectTokenType,scope:this.serviceAccountImpersonationUrl?[j]:this.getScopesArray()},c=!this.clientAuth&&this.workforcePoolUserProject?{userProject:this.workforcePoolUserProject}:void 0,d=new Headers({"x-goog-api-client":this.getMetricsHeaderValue()}),e=await this.stsCredential.exchangeToken(b,d,c);return this.serviceAccountImpersonationUrl?this.cachedAccessToken=await this.getImpersonatedAccessToken(e.access_token):e.expires_in?this.cachedAccessToken={access_token:e.access_token,expiry_date:new Date().getTime()+1e3*e.expires_in,res:e.res}:this.cachedAccessToken={access_token:e.access_token,res:e.res},this.credentials={},Object.assign(this.credentials,this.cachedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedAccessToken.expiry_date,access_token:this.cachedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedAccessToken}getProjectNumber(a){let b=a.match(/\/projects\/([^/]+)/);return b?b[1]:null}async getImpersonatedAccessToken(a){let b={...k.RETRY_CONFIG,url:this.serviceAccountImpersonationUrl,method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${a}`},data:{scope:this.getScopesArray(),lifetime:this.serviceAccountImpersonationLifetime+"s"},responseType:"json"};f.AuthClient.setMethodName(b,"getImpersonatedAccessToken");let c=await this.transporter.request(b),d=c.data;return{access_token:d.accessToken,expiry_date:new Date(d.expireTime).getTime(),res:c}}isExpired(a){let b=new Date().getTime();return!!a.expiry_date&&b>=a.expiry_date-this.eagerRefreshThresholdMillis}getScopesArray(){return"string"==typeof this.scopes?[this.scopes]:this.scopes||[j]}getMetricsHeaderValue(){let a=process.version.replace(/^v/,""),b=void 0!==this.serviceAccountImpersonationUrl,c=this.credentialSourceType?this.credentialSourceType:"unknown";return`gl-node/${a} auth/${i.pkg.version} google-byoid-sdk source/${c} sa-impersonation/${b} config-lifetime/${this.configLifetimeRequested}`}getTokenUrl(){return this.tokenUrl}}b.BaseExternalAccountClient=k},82146:(a,b,c)=>{"use strict";c(80123);let{Duplex:d}=c(27910);function e(a){a.emit("close")}function f(){!this.destroyed&&this._writableState.finished&&this.destroy()}function g(a){this.removeListener("error",g),this.destroy(),0===this.listenerCount("error")&&this.emit("error",a)}a.exports=function(a,b){let c=!0,h=new d({...b,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return a.on("message",function(b,c){let d=!c&&h._readableState.objectMode?b.toString():b;h.push(d)||a.pause()}),a.once("error",function(a){h.destroyed||(c=!1,h.destroy(a))}),a.once("close",function(){h.destroyed||h.push(null)}),h._destroy=function(b,d){if(a.readyState===a.CLOSED){d(b),process.nextTick(e,h);return}let f=!1;a.once("error",function(a){f=!0,d(a)}),a.once("close",function(){f||d(b),process.nextTick(e,h)}),c&&a.terminate()},h._final=function(b){a.readyState===a.CONNECTING?a.once("open",function(){h._final(b)}):null!==a._socket&&(a._socket._writableState.finished?(b(),h._readableState.endEmitted&&h.destroy()):(a._socket.once("finish",function(){b()}),a.close()))},h._read=function(){a.isPaused&&a.resume()},h._write=function(b,c,d){a.readyState===a.CONNECTING?a.once("open",function(){h._write(b,c,d)}):a.send(b,d)},h.on("end",f),h.on("error",g),h}},82517:function(a,b,c){var d;!function(e){"use strict";var f,g=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,h=Math.ceil,i=Math.floor,j="[BigNumber Error] ",k=j+"Number primitive has more than 15 significant digits: ",l=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13];function m(a){var b=0|a;return a>0||a===b?b:b-1}function n(a){for(var b,c,d=1,e=a.length,f=a[0]+"";d<e;){for(c=14-(b=a[d++]+"").length;c--;b="0"+b);f+=b}for(e=f.length;48===f.charCodeAt(--e););return f.slice(0,e+1||1)}function o(a,b){var c,d,e=a.c,f=b.c,g=a.s,h=b.s,i=a.e,j=b.e;if(!g||!h)return null;if(c=e&&!e[0],d=f&&!f[0],c||d)return c?d?0:-h:g;if(g!=h)return g;if(c=g<0,d=i==j,!e||!f)return d?0:!e^c?1:-1;if(!d)return i>j^c?1:-1;for(g=0,h=(i=e.length)<(j=f.length)?i:j;g<h;g++)if(e[g]!=f[g])return e[g]>f[g]^c?1:-1;return i==j?0:i>j^c?1:-1}function p(a,b,c,d){if(a<b||a>c||a!==i(a))throw Error(j+(d||"Argument")+("number"==typeof a?a<b||a>c?" out of range: ":" not an integer: ":" not a primitive number: ")+String(a))}function q(a){var b=a.c.length-1;return m(a.e/14)==b&&a.c[b]%2!=0}function r(a,b){return(a.length>1?a.charAt(0)+"."+a.slice(1):a)+(b<0?"e":"e+")+b}function s(a,b,c){var d,e;if(b<0){for(e=c+".";++b;e+=c);a=e+a}else if(d=a.length,++b>d){for(e=c,b-=d;--b;e+=c);a+=e}else b<d&&(a=a.slice(0,b)+"."+a.slice(b));return a}(f=function a(b){var c,d,e,f,t,u,v,w,x,y=M.prototype={constructor:M,toString:null,valueOf:null},z=new M(1),A=20,B=4,C=-7,D=21,E=-1e7,F=1e7,G=!1,H=1,I=0,J={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xa0",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",L=!0;function M(a,b){var c,d,e,f,h,j,l,m,n=this;if(!(n instanceof M))return new M(a,b);if(null==b){if(a&&!0===a._isBigNumber){n.s=a.s,!a.c||a.e>F?n.c=n.e=null:a.e<E?n.c=[n.e=0]:(n.e=a.e,n.c=a.c.slice());return}if((j="number"==typeof a)&&0*a==0){if(n.s=1/a<0?(a=-a,-1):1,a===~~a){for(f=0,h=a;h>=10;h/=10,f++);f>F?n.c=n.e=null:(n.e=f,n.c=[a]);return}m=String(a)}else{if(!g.test(m=String(a)))return x(n,m,j);n.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(f=m.indexOf("."))>-1&&(m=m.replace(".","")),(h=m.search(/e/i))>0?(f<0&&(f=h),f+=+m.slice(h+1),m=m.substring(0,h)):f<0&&(f=m.length)}else{if(p(b,2,K.length,"Base"),10==b&&L)return Q(n=new M(a),A+n.e+1,B);if(m=String(a),j="number"==typeof a){if(0*a!=0)return x(n,m,j,b);if(n.s=1/a<0?(m=m.slice(1),-1):1,M.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(k+a)}else n.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(c=K.slice(0,b),f=h=0,l=m.length;h<l;h++)if(0>c.indexOf(d=m.charAt(h))){if("."==d){if(h>f){f=l;continue}}else if(!e&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){e=!0,h=-1,f=0;continue}return x(n,String(a),j,b)}j=!1,(f=(m=w(m,b,10,n.s)).indexOf("."))>-1?m=m.replace(".",""):f=m.length}for(h=0;48===m.charCodeAt(h);h++);for(l=m.length;48===m.charCodeAt(--l););if(m=m.slice(h,++l)){if(l-=h,j&&M.DEBUG&&l>15&&(a>0x1fffffffffffff||a!==i(a)))throw Error(k+n.s*a);if((f=f-h-1)>F)n.c=n.e=null;else if(f<E)n.c=[n.e=0];else{if(n.e=f,n.c=[],h=(f+1)%14,f<0&&(h+=14),h<l){for(h&&n.c.push(+m.slice(0,h)),l-=14;h<l;)n.c.push(+m.slice(h,h+=14));h=14-(m=m.slice(h)).length}else h-=l;for(;h--;m+="0");n.c.push(+m)}}else n.c=[n.e=0]}function N(a,b,c,d){var e,f,g,h,i;if(null==c?c=B:p(c,0,8),!a.c)return a.toString();if(e=a.c[0],g=a.e,null==b)i=n(a.c),i=1==d||2==d&&(g<=C||g>=D)?r(i,g):s(i,g,"0");else if(f=(a=Q(new M(a),b,c)).e,h=(i=n(a.c)).length,1==d||2==d&&(b<=f||f<=C)){for(;h<b;i+="0",h++);i=r(i,f)}else if(b-=g+(2===d&&f>g),i=s(i,f,"0"),f+1>h){if(--b>0)for(i+=".";b--;i+="0");}else if((b+=f-h)>0)for(f+1==h&&(i+=".");b--;i+="0");return a.s<0&&e?"-"+i:i}function O(a,b){for(var c,d,e=1,f=new M(a[0]);e<a.length;e++)(d=new M(a[e])).s&&(c=o(f,d))!==b&&(0!==c||f.s!==b)||(f=d);return f}function P(a,b,c){for(var d=1,e=b.length;!b[--e];b.pop());for(e=b[0];e>=10;e/=10,d++);return(c=d+14*c-1)>F?a.c=a.e=null:c<E?a.c=[a.e=0]:(a.e=c,a.c=b),a}function Q(a,b,c,d){var e,f,g,j,k,m,n,o=a.c;if(o){b:{for(e=1,j=o[0];j>=10;j/=10,e++);if((f=b-e)<0)f+=14,g=b,n=i((k=o[m=0])/l[e-g-1]%10);else if((m=h((f+1)/14))>=o.length)if(d){for(;o.length<=m;o.push(0));k=n=0,e=1,f%=14,g=f-14+1}else break b;else{for(e=1,k=j=o[m];j>=10;j/=10,e++);f%=14,n=(g=f-14+e)<0?0:i(k/l[e-g-1]%10)}if(d=d||b<0||null!=o[m+1]||(g<0?k:k%l[e-g-1]),d=c<4?(n||d)&&(0==c||c==(a.s<0?3:2)):n>5||5==n&&(4==c||d||6==c&&(f>0?g>0?k/l[e-g]:0:o[m-1])%10&1||c==(a.s<0?8:7)),b<1||!o[0])return o.length=0,d?(b-=a.e+1,o[0]=l[(14-b%14)%14],a.e=-b||0):o[0]=a.e=0,a;if(0==f?(o.length=m,j=1,m--):(o.length=m+1,j=l[14-f],o[m]=g>0?i(k/l[e-g]%l[g])*j:0),d)for(;;)if(0==m){for(f=1,g=o[0];g>=10;g/=10,f++);for(g=o[0]+=j,j=1;g>=10;g/=10,j++);f!=j&&(a.e++,1e14==o[0]&&(o[0]=1));break}else{if(o[m]+=j,1e14!=o[m])break;o[m--]=0,j=1}for(f=o.length;0===o[--f];o.pop());}a.e>F?a.c=a.e=null:a.e<E&&(a.c=[a.e=0])}return a}function R(a){var b,c=a.e;return null===c?a.toString():(b=n(a.c),b=c<=C||c>=D?r(b,c):s(b,c,"0"),a.s<0?"-"+b:b)}return M.clone=a,M.ROUND_UP=0,M.ROUND_DOWN=1,M.ROUND_CEIL=2,M.ROUND_FLOOR=3,M.ROUND_HALF_UP=4,M.ROUND_HALF_DOWN=5,M.ROUND_HALF_EVEN=6,M.ROUND_HALF_CEIL=7,M.ROUND_HALF_FLOOR=8,M.EUCLID=9,M.config=M.set=function(a){var b,c;if(null!=a)if("object"==typeof a){if(a.hasOwnProperty(b="DECIMAL_PLACES")&&(p(c=a[b],0,1e9,b),A=c),a.hasOwnProperty(b="ROUNDING_MODE")&&(p(c=a[b],0,8,b),B=c),a.hasOwnProperty(b="EXPONENTIAL_AT")&&((c=a[b])&&c.pop?(p(c[0],-1e9,0,b),p(c[1],0,1e9,b),C=c[0],D=c[1]):(p(c,-1e9,1e9,b),C=-(D=c<0?-c:c))),a.hasOwnProperty(b="RANGE"))if((c=a[b])&&c.pop)p(c[0],-1e9,-1,b),p(c[1],1,1e9,b),E=c[0],F=c[1];else if(p(c,-1e9,1e9,b),c)E=-(F=c<0?-c:c);else throw Error(j+b+" cannot be zero: "+c);if(a.hasOwnProperty(b="CRYPTO"))if(!!(c=a[b])===c)if(c)if("u">typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))G=c;else throw G=!c,Error(j+"crypto unavailable");else G=c;else throw Error(j+b+" not true or false: "+c);if(a.hasOwnProperty(b="MODULO_MODE")&&(p(c=a[b],0,9,b),H=c),a.hasOwnProperty(b="POW_PRECISION")&&(p(c=a[b],0,1e9,b),I=c),a.hasOwnProperty(b="FORMAT"))if("object"==typeof(c=a[b]))J=c;else throw Error(j+b+" not an object: "+c);if(a.hasOwnProperty(b="ALPHABET")){if("string"!=typeof(c=a[b])||/^.?$|[+\-.\s]|(.).*\1/.test(c))throw Error(j+b+" invalid: "+c);L="0123456789"==c.slice(0,10),K=c}}else throw Error(j+"Object expected: "+a);return{DECIMAL_PLACES:A,ROUNDING_MODE:B,EXPONENTIAL_AT:[C,D],RANGE:[E,F],CRYPTO:G,MODULO_MODE:H,POW_PRECISION:I,FORMAT:J,ALPHABET:K}},M.isBigNumber=function(a){if(!a||!0!==a._isBigNumber)return!1;if(!M.DEBUG)return!0;var b,c,d=a.c,e=a.e,f=a.s;b:if("[object Array]"==({}).toString.call(d)){if((1===f||-1===f)&&e>=-1e9&&e<=1e9&&e===i(e)){if(0===d[0]){if(0===e&&1===d.length)return!0;break b}if((b=(e+1)%14)<1&&(b+=14),String(d[0]).length==b){for(b=0;b<d.length;b++)if((c=d[b])<0||c>=1e14||c!==i(c))break b;if(0!==c)return!0}}}else if(null===d&&null===e&&(null===f||1===f||-1===f))return!0;throw Error(j+"Invalid BigNumber: "+a)},M.maximum=M.max=function(){return O(arguments,-1)},M.minimum=M.min=function(){return O(arguments,1)},c=0x20000000000000*Math.random()&2097151?function(){return i(0x20000000000000*Math.random())}:function(){return(0x40000000*Math.random()|0)*8388608+(8388608*Math.random()|0)},M.random=function(a){var b,d,e,f,g,k=0,m=[],n=new M(z);if(null==a?a=A:p(a,0,1e9),f=h(a/14),G)if(crypto.getRandomValues){for(b=crypto.getRandomValues(new Uint32Array(f*=2));k<f;)(g=131072*b[k]+(b[k+1]>>>11))>=9e15?(d=crypto.getRandomValues(new Uint32Array(2)),b[k]=d[0],b[k+1]=d[1]):(m.push(g%1e14),k+=2);k=f/2}else if(crypto.randomBytes){for(b=crypto.randomBytes(f*=7);k<f;)(g=(31&b[k])*0x1000000000000+0x10000000000*b[k+1]+0x100000000*b[k+2]+0x1000000*b[k+3]+(b[k+4]<<16)+(b[k+5]<<8)+b[k+6])>=9e15?crypto.randomBytes(7).copy(b,k):(m.push(g%1e14),k+=7);k=f/7}else throw G=!1,Error(j+"crypto unavailable");if(!G)for(;k<f;)(g=c())<9e15&&(m[k++]=g%1e14);for(f=m[--k],a%=14,f&&a&&(g=l[14-a],m[k]=i(f/g)*g);0===m[k];m.pop(),k--);if(k<0)m=[e=0];else{for(e=-1;0===m[0];m.splice(0,1),e-=14);for(k=1,g=m[0];g>=10;g/=10,k++);k<14&&(e-=14-k)}return n.e=e,n.c=m,n},M.sum=function(){for(var a=1,b=arguments,c=new M(b[0]);a<b.length;)c=c.plus(b[a++]);return c},w=function(){var a="0123456789";function b(a,b,c,d){for(var e,f,g=[0],h=0,i=a.length;h<i;){for(f=g.length;f--;g[f]*=b);for(g[0]+=d.indexOf(a.charAt(h++)),e=0;e<g.length;e++)g[e]>c-1&&(null==g[e+1]&&(g[e+1]=0),g[e+1]+=g[e]/c|0,g[e]%=c)}return g.reverse()}return function(c,d,e,f,g){var h,i,j,k,l,m,o,p,q=c.indexOf("."),r=A,t=B;for(q>=0&&(k=I,I=0,c=c.replace(".",""),m=(p=new M(d)).pow(c.length-q),I=k,p.c=b(s(n(m.c),m.e,"0"),10,e,a),p.e=p.c.length),j=k=(o=b(c,d,e,g?(h=K,a):(h=a,K))).length;0==o[--k];o.pop());if(!o[0])return h.charAt(0);if(q<0?--j:(m.c=o,m.e=j,m.s=f,o=(m=v(m,p,r,t,e)).c,l=m.r,j=m.e),q=o[i=j+r+1],k=e/2,l=l||i<0||null!=o[i+1],l=t<4?(null!=q||l)&&(0==t||t==(m.s<0?3:2)):q>k||q==k&&(4==t||l||6==t&&1&o[i-1]||t==(m.s<0?8:7)),i<1||!o[0])c=l?s(h.charAt(1),-r,h.charAt(0)):h.charAt(0);else{if(o.length=i,l)for(--e;++o[--i]>e;)o[i]=0,i||(++j,o=[1].concat(o));for(k=o.length;!o[--k];);for(q=0,c="";q<=k;c+=h.charAt(o[q++]));c=s(c,j,h.charAt(0))}return c}}(),v=function(){function a(a,b,c){var d,e,f,g,h=0,i=a.length,j=b%1e7,k=b/1e7|0;for(a=a.slice();i--;)d=k*(f=a[i]%1e7)+(g=a[i]/1e7|0)*j,h=((e=j*f+d%1e7*1e7+h)/c|0)+(d/1e7|0)+k*g,a[i]=e%c;return h&&(a=[h].concat(a)),a}function b(a,b,c,d){var e,f;if(c!=d)f=c>d?1:-1;else for(e=f=0;e<c;e++)if(a[e]!=b[e]){f=a[e]>b[e]?1:-1;break}return f}function c(a,b,c,d){for(var e=0;c--;)a[c]-=e,e=+(a[c]<b[c]),a[c]=e*d+a[c]-b[c];for(;!a[0]&&a.length>1;a.splice(0,1));}return function(d,e,f,g,h){var j,k,l,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=d.s==e.s?1:-1,C=d.c,D=e.c;if(!C||!C[0]||!D||!D[0])return new M(!d.s||!e.s||(C?D&&C[0]==D[0]:!D)?NaN:C&&0==C[0]||!D?0*B:B/0);for(s=(r=new M(B)).c=[],B=f+(k=d.e-e.e)+1,h||(h=1e14,k=m(d.e/14)-m(e.e/14),B=B/14|0),l=0;D[l]==(C[l]||0);l++);if(D[l]>(C[l]||0)&&k--,B<0)s.push(1),n=!0;else{for(x=C.length,z=D.length,l=0,B+=2,(o=i(h/(D[0]+1)))>1&&(D=a(D,o,h),C=a(C,o,h),z=D.length,x=C.length),w=z,u=(t=C.slice(0,z)).length;u<z;t[u++]=0);A=[0].concat(A=D.slice()),y=D[0],D[1]>=h/2&&y++;do{if(o=0,(j=b(D,t,z,u))<0){if(v=t[0],z!=u&&(v=v*h+(t[1]||0)),(o=i(v/y))>1)for(o>=h&&(o=h-1),q=(p=a(D,o,h)).length,u=t.length;1==b(p,t,q,u);)o--,c(p,z<q?A:D,q,h),q=p.length,j=1;else 0==o&&(j=o=1),q=(p=D.slice()).length;if(q<u&&(p=[0].concat(p)),c(t,p,u,h),u=t.length,-1==j)for(;1>b(D,t,z,u);)o++,c(t,z<u?A:D,u,h),u=t.length}else 0===j&&(o++,t=[0]);s[l++]=o,t[0]?t[u++]=C[w]||0:(t=[C[w]],u=1)}while((w++<x||null!=t[0])&&B--);n=null!=t[0],s[0]||s.splice(0,1)}if(1e14==h){for(l=1,B=s[0];B>=10;B/=10,l++);Q(r,f+(r.e=l+14*k-1)+1,g,n)}else r.e=k,r.r=+n;return r}}(),d=/^(-?)0([xbo])(?=\w[\w.]*$)/i,e=/^([^.]+)\.$/,f=/^\.([^.]+)$/,t=/^-?(Infinity|NaN)$/,u=/^\s*\+(?=[\w.])|^\s+|\s+$/g,x=function(a,b,c,g){var h,i=c?b:b.replace(u,"");if(t.test(i))a.s=isNaN(i)?null:i<0?-1:1;else{if(!c&&(i=i.replace(d,function(a,b,c){return h="x"==(c=c.toLowerCase())?16:"b"==c?2:8,g&&g!=h?a:b}),g&&(h=g,i=i.replace(e,"$1").replace(f,"0.$1")),b!=i))return new M(i,h);if(M.DEBUG)throw Error(j+"Not a"+(g?" base "+g:"")+" number: "+b);a.s=null}a.c=a.e=null},y.absoluteValue=y.abs=function(){var a=new M(this);return a.s<0&&(a.s=1),a},y.comparedTo=function(a,b){return o(this,new M(a,b))},y.decimalPlaces=y.dp=function(a,b){var c,d,e;if(null!=a)return p(a,0,1e9),null==b?b=B:p(b,0,8),Q(new M(this),a+this.e+1,b);if(!(c=this.c))return null;if(d=((e=c.length-1)-m(this.e/14))*14,e=c[e])for(;e%10==0;e/=10,d--);return d<0&&(d=0),d},y.dividedBy=y.div=function(a,b){return v(this,new M(a,b),A,B)},y.dividedToIntegerBy=y.idiv=function(a,b){return v(this,new M(a,b),0,1)},y.exponentiatedBy=y.pow=function(a,b){var c,d,e,f,g,k,l,m,n,o=this;if((a=new M(a)).c&&!a.isInteger())throw Error(j+"Exponent not an integer: "+R(a));if(null!=b&&(b=new M(b)),k=a.e>14,!o.c||!o.c[0]||1==o.c[0]&&!o.e&&1==o.c.length||!a.c||!a.c[0])return n=new M(Math.pow(+R(o),k?a.s*(2-q(a)):+R(a))),b?n.mod(b):n;if(l=a.s<0,b){if(b.c?!b.c[0]:!b.s)return new M(NaN);(d=!l&&o.isInteger()&&b.isInteger())&&(o=o.mod(b))}else{if(a.e>9&&(o.e>0||o.e<-1||(0==o.e?o.c[0]>1||k&&o.c[1]>=24e7:o.c[0]<8e13||k&&o.c[0]<=9999975e7)))return f=o.s<0&&q(a)?-0:0,o.e>-1&&(f=1/f),new M(l?1/f:f);I&&(f=h(I/14+2))}for(k?(c=new M(.5),l&&(a.s=1),m=q(a)):m=(e=Math.abs(+R(a)))%2,n=new M(z);;){if(m){if(!(n=n.times(o)).c)break;f?n.c.length>f&&(n.c.length=f):d&&(n=n.mod(b))}if(e){if(0===(e=i(e/2)))break;m=e%2}else if(Q(a=a.times(c),a.e+1,1),a.e>14)m=q(a);else{if(0==(e=+R(a)))break;m=e%2}o=o.times(o),f?o.c&&o.c.length>f&&(o.c.length=f):d&&(o=o.mod(b))}return d?n:(l&&(n=z.div(n)),b?n.mod(b):f?Q(n,I,B,g):n)},y.integerValue=function(a){var b=new M(this);return null==a?a=B:p(a,0,8),Q(b,b.e+1,a)},y.isEqualTo=y.eq=function(a,b){return 0===o(this,new M(a,b))},y.isFinite=function(){return!!this.c},y.isGreaterThan=y.gt=function(a,b){return o(this,new M(a,b))>0},y.isGreaterThanOrEqualTo=y.gte=function(a,b){return 1===(b=o(this,new M(a,b)))||0===b},y.isInteger=function(){return!!this.c&&m(this.e/14)>this.c.length-2},y.isLessThan=y.lt=function(a,b){return 0>o(this,new M(a,b))},y.isLessThanOrEqualTo=y.lte=function(a,b){return -1===(b=o(this,new M(a,b)))||0===b},y.isNaN=function(){return!this.s},y.isNegative=function(){return this.s<0},y.isPositive=function(){return this.s>0},y.isZero=function(){return!!this.c&&0==this.c[0]},y.minus=function(a,b){var c,d,e,f,g=this.s;if(b=(a=new M(a,b)).s,!g||!b)return new M(NaN);if(g!=b)return a.s=-b,this.plus(a);var h=this.e/14,i=a.e/14,j=this.c,k=a.c;if(!h||!i){if(!j||!k)return j?(a.s=-b,a):new M(k?this:NaN);if(!j[0]||!k[0])return k[0]?(a.s=-b,a):new M(j[0]?this:3==B?-0:0)}if(h=m(h),i=m(i),j=j.slice(),g=h-i){for((f=g<0)?(g=-g,e=j):(i=h,e=k),e.reverse(),b=g;b--;e.push(0));e.reverse()}else for(d=(f=(g=j.length)<(b=k.length))?g:b,g=b=0;b<d;b++)if(j[b]!=k[b]){f=j[b]<k[b];break}if(f&&(e=j,j=k,k=e,a.s=-a.s),(b=(d=k.length)-(c=j.length))>0)for(;b--;j[c++]=0);for(b=1e14-1;d>g;){if(j[--d]<k[d]){for(c=d;c&&!j[--c];j[c]=b);--j[c],j[d]+=1e14}j[d]-=k[d]}for(;0==j[0];j.splice(0,1),--i);return j[0]?P(a,j,i):(a.s=3==B?-1:1,a.c=[a.e=0],a)},y.modulo=y.mod=function(a,b){var c,d;return(a=new M(a,b),this.c&&a.s&&(!a.c||a.c[0]))?a.c&&(!this.c||this.c[0])?(9==H?(d=a.s,a.s=1,c=v(this,a,0,3),a.s=d,c.s*=d):c=v(this,a,0,H),(a=this.minus(c.times(a))).c[0]||1!=H||(a.s=this.s),a):new M(this):new M(NaN)},y.multipliedBy=y.times=function(a,b){var c,d,e,f,g,h,i,j,k,l,n,o,p,q=this.c,r=(a=new M(a,b)).c;if(!q||!r||!q[0]||!r[0])return this.s&&a.s&&(!q||q[0]||r)&&(!r||r[0]||q)?(a.s*=this.s,q&&r?(a.c=[0],a.e=0):a.c=a.e=null):a.c=a.e=a.s=null,a;for(d=m(this.e/14)+m(a.e/14),a.s*=this.s,(i=q.length)<(l=r.length)&&(p=q,q=r,r=p,e=i,i=l,l=e),e=i+l,p=[];e--;p.push(0));for(e=l;--e>=0;){for(c=0,n=r[e]%1e7,o=r[e]/1e7|0,f=e+(g=i);f>e;)h=o*(j=q[--g]%1e7)+(k=q[g]/1e7|0)*n,c=((j=n*j+h%1e7*1e7+p[f]+c)/1e14|0)+(h/1e7|0)+o*k,p[f--]=j%1e14;p[f]=c}return c?++d:p.splice(0,1),P(a,p,d)},y.negated=function(){var a=new M(this);return a.s=-a.s||null,a},y.plus=function(a,b){var c,d=this.s;if(b=(a=new M(a,b)).s,!d||!b)return new M(NaN);if(d!=b)return a.s=-b,this.minus(a);var e=this.e/14,f=a.e/14,g=this.c,h=a.c;if(!e||!f){if(!g||!h)return new M(d/0);if(!g[0]||!h[0])return h[0]?a:new M(g[0]?this:0*d)}if(e=m(e),f=m(f),g=g.slice(),d=e-f){for(d>0?(f=e,c=h):(d=-d,c=g),c.reverse();d--;c.push(0));c.reverse()}for((d=g.length)-(b=h.length)<0&&(c=h,h=g,g=c,b=d),d=0;b;)d=(g[--b]=g[b]+h[b]+d)/1e14|0,g[b]=1e14===g[b]?0:g[b]%1e14;return d&&(g=[d].concat(g),++f),P(a,g,f)},y.precision=y.sd=function(a,b){var c,d,e;if(null!=a&&!!a!==a)return p(a,1,1e9),null==b?b=B:p(b,0,8),Q(new M(this),a,b);if(!(c=this.c))return null;if(d=14*(e=c.length-1)+1,e=c[e]){for(;e%10==0;e/=10,d--);for(e=c[0];e>=10;e/=10,d++);}return a&&this.e+1>d&&(d=this.e+1),d},y.shiftedBy=function(a){return p(a,-0x1fffffffffffff,0x1fffffffffffff),this.times("1e"+a)},y.squareRoot=y.sqrt=function(){var a,b,c,d,e,f=this.c,g=this.s,h=this.e,i=A+4,j=new M("0.5");if(1!==g||!f||!f[0])return new M(!g||g<0&&(!f||f[0])?NaN:f?this:1/0);if(0==(g=Math.sqrt(+R(this)))||g==1/0?(((b=n(f)).length+h)%2==0&&(b+="0"),g=Math.sqrt(+b),h=m((h+1)/2)-(h<0||h%2),c=new M(b=g==1/0?"5e"+h:(b=g.toExponential()).slice(0,b.indexOf("e")+1)+h)):c=new M(g+""),c.c[0]){for((g=(h=c.e)+i)<3&&(g=0);;)if(e=c,c=j.times(e.plus(v(this,e,i,1))),n(e.c).slice(0,g)===(b=n(c.c)).slice(0,g)){if(c.e<h&&--g,"9999"!=(b=b.slice(g-3,g+1))&&(d||"4999"!=b)){+b&&(+b.slice(1)||"5"!=b.charAt(0))||(Q(c,c.e+A+2,1),a=!c.times(c).eq(this));break}if(!d&&(Q(e,e.e+A+2,0),e.times(e).eq(this))){c=e;break}i+=4,g+=4,d=1}}return Q(c,c.e+A+1,B,a)},y.toExponential=function(a,b){return null!=a&&(p(a,0,1e9),a++),N(this,a,b,1)},y.toFixed=function(a,b){return null!=a&&(p(a,0,1e9),a=a+this.e+1),N(this,a,b)},y.toFormat=function(a,b,c){var d;if(null==c)null!=a&&b&&"object"==typeof b?(c=b,b=null):a&&"object"==typeof a?(c=a,a=b=null):c=J;else if("object"!=typeof c)throw Error(j+"Argument not an object: "+c);if(d=this.toFixed(a,b),this.c){var e,f=d.split("."),g=+c.groupSize,h=+c.secondaryGroupSize,i=c.groupSeparator||"",k=f[0],l=f[1],m=this.s<0,n=m?k.slice(1):k,o=n.length;if(h&&(e=g,g=h,h=e,o-=e),g>0&&o>0){for(e=o%g||g,k=n.substr(0,e);e<o;e+=g)k+=i+n.substr(e,g);h>0&&(k+=i+n.slice(e)),m&&(k="-"+k)}d=l?k+(c.decimalSeparator||"")+((h=+c.fractionGroupSize)?l.replace(RegExp("\\d{"+h+"}\\B","g"),"$&"+(c.fractionGroupSeparator||"")):l):k}return(c.prefix||"")+d+(c.suffix||"")},y.toFraction=function(a){var b,c,d,e,f,g,h,i,k,m,o,p,q=this.c;if(null!=a&&(!(h=new M(a)).isInteger()&&(h.c||1!==h.s)||h.lt(z)))throw Error(j+"Argument "+(h.isInteger()?"out of range: ":"not an integer: ")+R(h));if(!q)return new M(this);for(b=new M(z),k=c=new M(z),d=i=new M(z),p=n(q),f=b.e=p.length-this.e-1,b.c[0]=l[(g=f%14)<0?14+g:g],a=!a||h.comparedTo(b)>0?f>0?b:k:h,g=F,F=1/0,h=new M(p),i.c[0]=0;m=v(h,b,0,1),1!=(e=c.plus(m.times(d))).comparedTo(a);)c=d,d=e,k=i.plus(m.times(e=k)),i=e,b=h.minus(m.times(e=b)),h=e;return e=v(a.minus(c),d,0,1),i=i.plus(e.times(k)),c=c.plus(e.times(d)),i.s=k.s=this.s,f*=2,o=1>v(k,d,f,B).minus(this).abs().comparedTo(v(i,c,f,B).minus(this).abs())?[k,d]:[i,c],F=g,o},y.toNumber=function(){return+R(this)},y.toPrecision=function(a,b){return null!=a&&p(a,1,1e9),N(this,a,b,2)},y.toString=function(a){var b,c=this,d=c.s,e=c.e;return null===e?d?(b="Infinity",d<0&&(b="-"+b)):b="NaN":(null==a?b=e<=C||e>=D?r(n(c.c),e):s(n(c.c),e,"0"):10===a&&L?b=s(n((c=Q(new M(c),A+e+1,B)).c),c.e,"0"):(p(a,2,K.length,"Base"),b=w(s(n(c.c),e,"0"),10,a,d,!0)),d<0&&c.c[0]&&(b="-"+b)),b},y.valueOf=y.toJSON=function(){return R(this)},y._isBigNumber=!0,null!=b&&M.set(b),M}()).default=f.BigNumber=f,void 0===(d=(function(){return f}).call(b,c,b,a))||(a.exports=d)}(0)},82660:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.LoginTicket=void 0;class c{envelope;payload;constructor(a,b){this.envelope=a,this.payload=b}getEnvelope(){return this.envelope}getPayload(){return this.payload}getUserId(){let a=this.getPayload();return a&&a.sub?a.sub:null}getAttributes(){return{envelope:this.getEnvelope(),payload:this.getPayload()}}}b.LoginTicket=c},82799:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.DefaultAwsSecurityCredentialsSupplier=void 0;let d=c(56916);class e{regionUrl;securityCredentialsUrl;imdsV2SessionTokenUrl;additionalGaxiosOptions;constructor(a){this.regionUrl=a.regionUrl,this.securityCredentialsUrl=a.securityCredentialsUrl,this.imdsV2SessionTokenUrl=a.imdsV2SessionTokenUrl,this.additionalGaxiosOptions=a.additionalGaxiosOptions}async getAwsRegion(a){if(this.#A)return this.#A;let b=new Headers;if(!this.#A&&this.imdsV2SessionTokenUrl&&b.set("x-aws-ec2-metadata-token",await this.#B(a.transporter)),!this.regionUrl)throw RangeError('Unable to determine AWS region due to missing "options.credential_source.region_url"');let c={...this.additionalGaxiosOptions,url:this.regionUrl,method:"GET",responseType:"text",headers:b};d.AuthClient.setMethodName(c,"getAwsRegion");let e=await a.transporter.request(c);return e.data.substr(0,e.data.length-1)}async getAwsSecurityCredentials(a){if(this.#C)return this.#C;let b=new Headers;this.imdsV2SessionTokenUrl&&b.set("x-aws-ec2-metadata-token",await this.#B(a.transporter));let c=await this.#D(b,a.transporter),d=await this.#E(c,b,a.transporter);return{accessKeyId:d.AccessKeyId,secretAccessKey:d.SecretAccessKey,token:d.Token}}async #B(a){let b={...this.additionalGaxiosOptions,url:this.imdsV2SessionTokenUrl,method:"PUT",responseType:"text",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};return d.AuthClient.setMethodName(b,"#getImdsV2SessionToken"),(await a.request(b)).data}async #D(a,b){if(!this.securityCredentialsUrl)throw Error('Unable to determine AWS role name due to missing "options.credential_source.url"');let c={...this.additionalGaxiosOptions,url:this.securityCredentialsUrl,method:"GET",responseType:"text",headers:a};return d.AuthClient.setMethodName(c,"#getAwsRoleName"),(await b.request(c)).data}async #E(a,b,c){let e={...this.additionalGaxiosOptions,url:`${this.securityCredentialsUrl}/${a}`,headers:b,responseType:"json"};return d.AuthClient.setMethodName(e,"#retrieveAwsSecurityCredentials"),(await c.request(e)).data}get #A(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||null}get #C(){return process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY?{accessKeyId:process.env.AWS_ACCESS_KEY_ID,secretAccessKey:process.env.AWS_SECRET_ACCESS_KEY,token:process.env.AWS_SESSION_TOKEN}:null}}b.DefaultAwsSecurityCredentialsSupplier=e},84315:(a,b,c)=>{"use strict";a.exports={pkg:c(36547)}},88490:function(a,b,c){"use strict";var d=this&&this.__createBinding||(Object.create?function(a,b,c,d){void 0===d&&(d=c);var e=Object.getOwnPropertyDescriptor(b,c);(!e||("get"in e?!b.__esModule:e.writable||e.configurable))&&(e={enumerable:!0,get:function(){return b[c]}}),Object.defineProperty(a,d,e)}:function(a,b,c,d){void 0===d&&(d=c),a[d]=b[c]}),e=this&&this.__exportStar||function(a,b){for(var c in a)"default"===c||Object.prototype.hasOwnProperty.call(b,c)||d(b,a,c)};Object.defineProperty(b,"__esModule",{value:!0}),b.GoogleAuth=b.auth=b.GDCH_SERVICE_ACCOUNT_TYPE=b.GdchClient=b.PassThroughClient=b.ExternalAccountAuthorizedUserClient=b.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=b.ExecutableError=b.PluggableAuthClient=b.DownscopedClient=b.BaseExternalAccountClient=b.ExternalAccountClient=b.IdentityPoolClient=b.AwsRequestSigner=b.AwsClient=b.UserRefreshClient=b.LoginTicket=b.ClientAuthentication=b.OAuth2Client=b.CodeChallengeMethod=b.Impersonated=b.JWT=b.JWTAccess=b.IdTokenClient=b.IAMAuth=b.GCPEnv=b.Compute=b.DEFAULT_UNIVERSE=b.AuthClient=b.gaxios=b.gcpMetadata=void 0;let f=c(2800);Object.defineProperty(b,"GoogleAuth",{enumerable:!0,get:function(){return f.GoogleAuth}}),b.gcpMetadata=c(18240),b.gaxios=c(27064);var g=c(56916);Object.defineProperty(b,"AuthClient",{enumerable:!0,get:function(){return g.AuthClient}}),Object.defineProperty(b,"DEFAULT_UNIVERSE",{enumerable:!0,get:function(){return g.DEFAULT_UNIVERSE}});var h=c(29027);Object.defineProperty(b,"Compute",{enumerable:!0,get:function(){return h.Compute}});var i=c(45813);Object.defineProperty(b,"GCPEnv",{enumerable:!0,get:function(){return i.GCPEnv}});var j=c(10692);Object.defineProperty(b,"IAMAuth",{enumerable:!0,get:function(){return j.IAMAuth}});var k=c(71776);Object.defineProperty(b,"IdTokenClient",{enumerable:!0,get:function(){return k.IdTokenClient}});var l=c(16822);Object.defineProperty(b,"JWTAccess",{enumerable:!0,get:function(){return l.JWTAccess}});var m=c(10607);Object.defineProperty(b,"JWT",{enumerable:!0,get:function(){return m.JWT}});var n=c(2874);Object.defineProperty(b,"Impersonated",{enumerable:!0,get:function(){return n.Impersonated}});var o=c(16757);Object.defineProperty(b,"CodeChallengeMethod",{enumerable:!0,get:function(){return o.CodeChallengeMethod}}),Object.defineProperty(b,"OAuth2Client",{enumerable:!0,get:function(){return o.OAuth2Client}}),Object.defineProperty(b,"ClientAuthentication",{enumerable:!0,get:function(){return o.ClientAuthentication}});var p=c(82660);Object.defineProperty(b,"LoginTicket",{enumerable:!0,get:function(){return p.LoginTicket}});var q=c(75357);Object.defineProperty(b,"UserRefreshClient",{enumerable:!0,get:function(){return q.UserRefreshClient}});var r=c(38087);Object.defineProperty(b,"AwsClient",{enumerable:!0,get:function(){return r.AwsClient}});var s=c(58545);Object.defineProperty(b,"AwsRequestSigner",{enumerable:!0,get:function(){return s.AwsRequestSigner}});var t=c(25306);Object.defineProperty(b,"IdentityPoolClient",{enumerable:!0,get:function(){return t.IdentityPoolClient}});var u=c(75093);Object.defineProperty(b,"ExternalAccountClient",{enumerable:!0,get:function(){return u.ExternalAccountClient}});var v=c(82080);Object.defineProperty(b,"BaseExternalAccountClient",{enumerable:!0,get:function(){return v.BaseExternalAccountClient}});var w=c(92874);Object.defineProperty(b,"DownscopedClient",{enumerable:!0,get:function(){return w.DownscopedClient}});var x=c(31299);Object.defineProperty(b,"PluggableAuthClient",{enumerable:!0,get:function(){return x.PluggableAuthClient}}),Object.defineProperty(b,"ExecutableError",{enumerable:!0,get:function(){return x.ExecutableError}});var y=c(60446);Object.defineProperty(b,"EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE",{enumerable:!0,get:function(){return y.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE}}),Object.defineProperty(b,"ExternalAccountAuthorizedUserClient",{enumerable:!0,get:function(){return y.ExternalAccountAuthorizedUserClient}});var z=c(41715);Object.defineProperty(b,"PassThroughClient",{enumerable:!0,get:function(){return z.PassThroughClient}});var A=c(36654);Object.defineProperty(b,"GdchClient",{enumerable:!0,get:function(){return A.GdchClient}}),Object.defineProperty(b,"GDCH_SERVICE_ACCOUNT_TYPE",{enumerable:!0,get:function(){return A.GDCH_SERVICE_ACCOUNT_TYPE}}),e(c(26389),b),b.auth=new f.GoogleAuth},88634:(a,b,c)=>{"use strict";let d,e=c(74075),f=c(6361),g=c(89672),{kStatusCode:h}=c(17165),i=Buffer[Symbol.species],j=Buffer.from([0,0,255,255]),k=Symbol("permessage-deflate"),l=Symbol("total-length"),m=Symbol("callback"),n=Symbol("buffers"),o=Symbol("error");class p{constructor(a){this._options=a||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._maxPayload=0|this._options.maxPayload,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,d||(d=new g(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let a={};return this._options.serverNoContextTakeover&&(a.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(a.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(a.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?a.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(a.client_max_window_bits=!0),a}accept(a){return a=this.normalizeParams(a),this.params=this._isServer?this.acceptAsServer(a):this.acceptAsClient(a),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let a=this._deflate[m];this._deflate.close(),this._deflate=null,a&&a(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(a){let b=this._options,c=a.find(a=>(!1!==b.serverNoContextTakeover||!a.server_no_context_takeover)&&(!a.server_max_window_bits||!1!==b.serverMaxWindowBits&&("number"!=typeof b.serverMaxWindowBits||!(b.serverMaxWindowBits>a.server_max_window_bits)))&&("number"!=typeof b.clientMaxWindowBits||!!a.client_max_window_bits));if(!c)throw Error("None of the extension offers can be accepted");return b.serverNoContextTakeover&&(c.server_no_context_takeover=!0),b.clientNoContextTakeover&&(c.client_no_context_takeover=!0),"number"==typeof b.serverMaxWindowBits&&(c.server_max_window_bits=b.serverMaxWindowBits),"number"==typeof b.clientMaxWindowBits?c.client_max_window_bits=b.clientMaxWindowBits:(!0===c.client_max_window_bits||!1===b.clientMaxWindowBits)&&delete c.client_max_window_bits,c}acceptAsClient(a){let b=a[0];if(!1===this._options.clientNoContextTakeover&&b.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(b.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&b.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(b.client_max_window_bits=this._options.clientMaxWindowBits);return b}normalizeParams(a){return a.forEach(a=>{Object.keys(a).forEach(b=>{let c=a[b];if(c.length>1)throw Error(`Parameter "${b}" must have only a single value`);if(c=c[0],"client_max_window_bits"===b){if(!0!==c){let a=+c;if(!Number.isInteger(a)||a<8||a>15)throw TypeError(`Invalid value for parameter "${b}": ${c}`);c=a}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${b}": ${c}`)}else if("server_max_window_bits"===b){let a=+c;if(!Number.isInteger(a)||a<8||a>15)throw TypeError(`Invalid value for parameter "${b}": ${c}`);c=a}else if("client_no_context_takeover"===b||"server_no_context_takeover"===b){if(!0!==c)throw TypeError(`Invalid value for parameter "${b}": ${c}`)}else throw Error(`Unknown parameter "${b}"`);a[b]=c})}),a}decompress(a,b,c){d.add(d=>{this._decompress(a,b,(a,b)=>{d(),c(a,b)})})}compress(a,b,c){d.add(d=>{this._compress(a,b,(a,b)=>{d(),c(a,b)})})}_decompress(a,b,c){let d=this._isServer?"client":"server";if(!this._inflate){let a=`${d}_max_window_bits`,b="number"!=typeof this.params[a]?e.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=e.createInflateRaw({...this._options.zlibInflateOptions,windowBits:b}),this._inflate[k]=this,this._inflate[l]=0,this._inflate[n]=[],this._inflate.on("error",s),this._inflate.on("data",r)}this._inflate[m]=c,this._inflate.write(a),b&&this._inflate.write(j),this._inflate.flush(()=>{let a=this._inflate[o];if(a){this._inflate.close(),this._inflate=null,c(a);return}let e=f.concat(this._inflate[n],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[n]=[],b&&this.params[`${d}_no_context_takeover`]&&this._inflate.reset()),c(null,e)})}_compress(a,b,c){let d=this._isServer?"server":"client";if(!this._deflate){let a=`${d}_max_window_bits`,b="number"!=typeof this.params[a]?e.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=e.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:b}),this._deflate[l]=0,this._deflate[n]=[],this._deflate.on("data",q)}this._deflate[m]=c,this._deflate.write(a),this._deflate.flush(e.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=f.concat(this._deflate[n],this._deflate[l]);b&&(a=new i(a.buffer,a.byteOffset,a.length-4)),this._deflate[m]=null,this._deflate[l]=0,this._deflate[n]=[],b&&this.params[`${d}_no_context_takeover`]&&this._deflate.reset(),c(null,a)})}}function q(a){this[n].push(a),this[l]+=a.length}function r(a){(this[l]+=a.length,this[k]._maxPayload<1||this[l]<=this[k]._maxPayload)?this[n].push(a):(this[o]=RangeError("Max payload size exceeded"),this[o].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[o][h]=1009,this.removeListener("data",r),this.reset())}function s(a){(this[k]._inflate=null,this[o])?this[m](this[o]):(a[h]=1007,this[m](a))}a.exports=p},89672:a=>{"use strict";let b=Symbol("kDone"),c=Symbol("kRun");class d{constructor(a){this[b]=()=>{this.pending--,this[c]()},this.concurrency=a||1/0,this.jobs=[],this.pending=0}add(a){this.jobs.push(a),this[c]()}[c](){if(this.pending!==this.concurrency&&this.jobs.length){let a=this.jobs.shift();this.pending++,a(this[b])}}}a.exports=d},90157:(a,b,c)=>{var d=c(62760).Buffer,e=c(27910);function f(a){if(this.buffer=null,this.writable=!0,this.readable=!0,!a)return this.buffer=d.alloc(0),this;if("function"==typeof a.pipe)return this.buffer=d.alloc(0),a.pipe(this),this;if(a.length||"object"==typeof a)return this.buffer=a,this.writable=!1,process.nextTick((function(){this.emit("end",a),this.readable=!1,this.emit("close")}).bind(this)),this;throw TypeError("Unexpected data type ("+typeof a+")")}c(28354).inherits(f,e),f.prototype.write=function(a){this.buffer=d.concat([this.buffer,d.from(a)]),this.emit("data",a)},f.prototype.end=function(a){a&&this.write(a),this.emit("end",a),this.emit("close"),this.writable=!1,this.readable=!1},a.exports=f},90630:a=>{"use strict";a.exports=JSON.parse('{"name":"google-auth-library","version":"10.9.0","author":"Google Inc.","description":"Google APIs Authentication Client Library for Node.js","engines":{"node":">=18"},"main":"./build/src/index.js","types":"./build/src/index.d.ts","repository":{"type":"git","directory":"core/packages/google-auth-library-nodejs","url":"https://github.com/googleapis/google-cloud-node.git"},"keywords":["google","api","google apis","client","client library"],"dependencies":{"base64-js":"^1.3.0","ecdsa-sig-formatter":"^1.0.11","gaxios":"^7.1.4","gcp-metadata":"8.1.2","google-logging-utils":"1.1.3","jws":"^4.0.0"},"devDependencies":{"@types/base64-js":"^1.2.5","@types/jws":"^3.1.0","@types/mocha":"^10.0.10","@types/mv":"^2.1.0","@types/ncp":"^2.0.8","@types/node":"^24.0.0","@types/sinon":"^21.0.0","assert-rejects":"^1.0.0","c8":"^10.1.3","codecov":"^3.8.3","gts":"^6.0.2","is-docker":"^3.0.0","jsdoc":"^4.0.4","jsdoc-fresh":"^5.0.0","jsdoc-region-tag":"^4.0.0","karma":"^6.0.0","karma-chrome-launcher":"^3.0.0","karma-coverage":"^2.0.0","karma-firefox-launcher":"^2.0.0","karma-mocha":"^2.0.0","karma-sourcemap-loader":"^0.4.0","karma-webpack":"^5.0.1","keypair":"^1.0.4","mocha":"^11.1.0","mv":"^2.1.1","ncp":"^2.0.0","nock":"^14.0.5","null-loader":"^4.0.1","puppeteer":"^24.0.0","sinon":"21.0.3","ts-loader":"^9.5.2","typescript":"5.8.3","webpack":"^5.97.1","webpack-cli":"^6.0.1"},"files":["build/src","!build/src/**/*.map"],"scripts":{"test":"c8 mocha build/test","clean":"gts clean","prepare":"npm run compile","lint":"gts check --no-inline-config","compile":"tsc -p .","fix":"gts fix","pretest":"npm run compile -- --sourceMap","docs":"jsdoc -c .jsdoc.js","samples-setup":"cd samples/ && npm link ../ && npm run setup && cd ../","samples-test":"cd samples/ && npm link ../ && npm test && cd ../","system-test":"mocha build/system-test --timeout 60000","presystem-test":"npm run compile -- --sourceMap","webpack":"webpack","browser-test":"karma start","prelint":"cd samples; npm link ../; npm install"},"license":"Apache-2.0","homepage":"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/google-auth-library-nodejs"}')},92109:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.ErrorWithCode=void 0;class c extends Error{code;constructor(a,b){super(a),this.code=b}}b.ErrorWithCode=c},92874:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.DownscopedClient=b.EXPIRATION_TIME_OFFSET=b.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;let d=c(27064),e=c(27910),f=c(56916),g=c(12135);b.MAX_ACCESS_BOUNDARY_RULES_COUNT=10,b.EXPIRATION_TIME_OFFSET=3e5;class h extends f.AuthClient{authClient;credentialAccessBoundary;cachedDownscopedAccessToken;stsCredential;constructor(a,c={accessBoundary:{accessBoundaryRules:[]}}){if(super(a instanceof f.AuthClient?{}:a),a instanceof f.AuthClient?(this.authClient=a,this.credentialAccessBoundary=c):(this.authClient=a.authClient,this.credentialAccessBoundary=a.credentialAccessBoundary),0===this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length)throw Error("At least one access boundary rule needs to be defined.");if(this.credentialAccessBoundary.accessBoundary.accessBoundaryRules.length>b.MAX_ACCESS_BOUNDARY_RULES_COUNT)throw Error(`The provided access boundary has more than ${b.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`);for(const a of this.credentialAccessBoundary.accessBoundary.accessBoundaryRules)if(0===a.availablePermissions.length)throw Error("At least one permission should be defined in access boundary rules.");this.stsCredential=new g.StsCredentials({tokenExchangeEndpoint:`https://sts.${this.universeDomain}/v1/token`}),this.cachedDownscopedAccessToken=null}setCredentials(a){if(!a.expiry_date)throw Error("The access token expiry_date field is missing in the provided credentials.");super.setCredentials(a),this.cachedDownscopedAccessToken=a}async getAccessToken(){return(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken))&&await this.refreshAccessTokenAsync(),{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){let a=await this.getAccessToken(),b=new Headers({authorization:`Bearer ${a.token}`});return this.addSharedMetadataHeaders(b)}request(a,b){if(!b)return this.requestAsync(a);this.requestAsync(a).then(a=>b(null,a),a=>b(a,a.response))}async requestAsync(a,b=!1){let c;try{let b=await this.getRequestHeaders();a.headers=d.Gaxios.mergeHeaders(a.headers),this.addUserProjectAndAuthHeaders(a.headers,b),c=await this.transporter.request(a)}catch(d){let c=d.response;if(c){let d=c.status,f=c.config.data instanceof e.Readable;if(!b&&(401===d||403===d)&&!f&&this.forceRefreshOnFailure)return await this.refreshAccessTokenAsync(),await this.requestAsync(a,!0)}throw d}return c}async refreshAccessTokenAsync(){let a=(await this.authClient.getAccessToken()).token,b=await this.stsCredential.exchangeToken({grantType:"urn:ietf:params:oauth:grant-type:token-exchange",requestedTokenType:"urn:ietf:params:oauth:token-type:access_token",subjectToken:a,subjectTokenType:"urn:ietf:params:oauth:token-type:access_token"},void 0,this.credentialAccessBoundary),c=this.authClient.credentials?.expiry_date||null,d=b.expires_in?new Date().getTime()+1e3*b.expires_in:c;return this.cachedDownscopedAccessToken={access_token:b.access_token,expiry_date:d,res:b.res},this.credentials={},Object.assign(this.credentials,this.cachedDownscopedAccessToken),delete this.credentials.res,this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null}),this.cachedDownscopedAccessToken}isExpired(a){let b=new Date().getTime();return!!a.expiry_date&&b>=a.expiry_date-this.eagerRefreshThresholdMillis}}b.DownscopedClient=h},95790:(a,b,c)=>{var d=c(62760).Buffer,e=c(90157),f=c(572),g=c(27910),h=c(15876),i=c(28354);function j(a,b){return d.from(a,b).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function k(a){var b,c,d,e=a.header,g=a.payload,k=a.secret||a.privateKey,l=a.encoding,m=f(e.alg),n=(b=(b=l)||"utf8",c=j(h(e),"binary"),d=j(h(g),b),i.format("%s.%s",c,d)),o=m.sign(n,k);return i.format("%s.%s",n,o)}function l(a){var b=a.secret;if(b=null==(b=null==b?a.privateKey:b)?a.key:b,!0===/^hs/i.test(a.header.alg)&&null==b)throw TypeError("secret must be a string or buffer or a KeyObject");var c=new e(b);this.readable=!0,this.header=a.header,this.encoding=a.encoding,this.secret=this.privateKey=this.key=c,this.payload=new e(a.payload),this.secret.once("close",(function(){!this.payload.writable&&this.readable&&this.sign()}).bind(this)),this.payload.once("close",(function(){!this.secret.writable&&this.readable&&this.sign()}).bind(this))}i.inherits(l,g),l.prototype.sign=function(){try{var a=k({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",a),this.emit("data",a),this.emit("end"),this.readable=!1,a}catch(a){this.readable=!1,this.emit("error",a),this.emit("close")}},l.sign=k,a.exports=l},96674:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.TokenHandler=void 0;let d=c(7236),e=c(36079);class f{token;tokenExpiresAt;inFlightRequest;tokenOptions;constructor(a){this.tokenOptions=a}async processCredentials(){if(!this.tokenOptions.key&&!this.tokenOptions.keyFile)throw Error("No key or keyFile set.");if(!this.tokenOptions.key&&this.tokenOptions.keyFile){let a=await (0,e.getCredentials)(this.tokenOptions.keyFile);this.tokenOptions.key=a.privateKey,this.tokenOptions.email=a.clientEmail}}isTokenExpiring(){if(!this.token||!this.tokenExpiresAt)return!0;let a=new Date().getTime(),b=this.tokenOptions.eagerRefreshThresholdMillis??0;return this.tokenExpiresAt<=a+b}hasExpired(){return new Date().getTime(),!this.token||!this.tokenExpiresAt||new Date().getTime()>=this.tokenExpiresAt}async getToken(a){if(await this.processCredentials(),this.inFlightRequest&&!a)return this.inFlightRequest;if(this.token&&!this.isTokenExpiring()&&!a)return this.token;try{this.inFlightRequest=(0,d.getToken)(this.tokenOptions);let a=await this.inFlightRequest;return this.token=a,this.tokenExpiresAt=new Date().getTime()+(a.expires_in??0)*1e3,a}finally{this.inFlightRequest=void 0}}}b.TokenHandler=f},97861:(a,b,c)=>{"use strict";let{isUtf8:d}=c(79428),{hasBlob:e}=c(17165);function f(a){let b=a.length,c=0;for(;c<b;)if((128&a[c])==0)c++;else if((224&a[c])==192){if(c+1===b||(192&a[c+1])!=128||(254&a[c])==192)return!1;c+=2}else if((240&a[c])==224){if(c+2>=b||(192&a[c+1])!=128||(192&a[c+2])!=128||224===a[c]&&(224&a[c+1])==128||237===a[c]&&(224&a[c+1])==160)return!1;c+=3}else{if((248&a[c])!=240||c+3>=b||(192&a[c+1])!=128||(192&a[c+2])!=128||(192&a[c+3])!=128||240===a[c]&&(240&a[c+1])==128||244===a[c]&&a[c+1]>143||a[c]>244)return!1;c+=4}return!0}if(a.exports={isBlob:function(a){return e&&"object"==typeof a&&"function"==typeof a.arrayBuffer&&"string"==typeof a.type&&"function"==typeof a.stream&&("Blob"===a[Symbol.toStringTag]||"File"===a[Symbol.toStringTag])},isValidStatusCode:function(a){return a>=1e3&&a<=1014&&1004!==a&&1005!==a&&1006!==a||a>=3e3&&a<=4999},isValidUTF8:f,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},d)a.exports.isValidUTF8=function(a){return a.length<24?f(a):d(a)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let b=c(47990);a.exports.isValidUTF8=function(a){return a.length<32?f(a):b(a)}}catch(a){}}};