@cravern/bpmn-flow-designer 1.0.0 → 1.0.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.
@@ -0,0 +1,242 @@
1
+ (function(fe,J){typeof exports=="object"&&typeof module<"u"?J(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],J):(fe=typeof globalThis<"u"?globalThis:fe||self,J(fe.BpmfFlowDesigner={},fe.React))})(this,(function(fe,J){"use strict";var Ft=document.createElement("style");Ft.textContent=`@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}body{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-family:Inter,Inter Var,system-ui,sans-serif}.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-width:1280px}}@media(min-width:1536px){.container{max-width:1536px}}.bpmn-io-style .djs-palette{display:none!important}.bpmn-io-style .djs-container{background-color:transparent!important}.bjs-powered-by{display:none!important}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.-right-4{right:-1rem}.top-0{top:0}.top-1\\/2{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.mr-1{margin-right:.25rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-auto{margin-top:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-14{height:3.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-5{height:1.25rem}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-3{width:.75rem}.w-5{width:1.25rem}.w-80{width:20rem}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-7xl{max-width:80rem}.flex-1{flex:1 1 0%}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-8{gap:2rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-indigo-600{--tw-border-opacity: 1;border-color:rgb(79 70 229 / var(--tw-border-opacity, 1))}.border-slate-100{--tw-border-opacity: 1;border-color:rgb(241 245 249 / var(--tw-border-opacity, 1))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-indigo-100{--tw-bg-opacity: 1;background-color:rgb(224 231 255 / var(--tw-bg-opacity, 1))}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.bg-slate-50\\/50{background-color:#f8fafc80}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\\/80{background-color:#fffc}.bg-\\[radial-gradient\\(\\#e5e7eb_1px\\,transparent_1px\\)\\]{background-image:radial-gradient(#e5e7eb 1px,transparent 1px)}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pl-4{padding-left:1rem}.pt-6{padding-top:1.5rem}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\\[10px\\]{font-size:10px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity, 1))}.text-indigo-600{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.opacity-0{opacity:0}.opacity-40{opacity:.4}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.\\[background-size\\:24px_24px\\]{background-size:24px 24px}.hover\\:border-indigo-400:hover{--tw-border-opacity: 1;border-color:rgb(129 140 248 / var(--tw-border-opacity, 1))}.hover\\:bg-indigo-200:hover{--tw-bg-opacity: 1;background-color:rgb(199 210 254 / var(--tw-bg-opacity, 1))}.hover\\:bg-indigo-50\\/50:hover{background-color:#eef2ff80}.hover\\:bg-indigo-700:hover{--tw-bg-opacity: 1;background-color:rgb(67 56 202 / var(--tw-bg-opacity, 1))}.hover\\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\\:bg-slate-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.hover\\:text-indigo-600:hover{--tw-text-opacity: 1;color:rgb(79 70 229 / var(--tw-text-opacity, 1))}.hover\\:text-slate-700:hover{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.hover\\:shadow-sm:hover{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\\:bg-slate-300:disabled{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\\:opacity-100{opacity:1}@media(min-width:1024px){.lg\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}
2
+ /*$vite$:1*/`,document.head.appendChild(Ft);var Oe={exports:{}},De={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var Ut;function Qo(){if(Ut)return De;Ut=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,a){var l=null;if(a!==void 0&&(l=""+a),i.key!==void 0&&(l=""+i.key),"key"in i){a={};for(var u in i)u!=="key"&&(a[u]=i[u])}else a=i;return i=a.ref,{$$typeof:o,type:n,key:l,ref:i!==void 0?i:null,props:a}}return De.Fragment=e,De.jsx=t,De.jsxs=t,De}var be={};/**
11
+ * @license React
12
+ * react-jsx-runtime.development.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var Gt;function jo(){return Gt||(Gt=1,process.env.NODE_ENV!=="production"&&(function(){function o(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===Q?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case x:return"Fragment";case R:return"Profiler";case M:return"StrictMode";case A:return"Suspense";case P:return"SuspenseList";case B:return"Activity"}if(typeof y=="object")switch(typeof y.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),y.$$typeof){case v:return"Portal";case V:return y.displayName||"Context";case k:return(y._context.displayName||"Context")+".Consumer";case E:var F=y.render;return y=y.displayName,y||(y=F.displayName||F.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case O:return F=y.displayName||null,F!==null?F:o(y.type)||"Memo";case b:F=y._payload,y=y._init;try{return o(y(F))}catch{}}return null}function e(y){return""+y}function t(y){try{e(y);var F=!1}catch{F=!0}if(F){F=console;var H=F.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&y[Symbol.toStringTag]||y.constructor.name||"Object";return H.call(F,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),e(y)}}function n(y){if(y===x)return"<>";if(typeof y=="object"&&y!==null&&y.$$typeof===b)return"<...>";try{var F=o(y);return F?"<"+F+">":"<...>"}catch{return"<...>"}}function i(){var y=Ne.A;return y===null?null:y.getOwner()}function a(){return Error("react-stack-top-frame")}function l(y){if($e.call(y,"key")){var F=Object.getOwnPropertyDescriptor(y,"key").get;if(F&&F.isReactWarning)return!1}return y.key!==void 0}function u(y,F){function H(){Wo||(Wo=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",F))}H.isReactWarning=!0,Object.defineProperty(y,"key",{get:H,configurable:!0})}function d(){var y=o(this.type);return Yo[y]||(Yo[y]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),y=this.props.ref,y!==void 0?y:null}function c(y,F,H,W,lt,Lt){var Y=H.ref;return y={$$typeof:g,type:y,key:F,props:H,_owner:W},(Y!==void 0?Y:null)!==null?Object.defineProperty(y,"ref",{enumerable:!1,get:d}):Object.defineProperty(y,"ref",{enumerable:!1,value:null}),y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(y,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(y,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:lt}),Object.defineProperty(y,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Lt}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y}function f(y,F,H,W,lt,Lt){var Y=F.children;if(Y!==void 0)if(W)if(ne(Y)){for(W=0;W<Y.length;W++)p(Y[W]);Object.freeze&&Object.freeze(Y)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else p(Y);if($e.call(F,"key")){Y=o(y);var Pe=Object.keys(F).filter(function(Zf){return Zf!=="key"});W=0<Pe.length?"{key: someKey, "+Pe.join(": ..., ")+": ...}":"{key: someKey}",Xo[Y+W]||(Pe=0<Pe.length?"{"+Pe.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
19
+ let props = %s;
20
+ <%s {...props} />
21
+ React keys must be passed directly to JSX without using spread:
22
+ let props = %s;
23
+ <%s key={someKey} {...props} />`,W,Y,Pe,Y),Xo[Y+W]=!0)}if(Y=null,H!==void 0&&(t(H),Y=""+H),l(F)&&(t(F.key),Y=""+F.key),"key"in F){H={};for(var Vt in F)Vt!=="key"&&(H[Vt]=F[Vt])}else H=F;return Y&&u(H,typeof y=="function"?y.displayName||y.name||"Unknown":y),c(y,Y,H,i(),lt,Lt)}function p(y){m(y)?y._store&&(y._store.validated=1):typeof y=="object"&&y!==null&&y.$$typeof===b&&(y._payload.status==="fulfilled"?m(y._payload.value)&&y._payload.value._store&&(y._payload.value._store.validated=1):y._store&&(y._store.validated=1))}function m(y){return typeof y=="object"&&y!==null&&y.$$typeof===g}var h=J,g=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),V=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),Ne=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$e=Object.prototype.hasOwnProperty,ne=Array.isArray,ye=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(y){return y()}};var Wo,Yo={},Zo=h.react_stack_bottom_frame.bind(h,a)(),Ko=ye(n(a)),Xo={};be.Fragment=x,be.jsx=function(y,F,H){var W=1e4>Ne.recentlyCreatedOwnerStacks++;return f(y,F,H,!1,W?Error("react-stack-top-frame"):Zo,W?ye(n(y)):Ko)},be.jsxs=function(y,F,H){var W=1e4>Ne.recentlyCreatedOwnerStacks++;return f(y,F,H,!0,W?Error("react-stack-top-frame"):Zo,W?ye(n(y)):Ko)}})()),be}var Bt;function ei(){return Bt||(Bt=1,process.env.NODE_ENV==="production"?Oe.exports=Qo():Oe.exports=jo()),Oe.exports}var C=ei();/**
24
+ * @license lucide-react v0.460.0 - ISC
25
+ *
26
+ * This source code is licensed under the ISC license.
27
+ * See the LICENSE file in the root directory of this source tree.
28
+ */const ti=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qt=(...o)=>o.filter((e,t,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===t).join(" ").trim();/**
29
+ * @license lucide-react v0.460.0 - ISC
30
+ *
31
+ * This source code is licensed under the ISC license.
32
+ * See the LICENSE file in the root directory of this source tree.
33
+ */var ni={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
34
+ * @license lucide-react v0.460.0 - ISC
35
+ *
36
+ * This source code is licensed under the ISC license.
37
+ * See the LICENSE file in the root directory of this source tree.
38
+ */const oi=J.forwardRef(({color:o="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:n,className:i="",children:a,iconNode:l,...u},d)=>J.createElement("svg",{ref:d,...ni,width:e,height:e,stroke:o,strokeWidth:n?Number(t)*24/Number(e):t,className:qt("lucide",i),...u},[...l.map(([c,f])=>J.createElement(c,f)),...Array.isArray(a)?a:[a]]));/**
39
+ * @license lucide-react v0.460.0 - ISC
40
+ *
41
+ * This source code is licensed under the ISC license.
42
+ * See the LICENSE file in the root directory of this source tree.
43
+ */const Z=(o,e)=>{const t=J.forwardRef(({className:n,...i},a)=>J.createElement(oi,{ref:a,iconNode:e,className:qt(`lucide-${ti(o)}`,n),...i}));return t.displayName=`${o}`,t};/**
44
+ * @license lucide-react v0.460.0 - ISC
45
+ *
46
+ * This source code is licensed under the ISC license.
47
+ * See the LICENSE file in the root directory of this source tree.
48
+ */const ii=Z("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
49
+ * @license lucide-react v0.460.0 - ISC
50
+ *
51
+ * This source code is licensed under the ISC license.
52
+ * See the LICENSE file in the root directory of this source tree.
53
+ */const ri=Z("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
54
+ * @license lucide-react v0.460.0 - ISC
55
+ *
56
+ * This source code is licensed under the ISC license.
57
+ * See the LICENSE file in the root directory of this source tree.
58
+ */const si=Z("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
59
+ * @license lucide-react v0.460.0 - ISC
60
+ *
61
+ * This source code is licensed under the ISC license.
62
+ * See the LICENSE file in the root directory of this source tree.
63
+ */const He=Z("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
64
+ * @license lucide-react v0.460.0 - ISC
65
+ *
66
+ * This source code is licensed under the ISC license.
67
+ * See the LICENSE file in the root directory of this source tree.
68
+ */const ai=Z("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
69
+ * @license lucide-react v0.460.0 - ISC
70
+ *
71
+ * This source code is licensed under the ISC license.
72
+ * See the LICENSE file in the root directory of this source tree.
73
+ */const li=Z("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
74
+ * @license lucide-react v0.460.0 - ISC
75
+ *
76
+ * This source code is licensed under the ISC license.
77
+ * See the LICENSE file in the root directory of this source tree.
78
+ */const ui=Z("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
79
+ * @license lucide-react v0.460.0 - ISC
80
+ *
81
+ * This source code is licensed under the ISC license.
82
+ * See the LICENSE file in the root directory of this source tree.
83
+ */const ci=Z("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/**
84
+ * @license lucide-react v0.460.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */const di=Z("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
89
+ * @license lucide-react v0.460.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */const fi=Z("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
94
+ * @license lucide-react v0.460.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ */const $t=Z("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
99
+ * @license lucide-react v0.460.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */const pi=Z("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
104
+ * @license lucide-react v0.460.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */const mi=Z("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
109
+ * @license lucide-react v0.460.0 - ISC
110
+ *
111
+ * This source code is licensed under the ISC license.
112
+ * See the LICENSE file in the root directory of this source tree.
113
+ */const hi=Z("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
114
+ * @license lucide-react v0.460.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */const gi=Z("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);var G;(function(o){o.assertEqual=i=>{};function e(i){}o.assertIs=e;function t(i){throw new Error}o.assertNever=t,o.arrayToEnum=i=>{const a={};for(const l of i)a[l]=l;return a},o.getValidEnumValues=i=>{const a=o.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),l={};for(const u of a)l[u]=i[u];return o.objectValues(l)},o.objectValues=i=>o.objectKeys(i).map(function(a){return i[a]}),o.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&a.push(l);return a},o.find=(i,a)=>{for(const l of i)if(a(l))return l},o.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(a)}o.joinValues=n,o.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(G||(G={}));var Ot;(function(o){o.mergeShapes=(e,t)=>({...e,...t})})(Ot||(Ot={}));const w=G.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ae=o=>{switch(typeof o){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(o)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":return Array.isArray(o)?w.array:o===null?w.null:o.then&&typeof o.then=="function"&&o.catch&&typeof o.catch=="function"?w.promise:typeof Map<"u"&&o instanceof Map?w.map:typeof Set<"u"&&o instanceof Set?w.set:typeof Date<"u"&&o instanceof Date?w.date:w.object;default:return w.unknown}},T=G.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class se extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},i=a=>{for(const l of a.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)n._errors.push(t(l));else{let u=n,d=0;for(;d<l.path.length;){const c=l.path[d];d===l.path.length-1?(u[c]=u[c]||{_errors:[]},u[c]._errors.push(t(l))):u[c]=u[c]||{_errors:[]},u=u[c],d++}}};return i(this),n}static assert(e){if(!(e instanceof se))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,G.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];t[a]=t[a]||[],t[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}se.create=o=>new se(o);const ut=(o,e)=>{let t;switch(o.code){case T.invalid_type:o.received===w.undefined?t="Required":t=`Expected ${o.expected}, received ${o.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(o.expected,G.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${G.joinValues(o.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${G.joinValues(o.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${G.joinValues(o.options)}, received '${o.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof o.validation=="object"?"includes"in o.validation?(t=`Invalid input: must include "${o.validation.includes}"`,typeof o.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${o.validation.position}`)):"startsWith"in o.validation?t=`Invalid input: must start with "${o.validation.startsWith}"`:"endsWith"in o.validation?t=`Invalid input: must end with "${o.validation.endsWith}"`:G.assertNever(o.validation):o.validation!=="regex"?t=`Invalid ${o.validation}`:t="Invalid";break;case T.too_small:o.type==="array"?t=`Array must contain ${o.exact?"exactly":o.inclusive?"at least":"more than"} ${o.minimum} element(s)`:o.type==="string"?t=`String must contain ${o.exact?"exactly":o.inclusive?"at least":"over"} ${o.minimum} character(s)`:o.type==="number"?t=`Number must be ${o.exact?"exactly equal to ":o.inclusive?"greater than or equal to ":"greater than "}${o.minimum}`:o.type==="bigint"?t=`Number must be ${o.exact?"exactly equal to ":o.inclusive?"greater than or equal to ":"greater than "}${o.minimum}`:o.type==="date"?t=`Date must be ${o.exact?"exactly equal to ":o.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(o.minimum))}`:t="Invalid input";break;case T.too_big:o.type==="array"?t=`Array must contain ${o.exact?"exactly":o.inclusive?"at most":"less than"} ${o.maximum} element(s)`:o.type==="string"?t=`String must contain ${o.exact?"exactly":o.inclusive?"at most":"under"} ${o.maximum} character(s)`:o.type==="number"?t=`Number must be ${o.exact?"exactly":o.inclusive?"less than or equal to":"less than"} ${o.maximum}`:o.type==="bigint"?t=`BigInt must be ${o.exact?"exactly":o.inclusive?"less than or equal to":"less than"} ${o.maximum}`:o.type==="date"?t=`Date must be ${o.exact?"exactly":o.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(o.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${o.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,G.assertNever(o)}return{message:t}};let yi=ut;function vi(){return yi}const Ti=o=>{const{data:e,path:t,errorMaps:n,issueData:i}=o,a=[...t,...i.path||[]],l={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let u="";const d=n.filter(c=>!!c).slice().reverse();for(const c of d)u=c(l,{data:e,defaultError:u}).message;return{...i,path:a,message:u}};function _(o,e){const t=vi(),n=Ti({issueData:e,data:o.data,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,t,t===ut?void 0:ut].filter(i=>!!i)});o.common.issues.push(n)}class K{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if(i.status==="aborted")return D;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const a=await i.key,l=await i.value;n.push({key:a,value:l})}return K.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:a,value:l}=i;if(a.status==="aborted"||l.status==="aborted")return D;a.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(n[a.value]=l.value)}return{status:e.value,value:n}}}const D=Object.freeze({status:"aborted"}),Le=o=>({status:"dirty",value:o}),j=o=>({status:"valid",value:o}),Ht=o=>o.status==="aborted",Jt=o=>o.status==="dirty",ve=o=>o.status==="valid",Je=o=>typeof Promise<"u"&&o instanceof Promise;var S;(function(o){o.errToObj=e=>typeof e=="string"?{message:e}:e||{},o.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(S||(S={}));class oe{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const zt=(o,e)=>{if(ve(e))return{success:!0,data:e.value};if(!o.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new se(o.common.issues);return this._error=t,this._error}}};function L(o){if(!o)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:i}=o;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(l,u)=>{const{message:d}=o;return l.code==="invalid_enum_value"?{message:d??u.defaultError}:typeof u.data>"u"?{message:d??n??u.defaultError}:l.code!=="invalid_type"?{message:u.defaultError}:{message:d??t??u.defaultError}},description:i}}class U{get description(){return this._def.description}_getType(e){return ae(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ae(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new K,ctx:{common:e.parent.common,data:e.data,parsedType:ae(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Je(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ae(e)},i=this._parseSync({data:e,path:n.path,parent:n});return zt(n,i)}"~validate"(e){var n,i;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ae(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return ve(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(i=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>ve(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ae(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(Je(i)?i:Promise.resolve(i));return zt(n,a)}refine(e,t){const n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,a)=>{const l=e(i),u=()=>a.addIssue({code:T.custom,...n(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(u(),!1)):l?!0:(u(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new xe({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ue.create(this,this._def)}nullable(){return Ee.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this)}promise(){return Ke.create(this,this._def)}or(e){return We.create([this,e],this._def)}and(e){return Ye.create(this,e,this._def)}transform(e){return new xe({...L(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new mt({...L(this._def),innerType:this,defaultValue:t,typeName:N.ZodDefault})}brand(){return new $i({typeName:N.ZodBranded,type:this,...L(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ht({...L(this._def),innerType:this,catchValue:t,typeName:N.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return gt.create(this,e)}readonly(){return yt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ci=/^c[^\s-]{8,}$/i,_i=/^[0-9a-z]+$/,xi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ei=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,wi=/^[a-z0-9_-]{21}$/i,Si=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ai=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Mi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ii="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ct;const Ri=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ki=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ni=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Pi=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Di=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,bi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Wt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Li=new RegExp(`^${Wt}$`);function Yt(o){let e="[0-5]\\d";o.precision?e=`${e}\\.\\d{${o.precision}}`:o.precision==null&&(e=`${e}(\\.\\d+)?`);const t=o.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Vi(o){return new RegExp(`^${Yt(o)}$`)}function Fi(o){let e=`${Wt}T${Yt(o)}`;const t=[];return t.push(o.local?"Z?":"Z"),o.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ui(o,e){return!!((e==="v4"||!e)&&Ri.test(o)||(e==="v6"||!e)&&Ni.test(o))}function Gi(o,e){if(!Si.test(o))return!1;try{const[t]=o.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Bi(o,e){return!!((e==="v4"||!e)&&ki.test(o)||(e==="v6"||!e)&&Pi.test(o))}class ie extends U{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==w.string){const a=this._getOrReturnCtx(e);return _(a,{code:T.invalid_type,expected:w.string,received:a.parsedType}),D}const n=new K;let i;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),_(i,{code:T.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),_(i,{code:T.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const l=e.data.length>a.value,u=e.data.length<a.value;(l||u)&&(i=this._getOrReturnCtx(e,i),l?_(i,{code:T.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):u&&_(i,{code:T.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Mi.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"email",code:T.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")ct||(ct=new RegExp(Ii,"u")),ct.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"emoji",code:T.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Ei.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"uuid",code:T.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")wi.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"nanoid",code:T.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Ci.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"cuid",code:T.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")_i.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"cuid2",code:T.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")xi.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"ulid",code:T.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),_(i,{validation:"url",code:T.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"regex",code:T.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),_(i,{code:T.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),_(i,{code:T.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),_(i,{code:T.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Fi(a).test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{code:T.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Li.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{code:T.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Vi(a).test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{code:T.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Ai.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"duration",code:T.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Ui(e.data,a.version)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"ip",code:T.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Gi(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"jwt",code:T.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Bi(e.data,a.version)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"cidr",code:T.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Di.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"base64",code:T.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?bi.test(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{validation:"base64url",code:T.invalid_string,message:a.message}),n.dirty()):G.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:T.invalid_string,...S.errToObj(n)})}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...S.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...S.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...S.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...S.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...S.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...S.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...S.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...S.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...S.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...S.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...S.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...S.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...S.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...S.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...S.errToObj(t)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new ie({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ie({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ie({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ie.create=o=>new ie({checks:[],typeName:N.ZodString,coerce:(o==null?void 0:o.coerce)??!1,...L(o)});function qi(o,e){const t=(o.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,a=Number.parseInt(o.toFixed(i).replace(".","")),l=Number.parseInt(e.toFixed(i).replace(".",""));return a%l/10**i}class pe extends U{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==w.number){const a=this._getOrReturnCtx(e);return _(a,{code:T.invalid_type,expected:w.number,received:a.parsedType}),D}let n;const i=new K;for(const a of this._def.checks)a.kind==="int"?G.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),_(n,{code:T.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),_(n,{code:T.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),_(n,{code:T.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?qi(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),_(n,{code:T.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),_(n,{code:T.not_finite,message:a.message}),i.dirty()):G.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,n,i){return new pe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:S.toString(i)}]})}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:S.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&G.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}pe.create=o=>new pe({checks:[],typeName:N.ZodNumber,coerce:(o==null?void 0:o.coerce)||!1,...L(o)});class me extends U{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==w.bigint)return this._getInvalidInput(e);let n;const i=new K;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),_(n,{code:T.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),_(n,{code:T.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),_(n,{code:T.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):G.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return _(t,{code:T.invalid_type,expected:w.bigint,received:t.parsedType}),D}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,n,i){return new me({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:S.toString(i)}]})}_addCheck(e){return new me({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}me.create=o=>new me({checks:[],typeName:N.ZodBigInt,coerce:(o==null?void 0:o.coerce)??!1,...L(o)});class ze extends U{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==w.boolean){const n=this._getOrReturnCtx(e);return _(n,{code:T.invalid_type,expected:w.boolean,received:n.parsedType}),D}return j(e.data)}}ze.create=o=>new ze({typeName:N.ZodBoolean,coerce:(o==null?void 0:o.coerce)||!1,...L(o)});class Te extends U{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==w.date){const a=this._getOrReturnCtx(e);return _(a,{code:T.invalid_type,expected:w.date,received:a.parsedType}),D}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return _(a,{code:T.invalid_date}),D}const n=new K;let i;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),_(i,{code:T.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),_(i,{code:T.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):G.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:S.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:S.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Te.create=o=>new Te({checks:[],coerce:(o==null?void 0:o.coerce)||!1,typeName:N.ZodDate,...L(o)});class Zt extends U{_parse(e){if(this._getType(e)!==w.symbol){const n=this._getOrReturnCtx(e);return _(n,{code:T.invalid_type,expected:w.symbol,received:n.parsedType}),D}return j(e.data)}}Zt.create=o=>new Zt({typeName:N.ZodSymbol,...L(o)});class Kt extends U{_parse(e){if(this._getType(e)!==w.undefined){const n=this._getOrReturnCtx(e);return _(n,{code:T.invalid_type,expected:w.undefined,received:n.parsedType}),D}return j(e.data)}}Kt.create=o=>new Kt({typeName:N.ZodUndefined,...L(o)});class Xt extends U{_parse(e){if(this._getType(e)!==w.null){const n=this._getOrReturnCtx(e);return _(n,{code:T.invalid_type,expected:w.null,received:n.parsedType}),D}return j(e.data)}}Xt.create=o=>new Xt({typeName:N.ZodNull,...L(o)});class Qt extends U{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}Qt.create=o=>new Qt({typeName:N.ZodAny,...L(o)});class dt extends U{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}dt.create=o=>new dt({typeName:N.ZodUnknown,...L(o)});class le extends U{_parse(e){const t=this._getOrReturnCtx(e);return _(t,{code:T.invalid_type,expected:w.never,received:t.parsedType}),D}}le.create=o=>new le({typeName:N.ZodNever,...L(o)});class jt extends U{_parse(e){if(this._getType(e)!==w.undefined){const n=this._getOrReturnCtx(e);return _(n,{code:T.invalid_type,expected:w.void,received:n.parsedType}),D}return j(e.data)}}jt.create=o=>new jt({typeName:N.ZodVoid,...L(o)});class re extends U{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==w.array)return _(t,{code:T.invalid_type,expected:w.array,received:t.parsedType}),D;if(i.exactLength!==null){const l=t.data.length>i.exactLength.value,u=t.data.length<i.exactLength.value;(l||u)&&(_(t,{code:l?T.too_big:T.too_small,minimum:u?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(_(t,{code:T.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(_(t,{code:T.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((l,u)=>i.type._parseAsync(new oe(t,l,t.path,u)))).then(l=>K.mergeArray(n,l));const a=[...t.data].map((l,u)=>i.type._parseSync(new oe(t,l,t.path,u)));return K.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new re({...this._def,minLength:{value:e,message:S.toString(t)}})}max(e,t){return new re({...this._def,maxLength:{value:e,message:S.toString(t)}})}length(e,t){return new re({...this._def,exactLength:{value:e,message:S.toString(t)}})}nonempty(e){return this.min(1,e)}}re.create=(o,e)=>new re({type:o,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...L(e)});function Ce(o){if(o instanceof z){const e={};for(const t in o.shape){const n=o.shape[t];e[t]=ue.create(Ce(n))}return new z({...o._def,shape:()=>e})}else return o instanceof re?new re({...o._def,type:Ce(o.element)}):o instanceof ue?ue.create(Ce(o.unwrap())):o instanceof Ee?Ee.create(Ce(o.unwrap())):o instanceof he?he.create(o.items.map(e=>Ce(e))):o}class z extends U{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=G.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==w.object){const c=this._getOrReturnCtx(e);return _(c,{code:T.invalid_type,expected:w.object,received:c.parsedType}),D}const{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:l}=this._getCached(),u=[];if(!(this._def.catchall instanceof le&&this._def.unknownKeys==="strip"))for(const c in i.data)l.includes(c)||u.push(c);const d=[];for(const c of l){const f=a[c],p=i.data[c];d.push({key:{status:"valid",value:c},value:f._parse(new oe(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof le){const c=this._def.unknownKeys;if(c==="passthrough")for(const f of u)d.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(c==="strict")u.length>0&&(_(i,{code:T.unrecognized_keys,keys:u}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const f of u){const p=i.data[f];d.push({key:{status:"valid",value:f},value:c._parse(new oe(i,p,i.path,f)),alwaysSet:f in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const f of d){const p=await f.key,m=await f.value;c.push({key:p,value:m,alwaysSet:f.alwaysSet})}return c}).then(c=>K.mergeObjectSync(n,c)):K.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return S.errToObj,new z({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,l;const i=((l=(a=this._def).errorMap)==null?void 0:l.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:S.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new z({...this._def,unknownKeys:"strip"})}passthrough(){return new z({...this._def,unknownKeys:"passthrough"})}extend(e){return new z({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new z({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new z({...this._def,catchall:e})}pick(e){const t={};for(const n of G.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new z({...this._def,shape:()=>t})}omit(e){const t={};for(const n of G.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new z({...this._def,shape:()=>t})}deepPartial(){return Ce(this)}partial(e){const t={};for(const n of G.objectKeys(this.shape)){const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}return new z({...this._def,shape:()=>t})}required(e){const t={};for(const n of G.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof ue;)a=a._def.innerType;t[n]=a}return new z({...this._def,shape:()=>t})}keyof(){return nn(G.objectKeys(this.shape))}}z.create=(o,e)=>new z({shape:()=>o,unknownKeys:"strip",catchall:le.create(),typeName:N.ZodObject,...L(e)}),z.strictCreate=(o,e)=>new z({shape:()=>o,unknownKeys:"strict",catchall:le.create(),typeName:N.ZodObject,...L(e)}),z.lazycreate=(o,e)=>new z({shape:o,unknownKeys:"strip",catchall:le.create(),typeName:N.ZodObject,...L(e)});class We extends U{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function i(a){for(const u of a)if(u.result.status==="valid")return u.result;for(const u of a)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;const l=a.map(u=>new se(u.ctx.common.issues));return _(t,{code:T.invalid_union,unionErrors:l}),D}if(t.common.async)return Promise.all(n.map(async a=>{const l={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(i);{let a;const l=[];for(const d of n){const c={...t,common:{...t.common,issues:[]},parent:null},f=d._parseSync({data:t.data,path:t.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:c}),c.common.issues.length&&l.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const u=l.map(d=>new se(d));return _(t,{code:T.invalid_union,unionErrors:u}),D}}get options(){return this._def.options}}We.create=(o,e)=>new We({options:o,typeName:N.ZodUnion,...L(e)});function ft(o,e){const t=ae(o),n=ae(e);if(o===e)return{valid:!0,data:o};if(t===w.object&&n===w.object){const i=G.objectKeys(e),a=G.objectKeys(o).filter(u=>i.indexOf(u)!==-1),l={...o,...e};for(const u of a){const d=ft(o[u],e[u]);if(!d.valid)return{valid:!1};l[u]=d.data}return{valid:!0,data:l}}else if(t===w.array&&n===w.array){if(o.length!==e.length)return{valid:!1};const i=[];for(let a=0;a<o.length;a++){const l=o[a],u=e[a],d=ft(l,u);if(!d.valid)return{valid:!1};i.push(d.data)}return{valid:!0,data:i}}else return t===w.date&&n===w.date&&+o==+e?{valid:!0,data:o}:{valid:!1}}class Ye extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=(a,l)=>{if(Ht(a)||Ht(l))return D;const u=ft(a.value,l.value);return u.valid?((Jt(a)||Jt(l))&&t.dirty(),{status:t.value,value:u.data}):(_(n,{code:T.invalid_intersection_types}),D)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,l])=>i(a,l)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ye.create=(o,e,t)=>new Ye({left:o,right:e,typeName:N.ZodIntersection,...L(t)});class he extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.array)return _(n,{code:T.invalid_type,expected:w.array,received:n.parsedType}),D;if(n.data.length<this._def.items.length)return _(n,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),D;!this._def.rest&&n.data.length>this._def.items.length&&(_(n,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((l,u)=>{const d=this._def.items[u]||this._def.rest;return d?d._parse(new oe(n,l,n.path,u)):null}).filter(l=>!!l);return n.common.async?Promise.all(a).then(l=>K.mergeArray(t,l)):K.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new he({...this._def,rest:e})}}he.create=(o,e)=>{if(!Array.isArray(o))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new he({items:o,typeName:N.ZodTuple,rest:null,...L(e)})};class Ze extends U{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.object)return _(n,{code:T.invalid_type,expected:w.object,received:n.parsedType}),D;const i=[],a=this._def.keyType,l=this._def.valueType;for(const u in n.data)i.push({key:a._parse(new oe(n,u,n.path,u)),value:l._parse(new oe(n,n.data[u],n.path,u)),alwaysSet:u in n.data});return n.common.async?K.mergeObjectAsync(t,i):K.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof U?new Ze({keyType:e,valueType:t,typeName:N.ZodRecord,...L(n)}):new Ze({keyType:ie.create(),valueType:e,typeName:N.ZodRecord,...L(t)})}}class en extends U{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.map)return _(n,{code:T.invalid_type,expected:w.map,received:n.parsedType}),D;const i=this._def.keyType,a=this._def.valueType,l=[...n.data.entries()].map(([u,d],c)=>({key:i._parse(new oe(n,u,n.path,[c,"key"])),value:a._parse(new oe(n,d,n.path,[c,"value"]))}));if(n.common.async){const u=new Map;return Promise.resolve().then(async()=>{for(const d of l){const c=await d.key,f=await d.value;if(c.status==="aborted"||f.status==="aborted")return D;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),u.set(c.value,f.value)}return{status:t.value,value:u}})}else{const u=new Map;for(const d of l){const c=d.key,f=d.value;if(c.status==="aborted"||f.status==="aborted")return D;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),u.set(c.value,f.value)}return{status:t.value,value:u}}}}en.create=(o,e,t)=>new en({valueType:e,keyType:o,typeName:N.ZodMap,...L(t)});class Ve extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.set)return _(n,{code:T.invalid_type,expected:w.set,received:n.parsedType}),D;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(_(n,{code:T.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(_(n,{code:T.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const a=this._def.valueType;function l(d){const c=new Set;for(const f of d){if(f.status==="aborted")return D;f.status==="dirty"&&t.dirty(),c.add(f.value)}return{status:t.value,value:c}}const u=[...n.data.values()].map((d,c)=>a._parse(new oe(n,d,n.path,c)));return n.common.async?Promise.all(u).then(d=>l(d)):l(u)}min(e,t){return new Ve({...this._def,minSize:{value:e,message:S.toString(t)}})}max(e,t){return new Ve({...this._def,maxSize:{value:e,message:S.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ve.create=(o,e)=>new Ve({valueType:o,minSize:null,maxSize:null,typeName:N.ZodSet,...L(e)});class pt extends U{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}pt.create=(o,e)=>new pt({getter:o,typeName:N.ZodLazy,...L(e)});class tn extends U{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return _(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),D}return{status:"valid",value:e.data}}get value(){return this._def.value}}tn.create=(o,e)=>new tn({value:o,typeName:N.ZodLiteral,...L(e)});function nn(o,e){return new _e({values:o,typeName:N.ZodEnum,...L(e)})}class _e extends U{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return _(t,{expected:G.joinValues(n),received:t.parsedType,code:T.invalid_type}),D}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return _(t,{received:t.data,code:T.invalid_enum_value,options:n}),D}return j(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return _e.create(e,{...this._def,...t})}exclude(e,t=this._def){return _e.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}_e.create=nn;class on extends U{_parse(e){const t=G.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==w.string&&n.parsedType!==w.number){const i=G.objectValues(t);return _(n,{expected:G.joinValues(i),received:n.parsedType,code:T.invalid_type}),D}if(this._cache||(this._cache=new Set(G.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=G.objectValues(t);return _(n,{received:n.data,code:T.invalid_enum_value,options:i}),D}return j(e.data)}get enum(){return this._def.values}}on.create=(o,e)=>new on({values:o,typeName:N.ZodNativeEnum,...L(e)});class Ke extends U{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==w.promise&&t.common.async===!1)return _(t,{code:T.invalid_type,expected:w.promise,received:t.parsedType}),D;const n=t.parsedType===w.promise?t.data:Promise.resolve(t.data);return j(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ke.create=(o,e)=>new Ke({type:o,typeName:N.ZodPromise,...L(e)});class xe extends U{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:l=>{_(n,l),l.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){const l=i.transform(n.data,a);if(n.common.async)return Promise.resolve(l).then(async u=>{if(t.value==="aborted")return D;const d=await this._def.schema._parseAsync({data:u,path:n.path,parent:n});return d.status==="aborted"?D:d.status==="dirty"||t.value==="dirty"?Le(d.value):d});{if(t.value==="aborted")return D;const u=this._def.schema._parseSync({data:l,path:n.path,parent:n});return u.status==="aborted"?D:u.status==="dirty"||t.value==="dirty"?Le(u.value):u}}if(i.type==="refinement"){const l=u=>{const d=i.refinement(u,a);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(n.common.async===!1){const u=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return u.status==="aborted"?D:(u.status==="dirty"&&t.dirty(),l(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(u=>u.status==="aborted"?D:(u.status==="dirty"&&t.dirty(),l(u.value).then(()=>({status:t.value,value:u.value}))))}if(i.type==="transform")if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ve(l))return D;const u=i.transform(l.value,a);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>ve(l)?Promise.resolve(i.transform(l.value,a)).then(u=>({status:t.value,value:u})):D);G.assertNever(i)}}xe.create=(o,e,t)=>new xe({schema:o,typeName:N.ZodEffects,effect:e,...L(t)}),xe.createWithPreprocess=(o,e,t)=>new xe({schema:e,effect:{type:"preprocess",transform:o},typeName:N.ZodEffects,...L(t)});class ue extends U{_parse(e){return this._getType(e)===w.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ue.create=(o,e)=>new ue({innerType:o,typeName:N.ZodOptional,...L(e)});class Ee extends U{_parse(e){return this._getType(e)===w.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ee.create=(o,e)=>new Ee({innerType:o,typeName:N.ZodNullable,...L(e)});class mt extends U{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===w.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}mt.create=(o,e)=>new mt({innerType:o,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});class ht extends U{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Je(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new se(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new se(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ht.create=(o,e)=>new ht({innerType:o,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});class rn extends U{_parse(e){if(this._getType(e)!==w.nan){const n=this._getOrReturnCtx(e);return _(n,{code:T.invalid_type,expected:w.nan,received:n.parsedType}),D}return{status:"valid",value:e.data}}}rn.create=o=>new rn({typeName:N.ZodNaN,...L(o)});class $i extends U{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class gt extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?D:a.status==="dirty"?(t.dirty(),Le(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?D:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new gt({in:e,out:t,typeName:N.ZodPipeline})}}class yt extends U{_parse(e){const t=this._def.innerType._parse(e),n=i=>(ve(i)&&(i.value=Object.freeze(i.value)),i);return Je(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}}yt.create=(o,e)=>new yt({innerType:o,typeName:N.ZodReadonly,...L(e)});var N;(function(o){o.ZodString="ZodString",o.ZodNumber="ZodNumber",o.ZodNaN="ZodNaN",o.ZodBigInt="ZodBigInt",o.ZodBoolean="ZodBoolean",o.ZodDate="ZodDate",o.ZodSymbol="ZodSymbol",o.ZodUndefined="ZodUndefined",o.ZodNull="ZodNull",o.ZodAny="ZodAny",o.ZodUnknown="ZodUnknown",o.ZodNever="ZodNever",o.ZodVoid="ZodVoid",o.ZodArray="ZodArray",o.ZodObject="ZodObject",o.ZodUnion="ZodUnion",o.ZodDiscriminatedUnion="ZodDiscriminatedUnion",o.ZodIntersection="ZodIntersection",o.ZodTuple="ZodTuple",o.ZodRecord="ZodRecord",o.ZodMap="ZodMap",o.ZodSet="ZodSet",o.ZodFunction="ZodFunction",o.ZodLazy="ZodLazy",o.ZodLiteral="ZodLiteral",o.ZodEnum="ZodEnum",o.ZodEffects="ZodEffects",o.ZodNativeEnum="ZodNativeEnum",o.ZodOptional="ZodOptional",o.ZodNullable="ZodNullable",o.ZodDefault="ZodDefault",o.ZodCatch="ZodCatch",o.ZodPromise="ZodPromise",o.ZodBranded="ZodBranded",o.ZodPipeline="ZodPipeline",o.ZodReadonly="ZodReadonly"})(N||(N={}));const ge=ie.create,sn=pe.create;me.create;const Oi=ze.create;Te.create;const an=dt.create;le.create;const Fe=re.create,Hi=z.create,Ji=We.create;Ye.create,he.create;const zi=Ze.create,Wi=pt.create,Yi=_e.create;Ke.create,ue.create,Ee.create;const we={string:(o=>ie.create({...o,coerce:!0})),number:(o=>pe.create({...o,coerce:!0})),boolean:(o=>ze.create({...o,coerce:!0})),bigint:(o=>me.create({...o,coerce:!0})),date:(o=>Te.create({...o,coerce:!0}))};/**
119
+ * @license
120
+ * Copyright 2025 Google LLC
121
+ * SPDX-License-Identifier: Apache-2.0
122
+ */let Zi,Ki;function Xi(){return{geminiUrl:Zi,vertexUrl:Ki}}function Qi(o,e,t){var n,i,a;if(!(!((n=o.httpOptions)===null||n===void 0)&&n.baseUrl)){const l=Xi();return o.vertexai?(i=l.vertexUrl)!==null&&i!==void 0?i:e:(a=l.geminiUrl)!==null&&a!==void 0?a:t}return o.httpOptions.baseUrl}/**
123
+ * @license
124
+ * Copyright 2025 Google LLC
125
+ * SPDX-License-Identifier: Apache-2.0
126
+ */class Se{}function I(o,e){const t=/\{([^}]+)\}/g;return o.replace(t,(n,i)=>{if(Object.prototype.hasOwnProperty.call(e,i)){const a=e[i];return a!=null?String(a):""}else throw new Error(`Key '${i}' not found in valueMap.`)})}function s(o,e,t){for(let a=0;a<e.length-1;a++){const l=e[a];if(l.endsWith("[]")){const u=l.slice(0,-2);if(!(u in o))if(Array.isArray(t))o[u]=Array.from({length:t.length},()=>({}));else throw new Error(`Value must be a list given an array path ${l}`);if(Array.isArray(o[u])){const d=o[u];if(Array.isArray(t))for(let c=0;c<d.length;c++){const f=d[c];s(f,e.slice(a+1),t[c])}else for(const c of d)s(c,e.slice(a+1),t)}return}else if(l.endsWith("[0]")){const u=l.slice(0,-3);u in o||(o[u]=[{}]);const d=o[u];s(d[0],e.slice(a+1),t);return}(!o[l]||typeof o[l]!="object")&&(o[l]={}),o=o[l]}const n=e[e.length-1],i=o[n];if(i!==void 0){if(!t||typeof t=="object"&&Object.keys(t).length===0||t===i)return;if(typeof i=="object"&&typeof t=="object"&&i!==null&&t!==null)Object.assign(i,t);else throw new Error(`Cannot set value for an existing key. Key: ${n}`)}else o[n]=t}function r(o,e){try{if(e.length===1&&e[0]==="_self")return o;for(let t=0;t<e.length;t++){if(typeof o!="object"||o===null)return;const n=e[t];if(n.endsWith("[]")){const i=n.slice(0,-2);if(i in o){const a=o[i];return Array.isArray(a)?a.map(l=>r(l,e.slice(t+1))):void 0}else return}else o=o[n]}return o}catch(t){if(t instanceof TypeError)return;throw t}}/**
127
+ * @license
128
+ * Copyright 2025 Google LLC
129
+ * SPDX-License-Identifier: Apache-2.0
130
+ */var ln;(function(o){o.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",o.OUTCOME_OK="OUTCOME_OK",o.OUTCOME_FAILED="OUTCOME_FAILED",o.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(ln||(ln={}));var un;(function(o){o.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",o.PYTHON="PYTHON"})(un||(un={}));var ee;(function(o){o.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",o.STRING="STRING",o.NUMBER="NUMBER",o.INTEGER="INTEGER",o.BOOLEAN="BOOLEAN",o.ARRAY="ARRAY",o.OBJECT="OBJECT",o.NULL="NULL"})(ee||(ee={}));var cn;(function(o){o.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",o.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",o.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",o.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",o.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",o.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY"})(cn||(cn={}));var dn;(function(o){o.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",o.SEVERITY="SEVERITY",o.PROBABILITY="PROBABILITY"})(dn||(dn={}));var fn;(function(o){o.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",o.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",o.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",o.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",o.BLOCK_NONE="BLOCK_NONE",o.OFF="OFF"})(fn||(fn={}));var pn;(function(o){o.MODE_UNSPECIFIED="MODE_UNSPECIFIED",o.MODE_DYNAMIC="MODE_DYNAMIC"})(pn||(pn={}));var mn;(function(o){o.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",o.NO_AUTH="NO_AUTH",o.API_KEY_AUTH="API_KEY_AUTH",o.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",o.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",o.OAUTH="OAUTH",o.OIDC_AUTH="OIDC_AUTH"})(mn||(mn={}));var hn;(function(o){o.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",o.STOP="STOP",o.MAX_TOKENS="MAX_TOKENS",o.SAFETY="SAFETY",o.RECITATION="RECITATION",o.LANGUAGE="LANGUAGE",o.OTHER="OTHER",o.BLOCKLIST="BLOCKLIST",o.PROHIBITED_CONTENT="PROHIBITED_CONTENT",o.SPII="SPII",o.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",o.IMAGE_SAFETY="IMAGE_SAFETY",o.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL"})(hn||(hn={}));var gn;(function(o){o.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",o.NEGLIGIBLE="NEGLIGIBLE",o.LOW="LOW",o.MEDIUM="MEDIUM",o.HIGH="HIGH"})(gn||(gn={}));var yn;(function(o){o.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",o.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",o.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",o.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",o.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})(yn||(yn={}));var vn;(function(o){o.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",o.SAFETY="SAFETY",o.OTHER="OTHER",o.BLOCKLIST="BLOCKLIST",o.PROHIBITED_CONTENT="PROHIBITED_CONTENT"})(vn||(vn={}));var Tn;(function(o){o.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",o.ON_DEMAND="ON_DEMAND",o.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(Tn||(Tn={}));var Xe;(function(o){o.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",o.TEXT="TEXT",o.IMAGE="IMAGE",o.AUDIO="AUDIO"})(Xe||(Xe={}));var Cn;(function(o){o.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",o.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",o.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",o.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(Cn||(Cn={}));var vt;(function(o){o.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",o.JOB_STATE_QUEUED="JOB_STATE_QUEUED",o.JOB_STATE_PENDING="JOB_STATE_PENDING",o.JOB_STATE_RUNNING="JOB_STATE_RUNNING",o.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",o.JOB_STATE_FAILED="JOB_STATE_FAILED",o.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",o.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",o.JOB_STATE_PAUSED="JOB_STATE_PAUSED",o.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",o.JOB_STATE_UPDATING="JOB_STATE_UPDATING",o.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(vt||(vt={}));var _n;(function(o){o.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",o.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",o.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",o.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",o.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",o.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",o.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(_n||(_n={}));var xn;(function(o){o.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",o.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",o.BALANCED="BALANCED",o.PRIORITIZE_COST="PRIORITIZE_COST"})(xn||(xn={}));var En;(function(o){o.UNSPECIFIED="UNSPECIFIED",o.BLOCKING="BLOCKING",o.NON_BLOCKING="NON_BLOCKING"})(En||(En={}));var wn;(function(o){o.MODE_UNSPECIFIED="MODE_UNSPECIFIED",o.MODE_DYNAMIC="MODE_DYNAMIC"})(wn||(wn={}));var Sn;(function(o){o.MODE_UNSPECIFIED="MODE_UNSPECIFIED",o.AUTO="AUTO",o.ANY="ANY",o.NONE="NONE"})(Sn||(Sn={}));var An;(function(o){o.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",o.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",o.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR"})(An||(An={}));var Mn;(function(o){o.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",o.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",o.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",o.BLOCK_NONE="BLOCK_NONE"})(Mn||(Mn={}));var In;(function(o){o.DONT_ALLOW="DONT_ALLOW",o.ALLOW_ADULT="ALLOW_ADULT",o.ALLOW_ALL="ALLOW_ALL"})(In||(In={}));var Rn;(function(o){o.auto="auto",o.en="en",o.ja="ja",o.ko="ko",o.hi="hi"})(Rn||(Rn={}));var kn;(function(o){o.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",o.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",o.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",o.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",o.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})(kn||(kn={}));var Nn;(function(o){o.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",o.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",o.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",o.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(Nn||(Nn={}));var Pn;(function(o){o.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",o.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",o.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",o.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(Pn||(Pn={}));var Dn;(function(o){o.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",o.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",o.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",o.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",o.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",o.EDIT_MODE_STYLE="EDIT_MODE_STYLE",o.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",o.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(Dn||(Dn={}));var bn;(function(o){o.STATE_UNSPECIFIED="STATE_UNSPECIFIED",o.PROCESSING="PROCESSING",o.ACTIVE="ACTIVE",o.FAILED="FAILED"})(bn||(bn={}));var Ln;(function(o){o.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",o.UPLOADED="UPLOADED",o.GENERATED="GENERATED"})(Ln||(Ln={}));var Vn;(function(o){o.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",o.TEXT="TEXT",o.IMAGE="IMAGE",o.VIDEO="VIDEO",o.AUDIO="AUDIO",o.DOCUMENT="DOCUMENT"})(Vn||(Vn={}));var Fn;(function(o){o.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",o.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",o.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Fn||(Fn={}));var Un;(function(o){o.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",o.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",o.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(Un||(Un={}));var Gn;(function(o){o.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",o.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",o.NO_INTERRUPTION="NO_INTERRUPTION"})(Gn||(Gn={}));var Bn;(function(o){o.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",o.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",o.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT"})(Bn||(Bn={}));var qn;(function(o){o.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",o.SILENT="SILENT",o.WHEN_IDLE="WHEN_IDLE",o.INTERRUPT="INTERRUPT"})(qn||(qn={}));var $n;(function(o){o.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",o.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",o.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",o.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",o.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",o.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",o.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",o.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",o.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",o.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",o.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",o.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",o.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})($n||($n={}));var Ae;(function(o){o.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",o.PLAY="PLAY",o.PAUSE="PAUSE",o.STOP="STOP",o.RESET_CONTEXT="RESET_CONTEXT"})(Ae||(Ae={}));class Ue{get text(){var e,t,n,i,a,l,u,d;if(((i=(n=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||n===void 0?void 0:n.parts)===null||i===void 0?void 0:i.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 c="",f=!1;const p=[];for(const m of(d=(u=(l=(a=this.candidates)===null||a===void 0?void 0:a[0])===null||l===void 0?void 0:l.content)===null||u===void 0?void 0:u.parts)!==null&&d!==void 0?d:[]){for(const[h,g]of Object.entries(m))h!=="text"&&h!=="thought"&&(g!==null||g!==void 0)&&p.push(h);if(typeof m.text=="string"){if(typeof m.thought=="boolean"&&m.thought)continue;f=!0,c+=m.text}}return p.length>0&&console.warn(`there are non-text parts ${p} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),f?c:void 0}get data(){var e,t,n,i,a,l,u,d;if(((i=(n=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||n===void 0?void 0:n.parts)===null||i===void 0?void 0:i.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 c="";const f=[];for(const p of(d=(u=(l=(a=this.candidates)===null||a===void 0?void 0:a[0])===null||l===void 0?void 0:l.content)===null||u===void 0?void 0:u.parts)!==null&&d!==void 0?d:[]){for(const[m,h]of Object.entries(p))m!=="inlineData"&&(h!==null||h!==void 0)&&f.push(m);p.inlineData&&typeof p.inlineData.data=="string"&&(c+=atob(p.inlineData.data))}return f.length>0&&console.warn(`there are non-data parts ${f} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),c.length>0?btoa(c):void 0}get functionCalls(){var e,t,n,i,a,l,u,d;if(((i=(n=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||n===void 0?void 0:n.parts)===null||i===void 0?void 0:i.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.");const c=(d=(u=(l=(a=this.candidates)===null||a===void 0?void 0:a[0])===null||l===void 0?void 0:l.content)===null||u===void 0?void 0:u.parts)===null||d===void 0?void 0:d.filter(f=>f.functionCall).map(f=>f.functionCall).filter(f=>f!==void 0);if((c==null?void 0:c.length)!==0)return c}get executableCode(){var e,t,n,i,a,l,u,d,c;if(((i=(n=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||n===void 0?void 0:n.parts)===null||i===void 0?void 0:i.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.");const f=(d=(u=(l=(a=this.candidates)===null||a===void 0?void 0:a[0])===null||l===void 0?void 0:l.content)===null||u===void 0?void 0:u.parts)===null||d===void 0?void 0:d.filter(p=>p.executableCode).map(p=>p.executableCode).filter(p=>p!==void 0);if((f==null?void 0:f.length)!==0)return(c=f==null?void 0:f[0])===null||c===void 0?void 0:c.code}get codeExecutionResult(){var e,t,n,i,a,l,u,d,c;if(((i=(n=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||n===void 0?void 0:n.parts)===null||i===void 0?void 0:i.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.");const f=(d=(u=(l=(a=this.candidates)===null||a===void 0?void 0:a[0])===null||l===void 0?void 0:l.content)===null||u===void 0?void 0:u.parts)===null||d===void 0?void 0:d.filter(p=>p.codeExecutionResult).map(p=>p.codeExecutionResult).filter(p=>p!==void 0);if((f==null?void 0:f.length)!==0)return(c=f==null?void 0:f[0])===null||c===void 0?void 0:c.output}}class On{}class Hn{}class ji{}class er{}class Jn{}class zn{}class Wn{}class tr{}class Yn{}class Zn{}class Kn{}class nr{}class Tt{constructor(e){const t={};for(const n of e.headers.entries())t[n[0]]=n[1];this.headers=t,this.responseInternal=e}json(){return this.responseInternal.json()}}class or{}class ir{}class rr{get text(){var e,t,n;let i="",a=!1;const l=[];for(const u of(n=(t=(e=this.serverContent)===null||e===void 0?void 0:e.modelTurn)===null||t===void 0?void 0:t.parts)!==null&&n!==void 0?n:[]){for(const[d,c]of Object.entries(u))d!=="text"&&d!=="thought"&&c!==null&&l.push(d);if(typeof u.text=="string"){if(typeof u.thought=="boolean"&&u.thought)continue;a=!0,i+=u.text}}return l.length>0&&console.warn(`there are non-text parts ${l} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),a?i:void 0}get data(){var e,t,n;let i="";const a=[];for(const l of(n=(t=(e=this.serverContent)===null||e===void 0?void 0:e.modelTurn)===null||t===void 0?void 0:t.parts)!==null&&n!==void 0?n:[]){for(const[u,d]of Object.entries(l))u!=="inlineData"&&d!==null&&a.push(u);l.inlineData&&typeof l.inlineData.data=="string"&&(i+=atob(l.inlineData.data))}return a.length>0&&console.warn(`there are non-data parts ${a} 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}}class sr{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}/**
131
+ * @license
132
+ * Copyright 2025 Google LLC
133
+ * SPDX-License-Identifier: Apache-2.0
134
+ */function q(o,e){if(!e||typeof e!="string")throw new Error("model is required and must be a string");if(o.isVertexAI()){if(e.startsWith("publishers/")||e.startsWith("projects/")||e.startsWith("models/"))return e;if(e.indexOf("/")>=0){const t=e.split("/",2);return`publishers/${t[0]}/models/${t[1]}`}else return`publishers/google/models/${e}`}else return e.startsWith("models/")||e.startsWith("tunedModels/")?e:`models/${e}`}function Xn(o,e){const t=q(o,e);return t?t.startsWith("publishers/")&&o.isVertexAI()?`projects/${o.getProject()}/locations/${o.getLocation()}/${t}`:t.startsWith("models/")&&o.isVertexAI()?`projects/${o.getProject()}/locations/${o.getLocation()}/publishers/google/${t}`:t:""}function Qn(o,e){return Array.isArray(e)?e.map(t=>Qe(o,t)):[Qe(o,e)]}function Qe(o,e){if(typeof e=="object"&&e!==null)return e;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof e}`)}function ar(o,e){const t=Qe(o,e);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function lr(o,e){const t=Qe(o,e);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function jn(o,e){if(e==null)throw new Error("PartUnion is required");if(typeof e=="object")return e;if(typeof e=="string")return{text:e};throw new Error(`Unsupported part type: ${typeof e}`)}function eo(o,e){if(e==null||Array.isArray(e)&&e.length===0)throw new Error("PartListUnion is required");return Array.isArray(e)?e.map(t=>jn(o,t)):[jn(o,e)]}function Ct(o){return o!=null&&typeof o=="object"&&"parts"in o&&Array.isArray(o.parts)}function to(o){return o!=null&&typeof o=="object"&&"functionCall"in o}function no(o){return o!=null&&typeof o=="object"&&"functionResponse"in o}function X(o,e){if(e==null)throw new Error("ContentUnion is required");return Ct(e)?e:{role:"user",parts:eo(o,e)}}function oo(o,e){if(!e)return[];if(o.isVertexAI()&&Array.isArray(e))return e.flatMap(t=>{const n=X(o,t);return n.parts&&n.parts.length>0&&n.parts[0].text!==void 0?[n.parts[0].text]:[]});if(o.isVertexAI()){const t=X(o,e);return t.parts&&t.parts.length>0&&t.parts[0].text!==void 0?[t.parts[0].text]:[]}return Array.isArray(e)?e.map(t=>X(o,t)):[X(o,e)]}function te(o,e){if(e==null||Array.isArray(e)&&e.length===0)throw new Error("contents are required");if(!Array.isArray(e)){if(to(e)||no(e))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[X(o,e)]}const t=[],n=[],i=Ct(e[0]);for(const a of e){const l=Ct(a);if(l!=i)throw new 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(l)t.push(a);else{if(to(a)||no(a))throw new Error("To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them");n.push(a)}}return i||t.push({role:"user",parts:eo(o,n)}),t}const ur=new Set(["type","format","title","description","default","items","minItems","maxItems","enum","properties","required","minProperties","maxProperties","minimum","maximum","minLength","maxLength","pattern","anyOf","propertyOrdering"]),io=Yi(["string","number","integer","object","array","boolean","null"]),cr=Ji([io,Fe(io)]);function dr(o=!0){const e=Wi(()=>{const t=Hi({type:cr.optional(),format:ge().optional(),title:ge().optional(),description:ge().optional(),default:an().optional(),items:e.optional(),minItems:we.string().optional(),maxItems:we.string().optional(),enum:Fe(an()).optional(),properties:zi(ge(),e).optional(),required:Fe(ge()).optional(),minProperties:we.string().optional(),maxProperties:we.string().optional(),propertyOrdering:Fe(ge()).optional(),minimum:sn().optional(),maximum:sn().optional(),minLength:we.string().optional(),maxLength:we.string().optional(),pattern:ge().optional(),anyOf:Fe(e).optional(),additionalProperties:Oi().optional()});return o?t.strict():t});return e}function fr(o,e){o.includes("null")&&(e.nullable=!0);const t=o.filter(n=>n!=="null");if(t.length===1)e.type=Object.keys(ee).includes(t[0].toUpperCase())?ee[t[0].toUpperCase()]:ee.TYPE_UNSPECIFIED;else{e.anyOf=[];for(const n of t)e.anyOf.push({type:Object.keys(ee).includes(n.toUpperCase())?ee[n.toUpperCase()]:ee.TYPE_UNSPECIFIED})}}function Me(o){const e={},t=["items"],n=["anyOf"],i=["properties"];if(o.type&&o.anyOf)throw new Error("type and anyOf cannot be both populated.");const a=o.anyOf;a!=null&&a.length==2&&(a[0].type==="null"?(e.nullable=!0,o=a[1]):a[1].type==="null"&&(e.nullable=!0,o=a[0])),o.type instanceof Array&&fr(o.type,e);for(const[l,u]of Object.entries(o))if(u!=null)if(l=="type"){if(u==="null")throw new Error("type: null can not be the only possible type for the field.");if(u instanceof Array)continue;e.type=Object.keys(ee).includes(u.toUpperCase())?u.toUpperCase():ee.TYPE_UNSPECIFIED}else if(t.includes(l))e[l]=Me(u);else if(n.includes(l)){const d=[];for(const c of u){if(c.type=="null"){e.nullable=!0;continue}d.push(Me(c))}e[l]=d}else if(i.includes(l)){const d={};for(const[c,f]of Object.entries(u))d[c]=Me(f);e[l]=d}else{if(l==="additionalProperties")continue;e[l]=u}return e}function je(o,e){if(Object.keys(e).includes("$schema")){delete e.$schema;const t=dr().parse(e);return Me(t)}else return Me(e)}function ro(o,e){if(typeof e=="object")return e;if(typeof e=="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:e}}};throw new Error(`Unsupported speechConfig type: ${typeof e}`)}function _t(o,e){if("multiSpeakerVoiceConfig"in e)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return e}function Ge(o,e){if(e.functionDeclarations)for(const t of e.functionDeclarations)t.parameters&&(t.parameters=je(o,t.parameters)),t.response&&(t.response=je(o,t.response));return e}function Be(o,e){if(e==null)throw new Error("tools is required");if(!Array.isArray(e))throw new Error("tools is required and must be an array of Tools");const t=[];for(const n of e)t.push(n);return t}function pr(o,e,t,n=1){const i=!e.startsWith(`${t}/`)&&e.split("/").length===n;return o.isVertexAI()?e.startsWith("projects/")?e:e.startsWith("locations/")?`projects/${o.getProject()}/${e}`:e.startsWith(`${t}/`)?`projects/${o.getProject()}/locations/${o.getLocation()}/${e}`:i?`projects/${o.getProject()}/locations/${o.getLocation()}/${t}/${e}`:e:i?`${t}/${e}`:e}function ce(o,e){if(typeof e!="string")throw new Error("name must be a string");return pr(o,e,"cachedContents")}function so(o,e){switch(e){case"STATE_UNSPECIFIED":return"JOB_STATE_UNSPECIFIED";case"CREATING":return"JOB_STATE_RUNNING";case"ACTIVE":return"JOB_STATE_SUCCEEDED";case"FAILED":return"JOB_STATE_FAILED";default:return e}}function de(o,e){if(typeof e!="string")throw new Error("fromImageBytes must be a string");return e}function mr(o){return o!=null&&typeof o=="object"&&"name"in o}function hr(o){return o!=null&&typeof o=="object"&&"video"in o}function gr(o){return o!=null&&typeof o=="object"&&"uri"in o}function ao(o,e){var t;let n;if(mr(e)&&(n=e.name),!(gr(e)&&(n=e.uri,n===void 0))&&!(hr(e)&&(n=(t=e.video)===null||t===void 0?void 0:t.uri,n===void 0))){if(typeof e=="string"&&(n=e),n===void 0)throw new Error("Could not extract file name from the provided input.");if(n.startsWith("https://")){const a=n.split("files/")[1].match(/[a-z0-9]+/);if(a===null)throw new Error(`Could not extract file name from URI ${n}`);n=a[0]}else n.startsWith("files/")&&(n=n.split("files/")[1]);return n}}function lo(o,e){let t;return o.isVertexAI()?t=e?"publishers/google/models":"models":t=e?"models":"tunedModels",t}function uo(o,e){for(const t of["models","tunedModels","publisherModels"])if(yr(e,t))return e[t];return[]}function yr(o,e){return o!==null&&typeof o=="object"&&e in o}function vr(o,e={}){const t=o,n={name:t.name,description:t.description,parameters:Me(et(t.inputSchema))};return e.behavior&&(n.behavior=e.behavior),{functionDeclarations:[n]}}function Tr(o,e={}){const t=[],n=new Set;for(const i of o){const a=i.name;if(n.has(a))throw new Error(`Duplicate function name ${a} found in MCP tools. Please ensure function names are unique.`);n.add(a);const l=vr(i,e);l.functionDeclarations&&t.push(...l.functionDeclarations)}return{functionDeclarations:t}}function Cr(o){const e=[];for(const t of o)e.push(et(t));return e}function _r(o){const e={};for(const[t,n]of Object.entries(o)){const i=n;e[t]=et(i)}return e}function et(o){const e=new Set(["items"]),t=new Set(["anyOf"]),n=new Set(["properties"]),i={};for(const[a,l]of Object.entries(o))if(e.has(a))i[a]=et(l);else if(t.has(a))i[a]=Cr(l);else if(n.has(a))i[a]=_r(l);else if(a==="type"){const u=l.toUpperCase();i[a]=Object.keys(ee).includes(u)?u:ee.TYPE_UNSPECIFIED}else ur.has(a)&&(i[a]=l);return i}/**
135
+ * @license
136
+ * Copyright 2025 Google LLC
137
+ * SPDX-License-Identifier: Apache-2.0
138
+ */function xr(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function Er(o,e){const t={};if(r(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=r(e,["data"]);n!=null&&s(t,["data"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function wr(o,e){const t={};if(r(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=r(e,["fileUri"]);n!=null&&s(t,["fileUri"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function Sr(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],xr(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],Er(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],wr(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function co(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>Sr(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Ar(o,e){const t={},n=r(e,["behavior"]);n!=null&&s(t,["behavior"],n);const i=r(e,["description"]);i!=null&&s(t,["description"],i);const a=r(e,["name"]);a!=null&&s(t,["name"],a);const l=r(e,["parameters"]);l!=null&&s(t,["parameters"],l);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function Mr(o,e){const t={},n=r(e,["startTime"]);n!=null&&s(t,["startTime"],n);const i=r(e,["endTime"]);return i!=null&&s(t,["endTime"],i),t}function Ir(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Mr(o,n)),t}function Rr(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["dynamicThreshold"]);return i!=null&&s(t,["dynamicThreshold"],i),t}function kr(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],Rr(o,n)),t}function Nr(){return{}}function Pr(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>Ar(o,c))),s(t,["functionDeclarations"],d)}if(r(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const i=r(e,["googleSearch"]);i!=null&&s(t,["googleSearch"],Ir(o,i));const a=r(e,["googleSearchRetrieval"]);if(a!=null&&s(t,["googleSearchRetrieval"],kr(o,a)),r(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");if(r(e,["googleMaps"])!==void 0)throw new Error("googleMaps parameter is not supported in Gemini API.");r(e,["urlContext"])!=null&&s(t,["urlContext"],Nr());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function Dr(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["allowedFunctionNames"]);return i!=null&&s(t,["allowedFunctionNames"],i),t}function br(o,e){const t={},n=r(e,["latitude"]);n!=null&&s(t,["latitude"],n);const i=r(e,["longitude"]);return i!=null&&s(t,["longitude"],i),t}function Lr(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],br(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function Vr(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],Dr(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],Lr(o,i)),t}function Fr(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const a=r(e,["expireTime"]);t!==void 0&&a!=null&&s(t,["expireTime"],a);const l=r(e,["displayName"]);t!==void 0&&l!=null&&s(t,["displayName"],l);const u=r(e,["contents"]);if(t!==void 0&&u!=null){let p=te(o,u);Array.isArray(p)&&(p=p.map(m=>co(o,m))),s(t,["contents"],p)}const d=r(e,["systemInstruction"]);t!==void 0&&d!=null&&s(t,["systemInstruction"],co(o,X(o,d)));const c=r(e,["tools"]);if(t!==void 0&&c!=null){let p=c;Array.isArray(p)&&(p=p.map(m=>Pr(o,m))),s(t,["tools"],p)}const f=r(e,["toolConfig"]);if(t!==void 0&&f!=null&&s(t,["toolConfig"],Vr(o,f)),r(e,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return n}function Ur(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["model"],Xn(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],Fr(o,i,t)),t}function Gr(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],ce(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Br(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],ce(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function qr(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const a=r(e,["expireTime"]);return t!==void 0&&a!=null&&s(t,["expireTime"],a),n}function $r(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],ce(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],qr(o,i,t)),t}function Or(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const a=r(e,["pageToken"]);return t!==void 0&&a!=null&&s(t,["_query","pageToken"],a),n}function Hr(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],Or(o,n,t)),t}function Jr(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function zr(o,e){const t={},n=r(e,["displayName"]);n!=null&&s(t,["displayName"],n);const i=r(e,["data"]);i!=null&&s(t,["data"],i);const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Wr(o,e){const t={},n=r(e,["displayName"]);n!=null&&s(t,["displayName"],n);const i=r(e,["fileUri"]);i!=null&&s(t,["fileUri"],i);const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Yr(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Jr(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],zr(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],Wr(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function fo(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>Yr(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Zr(o,e){const t={};if(r(e,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const n=r(e,["description"]);n!=null&&s(t,["description"],n);const i=r(e,["name"]);i!=null&&s(t,["name"],i);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const l=r(e,["response"]);return l!=null&&s(t,["response"],l),t}function Kr(o,e){const t={},n=r(e,["startTime"]);n!=null&&s(t,["startTime"],n);const i=r(e,["endTime"]);return i!=null&&s(t,["endTime"],i),t}function Xr(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Kr(o,n)),t}function Qr(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["dynamicThreshold"]);return i!=null&&s(t,["dynamicThreshold"],i),t}function jr(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],Qr(o,n)),t}function es(){return{}}function ts(o,e){const t={},n=r(e,["apiKeyString"]);return n!=null&&s(t,["apiKeyString"],n),t}function ns(o,e){const t={},n=r(e,["apiKeyConfig"]);n!=null&&s(t,["apiKeyConfig"],ts(o,n));const i=r(e,["authType"]);i!=null&&s(t,["authType"],i);const a=r(e,["googleServiceAccountConfig"]);a!=null&&s(t,["googleServiceAccountConfig"],a);const l=r(e,["httpBasicAuthConfig"]);l!=null&&s(t,["httpBasicAuthConfig"],l);const u=r(e,["oauthConfig"]);u!=null&&s(t,["oauthConfig"],u);const d=r(e,["oidcConfig"]);return d!=null&&s(t,["oidcConfig"],d),t}function os(o,e){const t={},n=r(e,["authConfig"]);return n!=null&&s(t,["authConfig"],ns(o,n)),t}function is(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(p=>Zr(o,p))),s(t,["functionDeclarations"],f)}const i=r(e,["retrieval"]);i!=null&&s(t,["retrieval"],i);const a=r(e,["googleSearch"]);a!=null&&s(t,["googleSearch"],Xr(o,a));const l=r(e,["googleSearchRetrieval"]);l!=null&&s(t,["googleSearchRetrieval"],jr(o,l)),r(e,["enterpriseWebSearch"])!=null&&s(t,["enterpriseWebSearch"],es());const d=r(e,["googleMaps"]);if(d!=null&&s(t,["googleMaps"],os(o,d)),r(e,["urlContext"])!==void 0)throw new Error("urlContext parameter is not supported in Vertex AI.");const c=r(e,["codeExecution"]);return c!=null&&s(t,["codeExecution"],c),t}function rs(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["allowedFunctionNames"]);return i!=null&&s(t,["allowedFunctionNames"],i),t}function ss(o,e){const t={},n=r(e,["latitude"]);n!=null&&s(t,["latitude"],n);const i=r(e,["longitude"]);return i!=null&&s(t,["longitude"],i),t}function as(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],ss(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function ls(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],rs(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],as(o,i)),t}function us(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const a=r(e,["expireTime"]);t!==void 0&&a!=null&&s(t,["expireTime"],a);const l=r(e,["displayName"]);t!==void 0&&l!=null&&s(t,["displayName"],l);const u=r(e,["contents"]);if(t!==void 0&&u!=null){let m=te(o,u);Array.isArray(m)&&(m=m.map(h=>fo(o,h))),s(t,["contents"],m)}const d=r(e,["systemInstruction"]);t!==void 0&&d!=null&&s(t,["systemInstruction"],fo(o,X(o,d)));const c=r(e,["tools"]);if(t!==void 0&&c!=null){let m=c;Array.isArray(m)&&(m=m.map(h=>is(o,h))),s(t,["tools"],m)}const f=r(e,["toolConfig"]);t!==void 0&&f!=null&&s(t,["toolConfig"],ls(o,f));const p=r(e,["kmsKeyName"]);return t!==void 0&&p!=null&&s(t,["encryption_spec","kmsKeyName"],p),n}function cs(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["model"],Xn(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],us(o,i,t)),t}function ds(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],ce(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function fs(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],ce(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function ps(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const a=r(e,["expireTime"]);return t!==void 0&&a!=null&&s(t,["expireTime"],a),n}function ms(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],ce(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],ps(o,i,t)),t}function hs(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const a=r(e,["pageToken"]);return t!==void 0&&a!=null&&s(t,["_query","pageToken"],a),n}function gs(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],hs(o,n,t)),t}function tt(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["displayName"]);i!=null&&s(t,["displayName"],i);const a=r(e,["model"]);a!=null&&s(t,["model"],a);const l=r(e,["createTime"]);l!=null&&s(t,["createTime"],l);const u=r(e,["updateTime"]);u!=null&&s(t,["updateTime"],u);const d=r(e,["expireTime"]);d!=null&&s(t,["expireTime"],d);const c=r(e,["usageMetadata"]);return c!=null&&s(t,["usageMetadata"],c),t}function ys(){return{}}function vs(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["cachedContents"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(l=>tt(o,l))),s(t,["cachedContents"],a)}return t}function nt(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["displayName"]);i!=null&&s(t,["displayName"],i);const a=r(e,["model"]);a!=null&&s(t,["model"],a);const l=r(e,["createTime"]);l!=null&&s(t,["createTime"],l);const u=r(e,["updateTime"]);u!=null&&s(t,["updateTime"],u);const d=r(e,["expireTime"]);d!=null&&s(t,["expireTime"],d);const c=r(e,["usageMetadata"]);return c!=null&&s(t,["usageMetadata"],c),t}function Ts(){return{}}function Cs(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["cachedContents"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(l=>nt(o,l))),s(t,["cachedContents"],a)}return t}/**
139
+ * @license
140
+ * Copyright 2025 Google LLC
141
+ * SPDX-License-Identifier: Apache-2.0
142
+ */var Ie;(function(o){o.PAGED_ITEM_BATCH_JOBS="batchJobs",o.PAGED_ITEM_MODELS="models",o.PAGED_ITEM_TUNING_JOBS="tuningJobs",o.PAGED_ITEM_FILES="files",o.PAGED_ITEM_CACHED_CONTENTS="cachedContents"})(Ie||(Ie={}));class ot{constructor(e,t,n,i){this.pageInternal=[],this.paramsInternal={},this.requestInternal=t,this.init(e,n,i)}init(e,t,n){var i,a;this.nameInternal=e,this.pageInternal=t[this.nameInternal]||[],this.idxInternal=0;let l={config:{}};n?typeof n=="object"?l=Object.assign({},n):l=n:l={config:{}},l.config&&(l.config.pageToken=t.nextPageToken),this.paramsInternal=l,this.pageInternalSize=(a=(i=l.config)===null||i===void 0?void 0:i.pageSize)!==null&&a!==void 0?a:this.pageInternal.length}initNextPage(e){this.init(this.nameInternal,e,this.paramsInternal)}get page(){return this.pageInternal}get name(){return this.nameInternal}get pageSize(){return this.pageInternalSize}get params(){return this.paramsInternal}get pageLength(){return this.pageInternal.length}getItem(e){return this.pageInternal[e]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};const e=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:e,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");const e=await this.requestInternal(this.params);return this.initNextPage(e),this.page}hasNextPage(){var e;return((e=this.params.config)===null||e===void 0?void 0:e.pageToken)!==void 0}}/**
143
+ * @license
144
+ * Copyright 2025 Google LLC
145
+ * SPDX-License-Identifier: Apache-2.0
146
+ */class _s extends Se{constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new ot(Ie.PAGED_ITEM_CACHED_CONTENTS,n=>this.listInternal(n),await this.listInternal(t),t)}async create(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=cs(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>nt(this.apiClient,f))}else{const c=Ur(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>tt(this.apiClient,f))}}async get(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=ds(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>nt(this.apiClient,f))}else{const c=Gr(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>tt(this.apiClient,f))}}async delete(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=fs(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(()=>{const f=Ts(),p=new Zn;return Object.assign(p,f),p})}else{const c=Br(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(()=>{const f=ys(),p=new Zn;return Object.assign(p,f),p})}}async update(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=ms(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>nt(this.apiClient,f))}else{const c=$r(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>tt(this.apiClient,f))}}async listInternal(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=gs(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>{const p=Cs(this.apiClient,f),m=new Kn;return Object.assign(m,p),m})}else{const c=Hr(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>{const p=vs(this.apiClient,f),m=new Kn;return Object.assign(m,p),m})}}}function po(o){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&o[e],n=0;if(t)return t.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&n>=o.length&&(o=void 0),{value:o&&o[n++],done:!o}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function $(o){return this instanceof $?(this.v=o,this):new $(o)}function Re(o,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(o,e||[]),i,a=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",l),i[Symbol.asyncIterator]=function(){return this},i;function l(h){return function(g){return Promise.resolve(g).then(h,p)}}function u(h,g){n[h]&&(i[h]=function(v){return new Promise(function(x,M){a.push([h,v,x,M])>1||d(h,v)})},g&&(i[h]=g(i[h])))}function d(h,g){try{c(n[h](g))}catch(v){m(a[0][3],v)}}function c(h){h.value instanceof $?Promise.resolve(h.value.v).then(f,p):m(a[0][2],h)}function f(h){d("next",h)}function p(h){d("throw",h)}function m(h,g){h(g),a.shift(),a.length&&d(a[0][0],a[0][1])}}function qe(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=o[Symbol.asyncIterator],t;return e?e.call(o):(o=typeof po=="function"?po(o):o[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=o[a]&&function(l){return new Promise(function(u,d){l=o[a](l),i(u,d,l.done,l.value)})}}function i(a,l,u,d){Promise.resolve(d).then(function(c){a({value:c,done:u})},l)}}typeof SuppressedError=="function"&&SuppressedError;/**
147
+ * @license
148
+ * Copyright 2025 Google LLC
149
+ * SPDX-License-Identifier: Apache-2.0
150
+ */function xs(o){var e;if(o.candidates==null||o.candidates.length===0)return!1;const t=(e=o.candidates[0])===null||e===void 0?void 0:e.content;return t===void 0?!1:mo(t)}function mo(o){if(o.parts===void 0||o.parts.length===0)return!1;for(const e of o.parts)if(e===void 0||Object.keys(e).length===0||!e.thought&&e.text!==void 0&&e.text==="")return!1;return!0}function Es(o){if(o.length!==0){for(const e of o)if(e.role!=="user"&&e.role!=="model")throw new Error(`Role must be user or model, but got ${e.role}.`)}}function ho(o){if(o===void 0||o.length===0)return[];const e=[],t=o.length;let n=0;for(;n<t;)if(o[n].role==="user")e.push(o[n]),n++;else{const i=[];let a=!0;for(;n<t&&o[n].role==="model";)i.push(o[n]),a&&!mo(o[n])&&(a=!1),n++;a?e.push(...i):e.pop()}return e}class ws{constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new Ss(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}}class Ss{constructor(e,t,n,i={},a=[]){this.apiClient=e,this.modelsModule=t,this.model=n,this.config=i,this.history=a,this.sendPromise=Promise.resolve(),Es(a)}async sendMessage(e){var t;await this.sendPromise;const n=X(this.apiClient,e.message),i=this.modelsModule.generateContent({model:this.model,contents:this.getHistory(!0).concat(n),config:(t=e.config)!==null&&t!==void 0?t:this.config});return this.sendPromise=(async()=>{var a,l,u;const d=await i,c=(l=(a=d.candidates)===null||a===void 0?void 0:a[0])===null||l===void 0?void 0:l.content,f=d.automaticFunctionCallingHistory,p=this.getHistory(!0).length;let m=[];f!=null&&(m=(u=f.slice(p))!==null&&u!==void 0?u:[]);const h=c?[c]:[];this.recordHistory(n,h,m)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),i}async sendMessageStream(e){var t;await this.sendPromise;const n=X(this.apiClient,e.message),i=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(n),config:(t=e.config)!==null&&t!==void 0?t:this.config});this.sendPromise=i.then(()=>{}).catch(()=>{});const a=await i;return this.processStreamResponse(a,n)}getHistory(e=!1){const t=e?ho(this.history):this.history;return structuredClone(t)}processStreamResponse(e,t){var n,i;return Re(this,arguments,function*(){var l,u,d,c;const f=[];try{for(var p=!0,m=qe(e),h;h=yield $(m.next()),l=h.done,!l;p=!0){c=h.value,p=!1;const g=c;if(xs(g)){const v=(i=(n=g.candidates)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.content;v!==void 0&&f.push(v)}yield yield $(g)}}catch(g){u={error:g}}finally{try{!p&&!l&&(d=m.return)&&(yield $(d.call(m)))}finally{if(u)throw u.error}}this.recordHistory(t,f)})}recordHistory(e,t,n){let i=[];t.length>0&&t.every(a=>a.role!==void 0)?i=t:i.push({role:"model",parts:[]}),n&&n.length>0?this.history.push(...ho(n)):this.history.push(e),this.history.push(...i)}}/**
151
+ * @license
152
+ * Copyright 2025 Google LLC
153
+ * SPDX-License-Identifier: Apache-2.0
154
+ */function As(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const a=r(e,["pageToken"]);return t!==void 0&&a!=null&&s(t,["_query","pageToken"],a),n}function Ms(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],As(o,n,t)),t}function Is(o,e){const t={},n=r(e,["details"]);n!=null&&s(t,["details"],n);const i=r(e,["message"]);i!=null&&s(t,["message"],i);const a=r(e,["code"]);return a!=null&&s(t,["code"],a),t}function Rs(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["displayName"]);i!=null&&s(t,["displayName"],i);const a=r(e,["mimeType"]);a!=null&&s(t,["mimeType"],a);const l=r(e,["sizeBytes"]);l!=null&&s(t,["sizeBytes"],l);const u=r(e,["createTime"]);u!=null&&s(t,["createTime"],u);const d=r(e,["expirationTime"]);d!=null&&s(t,["expirationTime"],d);const c=r(e,["updateTime"]);c!=null&&s(t,["updateTime"],c);const f=r(e,["sha256Hash"]);f!=null&&s(t,["sha256Hash"],f);const p=r(e,["uri"]);p!=null&&s(t,["uri"],p);const m=r(e,["downloadUri"]);m!=null&&s(t,["downloadUri"],m);const h=r(e,["state"]);h!=null&&s(t,["state"],h);const g=r(e,["source"]);g!=null&&s(t,["source"],g);const v=r(e,["videoMetadata"]);v!=null&&s(t,["videoMetadata"],v);const x=r(e,["error"]);return x!=null&&s(t,["error"],Is(o,x)),t}function ks(o,e){const t={},n=r(e,["file"]);n!=null&&s(t,["file"],Rs(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Ns(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","file"],ao(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Ps(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","file"],ao(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Ds(o,e){const t={},n=r(e,["details"]);n!=null&&s(t,["details"],n);const i=r(e,["message"]);i!=null&&s(t,["message"],i);const a=r(e,["code"]);return a!=null&&s(t,["code"],a),t}function xt(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["displayName"]);i!=null&&s(t,["displayName"],i);const a=r(e,["mimeType"]);a!=null&&s(t,["mimeType"],a);const l=r(e,["sizeBytes"]);l!=null&&s(t,["sizeBytes"],l);const u=r(e,["createTime"]);u!=null&&s(t,["createTime"],u);const d=r(e,["expirationTime"]);d!=null&&s(t,["expirationTime"],d);const c=r(e,["updateTime"]);c!=null&&s(t,["updateTime"],c);const f=r(e,["sha256Hash"]);f!=null&&s(t,["sha256Hash"],f);const p=r(e,["uri"]);p!=null&&s(t,["uri"],p);const m=r(e,["downloadUri"]);m!=null&&s(t,["downloadUri"],m);const h=r(e,["state"]);h!=null&&s(t,["state"],h);const g=r(e,["source"]);g!=null&&s(t,["source"],g);const v=r(e,["videoMetadata"]);v!=null&&s(t,["videoMetadata"],v);const x=r(e,["error"]);return x!=null&&s(t,["error"],Ds(o,x)),t}function bs(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["files"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(l=>xt(o,l))),s(t,["files"],a)}return t}function Ls(){return{}}function Vs(){return{}}/**
155
+ * @license
156
+ * Copyright 2025 Google LLC
157
+ * SPDX-License-Identifier: Apache-2.0
158
+ */class Fs extends Se{constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new ot(Ie.PAGED_ITEM_FILES,n=>this.listInternal(n),await this.listInternal(t),t)}async upload(e){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files. You can share files through a GCS bucket.");return this.apiClient.uploadFile(e.file,e.config).then(t=>xt(this.apiClient,t))}async download(e){await this.apiClient.downloadFile(e)}async listInternal(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=Ms(this.apiClient,e);return a=I("files",u._url),l=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(d=>d.json()),i.then(d=>{const c=bs(this.apiClient,d),f=new nr;return Object.assign(f,c),f})}}async createInternal(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=ks(this.apiClient,e);return a=I("upload/v1beta/files",u._url),l=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(d=>d.json()),i.then(()=>{const d=Ls(),c=new or;return Object.assign(c,d),c})}}async get(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=Ns(this.apiClient,e);return a=I("files/{file}",u._url),l=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(d=>d.json()),i.then(d=>xt(this.apiClient,d))}}async delete(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=Ps(this.apiClient,e);return a=I("files/{file}",u._url),l=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(u),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(d=>d.json()),i.then(()=>{const d=Vs(),c=new ir;return Object.assign(c,d),c})}}}/**
159
+ * @license
160
+ * Copyright 2025 Google LLC
161
+ * SPDX-License-Identifier: Apache-2.0
162
+ */function Us(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function Gs(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function go(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Us(o,n)),t}function Bs(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Gs(o,n)),t}function qs(o,e){const t={},n=r(e,["speaker"]);n!=null&&s(t,["speaker"],n);const i=r(e,["voiceConfig"]);return i!=null&&s(t,["voiceConfig"],go(o,i)),t}function $s(o,e){const t={},n=r(e,["speakerVoiceConfigs"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>qs(o,a))),s(t,["speakerVoiceConfigs"],i)}return t}function Os(o,e){const t={},n=r(e,["voiceConfig"]);n!=null&&s(t,["voiceConfig"],go(o,n));const i=r(e,["multiSpeakerVoiceConfig"]);i!=null&&s(t,["multiSpeakerVoiceConfig"],$s(o,i));const a=r(e,["languageCode"]);return a!=null&&s(t,["languageCode"],a),t}function Hs(o,e){const t={},n=r(e,["voiceConfig"]);if(n!=null&&s(t,["voiceConfig"],Bs(o,n)),r(e,["multiSpeakerVoiceConfig"])!==void 0)throw new Error("multiSpeakerVoiceConfig parameter is not supported in Vertex AI.");const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function Js(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function zs(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function Ws(o,e){const t={};if(r(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=r(e,["data"]);n!=null&&s(t,["data"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function Ys(o,e){const t={},n=r(e,["displayName"]);n!=null&&s(t,["displayName"],n);const i=r(e,["data"]);i!=null&&s(t,["data"],i);const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Zs(o,e){const t={};if(r(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=r(e,["fileUri"]);n!=null&&s(t,["fileUri"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function Ks(o,e){const t={},n=r(e,["displayName"]);n!=null&&s(t,["displayName"],n);const i=r(e,["fileUri"]);i!=null&&s(t,["fileUri"],i);const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Xs(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Js(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],Ws(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],Zs(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function Qs(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],zs(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],Ys(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],Ks(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function js(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>Xs(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function ea(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>Qs(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function ta(o,e){const t={},n=r(e,["behavior"]);n!=null&&s(t,["behavior"],n);const i=r(e,["description"]);i!=null&&s(t,["description"],i);const a=r(e,["name"]);a!=null&&s(t,["name"],a);const l=r(e,["parameters"]);l!=null&&s(t,["parameters"],l);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function na(o,e){const t={};if(r(e,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const n=r(e,["description"]);n!=null&&s(t,["description"],n);const i=r(e,["name"]);i!=null&&s(t,["name"],i);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const l=r(e,["response"]);return l!=null&&s(t,["response"],l),t}function oa(o,e){const t={},n=r(e,["startTime"]);n!=null&&s(t,["startTime"],n);const i=r(e,["endTime"]);return i!=null&&s(t,["endTime"],i),t}function ia(o,e){const t={},n=r(e,["startTime"]);n!=null&&s(t,["startTime"],n);const i=r(e,["endTime"]);return i!=null&&s(t,["endTime"],i),t}function ra(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],oa(o,n)),t}function sa(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],ia(o,n)),t}function aa(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["dynamicThreshold"]);return i!=null&&s(t,["dynamicThreshold"],i),t}function la(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["dynamicThreshold"]);return i!=null&&s(t,["dynamicThreshold"],i),t}function ua(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],aa(o,n)),t}function ca(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],la(o,n)),t}function da(){return{}}function fa(o,e){const t={},n=r(e,["apiKeyString"]);return n!=null&&s(t,["apiKeyString"],n),t}function pa(o,e){const t={},n=r(e,["apiKeyConfig"]);n!=null&&s(t,["apiKeyConfig"],fa(o,n));const i=r(e,["authType"]);i!=null&&s(t,["authType"],i);const a=r(e,["googleServiceAccountConfig"]);a!=null&&s(t,["googleServiceAccountConfig"],a);const l=r(e,["httpBasicAuthConfig"]);l!=null&&s(t,["httpBasicAuthConfig"],l);const u=r(e,["oauthConfig"]);u!=null&&s(t,["oauthConfig"],u);const d=r(e,["oidcConfig"]);return d!=null&&s(t,["oidcConfig"],d),t}function ma(o,e){const t={},n=r(e,["authConfig"]);return n!=null&&s(t,["authConfig"],pa(o,n)),t}function ha(){return{}}function ga(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>ta(o,c))),s(t,["functionDeclarations"],d)}if(r(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const i=r(e,["googleSearch"]);i!=null&&s(t,["googleSearch"],ra(o,i));const a=r(e,["googleSearchRetrieval"]);if(a!=null&&s(t,["googleSearchRetrieval"],ua(o,a)),r(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");if(r(e,["googleMaps"])!==void 0)throw new Error("googleMaps parameter is not supported in Gemini API.");r(e,["urlContext"])!=null&&s(t,["urlContext"],ha());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function ya(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(p=>na(o,p))),s(t,["functionDeclarations"],f)}const i=r(e,["retrieval"]);i!=null&&s(t,["retrieval"],i);const a=r(e,["googleSearch"]);a!=null&&s(t,["googleSearch"],sa(o,a));const l=r(e,["googleSearchRetrieval"]);l!=null&&s(t,["googleSearchRetrieval"],ca(o,l)),r(e,["enterpriseWebSearch"])!=null&&s(t,["enterpriseWebSearch"],da());const d=r(e,["googleMaps"]);if(d!=null&&s(t,["googleMaps"],ma(o,d)),r(e,["urlContext"])!==void 0)throw new Error("urlContext parameter is not supported in Vertex AI.");const c=r(e,["codeExecution"]);return c!=null&&s(t,["codeExecution"],c),t}function va(o,e){const t={},n=r(e,["handle"]);if(n!=null&&s(t,["handle"],n),r(e,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function Ta(o,e){const t={},n=r(e,["handle"]);n!=null&&s(t,["handle"],n);const i=r(e,["transparent"]);return i!=null&&s(t,["transparent"],i),t}function yo(){return{}}function vo(){return{}}function Ca(o,e){const t={},n=r(e,["disabled"]);n!=null&&s(t,["disabled"],n);const i=r(e,["startOfSpeechSensitivity"]);i!=null&&s(t,["startOfSpeechSensitivity"],i);const a=r(e,["endOfSpeechSensitivity"]);a!=null&&s(t,["endOfSpeechSensitivity"],a);const l=r(e,["prefixPaddingMs"]);l!=null&&s(t,["prefixPaddingMs"],l);const u=r(e,["silenceDurationMs"]);return u!=null&&s(t,["silenceDurationMs"],u),t}function _a(o,e){const t={},n=r(e,["disabled"]);n!=null&&s(t,["disabled"],n);const i=r(e,["startOfSpeechSensitivity"]);i!=null&&s(t,["startOfSpeechSensitivity"],i);const a=r(e,["endOfSpeechSensitivity"]);a!=null&&s(t,["endOfSpeechSensitivity"],a);const l=r(e,["prefixPaddingMs"]);l!=null&&s(t,["prefixPaddingMs"],l);const u=r(e,["silenceDurationMs"]);return u!=null&&s(t,["silenceDurationMs"],u),t}function xa(o,e){const t={},n=r(e,["automaticActivityDetection"]);n!=null&&s(t,["automaticActivityDetection"],Ca(o,n));const i=r(e,["activityHandling"]);i!=null&&s(t,["activityHandling"],i);const a=r(e,["turnCoverage"]);return a!=null&&s(t,["turnCoverage"],a),t}function Ea(o,e){const t={},n=r(e,["automaticActivityDetection"]);n!=null&&s(t,["automaticActivityDetection"],_a(o,n));const i=r(e,["activityHandling"]);i!=null&&s(t,["activityHandling"],i);const a=r(e,["turnCoverage"]);return a!=null&&s(t,["turnCoverage"],a),t}function wa(o,e){const t={},n=r(e,["targetTokens"]);return n!=null&&s(t,["targetTokens"],n),t}function Sa(o,e){const t={},n=r(e,["targetTokens"]);return n!=null&&s(t,["targetTokens"],n),t}function Aa(o,e){const t={},n=r(e,["triggerTokens"]);n!=null&&s(t,["triggerTokens"],n);const i=r(e,["slidingWindow"]);return i!=null&&s(t,["slidingWindow"],wa(o,i)),t}function Ma(o,e){const t={},n=r(e,["triggerTokens"]);n!=null&&s(t,["triggerTokens"],n);const i=r(e,["slidingWindow"]);return i!=null&&s(t,["slidingWindow"],Sa(o,i)),t}function Ia(o,e){const t={},n=r(e,["proactiveAudio"]);return n!=null&&s(t,["proactiveAudio"],n),t}function Ra(o,e){const t={},n=r(e,["proactiveAudio"]);return n!=null&&s(t,["proactiveAudio"],n),t}function ka(o,e,t){const n={},i=r(e,["generationConfig"]);t!==void 0&&i!=null&&s(t,["setup","generationConfig"],i);const a=r(e,["responseModalities"]);t!==void 0&&a!=null&&s(t,["setup","generationConfig","responseModalities"],a);const l=r(e,["temperature"]);t!==void 0&&l!=null&&s(t,["setup","generationConfig","temperature"],l);const u=r(e,["topP"]);t!==void 0&&u!=null&&s(t,["setup","generationConfig","topP"],u);const d=r(e,["topK"]);t!==void 0&&d!=null&&s(t,["setup","generationConfig","topK"],d);const c=r(e,["maxOutputTokens"]);t!==void 0&&c!=null&&s(t,["setup","generationConfig","maxOutputTokens"],c);const f=r(e,["mediaResolution"]);t!==void 0&&f!=null&&s(t,["setup","generationConfig","mediaResolution"],f);const p=r(e,["seed"]);t!==void 0&&p!=null&&s(t,["setup","generationConfig","seed"],p);const m=r(e,["speechConfig"]);t!==void 0&&m!=null&&s(t,["setup","generationConfig","speechConfig"],Os(o,_t(o,m)));const h=r(e,["enableAffectiveDialog"]);t!==void 0&&h!=null&&s(t,["setup","generationConfig","enableAffectiveDialog"],h);const g=r(e,["systemInstruction"]);t!==void 0&&g!=null&&s(t,["setup","systemInstruction"],js(o,X(o,g)));const v=r(e,["tools"]);if(t!==void 0&&v!=null){let A=Be(o,v);Array.isArray(A)&&(A=A.map(P=>ga(o,Ge(o,P)))),s(t,["setup","tools"],A)}const x=r(e,["sessionResumption"]);t!==void 0&&x!=null&&s(t,["setup","sessionResumption"],va(o,x));const M=r(e,["inputAudioTranscription"]);t!==void 0&&M!=null&&s(t,["setup","inputAudioTranscription"],yo());const R=r(e,["outputAudioTranscription"]);t!==void 0&&R!=null&&s(t,["setup","outputAudioTranscription"],yo());const k=r(e,["realtimeInputConfig"]);t!==void 0&&k!=null&&s(t,["setup","realtimeInputConfig"],xa(o,k));const V=r(e,["contextWindowCompression"]);t!==void 0&&V!=null&&s(t,["setup","contextWindowCompression"],Aa(o,V));const E=r(e,["proactivity"]);return t!==void 0&&E!=null&&s(t,["setup","proactivity"],Ia(o,E)),n}function Na(o,e,t){const n={},i=r(e,["generationConfig"]);t!==void 0&&i!=null&&s(t,["setup","generationConfig"],i);const a=r(e,["responseModalities"]);t!==void 0&&a!=null&&s(t,["setup","generationConfig","responseModalities"],a);const l=r(e,["temperature"]);t!==void 0&&l!=null&&s(t,["setup","generationConfig","temperature"],l);const u=r(e,["topP"]);t!==void 0&&u!=null&&s(t,["setup","generationConfig","topP"],u);const d=r(e,["topK"]);t!==void 0&&d!=null&&s(t,["setup","generationConfig","topK"],d);const c=r(e,["maxOutputTokens"]);t!==void 0&&c!=null&&s(t,["setup","generationConfig","maxOutputTokens"],c);const f=r(e,["mediaResolution"]);t!==void 0&&f!=null&&s(t,["setup","generationConfig","mediaResolution"],f);const p=r(e,["seed"]);t!==void 0&&p!=null&&s(t,["setup","generationConfig","seed"],p);const m=r(e,["speechConfig"]);t!==void 0&&m!=null&&s(t,["setup","generationConfig","speechConfig"],Hs(o,_t(o,m)));const h=r(e,["enableAffectiveDialog"]);t!==void 0&&h!=null&&s(t,["setup","generationConfig","enableAffectiveDialog"],h);const g=r(e,["systemInstruction"]);t!==void 0&&g!=null&&s(t,["setup","systemInstruction"],ea(o,X(o,g)));const v=r(e,["tools"]);if(t!==void 0&&v!=null){let A=Be(o,v);Array.isArray(A)&&(A=A.map(P=>ya(o,Ge(o,P)))),s(t,["setup","tools"],A)}const x=r(e,["sessionResumption"]);t!==void 0&&x!=null&&s(t,["setup","sessionResumption"],Ta(o,x));const M=r(e,["inputAudioTranscription"]);t!==void 0&&M!=null&&s(t,["setup","inputAudioTranscription"],vo());const R=r(e,["outputAudioTranscription"]);t!==void 0&&R!=null&&s(t,["setup","outputAudioTranscription"],vo());const k=r(e,["realtimeInputConfig"]);t!==void 0&&k!=null&&s(t,["setup","realtimeInputConfig"],Ea(o,k));const V=r(e,["contextWindowCompression"]);t!==void 0&&V!=null&&s(t,["setup","contextWindowCompression"],Ma(o,V));const E=r(e,["proactivity"]);return t!==void 0&&E!=null&&s(t,["setup","proactivity"],Ra(o,E)),n}function Pa(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["setup","model"],q(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],ka(o,i,t)),t}function Da(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["setup","model"],q(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],Na(o,i,t)),t}function ba(){return{}}function La(){return{}}function Va(){return{}}function Fa(){return{}}function Ua(o,e){const t={},n=r(e,["media"]);n!=null&&s(t,["mediaChunks"],Qn(o,n));const i=r(e,["audio"]);i!=null&&s(t,["audio"],lr(o,i));const a=r(e,["audioStreamEnd"]);a!=null&&s(t,["audioStreamEnd"],a);const l=r(e,["video"]);l!=null&&s(t,["video"],ar(o,l));const u=r(e,["text"]);return u!=null&&s(t,["text"],u),r(e,["activityStart"])!=null&&s(t,["activityStart"],ba()),r(e,["activityEnd"])!=null&&s(t,["activityEnd"],Va()),t}function Ga(o,e){const t={},n=r(e,["media"]);if(n!=null&&s(t,["mediaChunks"],Qn(o,n)),r(e,["audio"])!==void 0)throw new Error("audio parameter is not supported in Vertex AI.");const i=r(e,["audioStreamEnd"]);if(i!=null&&s(t,["audioStreamEnd"],i),r(e,["video"])!==void 0)throw new Error("video parameter is not supported in Vertex AI.");if(r(e,["text"])!==void 0)throw new Error("text parameter is not supported in Vertex AI.");return r(e,["activityStart"])!=null&&s(t,["activityStart"],La()),r(e,["activityEnd"])!=null&&s(t,["activityEnd"],Fa()),t}function To(o,e){const t={},n=r(e,["text"]);n!=null&&s(t,["text"],n);const i=r(e,["weight"]);return i!=null&&s(t,["weight"],i),t}function Ba(o,e){const t={},n=r(e,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>To(o,a))),s(t,["weightedPrompts"],i)}return t}function Co(o,e){const t={},n=r(e,["temperature"]);n!=null&&s(t,["temperature"],n);const i=r(e,["topK"]);i!=null&&s(t,["topK"],i);const a=r(e,["seed"]);a!=null&&s(t,["seed"],a);const l=r(e,["guidance"]);l!=null&&s(t,["guidance"],l);const u=r(e,["bpm"]);u!=null&&s(t,["bpm"],u);const d=r(e,["density"]);d!=null&&s(t,["density"],d);const c=r(e,["brightness"]);c!=null&&s(t,["brightness"],c);const f=r(e,["scale"]);f!=null&&s(t,["scale"],f);const p=r(e,["muteBass"]);p!=null&&s(t,["muteBass"],p);const m=r(e,["muteDrums"]);m!=null&&s(t,["muteDrums"],m);const h=r(e,["onlyBassAndDrums"]);return h!=null&&s(t,["onlyBassAndDrums"],h),t}function qa(o,e){const t={},n=r(e,["musicGenerationConfig"]);return n!=null&&s(t,["musicGenerationConfig"],Co(o,n)),t}function _o(o,e){const t={},n=r(e,["model"]);return n!=null&&s(t,["model"],n),t}function xo(o,e){const t={},n=r(e,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>To(o,a))),s(t,["weightedPrompts"],i)}return t}function Et(o,e){const t={},n=r(e,["setup"]);n!=null&&s(t,["setup"],_o(o,n));const i=r(e,["clientContent"]);i!=null&&s(t,["clientContent"],xo(o,i));const a=r(e,["musicGenerationConfig"]);a!=null&&s(t,["musicGenerationConfig"],Co(o,a));const l=r(e,["playbackControl"]);return l!=null&&s(t,["playbackControl"],l),t}function $a(){return{}}function Oa(){return{}}function Ha(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function Ja(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function za(o,e){const t={},n=r(e,["data"]);n!=null&&s(t,["data"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function Wa(o,e){const t={},n=r(e,["displayName"]);n!=null&&s(t,["displayName"],n);const i=r(e,["data"]);i!=null&&s(t,["data"],i);const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Ya(o,e){const t={},n=r(e,["fileUri"]);n!=null&&s(t,["fileUri"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function Za(o,e){const t={},n=r(e,["displayName"]);n!=null&&s(t,["displayName"],n);const i=r(e,["fileUri"]);i!=null&&s(t,["fileUri"],i);const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Ka(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Ha(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],za(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],Ya(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function Xa(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Ja(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],Wa(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],Za(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function Qa(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>Ka(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function ja(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>Xa(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Eo(o,e){const t={},n=r(e,["text"]);n!=null&&s(t,["text"],n);const i=r(e,["finished"]);return i!=null&&s(t,["finished"],i),t}function wo(o,e){const t={},n=r(e,["text"]);n!=null&&s(t,["text"],n);const i=r(e,["finished"]);return i!=null&&s(t,["finished"],i),t}function el(o,e){const t={},n=r(e,["retrievedUrl"]);n!=null&&s(t,["retrievedUrl"],n);const i=r(e,["urlRetrievalStatus"]);return i!=null&&s(t,["urlRetrievalStatus"],i),t}function tl(o,e){const t={},n=r(e,["urlMetadata"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>el(o,a))),s(t,["urlMetadata"],i)}return t}function nl(o,e){const t={},n=r(e,["modelTurn"]);n!=null&&s(t,["modelTurn"],Qa(o,n));const i=r(e,["turnComplete"]);i!=null&&s(t,["turnComplete"],i);const a=r(e,["interrupted"]);a!=null&&s(t,["interrupted"],a);const l=r(e,["groundingMetadata"]);l!=null&&s(t,["groundingMetadata"],l);const u=r(e,["generationComplete"]);u!=null&&s(t,["generationComplete"],u);const d=r(e,["inputTranscription"]);d!=null&&s(t,["inputTranscription"],Eo(o,d));const c=r(e,["outputTranscription"]);c!=null&&s(t,["outputTranscription"],Eo(o,c));const f=r(e,["urlContextMetadata"]);return f!=null&&s(t,["urlContextMetadata"],tl(o,f)),t}function ol(o,e){const t={},n=r(e,["modelTurn"]);n!=null&&s(t,["modelTurn"],ja(o,n));const i=r(e,["turnComplete"]);i!=null&&s(t,["turnComplete"],i);const a=r(e,["interrupted"]);a!=null&&s(t,["interrupted"],a);const l=r(e,["groundingMetadata"]);l!=null&&s(t,["groundingMetadata"],l);const u=r(e,["generationComplete"]);u!=null&&s(t,["generationComplete"],u);const d=r(e,["inputTranscription"]);d!=null&&s(t,["inputTranscription"],wo(o,d));const c=r(e,["outputTranscription"]);return c!=null&&s(t,["outputTranscription"],wo(o,c)),t}function il(o,e){const t={},n=r(e,["id"]);n!=null&&s(t,["id"],n);const i=r(e,["args"]);i!=null&&s(t,["args"],i);const a=r(e,["name"]);return a!=null&&s(t,["name"],a),t}function rl(o,e){const t={},n=r(e,["args"]);n!=null&&s(t,["args"],n);const i=r(e,["name"]);return i!=null&&s(t,["name"],i),t}function sl(o,e){const t={},n=r(e,["functionCalls"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>il(o,a))),s(t,["functionCalls"],i)}return t}function al(o,e){const t={},n=r(e,["functionCalls"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>rl(o,a))),s(t,["functionCalls"],i)}return t}function ll(o,e){const t={},n=r(e,["ids"]);return n!=null&&s(t,["ids"],n),t}function ul(o,e){const t={},n=r(e,["ids"]);return n!=null&&s(t,["ids"],n),t}function it(o,e){const t={},n=r(e,["modality"]);n!=null&&s(t,["modality"],n);const i=r(e,["tokenCount"]);return i!=null&&s(t,["tokenCount"],i),t}function rt(o,e){const t={},n=r(e,["modality"]);n!=null&&s(t,["modality"],n);const i=r(e,["tokenCount"]);return i!=null&&s(t,["tokenCount"],i),t}function cl(o,e){const t={},n=r(e,["promptTokenCount"]);n!=null&&s(t,["promptTokenCount"],n);const i=r(e,["cachedContentTokenCount"]);i!=null&&s(t,["cachedContentTokenCount"],i);const a=r(e,["responseTokenCount"]);a!=null&&s(t,["responseTokenCount"],a);const l=r(e,["toolUsePromptTokenCount"]);l!=null&&s(t,["toolUsePromptTokenCount"],l);const u=r(e,["thoughtsTokenCount"]);u!=null&&s(t,["thoughtsTokenCount"],u);const d=r(e,["totalTokenCount"]);d!=null&&s(t,["totalTokenCount"],d);const c=r(e,["promptTokensDetails"]);if(c!=null){let h=c;Array.isArray(h)&&(h=h.map(g=>it(o,g))),s(t,["promptTokensDetails"],h)}const f=r(e,["cacheTokensDetails"]);if(f!=null){let h=f;Array.isArray(h)&&(h=h.map(g=>it(o,g))),s(t,["cacheTokensDetails"],h)}const p=r(e,["responseTokensDetails"]);if(p!=null){let h=p;Array.isArray(h)&&(h=h.map(g=>it(o,g))),s(t,["responseTokensDetails"],h)}const m=r(e,["toolUsePromptTokensDetails"]);if(m!=null){let h=m;Array.isArray(h)&&(h=h.map(g=>it(o,g))),s(t,["toolUsePromptTokensDetails"],h)}return t}function dl(o,e){const t={},n=r(e,["promptTokenCount"]);n!=null&&s(t,["promptTokenCount"],n);const i=r(e,["cachedContentTokenCount"]);i!=null&&s(t,["cachedContentTokenCount"],i);const a=r(e,["candidatesTokenCount"]);a!=null&&s(t,["responseTokenCount"],a);const l=r(e,["toolUsePromptTokenCount"]);l!=null&&s(t,["toolUsePromptTokenCount"],l);const u=r(e,["thoughtsTokenCount"]);u!=null&&s(t,["thoughtsTokenCount"],u);const d=r(e,["totalTokenCount"]);d!=null&&s(t,["totalTokenCount"],d);const c=r(e,["promptTokensDetails"]);if(c!=null){let g=c;Array.isArray(g)&&(g=g.map(v=>rt(o,v))),s(t,["promptTokensDetails"],g)}const f=r(e,["cacheTokensDetails"]);if(f!=null){let g=f;Array.isArray(g)&&(g=g.map(v=>rt(o,v))),s(t,["cacheTokensDetails"],g)}const p=r(e,["candidatesTokensDetails"]);if(p!=null){let g=p;Array.isArray(g)&&(g=g.map(v=>rt(o,v))),s(t,["responseTokensDetails"],g)}const m=r(e,["toolUsePromptTokensDetails"]);if(m!=null){let g=m;Array.isArray(g)&&(g=g.map(v=>rt(o,v))),s(t,["toolUsePromptTokensDetails"],g)}const h=r(e,["trafficType"]);return h!=null&&s(t,["trafficType"],h),t}function fl(o,e){const t={},n=r(e,["timeLeft"]);return n!=null&&s(t,["timeLeft"],n),t}function pl(o,e){const t={},n=r(e,["timeLeft"]);return n!=null&&s(t,["timeLeft"],n),t}function ml(o,e){const t={},n=r(e,["newHandle"]);n!=null&&s(t,["newHandle"],n);const i=r(e,["resumable"]);i!=null&&s(t,["resumable"],i);const a=r(e,["lastConsumedClientMessageIndex"]);return a!=null&&s(t,["lastConsumedClientMessageIndex"],a),t}function hl(o,e){const t={},n=r(e,["newHandle"]);n!=null&&s(t,["newHandle"],n);const i=r(e,["resumable"]);i!=null&&s(t,["resumable"],i);const a=r(e,["lastConsumedClientMessageIndex"]);return a!=null&&s(t,["lastConsumedClientMessageIndex"],a),t}function gl(o,e){const t={};r(e,["setupComplete"])!=null&&s(t,["setupComplete"],$a());const i=r(e,["serverContent"]);i!=null&&s(t,["serverContent"],nl(o,i));const a=r(e,["toolCall"]);a!=null&&s(t,["toolCall"],sl(o,a));const l=r(e,["toolCallCancellation"]);l!=null&&s(t,["toolCallCancellation"],ll(o,l));const u=r(e,["usageMetadata"]);u!=null&&s(t,["usageMetadata"],cl(o,u));const d=r(e,["goAway"]);d!=null&&s(t,["goAway"],fl(o,d));const c=r(e,["sessionResumptionUpdate"]);return c!=null&&s(t,["sessionResumptionUpdate"],ml(o,c)),t}function yl(o,e){const t={};r(e,["setupComplete"])!=null&&s(t,["setupComplete"],Oa());const i=r(e,["serverContent"]);i!=null&&s(t,["serverContent"],ol(o,i));const a=r(e,["toolCall"]);a!=null&&s(t,["toolCall"],al(o,a));const l=r(e,["toolCallCancellation"]);l!=null&&s(t,["toolCallCancellation"],ul(o,l));const u=r(e,["usageMetadata"]);u!=null&&s(t,["usageMetadata"],dl(o,u));const d=r(e,["goAway"]);d!=null&&s(t,["goAway"],pl(o,d));const c=r(e,["sessionResumptionUpdate"]);return c!=null&&s(t,["sessionResumptionUpdate"],hl(o,c)),t}function vl(){return{}}function Tl(o,e){const t={},n=r(e,["text"]);n!=null&&s(t,["text"],n);const i=r(e,["weight"]);return i!=null&&s(t,["weight"],i),t}function Cl(o,e){const t={},n=r(e,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>Tl(o,a))),s(t,["weightedPrompts"],i)}return t}function _l(o,e){const t={},n=r(e,["temperature"]);n!=null&&s(t,["temperature"],n);const i=r(e,["topK"]);i!=null&&s(t,["topK"],i);const a=r(e,["seed"]);a!=null&&s(t,["seed"],a);const l=r(e,["guidance"]);l!=null&&s(t,["guidance"],l);const u=r(e,["bpm"]);u!=null&&s(t,["bpm"],u);const d=r(e,["density"]);d!=null&&s(t,["density"],d);const c=r(e,["brightness"]);c!=null&&s(t,["brightness"],c);const f=r(e,["scale"]);f!=null&&s(t,["scale"],f);const p=r(e,["muteBass"]);p!=null&&s(t,["muteBass"],p);const m=r(e,["muteDrums"]);m!=null&&s(t,["muteDrums"],m);const h=r(e,["onlyBassAndDrums"]);return h!=null&&s(t,["onlyBassAndDrums"],h),t}function xl(o,e){const t={},n=r(e,["clientContent"]);n!=null&&s(t,["clientContent"],Cl(o,n));const i=r(e,["musicGenerationConfig"]);return i!=null&&s(t,["musicGenerationConfig"],_l(o,i)),t}function El(o,e){const t={},n=r(e,["data"]);n!=null&&s(t,["data"],n);const i=r(e,["mimeType"]);i!=null&&s(t,["mimeType"],i);const a=r(e,["sourceMetadata"]);return a!=null&&s(t,["sourceMetadata"],xl(o,a)),t}function wl(o,e){const t={},n=r(e,["audioChunks"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>El(o,a))),s(t,["audioChunks"],i)}return t}function Sl(o,e){const t={},n=r(e,["text"]);n!=null&&s(t,["text"],n);const i=r(e,["filteredReason"]);return i!=null&&s(t,["filteredReason"],i),t}function Al(o,e){const t={};r(e,["setupComplete"])!=null&&s(t,["setupComplete"],vl());const i=r(e,["serverContent"]);i!=null&&s(t,["serverContent"],wl(o,i));const a=r(e,["filteredPrompt"]);return a!=null&&s(t,["filteredPrompt"],Sl(o,a)),t}/**
163
+ * @license
164
+ * Copyright 2025 Google LLC
165
+ * SPDX-License-Identifier: Apache-2.0
166
+ */function Ml(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function Il(o,e){const t={};if(r(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=r(e,["data"]);n!=null&&s(t,["data"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function Rl(o,e){const t={};if(r(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=r(e,["fileUri"]);n!=null&&s(t,["fileUri"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function kl(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Ml(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],Il(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],Rl(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function st(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>kl(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Nl(o,e){const t={},n=r(e,["anyOf"]);n!=null&&s(t,["anyOf"],n);const i=r(e,["default"]);i!=null&&s(t,["default"],i);const a=r(e,["description"]);a!=null&&s(t,["description"],a);const l=r(e,["enum"]);l!=null&&s(t,["enum"],l);const u=r(e,["example"]);u!=null&&s(t,["example"],u);const d=r(e,["format"]);d!=null&&s(t,["format"],d);const c=r(e,["items"]);c!=null&&s(t,["items"],c);const f=r(e,["maxItems"]);f!=null&&s(t,["maxItems"],f);const p=r(e,["maxLength"]);p!=null&&s(t,["maxLength"],p);const m=r(e,["maxProperties"]);m!=null&&s(t,["maxProperties"],m);const h=r(e,["maximum"]);h!=null&&s(t,["maximum"],h);const g=r(e,["minItems"]);g!=null&&s(t,["minItems"],g);const v=r(e,["minLength"]);v!=null&&s(t,["minLength"],v);const x=r(e,["minProperties"]);x!=null&&s(t,["minProperties"],x);const M=r(e,["minimum"]);M!=null&&s(t,["minimum"],M);const R=r(e,["nullable"]);R!=null&&s(t,["nullable"],R);const k=r(e,["pattern"]);k!=null&&s(t,["pattern"],k);const V=r(e,["properties"]);V!=null&&s(t,["properties"],V);const E=r(e,["propertyOrdering"]);E!=null&&s(t,["propertyOrdering"],E);const A=r(e,["required"]);A!=null&&s(t,["required"],A);const P=r(e,["title"]);P!=null&&s(t,["title"],P);const O=r(e,["type"]);return O!=null&&s(t,["type"],O),t}function Pl(o,e){const t={};if(r(e,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const n=r(e,["category"]);n!=null&&s(t,["category"],n);const i=r(e,["threshold"]);return i!=null&&s(t,["threshold"],i),t}function Dl(o,e){const t={},n=r(e,["behavior"]);n!=null&&s(t,["behavior"],n);const i=r(e,["description"]);i!=null&&s(t,["description"],i);const a=r(e,["name"]);a!=null&&s(t,["name"],a);const l=r(e,["parameters"]);l!=null&&s(t,["parameters"],l);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function bl(o,e){const t={},n=r(e,["startTime"]);n!=null&&s(t,["startTime"],n);const i=r(e,["endTime"]);return i!=null&&s(t,["endTime"],i),t}function Ll(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],bl(o,n)),t}function Vl(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["dynamicThreshold"]);return i!=null&&s(t,["dynamicThreshold"],i),t}function Fl(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],Vl(o,n)),t}function Ul(){return{}}function Gl(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>Dl(o,c))),s(t,["functionDeclarations"],d)}if(r(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const i=r(e,["googleSearch"]);i!=null&&s(t,["googleSearch"],Ll(o,i));const a=r(e,["googleSearchRetrieval"]);if(a!=null&&s(t,["googleSearchRetrieval"],Fl(o,a)),r(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");if(r(e,["googleMaps"])!==void 0)throw new Error("googleMaps parameter is not supported in Gemini API.");r(e,["urlContext"])!=null&&s(t,["urlContext"],Ul());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function Bl(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["allowedFunctionNames"]);return i!=null&&s(t,["allowedFunctionNames"],i),t}function ql(o,e){const t={},n=r(e,["latitude"]);n!=null&&s(t,["latitude"],n);const i=r(e,["longitude"]);return i!=null&&s(t,["longitude"],i),t}function $l(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],ql(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function Ol(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],Bl(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],$l(o,i)),t}function Hl(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function So(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Hl(o,n)),t}function Jl(o,e){const t={},n=r(e,["speaker"]);n!=null&&s(t,["speaker"],n);const i=r(e,["voiceConfig"]);return i!=null&&s(t,["voiceConfig"],So(o,i)),t}function zl(o,e){const t={},n=r(e,["speakerVoiceConfigs"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>Jl(o,a))),s(t,["speakerVoiceConfigs"],i)}return t}function Wl(o,e){const t={},n=r(e,["voiceConfig"]);n!=null&&s(t,["voiceConfig"],So(o,n));const i=r(e,["multiSpeakerVoiceConfig"]);i!=null&&s(t,["multiSpeakerVoiceConfig"],zl(o,i));const a=r(e,["languageCode"]);return a!=null&&s(t,["languageCode"],a),t}function Yl(o,e){const t={},n=r(e,["includeThoughts"]);n!=null&&s(t,["includeThoughts"],n);const i=r(e,["thinkingBudget"]);return i!=null&&s(t,["thinkingBudget"],i),t}function Zl(o,e,t){const n={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&s(t,["systemInstruction"],st(o,X(o,i)));const a=r(e,["temperature"]);a!=null&&s(n,["temperature"],a);const l=r(e,["topP"]);l!=null&&s(n,["topP"],l);const u=r(e,["topK"]);u!=null&&s(n,["topK"],u);const d=r(e,["candidateCount"]);d!=null&&s(n,["candidateCount"],d);const c=r(e,["maxOutputTokens"]);c!=null&&s(n,["maxOutputTokens"],c);const f=r(e,["stopSequences"]);f!=null&&s(n,["stopSequences"],f);const p=r(e,["responseLogprobs"]);p!=null&&s(n,["responseLogprobs"],p);const m=r(e,["logprobs"]);m!=null&&s(n,["logprobs"],m);const h=r(e,["presencePenalty"]);h!=null&&s(n,["presencePenalty"],h);const g=r(e,["frequencyPenalty"]);g!=null&&s(n,["frequencyPenalty"],g);const v=r(e,["seed"]);v!=null&&s(n,["seed"],v);const x=r(e,["responseMimeType"]);x!=null&&s(n,["responseMimeType"],x);const M=r(e,["responseSchema"]);if(M!=null&&s(n,["responseSchema"],Nl(o,je(o,M))),r(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(r(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const R=r(e,["safetySettings"]);if(t!==void 0&&R!=null){let B=R;Array.isArray(B)&&(B=B.map(Q=>Pl(o,Q))),s(t,["safetySettings"],B)}const k=r(e,["tools"]);if(t!==void 0&&k!=null){let B=Be(o,k);Array.isArray(B)&&(B=B.map(Q=>Gl(o,Ge(o,Q)))),s(t,["tools"],B)}const V=r(e,["toolConfig"]);if(t!==void 0&&V!=null&&s(t,["toolConfig"],Ol(o,V)),r(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const E=r(e,["cachedContent"]);t!==void 0&&E!=null&&s(t,["cachedContent"],ce(o,E));const A=r(e,["responseModalities"]);A!=null&&s(n,["responseModalities"],A);const P=r(e,["mediaResolution"]);P!=null&&s(n,["mediaResolution"],P);const O=r(e,["speechConfig"]);if(O!=null&&s(n,["speechConfig"],Wl(o,ro(o,O))),r(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const b=r(e,["thinkingConfig"]);return b!=null&&s(n,["thinkingConfig"],Yl(o,b)),n}function Ao(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["contents"]);if(i!=null){let l=te(o,i);Array.isArray(l)&&(l=l.map(u=>st(o,u))),s(t,["contents"],l)}const a=r(e,["config"]);return a!=null&&s(t,["generationConfig"],Zl(o,a,t)),t}function Kl(o,e,t){const n={},i=r(e,["taskType"]);t!==void 0&&i!=null&&s(t,["requests[]","taskType"],i);const a=r(e,["title"]);t!==void 0&&a!=null&&s(t,["requests[]","title"],a);const l=r(e,["outputDimensionality"]);if(t!==void 0&&l!=null&&s(t,["requests[]","outputDimensionality"],l),r(e,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(r(e,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return n}function Xl(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["contents"]);i!=null&&s(t,["requests[]","content"],oo(o,i));const a=r(e,["config"]);a!=null&&s(t,["config"],Kl(o,a,t));const l=r(e,["model"]);return l!==void 0&&s(t,["requests[]","model"],q(o,l)),t}function Ql(o,e,t){const n={};if(r(e,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(r(e,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const i=r(e,["numberOfImages"]);t!==void 0&&i!=null&&s(t,["parameters","sampleCount"],i);const a=r(e,["aspectRatio"]);t!==void 0&&a!=null&&s(t,["parameters","aspectRatio"],a);const l=r(e,["guidanceScale"]);if(t!==void 0&&l!=null&&s(t,["parameters","guidanceScale"],l),r(e,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const u=r(e,["safetyFilterLevel"]);t!==void 0&&u!=null&&s(t,["parameters","safetySetting"],u);const d=r(e,["personGeneration"]);t!==void 0&&d!=null&&s(t,["parameters","personGeneration"],d);const c=r(e,["includeSafetyAttributes"]);t!==void 0&&c!=null&&s(t,["parameters","includeSafetyAttributes"],c);const f=r(e,["includeRaiReason"]);t!==void 0&&f!=null&&s(t,["parameters","includeRaiReason"],f);const p=r(e,["language"]);t!==void 0&&p!=null&&s(t,["parameters","language"],p);const m=r(e,["outputMimeType"]);t!==void 0&&m!=null&&s(t,["parameters","outputOptions","mimeType"],m);const h=r(e,["outputCompressionQuality"]);if(t!==void 0&&h!=null&&s(t,["parameters","outputOptions","compressionQuality"],h),r(e,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(r(e,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return n}function jl(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["prompt"]);i!=null&&s(t,["instances[0]","prompt"],i);const a=r(e,["config"]);return a!=null&&s(t,["config"],Ql(o,a,t)),t}function eu(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","name"],q(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function tu(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const a=r(e,["pageToken"]);t!==void 0&&a!=null&&s(t,["_query","pageToken"],a);const l=r(e,["filter"]);t!==void 0&&l!=null&&s(t,["_query","filter"],l);const u=r(e,["queryBase"]);return t!==void 0&&u!=null&&s(t,["_url","models_url"],lo(o,u)),n}function nu(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],tu(o,n,t)),t}function ou(o,e,t){const n={},i=r(e,["displayName"]);t!==void 0&&i!=null&&s(t,["displayName"],i);const a=r(e,["description"]);t!==void 0&&a!=null&&s(t,["description"],a);const l=r(e,["defaultCheckpointId"]);return t!==void 0&&l!=null&&s(t,["defaultCheckpointId"],l),n}function iu(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","name"],q(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],ou(o,i,t)),t}function ru(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","name"],q(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function su(o,e){const t={};if(r(e,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(r(e,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(r(e,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return t}function au(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["contents"]);if(i!=null){let l=te(o,i);Array.isArray(l)&&(l=l.map(u=>st(o,u))),s(t,["contents"],l)}const a=r(e,["config"]);return a!=null&&s(t,["config"],su(o,a)),t}function lu(o,e){const t={};if(r(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const n=r(e,["imageBytes"]);n!=null&&s(t,["bytesBase64Encoded"],de(o,n));const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function uu(o,e,t){const n={},i=r(e,["numberOfVideos"]);if(t!==void 0&&i!=null&&s(t,["parameters","sampleCount"],i),r(e,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(r(e,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const a=r(e,["durationSeconds"]);if(t!==void 0&&a!=null&&s(t,["parameters","durationSeconds"],a),r(e,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const l=r(e,["aspectRatio"]);if(t!==void 0&&l!=null&&s(t,["parameters","aspectRatio"],l),r(e,["resolution"])!==void 0)throw new Error("resolution parameter is not supported in Gemini API.");const u=r(e,["personGeneration"]);if(t!==void 0&&u!=null&&s(t,["parameters","personGeneration"],u),r(e,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const d=r(e,["negativePrompt"]);if(t!==void 0&&d!=null&&s(t,["parameters","negativePrompt"],d),r(e,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");if(r(e,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");return n}function cu(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["prompt"]);i!=null&&s(t,["instances[0]","prompt"],i);const a=r(e,["image"]);a!=null&&s(t,["instances[0]","image"],lu(o,a));const l=r(e,["config"]);return l!=null&&s(t,["config"],uu(o,l,t)),t}function du(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function fu(o,e){const t={},n=r(e,["displayName"]);n!=null&&s(t,["displayName"],n);const i=r(e,["data"]);i!=null&&s(t,["data"],i);const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function pu(o,e){const t={},n=r(e,["displayName"]);n!=null&&s(t,["displayName"],n);const i=r(e,["fileUri"]);i!=null&&s(t,["fileUri"],i);const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function mu(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],du(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],fu(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],pu(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function ke(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>mu(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function hu(o,e){const t={},n=r(e,["anyOf"]);n!=null&&s(t,["anyOf"],n);const i=r(e,["default"]);i!=null&&s(t,["default"],i);const a=r(e,["description"]);a!=null&&s(t,["description"],a);const l=r(e,["enum"]);l!=null&&s(t,["enum"],l);const u=r(e,["example"]);u!=null&&s(t,["example"],u);const d=r(e,["format"]);d!=null&&s(t,["format"],d);const c=r(e,["items"]);c!=null&&s(t,["items"],c);const f=r(e,["maxItems"]);f!=null&&s(t,["maxItems"],f);const p=r(e,["maxLength"]);p!=null&&s(t,["maxLength"],p);const m=r(e,["maxProperties"]);m!=null&&s(t,["maxProperties"],m);const h=r(e,["maximum"]);h!=null&&s(t,["maximum"],h);const g=r(e,["minItems"]);g!=null&&s(t,["minItems"],g);const v=r(e,["minLength"]);v!=null&&s(t,["minLength"],v);const x=r(e,["minProperties"]);x!=null&&s(t,["minProperties"],x);const M=r(e,["minimum"]);M!=null&&s(t,["minimum"],M);const R=r(e,["nullable"]);R!=null&&s(t,["nullable"],R);const k=r(e,["pattern"]);k!=null&&s(t,["pattern"],k);const V=r(e,["properties"]);V!=null&&s(t,["properties"],V);const E=r(e,["propertyOrdering"]);E!=null&&s(t,["propertyOrdering"],E);const A=r(e,["required"]);A!=null&&s(t,["required"],A);const P=r(e,["title"]);P!=null&&s(t,["title"],P);const O=r(e,["type"]);return O!=null&&s(t,["type"],O),t}function gu(o,e){const t={},n=r(e,["featureSelectionPreference"]);return n!=null&&s(t,["featureSelectionPreference"],n),t}function yu(o,e){const t={},n=r(e,["method"]);n!=null&&s(t,["method"],n);const i=r(e,["category"]);i!=null&&s(t,["category"],i);const a=r(e,["threshold"]);return a!=null&&s(t,["threshold"],a),t}function vu(o,e){const t={};if(r(e,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");const n=r(e,["description"]);n!=null&&s(t,["description"],n);const i=r(e,["name"]);i!=null&&s(t,["name"],i);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const l=r(e,["response"]);return l!=null&&s(t,["response"],l),t}function Tu(o,e){const t={},n=r(e,["startTime"]);n!=null&&s(t,["startTime"],n);const i=r(e,["endTime"]);return i!=null&&s(t,["endTime"],i),t}function Cu(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Tu(o,n)),t}function _u(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["dynamicThreshold"]);return i!=null&&s(t,["dynamicThreshold"],i),t}function xu(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],_u(o,n)),t}function Eu(){return{}}function wu(o,e){const t={},n=r(e,["apiKeyString"]);return n!=null&&s(t,["apiKeyString"],n),t}function Su(o,e){const t={},n=r(e,["apiKeyConfig"]);n!=null&&s(t,["apiKeyConfig"],wu(o,n));const i=r(e,["authType"]);i!=null&&s(t,["authType"],i);const a=r(e,["googleServiceAccountConfig"]);a!=null&&s(t,["googleServiceAccountConfig"],a);const l=r(e,["httpBasicAuthConfig"]);l!=null&&s(t,["httpBasicAuthConfig"],l);const u=r(e,["oauthConfig"]);u!=null&&s(t,["oauthConfig"],u);const d=r(e,["oidcConfig"]);return d!=null&&s(t,["oidcConfig"],d),t}function Au(o,e){const t={},n=r(e,["authConfig"]);return n!=null&&s(t,["authConfig"],Su(o,n)),t}function Mo(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(p=>vu(o,p))),s(t,["functionDeclarations"],f)}const i=r(e,["retrieval"]);i!=null&&s(t,["retrieval"],i);const a=r(e,["googleSearch"]);a!=null&&s(t,["googleSearch"],Cu(o,a));const l=r(e,["googleSearchRetrieval"]);l!=null&&s(t,["googleSearchRetrieval"],xu(o,l)),r(e,["enterpriseWebSearch"])!=null&&s(t,["enterpriseWebSearch"],Eu());const d=r(e,["googleMaps"]);if(d!=null&&s(t,["googleMaps"],Au(o,d)),r(e,["urlContext"])!==void 0)throw new Error("urlContext parameter is not supported in Vertex AI.");const c=r(e,["codeExecution"]);return c!=null&&s(t,["codeExecution"],c),t}function Mu(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["allowedFunctionNames"]);return i!=null&&s(t,["allowedFunctionNames"],i),t}function Iu(o,e){const t={},n=r(e,["latitude"]);n!=null&&s(t,["latitude"],n);const i=r(e,["longitude"]);return i!=null&&s(t,["longitude"],i),t}function Ru(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],Iu(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function ku(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],Mu(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],Ru(o,i)),t}function Nu(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function Pu(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Nu(o,n)),t}function Du(o,e){const t={},n=r(e,["voiceConfig"]);if(n!=null&&s(t,["voiceConfig"],Pu(o,n)),r(e,["multiSpeakerVoiceConfig"])!==void 0)throw new Error("multiSpeakerVoiceConfig parameter is not supported in Vertex AI.");const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function bu(o,e){const t={},n=r(e,["includeThoughts"]);n!=null&&s(t,["includeThoughts"],n);const i=r(e,["thinkingBudget"]);return i!=null&&s(t,["thinkingBudget"],i),t}function Lu(o,e,t){const n={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&s(t,["systemInstruction"],ke(o,X(o,i)));const a=r(e,["temperature"]);a!=null&&s(n,["temperature"],a);const l=r(e,["topP"]);l!=null&&s(n,["topP"],l);const u=r(e,["topK"]);u!=null&&s(n,["topK"],u);const d=r(e,["candidateCount"]);d!=null&&s(n,["candidateCount"],d);const c=r(e,["maxOutputTokens"]);c!=null&&s(n,["maxOutputTokens"],c);const f=r(e,["stopSequences"]);f!=null&&s(n,["stopSequences"],f);const p=r(e,["responseLogprobs"]);p!=null&&s(n,["responseLogprobs"],p);const m=r(e,["logprobs"]);m!=null&&s(n,["logprobs"],m);const h=r(e,["presencePenalty"]);h!=null&&s(n,["presencePenalty"],h);const g=r(e,["frequencyPenalty"]);g!=null&&s(n,["frequencyPenalty"],g);const v=r(e,["seed"]);v!=null&&s(n,["seed"],v);const x=r(e,["responseMimeType"]);x!=null&&s(n,["responseMimeType"],x);const M=r(e,["responseSchema"]);M!=null&&s(n,["responseSchema"],hu(o,je(o,M)));const R=r(e,["routingConfig"]);R!=null&&s(n,["routingConfig"],R);const k=r(e,["modelSelectionConfig"]);k!=null&&s(n,["modelConfig"],gu(o,k));const V=r(e,["safetySettings"]);if(t!==void 0&&V!=null){let ne=V;Array.isArray(ne)&&(ne=ne.map(ye=>yu(o,ye))),s(t,["safetySettings"],ne)}const E=r(e,["tools"]);if(t!==void 0&&E!=null){let ne=Be(o,E);Array.isArray(ne)&&(ne=ne.map(ye=>Mo(o,Ge(o,ye)))),s(t,["tools"],ne)}const A=r(e,["toolConfig"]);t!==void 0&&A!=null&&s(t,["toolConfig"],ku(o,A));const P=r(e,["labels"]);t!==void 0&&P!=null&&s(t,["labels"],P);const O=r(e,["cachedContent"]);t!==void 0&&O!=null&&s(t,["cachedContent"],ce(o,O));const b=r(e,["responseModalities"]);b!=null&&s(n,["responseModalities"],b);const B=r(e,["mediaResolution"]);B!=null&&s(n,["mediaResolution"],B);const Q=r(e,["speechConfig"]);Q!=null&&s(n,["speechConfig"],Du(o,ro(o,Q)));const Ne=r(e,["audioTimestamp"]);Ne!=null&&s(n,["audioTimestamp"],Ne);const $e=r(e,["thinkingConfig"]);return $e!=null&&s(n,["thinkingConfig"],bu(o,$e)),n}function Io(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["contents"]);if(i!=null){let l=te(o,i);Array.isArray(l)&&(l=l.map(u=>ke(o,u))),s(t,["contents"],l)}const a=r(e,["config"]);return a!=null&&s(t,["generationConfig"],Lu(o,a,t)),t}function Vu(o,e,t){const n={},i=r(e,["taskType"]);t!==void 0&&i!=null&&s(t,["instances[]","task_type"],i);const a=r(e,["title"]);t!==void 0&&a!=null&&s(t,["instances[]","title"],a);const l=r(e,["outputDimensionality"]);t!==void 0&&l!=null&&s(t,["parameters","outputDimensionality"],l);const u=r(e,["mimeType"]);t!==void 0&&u!=null&&s(t,["instances[]","mimeType"],u);const d=r(e,["autoTruncate"]);return t!==void 0&&d!=null&&s(t,["parameters","autoTruncate"],d),n}function Fu(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["contents"]);i!=null&&s(t,["instances[]","content"],oo(o,i));const a=r(e,["config"]);return a!=null&&s(t,["config"],Vu(o,a,t)),t}function Uu(o,e,t){const n={},i=r(e,["outputGcsUri"]);t!==void 0&&i!=null&&s(t,["parameters","storageUri"],i);const a=r(e,["negativePrompt"]);t!==void 0&&a!=null&&s(t,["parameters","negativePrompt"],a);const l=r(e,["numberOfImages"]);t!==void 0&&l!=null&&s(t,["parameters","sampleCount"],l);const u=r(e,["aspectRatio"]);t!==void 0&&u!=null&&s(t,["parameters","aspectRatio"],u);const d=r(e,["guidanceScale"]);t!==void 0&&d!=null&&s(t,["parameters","guidanceScale"],d);const c=r(e,["seed"]);t!==void 0&&c!=null&&s(t,["parameters","seed"],c);const f=r(e,["safetyFilterLevel"]);t!==void 0&&f!=null&&s(t,["parameters","safetySetting"],f);const p=r(e,["personGeneration"]);t!==void 0&&p!=null&&s(t,["parameters","personGeneration"],p);const m=r(e,["includeSafetyAttributes"]);t!==void 0&&m!=null&&s(t,["parameters","includeSafetyAttributes"],m);const h=r(e,["includeRaiReason"]);t!==void 0&&h!=null&&s(t,["parameters","includeRaiReason"],h);const g=r(e,["language"]);t!==void 0&&g!=null&&s(t,["parameters","language"],g);const v=r(e,["outputMimeType"]);t!==void 0&&v!=null&&s(t,["parameters","outputOptions","mimeType"],v);const x=r(e,["outputCompressionQuality"]);t!==void 0&&x!=null&&s(t,["parameters","outputOptions","compressionQuality"],x);const M=r(e,["addWatermark"]);t!==void 0&&M!=null&&s(t,["parameters","addWatermark"],M);const R=r(e,["enhancePrompt"]);return t!==void 0&&R!=null&&s(t,["parameters","enhancePrompt"],R),n}function Gu(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["prompt"]);i!=null&&s(t,["instances[0]","prompt"],i);const a=r(e,["config"]);return a!=null&&s(t,["config"],Uu(o,a,t)),t}function wt(o,e){const t={},n=r(e,["gcsUri"]);n!=null&&s(t,["gcsUri"],n);const i=r(e,["imageBytes"]);i!=null&&s(t,["bytesBase64Encoded"],de(o,i));const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Bu(o,e){const t={},n=r(e,["maskMode"]);n!=null&&s(t,["maskMode"],n);const i=r(e,["segmentationClasses"]);i!=null&&s(t,["maskClasses"],i);const a=r(e,["maskDilation"]);return a!=null&&s(t,["dilation"],a),t}function qu(o,e){const t={},n=r(e,["controlType"]);n!=null&&s(t,["controlType"],n);const i=r(e,["enableControlImageComputation"]);return i!=null&&s(t,["computeControl"],i),t}function $u(o,e){const t={},n=r(e,["styleDescription"]);return n!=null&&s(t,["styleDescription"],n),t}function Ou(o,e){const t={},n=r(e,["subjectType"]);n!=null&&s(t,["subjectType"],n);const i=r(e,["subjectDescription"]);return i!=null&&s(t,["subjectDescription"],i),t}function Hu(o,e){const t={},n=r(e,["referenceImage"]);n!=null&&s(t,["referenceImage"],wt(o,n));const i=r(e,["referenceId"]);i!=null&&s(t,["referenceId"],i);const a=r(e,["referenceType"]);a!=null&&s(t,["referenceType"],a);const l=r(e,["maskImageConfig"]);l!=null&&s(t,["maskImageConfig"],Bu(o,l));const u=r(e,["controlImageConfig"]);u!=null&&s(t,["controlImageConfig"],qu(o,u));const d=r(e,["styleImageConfig"]);d!=null&&s(t,["styleImageConfig"],$u(o,d));const c=r(e,["subjectImageConfig"]);return c!=null&&s(t,["subjectImageConfig"],Ou(o,c)),t}function Ju(o,e,t){const n={},i=r(e,["outputGcsUri"]);t!==void 0&&i!=null&&s(t,["parameters","storageUri"],i);const a=r(e,["negativePrompt"]);t!==void 0&&a!=null&&s(t,["parameters","negativePrompt"],a);const l=r(e,["numberOfImages"]);t!==void 0&&l!=null&&s(t,["parameters","sampleCount"],l);const u=r(e,["aspectRatio"]);t!==void 0&&u!=null&&s(t,["parameters","aspectRatio"],u);const d=r(e,["guidanceScale"]);t!==void 0&&d!=null&&s(t,["parameters","guidanceScale"],d);const c=r(e,["seed"]);t!==void 0&&c!=null&&s(t,["parameters","seed"],c);const f=r(e,["safetyFilterLevel"]);t!==void 0&&f!=null&&s(t,["parameters","safetySetting"],f);const p=r(e,["personGeneration"]);t!==void 0&&p!=null&&s(t,["parameters","personGeneration"],p);const m=r(e,["includeSafetyAttributes"]);t!==void 0&&m!=null&&s(t,["parameters","includeSafetyAttributes"],m);const h=r(e,["includeRaiReason"]);t!==void 0&&h!=null&&s(t,["parameters","includeRaiReason"],h);const g=r(e,["language"]);t!==void 0&&g!=null&&s(t,["parameters","language"],g);const v=r(e,["outputMimeType"]);t!==void 0&&v!=null&&s(t,["parameters","outputOptions","mimeType"],v);const x=r(e,["outputCompressionQuality"]);t!==void 0&&x!=null&&s(t,["parameters","outputOptions","compressionQuality"],x);const M=r(e,["editMode"]);t!==void 0&&M!=null&&s(t,["parameters","editMode"],M);const R=r(e,["baseSteps"]);return t!==void 0&&R!=null&&s(t,["parameters","editConfig","baseSteps"],R),n}function zu(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["prompt"]);i!=null&&s(t,["instances[0]","prompt"],i);const a=r(e,["referenceImages"]);if(a!=null){let u=a;Array.isArray(u)&&(u=u.map(d=>Hu(o,d))),s(t,["instances[0]","referenceImages"],u)}const l=r(e,["config"]);return l!=null&&s(t,["config"],Ju(o,l,t)),t}function Wu(o,e,t){const n={},i=r(e,["includeRaiReason"]);t!==void 0&&i!=null&&s(t,["parameters","includeRaiReason"],i);const a=r(e,["outputMimeType"]);t!==void 0&&a!=null&&s(t,["parameters","outputOptions","mimeType"],a);const l=r(e,["outputCompressionQuality"]);t!==void 0&&l!=null&&s(t,["parameters","outputOptions","compressionQuality"],l);const u=r(e,["numberOfImages"]);t!==void 0&&u!=null&&s(t,["parameters","sampleCount"],u);const d=r(e,["mode"]);return t!==void 0&&d!=null&&s(t,["parameters","mode"],d),n}function Yu(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["image"]);i!=null&&s(t,["instances[0]","image"],wt(o,i));const a=r(e,["upscaleFactor"]);a!=null&&s(t,["parameters","upscaleConfig","upscaleFactor"],a);const l=r(e,["config"]);return l!=null&&s(t,["config"],Wu(o,l,t)),t}function Zu(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","name"],q(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Ku(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const a=r(e,["pageToken"]);t!==void 0&&a!=null&&s(t,["_query","pageToken"],a);const l=r(e,["filter"]);t!==void 0&&l!=null&&s(t,["_query","filter"],l);const u=r(e,["queryBase"]);return t!==void 0&&u!=null&&s(t,["_url","models_url"],lo(o,u)),n}function Xu(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],Ku(o,n,t)),t}function Qu(o,e,t){const n={},i=r(e,["displayName"]);t!==void 0&&i!=null&&s(t,["displayName"],i);const a=r(e,["description"]);t!==void 0&&a!=null&&s(t,["description"],a);const l=r(e,["defaultCheckpointId"]);return t!==void 0&&l!=null&&s(t,["defaultCheckpointId"],l),n}function ju(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],Qu(o,i,t)),t}function ec(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","name"],q(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function tc(o,e,t){const n={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&s(t,["systemInstruction"],ke(o,X(o,i)));const a=r(e,["tools"]);if(t!==void 0&&a!=null){let u=a;Array.isArray(u)&&(u=u.map(d=>Mo(o,d))),s(t,["tools"],u)}const l=r(e,["generationConfig"]);return t!==void 0&&l!=null&&s(t,["generationConfig"],l),n}function nc(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["contents"]);if(i!=null){let l=te(o,i);Array.isArray(l)&&(l=l.map(u=>ke(o,u))),s(t,["contents"],l)}const a=r(e,["config"]);return a!=null&&s(t,["config"],tc(o,a,t)),t}function oc(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["contents"]);if(i!=null){let l=te(o,i);Array.isArray(l)&&(l=l.map(u=>ke(o,u))),s(t,["contents"],l)}const a=r(e,["config"]);return a!=null&&s(t,["config"],a),t}function ic(o,e,t){const n={},i=r(e,["numberOfVideos"]);t!==void 0&&i!=null&&s(t,["parameters","sampleCount"],i);const a=r(e,["outputGcsUri"]);t!==void 0&&a!=null&&s(t,["parameters","storageUri"],a);const l=r(e,["fps"]);t!==void 0&&l!=null&&s(t,["parameters","fps"],l);const u=r(e,["durationSeconds"]);t!==void 0&&u!=null&&s(t,["parameters","durationSeconds"],u);const d=r(e,["seed"]);t!==void 0&&d!=null&&s(t,["parameters","seed"],d);const c=r(e,["aspectRatio"]);t!==void 0&&c!=null&&s(t,["parameters","aspectRatio"],c);const f=r(e,["resolution"]);t!==void 0&&f!=null&&s(t,["parameters","resolution"],f);const p=r(e,["personGeneration"]);t!==void 0&&p!=null&&s(t,["parameters","personGeneration"],p);const m=r(e,["pubsubTopic"]);t!==void 0&&m!=null&&s(t,["parameters","pubsubTopic"],m);const h=r(e,["negativePrompt"]);t!==void 0&&h!=null&&s(t,["parameters","negativePrompt"],h);const g=r(e,["enhancePrompt"]);t!==void 0&&g!=null&&s(t,["parameters","enhancePrompt"],g);const v=r(e,["generateAudio"]);return t!==void 0&&v!=null&&s(t,["parameters","generateAudio"],v),n}function rc(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["_url","model"],q(o,n));const i=r(e,["prompt"]);i!=null&&s(t,["instances[0]","prompt"],i);const a=r(e,["image"]);a!=null&&s(t,["instances[0]","image"],wt(o,a));const l=r(e,["config"]);return l!=null&&s(t,["config"],ic(o,l,t)),t}function sc(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function ac(o,e){const t={},n=r(e,["data"]);n!=null&&s(t,["data"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function lc(o,e){const t={},n=r(e,["fileUri"]);n!=null&&s(t,["fileUri"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function uc(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],sc(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],ac(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],lc(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function cc(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>uc(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function dc(o,e){const t={},n=r(e,["citationSources"]);return n!=null&&s(t,["citations"],n),t}function fc(o,e){const t={},n=r(e,["retrievedUrl"]);n!=null&&s(t,["retrievedUrl"],n);const i=r(e,["urlRetrievalStatus"]);return i!=null&&s(t,["urlRetrievalStatus"],i),t}function pc(o,e){const t={},n=r(e,["urlMetadata"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>fc(o,a))),s(t,["urlMetadata"],i)}return t}function mc(o,e){const t={},n=r(e,["content"]);n!=null&&s(t,["content"],cc(o,n));const i=r(e,["citationMetadata"]);i!=null&&s(t,["citationMetadata"],dc(o,i));const a=r(e,["tokenCount"]);a!=null&&s(t,["tokenCount"],a);const l=r(e,["finishReason"]);l!=null&&s(t,["finishReason"],l);const u=r(e,["urlContextMetadata"]);u!=null&&s(t,["urlContextMetadata"],pc(o,u));const d=r(e,["avgLogprobs"]);d!=null&&s(t,["avgLogprobs"],d);const c=r(e,["groundingMetadata"]);c!=null&&s(t,["groundingMetadata"],c);const f=r(e,["index"]);f!=null&&s(t,["index"],f);const p=r(e,["logprobsResult"]);p!=null&&s(t,["logprobsResult"],p);const m=r(e,["safetyRatings"]);return m!=null&&s(t,["safetyRatings"],m),t}function Ro(o,e){const t={},n=r(e,["candidates"]);if(n!=null){let u=n;Array.isArray(u)&&(u=u.map(d=>mc(o,d))),s(t,["candidates"],u)}const i=r(e,["modelVersion"]);i!=null&&s(t,["modelVersion"],i);const a=r(e,["promptFeedback"]);a!=null&&s(t,["promptFeedback"],a);const l=r(e,["usageMetadata"]);return l!=null&&s(t,["usageMetadata"],l),t}function hc(o,e){const t={},n=r(e,["values"]);return n!=null&&s(t,["values"],n),t}function gc(){return{}}function yc(o,e){const t={},n=r(e,["embeddings"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>hc(o,l))),s(t,["embeddings"],a)}return r(e,["metadata"])!=null&&s(t,["metadata"],gc()),t}function vc(o,e){const t={},n=r(e,["bytesBase64Encoded"]);n!=null&&s(t,["imageBytes"],de(o,n));const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function ko(o,e){const t={},n=r(e,["safetyAttributes","categories"]);n!=null&&s(t,["categories"],n);const i=r(e,["safetyAttributes","scores"]);i!=null&&s(t,["scores"],i);const a=r(e,["contentType"]);return a!=null&&s(t,["contentType"],a),t}function Tc(o,e){const t={},n=r(e,["_self"]);n!=null&&s(t,["image"],vc(o,n));const i=r(e,["raiFilteredReason"]);i!=null&&s(t,["raiFilteredReason"],i);const a=r(e,["_self"]);return a!=null&&s(t,["safetyAttributes"],ko(o,a)),t}function Cc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>Tc(o,l))),s(t,["generatedImages"],a)}const i=r(e,["positivePromptSafetyAttributes"]);return i!=null&&s(t,["positivePromptSafetyAttributes"],ko(o,i)),t}function _c(o,e){const t={},n=r(e,["baseModel"]);n!=null&&s(t,["baseModel"],n);const i=r(e,["createTime"]);i!=null&&s(t,["createTime"],i);const a=r(e,["updateTime"]);return a!=null&&s(t,["updateTime"],a),t}function St(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["displayName"]);i!=null&&s(t,["displayName"],i);const a=r(e,["description"]);a!=null&&s(t,["description"],a);const l=r(e,["version"]);l!=null&&s(t,["version"],l);const u=r(e,["_self"]);u!=null&&s(t,["tunedModelInfo"],_c(o,u));const d=r(e,["inputTokenLimit"]);d!=null&&s(t,["inputTokenLimit"],d);const c=r(e,["outputTokenLimit"]);c!=null&&s(t,["outputTokenLimit"],c);const f=r(e,["supportedGenerationMethods"]);return f!=null&&s(t,["supportedActions"],f),t}function xc(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["_self"]);if(i!=null){let a=uo(o,i);Array.isArray(a)&&(a=a.map(l=>St(o,l))),s(t,["models"],a)}return t}function Ec(){return{}}function wc(o,e){const t={},n=r(e,["totalTokens"]);n!=null&&s(t,["totalTokens"],n);const i=r(e,["cachedContentTokenCount"]);return i!=null&&s(t,["cachedContentTokenCount"],i),t}function Sc(o,e){const t={},n=r(e,["video","uri"]);n!=null&&s(t,["uri"],n);const i=r(e,["video","encodedVideo"]);i!=null&&s(t,["videoBytes"],de(o,i));const a=r(e,["encoding"]);return a!=null&&s(t,["mimeType"],a),t}function Ac(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Sc(o,n)),t}function Mc(o,e){const t={},n=r(e,["generatedSamples"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(u=>Ac(o,u))),s(t,["generatedVideos"],l)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const a=r(e,["raiMediaFilteredReasons"]);return a!=null&&s(t,["raiMediaFilteredReasons"],a),t}function Ic(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["metadata"]);i!=null&&s(t,["metadata"],i);const a=r(e,["done"]);a!=null&&s(t,["done"],a);const l=r(e,["error"]);l!=null&&s(t,["error"],l);const u=r(e,["response","generateVideoResponse"]);return u!=null&&s(t,["response"],Mc(o,u)),t}function Rc(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function kc(o,e){const t={},n=r(e,["displayName"]);n!=null&&s(t,["displayName"],n);const i=r(e,["data"]);i!=null&&s(t,["data"],i);const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Nc(o,e){const t={},n=r(e,["displayName"]);n!=null&&s(t,["displayName"],n);const i=r(e,["fileUri"]);i!=null&&s(t,["fileUri"],i);const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Pc(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Rc(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],kc(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],Nc(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function Dc(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>Pc(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function bc(o,e){const t={},n=r(e,["citations"]);return n!=null&&s(t,["citations"],n),t}function Lc(o,e){const t={},n=r(e,["content"]);n!=null&&s(t,["content"],Dc(o,n));const i=r(e,["citationMetadata"]);i!=null&&s(t,["citationMetadata"],bc(o,i));const a=r(e,["finishMessage"]);a!=null&&s(t,["finishMessage"],a);const l=r(e,["finishReason"]);l!=null&&s(t,["finishReason"],l);const u=r(e,["avgLogprobs"]);u!=null&&s(t,["avgLogprobs"],u);const d=r(e,["groundingMetadata"]);d!=null&&s(t,["groundingMetadata"],d);const c=r(e,["index"]);c!=null&&s(t,["index"],c);const f=r(e,["logprobsResult"]);f!=null&&s(t,["logprobsResult"],f);const p=r(e,["safetyRatings"]);return p!=null&&s(t,["safetyRatings"],p),t}function No(o,e){const t={},n=r(e,["candidates"]);if(n!=null){let c=n;Array.isArray(c)&&(c=c.map(f=>Lc(o,f))),s(t,["candidates"],c)}const i=r(e,["createTime"]);i!=null&&s(t,["createTime"],i);const a=r(e,["responseId"]);a!=null&&s(t,["responseId"],a);const l=r(e,["modelVersion"]);l!=null&&s(t,["modelVersion"],l);const u=r(e,["promptFeedback"]);u!=null&&s(t,["promptFeedback"],u);const d=r(e,["usageMetadata"]);return d!=null&&s(t,["usageMetadata"],d),t}function Vc(o,e){const t={},n=r(e,["truncated"]);n!=null&&s(t,["truncated"],n);const i=r(e,["token_count"]);return i!=null&&s(t,["tokenCount"],i),t}function Fc(o,e){const t={},n=r(e,["values"]);n!=null&&s(t,["values"],n);const i=r(e,["statistics"]);return i!=null&&s(t,["statistics"],Vc(o,i)),t}function Uc(o,e){const t={},n=r(e,["billableCharacterCount"]);return n!=null&&s(t,["billableCharacterCount"],n),t}function Gc(o,e){const t={},n=r(e,["predictions[]","embeddings"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>Fc(o,l))),s(t,["embeddings"],a)}const i=r(e,["metadata"]);return i!=null&&s(t,["metadata"],Uc(o,i)),t}function Bc(o,e){const t={},n=r(e,["gcsUri"]);n!=null&&s(t,["gcsUri"],n);const i=r(e,["bytesBase64Encoded"]);i!=null&&s(t,["imageBytes"],de(o,i));const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Po(o,e){const t={},n=r(e,["safetyAttributes","categories"]);n!=null&&s(t,["categories"],n);const i=r(e,["safetyAttributes","scores"]);i!=null&&s(t,["scores"],i);const a=r(e,["contentType"]);return a!=null&&s(t,["contentType"],a),t}function At(o,e){const t={},n=r(e,["_self"]);n!=null&&s(t,["image"],Bc(o,n));const i=r(e,["raiFilteredReason"]);i!=null&&s(t,["raiFilteredReason"],i);const a=r(e,["_self"]);a!=null&&s(t,["safetyAttributes"],Po(o,a));const l=r(e,["prompt"]);return l!=null&&s(t,["enhancedPrompt"],l),t}function qc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>At(o,l))),s(t,["generatedImages"],a)}const i=r(e,["positivePromptSafetyAttributes"]);return i!=null&&s(t,["positivePromptSafetyAttributes"],Po(o,i)),t}function $c(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>At(o,a))),s(t,["generatedImages"],i)}return t}function Oc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>At(o,a))),s(t,["generatedImages"],i)}return t}function Hc(o,e){const t={},n=r(e,["endpoint"]);n!=null&&s(t,["name"],n);const i=r(e,["deployedModelId"]);return i!=null&&s(t,["deployedModelId"],i),t}function Jc(o,e){const t={},n=r(e,["labels","google-vertex-llm-tuning-base-model-id"]);n!=null&&s(t,["baseModel"],n);const i=r(e,["createTime"]);i!=null&&s(t,["createTime"],i);const a=r(e,["updateTime"]);return a!=null&&s(t,["updateTime"],a),t}function zc(o,e){const t={},n=r(e,["checkpointId"]);n!=null&&s(t,["checkpointId"],n);const i=r(e,["epoch"]);i!=null&&s(t,["epoch"],i);const a=r(e,["step"]);return a!=null&&s(t,["step"],a),t}function Mt(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["displayName"]);i!=null&&s(t,["displayName"],i);const a=r(e,["description"]);a!=null&&s(t,["description"],a);const l=r(e,["versionId"]);l!=null&&s(t,["version"],l);const u=r(e,["deployedModels"]);if(u!=null){let m=u;Array.isArray(m)&&(m=m.map(h=>Hc(o,h))),s(t,["endpoints"],m)}const d=r(e,["labels"]);d!=null&&s(t,["labels"],d);const c=r(e,["_self"]);c!=null&&s(t,["tunedModelInfo"],Jc(o,c));const f=r(e,["defaultCheckpointId"]);f!=null&&s(t,["defaultCheckpointId"],f);const p=r(e,["checkpoints"]);if(p!=null){let m=p;Array.isArray(m)&&(m=m.map(h=>zc(o,h))),s(t,["checkpoints"],m)}return t}function Wc(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["_self"]);if(i!=null){let a=uo(o,i);Array.isArray(a)&&(a=a.map(l=>Mt(o,l))),s(t,["models"],a)}return t}function Yc(){return{}}function Zc(o,e){const t={},n=r(e,["totalTokens"]);return n!=null&&s(t,["totalTokens"],n),t}function Kc(o,e){const t={},n=r(e,["tokensInfo"]);return n!=null&&s(t,["tokensInfo"],n),t}function Xc(o,e){const t={},n=r(e,["gcsUri"]);n!=null&&s(t,["uri"],n);const i=r(e,["bytesBase64Encoded"]);i!=null&&s(t,["videoBytes"],de(o,i));const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Qc(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Xc(o,n)),t}function jc(o,e){const t={},n=r(e,["videos"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(u=>Qc(o,u))),s(t,["generatedVideos"],l)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const a=r(e,["raiMediaFilteredReasons"]);return a!=null&&s(t,["raiMediaFilteredReasons"],a),t}function ed(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["metadata"]);i!=null&&s(t,["metadata"],i);const a=r(e,["done"]);a!=null&&s(t,["done"],a);const l=r(e,["error"]);l!=null&&s(t,["error"],l);const u=r(e,["response"]);return u!=null&&s(t,["response"],jc(o,u)),t}/**
167
+ * @license
168
+ * Copyright 2025 Google LLC
169
+ * SPDX-License-Identifier: Apache-2.0
170
+ */const td="Content-Type",nd="X-Server-Timeout",od="User-Agent",It="x-goog-api-client",id="google-genai-sdk/1.3.0",rd="v1beta1",sd="v1beta",Do=/^data: (.*)(?:\n\n|\r\r|\r\n\r\n)/;class bo extends Error{constructor(e,t){t?super(e,{cause:t}):super(e,{cause:new Error().stack}),this.message=e,this.name="ClientError"}}class Rt extends Error{constructor(e,t){t?super(e,{cause:t}):super(e,{cause:new Error().stack}),this.message=e,this.name="ServerError"}}class ad{constructor(e){var t,n;this.clientOptions=Object.assign(Object.assign({},e),{project:e.project,location:e.location,apiKey:e.apiKey,vertexai:e.vertexai});const i={};this.clientOptions.vertexai?(i.apiVersion=(t=this.clientOptions.apiVersion)!==null&&t!==void 0?t:rd,i.baseUrl=this.baseUrlFromProjectLocation(),this.normalizeAuthParameters()):(i.apiVersion=(n=this.clientOptions.apiVersion)!==null&&n!==void 0?n:sd,i.baseUrl="https://generativelanguage.googleapis.com/"),i.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=i,e.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(i,e.httpOptions))}baseUrlFromProjectLocation(){return this.clientOptions.project&&this.clientOptions.location&&this.clientOptions.location!=="global"?`https://${this.clientOptions.location}-aiplatform.googleapis.com/`:"https://aiplatform.googleapis.com/"}normalizeAuthParameters(){if(this.clientOptions.project&&this.clientOptions.location){this.clientOptions.apiKey=void 0;return}this.clientOptions.project=void 0,this.clientOptions.location=void 0}isVertexAI(){var e;return(e=this.clientOptions.vertexai)!==null&&e!==void 0?e:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw new Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw new Error("Base URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;throw new Error("Headers are not set.")}getRequestUrlInternal(e){if(!e||e.baseUrl===void 0||e.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");const n=[e.baseUrl.endsWith("/")?e.baseUrl.slice(0,-1):e.baseUrl];return e.apiVersion&&e.apiVersion!==""&&n.push(e.apiVersion),n.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){const e=this.getBaseUrl(),t=new URL(e);return t.protocol=t.protocol=="http:"?"ws":"wss",t.toString()}setBaseUrl(e){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=e;else throw new Error("HTTP options are not correctly set.")}constructUrl(e,t,n){const i=[this.getRequestUrlInternal(t)];return n&&i.push(this.getBaseResourcePath()),e!==""&&i.push(e),new URL(`${i.join("/")}`)}shouldPrependVertexProjectPath(e){return!(this.clientOptions.apiKey||!this.clientOptions.vertexai||e.path.startsWith("projects/")||e.httpMethod==="GET"&&e.path.startsWith("publishers/google/models"))}async request(e){let t=this.clientOptions.httpOptions;e.httpOptions&&(t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));const n=this.shouldPrependVertexProjectPath(e),i=this.constructUrl(e.path,t,n);if(e.queryParams)for(const[l,u]of Object.entries(e.queryParams))i.searchParams.append(l,String(u));let a={};if(e.httpMethod==="GET"){if(e.body&&e.body!=="{}")throw new Error("Request body should be empty for GET request, but got non empty request body")}else a.body=e.body;return a=await this.includeExtraHttpOptionsToRequestInit(a,t,e.abortSignal),this.unaryApiCall(i,a,e.httpMethod)}patchHttpOptions(e,t){const n=JSON.parse(JSON.stringify(e));for(const[i,a]of Object.entries(t))typeof a=="object"?n[i]=Object.assign(Object.assign({},n[i]),a):a!==void 0&&(n[i]=a);return n}async requestStream(e){let t=this.clientOptions.httpOptions;e.httpOptions&&(t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));const n=this.shouldPrependVertexProjectPath(e),i=this.constructUrl(e.path,t,n);(!i.searchParams.has("alt")||i.searchParams.get("alt")!=="sse")&&i.searchParams.set("alt","sse");let a={};return a.body=e.body,a=await this.includeExtraHttpOptionsToRequestInit(a,t,e.abortSignal),this.streamApiCall(i,a,e.httpMethod)}async includeExtraHttpOptionsToRequestInit(e,t,n){if(t&&t.timeout||n){const i=new AbortController,a=i.signal;t.timeout&&(t==null?void 0:t.timeout)>0&&setTimeout(()=>i.abort(),t.timeout),n&&n.addEventListener("abort",()=>{i.abort()}),e.signal=a}return e.headers=await this.getHeadersInternal(t),e}async unaryApiCall(e,t,n){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:n})).then(async i=>(await Lo(i),new Tt(i))).catch(i=>{throw i instanceof Error?i:new Error(JSON.stringify(i))})}async streamApiCall(e,t,n){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:n})).then(async i=>(await Lo(i),this.processStreamResponse(i))).catch(i=>{throw i instanceof Error?i:new Error(JSON.stringify(i))})}processStreamResponse(e){var t;return Re(this,arguments,function*(){const i=(t=e==null?void 0:e.body)===null||t===void 0?void 0:t.getReader(),a=new TextDecoder("utf-8");if(!i)throw new Error("Response body is empty");try{let l="";for(;;){const{done:u,value:d}=yield $(i.read());if(u){if(l.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const c=a.decode(d);try{const p=JSON.parse(c);if("error"in p){const m=JSON.parse(JSON.stringify(p.error)),h=m.status,g=m.code,v=`got status: ${h}. ${JSON.stringify(p)}`;if(g>=400&&g<500)throw new bo(v);if(g>=500&&g<600)throw new Rt(v)}}catch(p){const m=p;if(m.name==="ClientError"||m.name==="ServerError")throw p}l+=c;let f=l.match(Do);for(;f;){const p=f[1];try{const m=new Response(p,{headers:e==null?void 0:e.headers,status:e==null?void 0:e.status,statusText:e==null?void 0:e.statusText});yield yield $(new Tt(m)),l=l.slice(f[0].length),f=l.match(Do)}catch(m){throw new Error(`exception parsing stream chunk ${p}. ${m}`)}}}}finally{i.releaseLock()}})}async apiCall(e,t){return fetch(e,t).catch(n=>{throw new Error(`exception ${n} sending request`)})}getDefaultHeaders(){const e={},t=id+" "+this.clientOptions.userAgentExtra;return e[od]=t,e[It]=t,e[td]="application/json",e}async getHeadersInternal(e){const t=new Headers;if(e&&e.headers){for(const[n,i]of Object.entries(e.headers))t.append(n,i);e.timeout&&e.timeout>0&&t.append(nd,String(Math.ceil(e.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(t),t}async uploadFile(e,t){var n;const i={};t!=null&&(i.mimeType=t.mimeType,i.name=t.name,i.displayName=t.displayName),i.name&&!i.name.startsWith("files/")&&(i.name=`files/${i.name}`);const a=this.clientOptions.uploader,l=await a.stat(e);i.sizeBytes=String(l.size);const u=(n=t==null?void 0:t.mimeType)!==null&&n!==void 0?n:l.type;if(u===void 0||u==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");i.mimeType=u;const d=await this.fetchUploadUrl(i,t);return a.upload(e,d,this)}async downloadFile(e){await this.clientOptions.downloader.download(e,this)}async fetchUploadUrl(e,t){var n;let i={};t!=null&&t.httpOptions?i=t.httpOptions:i={apiVersion:"",headers:{"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${e.sizeBytes}`,"X-Goog-Upload-Header-Content-Type":`${e.mimeType}`}};const a={file:e},l=await this.request({path:I("upload/v1beta/files",a._url),body:JSON.stringify(a),httpMethod:"POST",httpOptions:i});if(!l||!(l!=null&&l.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const u=(n=l==null?void 0:l.headers)===null||n===void 0?void 0:n["x-goog-upload-url"];if(u===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return u}}async function Lo(o){var e;if(o===void 0)throw new Rt("response is undefined");if(!o.ok){const t=o.status,n=o.statusText;let i;!((e=o.headers.get("content-type"))===null||e===void 0)&&e.includes("application/json")?i=await o.json():i={error:{message:await o.text(),code:o.status,status:o.statusText}};const a=`got status: ${t} ${n}. ${JSON.stringify(i)}`;throw t>=400&&t<500?new bo(a):t>=500&&t<600?new Rt(a):new Error(a)}}/**
171
+ * @license
172
+ * Copyright 2025 Google LLC
173
+ * SPDX-License-Identifier: Apache-2.0
174
+ */const ld="mcp_used/unknown";function Vo(o){for(const e of o)if(kt(e)||typeof e=="object"&&"inputSchema"in e)return!0;return!1}function Fo(o){var e;const t=(e=o[It])!==null&&e!==void 0?e:"";o[It]=(t+` ${ld}`).trimStart()}function ud(o){var e,t,n;return(n=(t=(e=o.config)===null||e===void 0?void 0:e.tools)===null||t===void 0?void 0:t.some(i=>kt(i)))!==null&&n!==void 0?n:!1}function cd(o){var e,t,n;return(n=(t=(e=o.config)===null||e===void 0?void 0:e.tools)===null||t===void 0?void 0:t.some(i=>!kt(i)))!==null&&n!==void 0?n:!1}function kt(o){return o!==null&&typeof o=="object"&&o instanceof Nt}function dd(o,e=100){return Re(this,arguments,function*(){let n,i=0;for(;i<e;){const a=yield $(o.listTools({cursor:n}));for(const l of a.tools)yield yield $(l),i++;if(!a.nextCursor)break;n=a.nextCursor}})}class Nt{constructor(e=[],t){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=e,this.config=t}static create(e,t){return new Nt(e,t)}async initialize(){var e,t,n,i;if(this.mcpTools.length>0)return;const a={},l=[];for(const f of this.mcpClients)try{for(var u=!0,d=(t=void 0,qe(dd(f))),c;c=await d.next(),e=c.done,!e;u=!0){i=c.value,u=!1;const p=i;l.push(p);const m=p.name;if(a[m])throw new Error(`Duplicate function name ${m} found in MCP tools. Please ensure function names are unique.`);a[m]=f}}catch(p){t={error:p}}finally{try{!u&&!e&&(n=d.return)&&await n.call(d)}finally{if(t)throw t.error}}this.mcpTools=l,this.functionNameToMcpClient=a}async tool(){return await this.initialize(),Tr(this.mcpTools,this.config)}async callTool(e){await this.initialize();const t=[];for(const n of e)if(n.name in this.functionNameToMcpClient){const a=await this.functionNameToMcpClient[n.name].callTool({name:n.name,arguments:n.args});t.push({functionResponse:{name:n.name,response:a.isError?{error:a}:a}})}return t}}/**
175
+ * @license
176
+ * Copyright 2025 Google LLC
177
+ * SPDX-License-Identifier: Apache-2.0
178
+ */async function fd(o,e,t){const n=new sr;let i;t.data instanceof Blob?i=JSON.parse(await t.data.text()):i=JSON.parse(t.data);const a=Al(o,i);Object.assign(n,a),e(n)}class pd{constructor(e,t,n){this.apiClient=e,this.auth=t,this.webSocketFactory=n}async connect(e){var t,n;if(this.apiClient.isVertexAI())throw new Error("Live music is not supported for Vertex AI.");console.warn("Live music generation is experimental and may change in future versions.");const i=this.apiClient.getWebsocketBaseUrl(),a=this.apiClient.getApiVersion(),l=gd(this.apiClient.getDefaultHeaders()),u=this.apiClient.getApiKey(),d=`${i}/ws/google.ai.generativelanguage.${a}.GenerativeService.BidiGenerateMusic?key=${u}`;let c=()=>{};const f=new Promise(k=>{c=k}),p=e.callbacks,m=function(){c({})},h=this.apiClient,g={onopen:m,onmessage:k=>{fd(h,p.onmessage,k)},onerror:(t=p==null?void 0:p.onerror)!==null&&t!==void 0?t:function(k){},onclose:(n=p==null?void 0:p.onclose)!==null&&n!==void 0?n:function(k){}},v=this.webSocketFactory.create(d,hd(l),g);v.connect(),await f;const x=q(this.apiClient,e.model),M=_o(this.apiClient,{model:x}),R=Et(this.apiClient,{setup:M});return v.send(JSON.stringify(R)),new md(v,this.apiClient)}}class md{constructor(e,t){this.conn=e,this.apiClient=t}async setWeightedPrompts(e){if(!e.weightedPrompts||Object.keys(e.weightedPrompts).length===0)throw new Error("Weighted prompts must be set and contain at least one entry.");const t=Ba(this.apiClient,e),n=xo(this.apiClient,t);this.conn.send(JSON.stringify({clientContent:n}))}async setMusicGenerationConfig(e){e.musicGenerationConfig||(e.musicGenerationConfig={});const t=qa(this.apiClient,e),n=Et(this.apiClient,t);this.conn.send(JSON.stringify(n))}sendPlaybackControl(e){const t=Et(this.apiClient,{playbackControl:e});this.conn.send(JSON.stringify(t))}play(){this.sendPlaybackControl(Ae.PLAY)}pause(){this.sendPlaybackControl(Ae.PAUSE)}stop(){this.sendPlaybackControl(Ae.STOP)}resetContext(){this.sendPlaybackControl(Ae.RESET_CONTEXT)}close(){this.conn.close()}}function hd(o){const e={};return o.forEach((t,n)=>{e[n]=t}),e}function gd(o){const e=new Headers;for(const[t,n]of Object.entries(o))e.append(t,n);return e}/**
179
+ * @license
180
+ * Copyright 2025 Google LLC
181
+ * SPDX-License-Identifier: Apache-2.0
182
+ */const yd="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function vd(o,e,t){const n=new rr;let i;if(t.data instanceof Blob?i=JSON.parse(await t.data.text()):i=JSON.parse(t.data),o.isVertexAI()){const a=yl(o,i);Object.assign(n,a)}else{const a=gl(o,i);Object.assign(n,a)}e(n)}class Td{constructor(e,t,n){this.apiClient=e,this.auth=t,this.webSocketFactory=n,this.music=new pd(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){var t,n,i,a,l,u;const d=this.apiClient.getWebsocketBaseUrl(),c=this.apiClient.getApiVersion();let f;const p=this.apiClient.getDefaultHeaders();e.config&&e.config.tools&&Vo(e.config.tools)&&Fo(p);const m=Ed(p);if(this.apiClient.isVertexAI())f=`${d}/ws/google.cloud.aiplatform.${c}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(m);else{const b=this.apiClient.getApiKey();let B="BidiGenerateContent",Q="key";b!=null&&b.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),B="BidiGenerateContentConstrained",Q="access_token"),f=`${d}/ws/google.ai.generativelanguage.${c}.GenerativeService.${B}?${Q}=${b}`}let h=()=>{};const g=new Promise(b=>{h=b}),v=e.callbacks,x=function(){var b;(b=v==null?void 0:v.onopen)===null||b===void 0||b.call(v),h({})},M=this.apiClient,R={onopen:x,onmessage:b=>{vd(M,v.onmessage,b)},onerror:(t=v==null?void 0:v.onerror)!==null&&t!==void 0?t:function(b){},onclose:(n=v==null?void 0:v.onclose)!==null&&n!==void 0?n:function(b){}},k=this.webSocketFactory.create(f,xd(m),R);k.connect(),await g;let V=q(this.apiClient,e.model);if(this.apiClient.isVertexAI()&&V.startsWith("publishers/")){const b=this.apiClient.getProject(),B=this.apiClient.getLocation();V=`projects/${b}/locations/${B}/`+V}let E={};this.apiClient.isVertexAI()&&((i=e.config)===null||i===void 0?void 0:i.responseModalities)===void 0&&(e.config===void 0?e.config={responseModalities:[Xe.AUDIO]}:e.config.responseModalities=[Xe.AUDIO]),!((a=e.config)===null||a===void 0)&&a.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).");const A=(u=(l=e.config)===null||l===void 0?void 0:l.tools)!==null&&u!==void 0?u:[],P=[];for(const b of A)if(this.isCallableTool(b)){const B=b;P.push(await B.tool())}else P.push(b);P.length>0&&(e.config.tools=P);const O={model:V,config:e.config,callbacks:e.callbacks};return this.apiClient.isVertexAI()?E=Da(this.apiClient,O):E=Pa(this.apiClient,O),delete E.config,k.send(JSON.stringify(E)),new _d(k,this.apiClient)}isCallableTool(e){return"callTool"in e&&typeof e.callTool=="function"}}const Cd={turnComplete:!0};class _d{constructor(e,t){this.conn=e,this.apiClient=t}tLiveClientContent(e,t){if(t.turns!==null&&t.turns!==void 0){let n=[];try{n=te(e,t.turns),e.isVertexAI()?n=n.map(i=>ke(e,i)):n=n.map(i=>st(e,i))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof t.turns}'`)}return{clientContent:{turns:n,turnComplete:t.turnComplete}}}return{clientContent:{turnComplete:t.turnComplete}}}tLiveClienttToolResponse(e,t){let n=[];if(t.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(t.functionResponses)?n=t.functionResponses:n=[t.functionResponses],n.length===0)throw new Error("functionResponses is required.");for(const a of n){if(typeof a!="object"||a===null||!("name"in a)||!("response"in a))throw new Error(`Could not parse function response, type '${typeof a}'.`);if(!e.isVertexAI()&&!("id"in a))throw new Error(yd)}return{toolResponse:{functionResponses:n}}}sendClientContent(e){e=Object.assign(Object.assign({},Cd),e);const t=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(t))}sendRealtimeInput(e){let t={};this.apiClient.isVertexAI()?t={realtimeInput:Ga(this.apiClient,e)}:t={realtimeInput:Ua(this.apiClient,e)},this.conn.send(JSON.stringify(t))}sendToolResponse(e){if(e.functionResponses==null)throw new Error("Tool response parameters are required.");const t=this.tLiveClienttToolResponse(this.apiClient,e);this.conn.send(JSON.stringify(t))}close(){this.conn.close()}}function xd(o){const e={};return o.forEach((t,n)=>{e[n]=t}),e}function Ed(o){const e=new Headers;for(const[t,n]of Object.entries(o))e.append(t,n);return e}/**
183
+ * @license
184
+ * Copyright 2025 Google LLC
185
+ * SPDX-License-Identifier: Apache-2.0
186
+ */const Uo=10;function Go(o){var e,t,n;if(!((e=o==null?void 0:o.automaticFunctionCalling)===null||e===void 0)&&e.disable)return!0;let i=!1;for(const l of(t=o==null?void 0:o.tools)!==null&&t!==void 0?t:[])if(at(l)){i=!0;break}if(!i)return!0;const a=(n=o==null?void 0:o.automaticFunctionCalling)===null||n===void 0?void 0:n.maximumRemoteCalls;return a&&(a<0||!Number.isInteger(a))||a==0?(console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a valid integer value greater than 0. maximumRemoteCalls provided:",a),!0):!1}function at(o){return"callTool"in o&&typeof o.callTool=="function"}function Bo(o){var e;return!(!((e=o==null?void 0:o.automaticFunctionCalling)===null||e===void 0)&&e.ignoreCallHistory)}/**
187
+ * @license
188
+ * Copyright 2025 Google LLC
189
+ * SPDX-License-Identifier: Apache-2.0
190
+ */class wd extends Se{constructor(e){super(),this.apiClient=e,this.generateContent=async t=>{var n,i,a,l,u;const d=await this.processParamsForMcpUsage(t);if(!ud(t)||Go(t.config))return await this.generateContentInternal(d);if(cd(t))throw new Error("Automatic function calling with CallableTools and Tools is not yet supported.");let c,f;const p=te(this.apiClient,d.contents),m=(a=(i=(n=d.config)===null||n===void 0?void 0:n.automaticFunctionCalling)===null||i===void 0?void 0:i.maximumRemoteCalls)!==null&&a!==void 0?a:Uo;let h=0;for(;h<m&&(c=await this.generateContentInternal(d),!(!c.functionCalls||c.functionCalls.length===0));){const g=c.candidates[0].content,v=[];for(const x of(u=(l=t.config)===null||l===void 0?void 0:l.tools)!==null&&u!==void 0?u:[])if(at(x)){const R=await x.callTool(c.functionCalls);v.push(...R)}h++,f={role:"user",parts:v},d.contents=te(this.apiClient,d.contents),d.contents.push(g),d.contents.push(f),Bo(d.config)&&(p.push(g),p.push(f))}return Bo(d.config)&&(c.automaticFunctionCallingHistory=p),c},this.generateContentStream=async t=>{if(Go(t.config)){const n=await this.processParamsForMcpUsage(t);return await this.generateContentStreamInternal(n)}else return await this.processAfcStream(t)},this.generateImages=async t=>await this.generateImagesInternal(t).then(n=>{var i;let a;const l=[];if(n!=null&&n.generatedImages)for(const d of n.generatedImages)d&&(d!=null&&d.safetyAttributes)&&((i=d==null?void 0:d.safetyAttributes)===null||i===void 0?void 0:i.contentType)==="Positive Prompt"?a=d==null?void 0:d.safetyAttributes:l.push(d);let u;return a?u={generatedImages:l,positivePromptSafetyAttributes:a}:u={generatedImages:l},u}),this.list=async t=>{var n;const l={config:Object.assign(Object.assign({},{queryBase:!0}),t==null?void 0:t.config)};if(this.apiClient.isVertexAI()&&!l.config.queryBase){if(!((n=l.config)===null||n===void 0)&&n.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");l.config.filter="labels.tune-type:*"}return new ot(Ie.PAGED_ITEM_MODELS,u=>this.listInternal(u),await this.listInternal(l),l)},this.editImage=async t=>{const n={model:t.model,prompt:t.prompt,referenceImages:[],config:t.config};return t.referenceImages&&t.referenceImages&&(n.referenceImages=t.referenceImages.map(i=>i.toReferenceImageAPI())),await this.editImageInternal(n)},this.upscaleImage=async t=>{let n={numberOfImages:1,mode:"upscale"};t.config&&(n=Object.assign(Object.assign({},n),t.config));const i={model:t.model,image:t.image,upscaleFactor:t.upscaleFactor,config:n};return await this.upscaleImageInternal(i)}}async processParamsForMcpUsage(e){var t,n,i;const a=(t=e.config)===null||t===void 0?void 0:t.tools;if(!a)return e;const l=await Promise.all(a.map(async d=>at(d)?await d.tool():d)),u={model:e.model,contents:e.contents,config:Object.assign(Object.assign({},e.config),{tools:l})};if(u.config.tools=l,e.config&&e.config.tools&&Vo(e.config.tools)){const d=(i=(n=e.config.httpOptions)===null||n===void 0?void 0:n.headers)!==null&&i!==void 0?i:{};let c=Object.assign({},d);Object.keys(c).length===0&&(c=this.apiClient.getDefaultHeaders()),Fo(c),u.config.httpOptions=Object.assign(Object.assign({},e.config.httpOptions),{headers:c})}return u}async initAfcToolsMap(e){var t,n,i;const a=new Map;for(const l of(n=(t=e.config)===null||t===void 0?void 0:t.tools)!==null&&n!==void 0?n:[])if(at(l)){const u=l,d=await u.tool();for(const c of(i=d.functionDeclarations)!==null&&i!==void 0?i:[]){if(!c.name)throw new Error("Function declaration name is required.");if(a.has(c.name))throw new Error(`Duplicate tool declaration name: ${c.name}`);a.set(c.name,u)}}return a}async processAfcStream(e){var t,n,i;const a=(i=(n=(t=e.config)===null||t===void 0?void 0:t.automaticFunctionCalling)===null||n===void 0?void 0:n.maximumRemoteCalls)!==null&&i!==void 0?i:Uo;let l=!1,u=0;const d=await this.initAfcToolsMap(e);return(function(c,f,p){var m,h;return Re(this,arguments,function*(){for(var g,v,x,M;u<a;){l&&(u++,l=!1);const E=yield $(c.processParamsForMcpUsage(p)),A=yield $(c.generateContentStreamInternal(E)),P=[],O=[];try{for(var R=!0,k=(v=void 0,qe(A)),V;V=yield $(k.next()),g=V.done,!g;R=!0){M=V.value,R=!1;const b=M;if(yield yield $(b),b.candidates&&(!((m=b.candidates[0])===null||m===void 0)&&m.content)){O.push(b.candidates[0].content);for(const B of(h=b.candidates[0].content.parts)!==null&&h!==void 0?h:[])if(u<a&&B.functionCall){if(!B.functionCall.name)throw new Error("Function call name was not returned by the model.");if(f.has(B.functionCall.name)){const Q=yield $(f.get(B.functionCall.name).callTool([B.functionCall]));P.push(...Q)}else throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${f.keys()}, mising tool: ${B.functionCall.name}`)}}}}catch(b){v={error:b}}finally{try{!R&&!g&&(x=k.return)&&(yield $(x.call(k)))}finally{if(v)throw v.error}}if(P.length>0){l=!0;const b=new Ue;b.candidates=[{content:{role:"user",parts:P}}],yield yield $(b);const B=[];B.push(...O),B.push({role:"user",parts:P});const Q=te(c.apiClient,p.contents).concat(B);p.contents=Q}else break}})})(this,d,e)}async generateContentInternal(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=Io(this.apiClient,e);return u=I("{model}:generateContent",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>{const p=No(this.apiClient,f),m=new Ue;return Object.assign(m,p),m})}else{const c=Ao(this.apiClient,e);return u=I("{model}:generateContent",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>{const p=Ro(this.apiClient,f),m=new Ue;return Object.assign(m,p),m})}}async generateContentStreamInternal(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=Io(this.apiClient,e);u=I("{model}:streamGenerateContent?alt=sse",c._url),d=c._query,delete c.config,delete c._url,delete c._query;const f=this.apiClient;return l=f.requestStream({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}),l.then(function(p){return Re(this,arguments,function*(){var m,h,g,v;try{for(var x=!0,M=qe(p),R;R=yield $(M.next()),m=R.done,!m;x=!0){v=R.value,x=!1;const V=No(f,yield $(v.json())),E=new Ue;Object.assign(E,V),yield yield $(E)}}catch(k){h={error:k}}finally{try{!x&&!m&&(g=M.return)&&(yield $(g.call(M)))}finally{if(h)throw h.error}}})})}else{const c=Ao(this.apiClient,e);u=I("{model}:streamGenerateContent?alt=sse",c._url),d=c._query,delete c.config,delete c._url,delete c._query;const f=this.apiClient;return l=f.requestStream({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}),l.then(function(p){return Re(this,arguments,function*(){var m,h,g,v;try{for(var x=!0,M=qe(p),R;R=yield $(M.next()),m=R.done,!m;x=!0){v=R.value,x=!1;const V=Ro(f,yield $(v.json())),E=new Ue;Object.assign(E,V),yield yield $(E)}}catch(k){h={error:k}}finally{try{!x&&!m&&(g=M.return)&&(yield $(g.call(M)))}finally{if(h)throw h.error}}})})}}async embedContent(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=Fu(this.apiClient,e);return u=I("{model}:predict",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>{const p=Gc(this.apiClient,f),m=new On;return Object.assign(m,p),m})}else{const c=Xl(this.apiClient,e);return u=I("{model}:batchEmbedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>{const p=yc(this.apiClient,f),m=new On;return Object.assign(m,p),m})}}async generateImagesInternal(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=Gu(this.apiClient,e);return u=I("{model}:predict",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>{const p=qc(this.apiClient,f),m=new Hn;return Object.assign(m,p),m})}else{const c=jl(this.apiClient,e);return u=I("{model}:predict",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>{const p=Cc(this.apiClient,f),m=new Hn;return Object.assign(m,p),m})}}async editImageInternal(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI()){const u=zu(this.apiClient,e);return a=I("{model}:predict",u._url),l=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(d=>d.json()),i.then(d=>{const c=$c(this.apiClient,d),f=new ji;return Object.assign(f,c),f})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI()){const u=Yu(this.apiClient,e);return a=I("{model}:predict",u._url),l=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(d=>d.json()),i.then(d=>{const c=Oc(this.apiClient,d),f=new er;return Object.assign(f,c),f})}else throw new Error("This method is only supported by the Vertex AI.")}async get(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=Zu(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>Mt(this.apiClient,f))}else{const c=eu(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>St(this.apiClient,f))}}async listInternal(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=Xu(this.apiClient,e);return u=I("{models_url}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>{const p=Wc(this.apiClient,f),m=new Jn;return Object.assign(m,p),m})}else{const c=nu(this.apiClient,e);return u=I("{models_url}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>{const p=xc(this.apiClient,f),m=new Jn;return Object.assign(m,p),m})}}async update(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=ju(this.apiClient,e);return u=I("{model}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>Mt(this.apiClient,f))}else{const c=iu(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"PATCH",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>St(this.apiClient,f))}}async delete(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=ec(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(()=>{const f=Yc(),p=new zn;return Object.assign(p,f),p})}else{const c=ru(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(()=>{const f=Ec(),p=new zn;return Object.assign(p,f),p})}}async countTokens(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=nc(this.apiClient,e);return u=I("{model}:countTokens",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>{const p=Zc(this.apiClient,f),m=new Wn;return Object.assign(m,p),m})}else{const c=au(this.apiClient,e);return u=I("{model}:countTokens",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>{const p=wc(this.apiClient,f),m=new Wn;return Object.assign(m,p),m})}}async computeTokens(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI()){const u=oc(this.apiClient,e);return a=I("{model}:computeTokens",u._url),l=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(d=>d.json()),i.then(d=>{const c=Kc(this.apiClient,d),f=new tr;return Object.assign(f,c),f})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideos(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=rc(this.apiClient,e);return u=I("{model}:predictLongRunning",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>ed(this.apiClient,f))}else{const c=cu(this.apiClient,e);return u=I("{model}:predictLongRunning",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>Ic(this.apiClient,f))}}}/**
191
+ * @license
192
+ * Copyright 2025 Google LLC
193
+ * SPDX-License-Identifier: Apache-2.0
194
+ */function Sd(o,e){const t={},n=r(e,["operationName"]);n!=null&&s(t,["_url","operationName"],n);const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Ad(o,e){const t={},n=r(e,["operationName"]);n!=null&&s(t,["_url","operationName"],n);const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Md(o,e){const t={},n=r(e,["operationName"]);n!=null&&s(t,["operationName"],n);const i=r(e,["resourceName"]);i!=null&&s(t,["_url","resourceName"],i);const a=r(e,["config"]);return a!=null&&s(t,["config"],a),t}function Id(o,e){const t={},n=r(e,["video","uri"]);n!=null&&s(t,["uri"],n);const i=r(e,["video","encodedVideo"]);i!=null&&s(t,["videoBytes"],de(o,i));const a=r(e,["encoding"]);return a!=null&&s(t,["mimeType"],a),t}function Rd(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Id(o,n)),t}function kd(o,e){const t={},n=r(e,["generatedSamples"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(u=>Rd(o,u))),s(t,["generatedVideos"],l)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const a=r(e,["raiMediaFilteredReasons"]);return a!=null&&s(t,["raiMediaFilteredReasons"],a),t}function Nd(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["metadata"]);i!=null&&s(t,["metadata"],i);const a=r(e,["done"]);a!=null&&s(t,["done"],a);const l=r(e,["error"]);l!=null&&s(t,["error"],l);const u=r(e,["response","generateVideoResponse"]);return u!=null&&s(t,["response"],kd(o,u)),t}function Pd(o,e){const t={},n=r(e,["gcsUri"]);n!=null&&s(t,["uri"],n);const i=r(e,["bytesBase64Encoded"]);i!=null&&s(t,["videoBytes"],de(o,i));const a=r(e,["mimeType"]);return a!=null&&s(t,["mimeType"],a),t}function Dd(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Pd(o,n)),t}function bd(o,e){const t={},n=r(e,["videos"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(u=>Dd(o,u))),s(t,["generatedVideos"],l)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const a=r(e,["raiMediaFilteredReasons"]);return a!=null&&s(t,["raiMediaFilteredReasons"],a),t}function qo(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["metadata"]);i!=null&&s(t,["metadata"],i);const a=r(e,["done"]);a!=null&&s(t,["done"],a);const l=r(e,["error"]);l!=null&&s(t,["error"],l);const u=r(e,["response"]);return u!=null&&s(t,["response"],bd(o,u)),t}/**
195
+ * @license
196
+ * Copyright 2025 Google LLC
197
+ * SPDX-License-Identifier: Apache-2.0
198
+ */class Ld extends Se{constructor(e){super(),this.apiClient=e}async getVideosOperation(e){const t=e.operation,n=e.config;if(t.name===void 0||t.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const i=t.name.split("/operations/")[0];let a;return n&&"httpOptions"in n&&(a=n.httpOptions),this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:i,config:{httpOptions:a}})}else return this.getVideosOperationInternal({operationName:t.name,config:n})}async getVideosOperationInternal(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=Ad(this.apiClient,e);return u=I("{operationName}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>qo(this.apiClient,f))}else{const c=Sd(this.apiClient,e);return u=I("{operationName}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>Nd(this.apiClient,f))}}async fetchPredictVideosOperationInternal(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI()){const u=Md(this.apiClient,e);return a=I("{resourceName}:fetchPredictOperation",u._url),l=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(d=>d.json()),i.then(d=>qo(this.apiClient,d))}else throw new Error("This method is only supported by the Vertex AI.")}}/**
199
+ * @license
200
+ * Copyright 2025 Google LLC
201
+ * SPDX-License-Identifier: Apache-2.0
202
+ */function Vd(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function $o(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Vd(o,n)),t}function Fd(o,e){const t={},n=r(e,["speaker"]);n!=null&&s(t,["speaker"],n);const i=r(e,["voiceConfig"]);return i!=null&&s(t,["voiceConfig"],$o(o,i)),t}function Ud(o,e){const t={},n=r(e,["speakerVoiceConfigs"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>Fd(o,a))),s(t,["speakerVoiceConfigs"],i)}return t}function Gd(o,e){const t={},n=r(e,["voiceConfig"]);n!=null&&s(t,["voiceConfig"],$o(o,n));const i=r(e,["multiSpeakerVoiceConfig"]);i!=null&&s(t,["multiSpeakerVoiceConfig"],Ud(o,i));const a=r(e,["languageCode"]);return a!=null&&s(t,["languageCode"],a),t}function Bd(o,e){const t={},n=r(e,["fps"]);n!=null&&s(t,["fps"],n);const i=r(e,["endOffset"]);i!=null&&s(t,["endOffset"],i);const a=r(e,["startOffset"]);return a!=null&&s(t,["startOffset"],a),t}function qd(o,e){const t={};if(r(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=r(e,["data"]);n!=null&&s(t,["data"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function $d(o,e){const t={};if(r(e,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const n=r(e,["fileUri"]);n!=null&&s(t,["fileUri"],n);const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function Od(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Bd(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const a=r(e,["inlineData"]);a!=null&&s(t,["inlineData"],qd(o,a));const l=r(e,["fileData"]);l!=null&&s(t,["fileData"],$d(o,l));const u=r(e,["thoughtSignature"]);u!=null&&s(t,["thoughtSignature"],u);const d=r(e,["codeExecutionResult"]);d!=null&&s(t,["codeExecutionResult"],d);const c=r(e,["executableCode"]);c!=null&&s(t,["executableCode"],c);const f=r(e,["functionCall"]);f!=null&&s(t,["functionCall"],f);const p=r(e,["functionResponse"]);p!=null&&s(t,["functionResponse"],p);const m=r(e,["text"]);return m!=null&&s(t,["text"],m),t}function Hd(o,e){const t={},n=r(e,["parts"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(l=>Od(o,l))),s(t,["parts"],a)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Jd(o,e){const t={},n=r(e,["behavior"]);n!=null&&s(t,["behavior"],n);const i=r(e,["description"]);i!=null&&s(t,["description"],i);const a=r(e,["name"]);a!=null&&s(t,["name"],a);const l=r(e,["parameters"]);l!=null&&s(t,["parameters"],l);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function zd(o,e){const t={},n=r(e,["startTime"]);n!=null&&s(t,["startTime"],n);const i=r(e,["endTime"]);return i!=null&&s(t,["endTime"],i),t}function Wd(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],zd(o,n)),t}function Yd(o,e){const t={},n=r(e,["mode"]);n!=null&&s(t,["mode"],n);const i=r(e,["dynamicThreshold"]);return i!=null&&s(t,["dynamicThreshold"],i),t}function Zd(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],Yd(o,n)),t}function Kd(){return{}}function Xd(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>Jd(o,c))),s(t,["functionDeclarations"],d)}if(r(e,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const i=r(e,["googleSearch"]);i!=null&&s(t,["googleSearch"],Wd(o,i));const a=r(e,["googleSearchRetrieval"]);if(a!=null&&s(t,["googleSearchRetrieval"],Zd(o,a)),r(e,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");if(r(e,["googleMaps"])!==void 0)throw new Error("googleMaps parameter is not supported in Gemini API.");r(e,["urlContext"])!=null&&s(t,["urlContext"],Kd());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function Qd(o,e){const t={},n=r(e,["handle"]);if(n!=null&&s(t,["handle"],n),r(e,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function Oo(){return{}}function jd(o,e){const t={},n=r(e,["disabled"]);n!=null&&s(t,["disabled"],n);const i=r(e,["startOfSpeechSensitivity"]);i!=null&&s(t,["startOfSpeechSensitivity"],i);const a=r(e,["endOfSpeechSensitivity"]);a!=null&&s(t,["endOfSpeechSensitivity"],a);const l=r(e,["prefixPaddingMs"]);l!=null&&s(t,["prefixPaddingMs"],l);const u=r(e,["silenceDurationMs"]);return u!=null&&s(t,["silenceDurationMs"],u),t}function ef(o,e){const t={},n=r(e,["automaticActivityDetection"]);n!=null&&s(t,["automaticActivityDetection"],jd(o,n));const i=r(e,["activityHandling"]);i!=null&&s(t,["activityHandling"],i);const a=r(e,["turnCoverage"]);return a!=null&&s(t,["turnCoverage"],a),t}function tf(o,e){const t={},n=r(e,["targetTokens"]);return n!=null&&s(t,["targetTokens"],n),t}function nf(o,e){const t={},n=r(e,["triggerTokens"]);n!=null&&s(t,["triggerTokens"],n);const i=r(e,["slidingWindow"]);return i!=null&&s(t,["slidingWindow"],tf(o,i)),t}function of(o,e){const t={},n=r(e,["proactiveAudio"]);return n!=null&&s(t,["proactiveAudio"],n),t}function rf(o,e,t){const n={},i=r(e,["generationConfig"]);t!==void 0&&i!=null&&s(t,["setup","generationConfig"],i);const a=r(e,["responseModalities"]);t!==void 0&&a!=null&&s(t,["setup","generationConfig","responseModalities"],a);const l=r(e,["temperature"]);t!==void 0&&l!=null&&s(t,["setup","generationConfig","temperature"],l);const u=r(e,["topP"]);t!==void 0&&u!=null&&s(t,["setup","generationConfig","topP"],u);const d=r(e,["topK"]);t!==void 0&&d!=null&&s(t,["setup","generationConfig","topK"],d);const c=r(e,["maxOutputTokens"]);t!==void 0&&c!=null&&s(t,["setup","generationConfig","maxOutputTokens"],c);const f=r(e,["mediaResolution"]);t!==void 0&&f!=null&&s(t,["setup","generationConfig","mediaResolution"],f);const p=r(e,["seed"]);t!==void 0&&p!=null&&s(t,["setup","generationConfig","seed"],p);const m=r(e,["speechConfig"]);t!==void 0&&m!=null&&s(t,["setup","generationConfig","speechConfig"],Gd(o,_t(o,m)));const h=r(e,["enableAffectiveDialog"]);t!==void 0&&h!=null&&s(t,["setup","generationConfig","enableAffectiveDialog"],h);const g=r(e,["systemInstruction"]);t!==void 0&&g!=null&&s(t,["setup","systemInstruction"],Hd(o,X(o,g)));const v=r(e,["tools"]);if(t!==void 0&&v!=null){let A=Be(o,v);Array.isArray(A)&&(A=A.map(P=>Xd(o,Ge(o,P)))),s(t,["setup","tools"],A)}const x=r(e,["sessionResumption"]);t!==void 0&&x!=null&&s(t,["setup","sessionResumption"],Qd(o,x));const M=r(e,["inputAudioTranscription"]);t!==void 0&&M!=null&&s(t,["setup","inputAudioTranscription"],Oo());const R=r(e,["outputAudioTranscription"]);t!==void 0&&R!=null&&s(t,["setup","outputAudioTranscription"],Oo());const k=r(e,["realtimeInputConfig"]);t!==void 0&&k!=null&&s(t,["setup","realtimeInputConfig"],ef(o,k));const V=r(e,["contextWindowCompression"]);t!==void 0&&V!=null&&s(t,["setup","contextWindowCompression"],nf(o,V));const E=r(e,["proactivity"]);return t!==void 0&&E!=null&&s(t,["setup","proactivity"],of(o,E)),n}function sf(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["setup","model"],q(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],rf(o,i,t)),t}function af(o,e,t){const n={},i=r(e,["expireTime"]);t!==void 0&&i!=null&&s(t,["expireTime"],i);const a=r(e,["newSessionExpireTime"]);t!==void 0&&a!=null&&s(t,["newSessionExpireTime"],a);const l=r(e,["uses"]);t!==void 0&&l!=null&&s(t,["uses"],l);const u=r(e,["liveConnectConstraints"]);t!==void 0&&u!=null&&s(t,["bidiGenerateContentSetup"],sf(o,u));const d=r(e,["lockAdditionalFields"]);return t!==void 0&&d!=null&&s(t,["fieldMask"],d),n}function lf(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],af(o,n,t)),t}function uf(o,e){const t={},n=r(e,["name"]);return n!=null&&s(t,["name"],n),t}/**
203
+ * @license
204
+ * Copyright 2025 Google LLC
205
+ * SPDX-License-Identifier: Apache-2.0
206
+ */function cf(o){const e=[];for(const t in o)if(Object.prototype.hasOwnProperty.call(o,t)){const n=o[t];if(typeof n=="object"&&n!=null&&Object.keys(n).length>0){const i=Object.keys(n).map(a=>`${t}.${a}`);e.push(...i)}else e.push(t)}return e.join(",")}function df(o,e){let t=null;const n=o.bidiGenerateContentSetup;if(typeof n=="object"&&n!==null&&"setup"in n){const a=n.setup;typeof a=="object"&&a!==null?(o.bidiGenerateContentSetup=a,t=a):delete o.bidiGenerateContentSetup}else n!==void 0&&delete o.bidiGenerateContentSetup;const i=o.fieldMask;if(t){const a=cf(t);if(Array.isArray(e==null?void 0:e.lockAdditionalFields)&&(e==null?void 0:e.lockAdditionalFields.length)===0)a?o.fieldMask=a:delete o.fieldMask;else if(e!=null&&e.lockAdditionalFields&&e.lockAdditionalFields.length>0&&i!==null&&Array.isArray(i)&&i.length>0){const l=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let u=[];i.length>0&&(u=i.map(c=>l.includes(c)?`generationConfig.${c}`:c));const d=[];a&&d.push(a),u.length>0&&d.push(...u),d.length>0?o.fieldMask=d.join(","):delete o.fieldMask}else delete o.fieldMask}else i!==null&&Array.isArray(i)&&i.length>0?o.fieldMask=i.join(","):delete o.fieldMask;return o}class ff extends Se{constructor(e){super(),this.apiClient=e}async create(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const u=lf(this.apiClient,e);a=I("auth_tokens",u._url),l=u._query,delete u.config,delete u._url,delete u._query;const d=df(u,e.config);return i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(c=>c.json()),i.then(c=>uf(this.apiClient,c))}}}/**
207
+ * @license
208
+ * Copyright 2025 Google LLC
209
+ * SPDX-License-Identifier: Apache-2.0
210
+ */function pf(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],n);const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function mf(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const a=r(e,["pageToken"]);t!==void 0&&a!=null&&s(t,["_query","pageToken"],a);const l=r(e,["filter"]);return t!==void 0&&l!=null&&s(t,["_query","filter"],l),n}function hf(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],mf(o,n,t)),t}function gf(o,e){const t={},n=r(e,["textInput"]);n!=null&&s(t,["textInput"],n);const i=r(e,["output"]);return i!=null&&s(t,["output"],i),t}function yf(o,e){const t={};if(r(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const n=r(e,["examples"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(a=>gf(o,a))),s(t,["examples","examples"],i)}return t}function vf(o,e,t){const n={};if(r(e,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const i=r(e,["tunedModelDisplayName"]);if(t!==void 0&&i!=null&&s(t,["displayName"],i),r(e,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const a=r(e,["epochCount"]);t!==void 0&&a!=null&&s(t,["tuningTask","hyperparameters","epochCount"],a);const l=r(e,["learningRateMultiplier"]);if(l!=null&&s(n,["tuningTask","hyperparameters","learningRateMultiplier"],l),r(e,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(r(e,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");const u=r(e,["batchSize"]);t!==void 0&&u!=null&&s(t,["tuningTask","hyperparameters","batchSize"],u);const d=r(e,["learningRate"]);return t!==void 0&&d!=null&&s(t,["tuningTask","hyperparameters","learningRate"],d),n}function Tf(o,e){const t={},n=r(e,["baseModel"]);n!=null&&s(t,["baseModel"],n);const i=r(e,["trainingDataset"]);i!=null&&s(t,["tuningTask","trainingData"],yf(o,i));const a=r(e,["config"]);return a!=null&&s(t,["config"],vf(o,a,t)),t}function Cf(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],n);const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function _f(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const a=r(e,["pageToken"]);t!==void 0&&a!=null&&s(t,["_query","pageToken"],a);const l=r(e,["filter"]);return t!==void 0&&l!=null&&s(t,["_query","filter"],l),n}function xf(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],_f(o,n,t)),t}function Ef(o,e,t){const n={},i=r(e,["gcsUri"]);if(t!==void 0&&i!=null&&s(t,["supervisedTuningSpec","trainingDatasetUri"],i),r(e,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return n}function wf(o,e){const t={},n=r(e,["gcsUri"]);return n!=null&&s(t,["validationDatasetUri"],n),t}function Sf(o,e,t){const n={},i=r(e,["validationDataset"]);t!==void 0&&i!=null&&s(t,["supervisedTuningSpec"],wf(o,i));const a=r(e,["tunedModelDisplayName"]);t!==void 0&&a!=null&&s(t,["tunedModelDisplayName"],a);const l=r(e,["description"]);t!==void 0&&l!=null&&s(t,["description"],l);const u=r(e,["epochCount"]);t!==void 0&&u!=null&&s(t,["supervisedTuningSpec","hyperParameters","epochCount"],u);const d=r(e,["learningRateMultiplier"]);t!==void 0&&d!=null&&s(t,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],d);const c=r(e,["exportLastCheckpointOnly"]);t!==void 0&&c!=null&&s(t,["supervisedTuningSpec","exportLastCheckpointOnly"],c);const f=r(e,["adapterSize"]);if(t!==void 0&&f!=null&&s(t,["supervisedTuningSpec","hyperParameters","adapterSize"],f),r(e,["batchSize"])!==void 0)throw new Error("batchSize parameter is not supported in Vertex AI.");if(r(e,["learningRate"])!==void 0)throw new Error("learningRate parameter is not supported in Vertex AI.");return n}function Af(o,e){const t={},n=r(e,["baseModel"]);n!=null&&s(t,["baseModel"],n);const i=r(e,["trainingDataset"]);i!=null&&s(t,["supervisedTuningSpec","trainingDatasetUri"],Ef(o,i,t));const a=r(e,["config"]);return a!=null&&s(t,["config"],Sf(o,a,t)),t}function Mf(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["model"],n);const i=r(e,["name"]);return i!=null&&s(t,["endpoint"],i),t}function Ho(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["state"]);i!=null&&s(t,["state"],so(o,i));const a=r(e,["createTime"]);a!=null&&s(t,["createTime"],a);const l=r(e,["tuningTask","startTime"]);l!=null&&s(t,["startTime"],l);const u=r(e,["tuningTask","completeTime"]);u!=null&&s(t,["endTime"],u);const d=r(e,["updateTime"]);d!=null&&s(t,["updateTime"],d);const c=r(e,["description"]);c!=null&&s(t,["description"],c);const f=r(e,["baseModel"]);f!=null&&s(t,["baseModel"],f);const p=r(e,["_self"]);p!=null&&s(t,["tunedModel"],Mf(o,p));const m=r(e,["distillationSpec"]);m!=null&&s(t,["distillationSpec"],m);const h=r(e,["experiment"]);h!=null&&s(t,["experiment"],h);const g=r(e,["labels"]);g!=null&&s(t,["labels"],g);const v=r(e,["pipelineJob"]);v!=null&&s(t,["pipelineJob"],v);const x=r(e,["serviceAccount"]);x!=null&&s(t,["serviceAccount"],x);const M=r(e,["tunedModelDisplayName"]);return M!=null&&s(t,["tunedModelDisplayName"],M),t}function If(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["tunedModels"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(l=>Ho(o,l))),s(t,["tuningJobs"],a)}return t}function Rf(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["metadata"]);i!=null&&s(t,["metadata"],i);const a=r(e,["done"]);a!=null&&s(t,["done"],a);const l=r(e,["error"]);return l!=null&&s(t,["error"],l),t}function kf(o,e){const t={},n=r(e,["checkpointId"]);n!=null&&s(t,["checkpointId"],n);const i=r(e,["epoch"]);i!=null&&s(t,["epoch"],i);const a=r(e,["step"]);a!=null&&s(t,["step"],a);const l=r(e,["endpoint"]);return l!=null&&s(t,["endpoint"],l),t}function Nf(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["model"],n);const i=r(e,["endpoint"]);i!=null&&s(t,["endpoint"],i);const a=r(e,["checkpoints"]);if(a!=null){let l=a;Array.isArray(l)&&(l=l.map(u=>kf(o,u))),s(t,["checkpoints"],l)}return t}function Pt(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["state"]);i!=null&&s(t,["state"],so(o,i));const a=r(e,["createTime"]);a!=null&&s(t,["createTime"],a);const l=r(e,["startTime"]);l!=null&&s(t,["startTime"],l);const u=r(e,["endTime"]);u!=null&&s(t,["endTime"],u);const d=r(e,["updateTime"]);d!=null&&s(t,["updateTime"],d);const c=r(e,["error"]);c!=null&&s(t,["error"],c);const f=r(e,["description"]);f!=null&&s(t,["description"],f);const p=r(e,["baseModel"]);p!=null&&s(t,["baseModel"],p);const m=r(e,["tunedModel"]);m!=null&&s(t,["tunedModel"],Nf(o,m));const h=r(e,["supervisedTuningSpec"]);h!=null&&s(t,["supervisedTuningSpec"],h);const g=r(e,["tuningDataStats"]);g!=null&&s(t,["tuningDataStats"],g);const v=r(e,["encryptionSpec"]);v!=null&&s(t,["encryptionSpec"],v);const x=r(e,["partnerModelTuningSpec"]);x!=null&&s(t,["partnerModelTuningSpec"],x);const M=r(e,["distillationSpec"]);M!=null&&s(t,["distillationSpec"],M);const R=r(e,["experiment"]);R!=null&&s(t,["experiment"],R);const k=r(e,["labels"]);k!=null&&s(t,["labels"],k);const V=r(e,["pipelineJob"]);V!=null&&s(t,["pipelineJob"],V);const E=r(e,["serviceAccount"]);E!=null&&s(t,["serviceAccount"],E);const A=r(e,["tunedModelDisplayName"]);return A!=null&&s(t,["tunedModelDisplayName"],A),t}function Pf(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["tuningJobs"]);if(i!=null){let a=i;Array.isArray(a)&&(a=a.map(l=>Pt(o,l))),s(t,["tuningJobs"],a)}return t}/**
211
+ * @license
212
+ * Copyright 2025 Google LLC
213
+ * SPDX-License-Identifier: Apache-2.0
214
+ */class Df extends Se{constructor(e){super(),this.apiClient=e,this.get=async t=>await this.getInternal(t),this.list=async(t={})=>new ot(Ie.PAGED_ITEM_TUNING_JOBS,n=>this.listInternal(n),await this.listInternal(t),t),this.tune=async t=>{if(this.apiClient.isVertexAI())return await this.tuneInternal(t);{const n=await this.tuneMldevInternal(t);let i="";return n.metadata!==void 0&&n.metadata.tunedModel!==void 0?i=n.metadata.tunedModel:n.name!==void 0&&n.name.includes("/operations/")&&(i=n.name.split("/operations/")[0]),{name:i,state:vt.JOB_STATE_QUEUED}}}}async getInternal(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=Cf(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>Pt(this.apiClient,f))}else{const c=pf(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>Ho(this.apiClient,f))}}async listInternal(e){var t,n,i,a;let l,u="",d={};if(this.apiClient.isVertexAI()){const c=xf(this.apiClient,e);return u=I("tuningJobs",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(f=>f.json()),l.then(f=>{const p=Pf(this.apiClient,f),m=new Yn;return Object.assign(m,p),m})}else{const c=hf(this.apiClient,e);return u=I("tunedModels",c._url),d=c._query,delete c.config,delete c._url,delete c._query,l=this.apiClient.request({path:u,queryParams:d,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(a=e.config)===null||a===void 0?void 0:a.abortSignal}).then(f=>f.json()),l.then(f=>{const p=If(this.apiClient,f),m=new Yn;return Object.assign(m,p),m})}}async tuneInternal(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI()){const u=Af(this.apiClient,e);return a=I("tuningJobs",u._url),l=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(d=>d.json()),i.then(d=>Pt(this.apiClient,d))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(e){var t,n;let i,a="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=Tf(this.apiClient,e);return a=I("tunedModels",u._url),l=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:a,queryParams:l,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(n=e.config)===null||n===void 0?void 0:n.abortSignal}).then(d=>d.json()),i.then(d=>Rf(this.apiClient,d))}}}/**
215
+ * @license
216
+ * Copyright 2025 Google LLC
217
+ * SPDX-License-Identifier: Apache-2.0
218
+ */class bf{async download(e,t){throw new Error("Download to file is not supported in the browser, please use a browser compliant download like an <a> tag.")}}const Lf=1024*1024*8,Vf=3,Ff=1e3,Uf=2,Dt="x-goog-upload-status";async function Gf(o,e,t){var n,i,a;let l=0,u=0,d=new Tt(new Response),c="upload";for(l=o.size;u<l;){const p=Math.min(Lf,l-u),m=o.slice(u,u+p);u+p>=l&&(c+=", finalize");let h=0,g=Ff;for(;h<Vf&&(d=await t.request({path:"",body:m,httpMethod:"POST",httpOptions:{apiVersion:"",baseUrl:e,headers:{"X-Goog-Upload-Command":c,"X-Goog-Upload-Offset":String(u),"Content-Length":String(p)}}}),!(!((n=d==null?void 0:d.headers)===null||n===void 0)&&n[Dt]));)h++,await qf(g),g=g*Uf;if(u+=p,((i=d==null?void 0:d.headers)===null||i===void 0?void 0:i[Dt])!=="active")break;if(l<=u)throw new Error("All content has been uploaded, but the upload status is not finalized.")}const f=await(d==null?void 0:d.json());if(((a=d==null?void 0:d.headers)===null||a===void 0?void 0:a[Dt])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return f.file}async function Bf(o){return{size:o.size,type:o.type}}function qf(o){return new Promise(e=>setTimeout(e,o))}class $f{async upload(e,t,n){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await Gf(e,t,n)}async stat(e){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await Bf(e)}}/**
219
+ * @license
220
+ * Copyright 2025 Google LLC
221
+ * SPDX-License-Identifier: Apache-2.0
222
+ */class Of{create(e,t,n){return new Hf(e,t,n)}}class Hf{constructor(e,t,n){this.url=e,this.headers=t,this.callbacks=n}connect(){this.ws=new WebSocket(this.url),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(e){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.send(e)}close(){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.close()}}/**
223
+ * @license
224
+ * Copyright 2025 Google LLC
225
+ * SPDX-License-Identifier: Apache-2.0
226
+ */const Jo="x-goog-api-key";class Jf{constructor(e){this.apiKey=e}async addAuthHeaders(e){if(e.get(Jo)===null){if(this.apiKey.startsWith("auth_tokens/"))throw new Error("Ephemeral tokens are only supported by the live API.");if(!this.apiKey)throw new Error("API key is missing. Please provide a valid API key.");e.append(Jo,this.apiKey)}}}/**
227
+ * @license
228
+ * Copyright 2025 Google LLC
229
+ * SPDX-License-Identifier: Apache-2.0
230
+ */const zf="gl-node/";class Wf{constructor(e){var t;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(t=e.vertexai)!==null&&t!==void 0?t:!1,this.apiKey=e.apiKey;const n=Qi(e,void 0,void 0);n&&(e.httpOptions?e.httpOptions.baseUrl=n:e.httpOptions={baseUrl:n}),this.apiVersion=e.apiVersion;const i=new Jf(this.apiKey);this.apiClient=new ad({auth:i,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:e.httpOptions,userAgentExtra:zf+"web",uploader:new $f,downloader:new bf}),this.models=new wd(this.apiClient),this.live=new Td(this.apiClient,i,new Of),this.chats=new ws(this.models,this.apiClient),this.caches=new _s(this.apiClient),this.files=new Fs(this.apiClient),this.operations=new Ld(this.apiClient),this.authTokens=new ff(this.apiClient),this.tunings=new Df(this.apiClient)}}const bt=[{id:"bp1",name:"Order to Cash",capabilities:[{id:"cap1",name:"Order Management",cycles:[{id:"cyc1",name:"Standard Order Processing",type:"cycle",practices:[{id:"pra1",name:"Validate Customer Credit",type:"practice"},{id:"pra3",name:"Check Inventory Availability",type:"practice"}]},{id:"cyc2",name:"Returns Management",type:"cycle",practices:[{id:"pra4",name:"Issue Return Material Auth",type:"practice"}]}]},{id:"cap2",name:"Invoicing & Collections",cycles:[{id:"cyc3",name:"Automated Billing Cycle",type:"cycle",practices:[]}]}]},{id:"bp2",name:"Hire to Retire",capabilities:[{id:"cap3",name:"Talent Acquisition",cycles:[{id:"cyc4",name:"Recruitment Funnel",type:"cycle",practices:[{id:"pra2",name:"Interview Evaluation",type:"practice"},{id:"pra5",name:"Background Verification",type:"practice"}]}]}]}],zo=`<?xml version="1.0" encoding="UTF-8"?>
231
+ <bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
232
+ <bpmn:process id="Process_1" isExecutable="false">
233
+ <bpmn:startEvent id="StartEvent_1" name="Start" />
234
+ </bpmn:process>
235
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
236
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
237
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
238
+ <dc:Bounds x="173" y="102" width="36" height="36" />
239
+ </bpmndi:BPMNShape>
240
+ </bpmndi:BPMNPlane>
241
+ </bpmndi:BPMNDiagram>
242
+ </bpmn:definitions>`,Yf=()=>{const[o,e]=J.useState("dashboard"),[t,n]=J.useState(bt[0].id),[i,a]=J.useState(null),l=J.useRef(null),u=J.useRef(null),[d,c]=J.useState(!0),[f,p]=J.useState(""),[m,h]=J.useState(!1),[g,v]=J.useState("");J.useEffect(()=>{if(o==="designer"&&l.current){const E=setTimeout(()=>{!u.current&&l.current&&(u.current=new BpmnJS({container:l.current}),u.current.importXML(zo).catch(console.error))},50);return()=>clearTimeout(E)}return()=>{if(u.current){try{u.current.destroy()}catch(E){console.warn("Modeler destruction warning",E)}u.current=null}}},[o]);const x=E=>{a(E),e("designer")},M=()=>{e("dashboard"),a(null),p(""),v(""),h(!1)},R=async()=>{if(u.current)try{const{xml:E}=await u.current.saveXML({format:!0}),A=new Blob([E],{type:"application/xml"}),P=document.createElement("a");P.href=URL.createObjectURL(A),P.download=`${(i==null?void 0:i.name.replace(/\s+/g,"_"))||"process"}.bpmn`,P.click()}catch(E){console.error("Error exporting BPMN",E)}},k=async()=>{if(!(!f.trim()||!u.current)){h(!0),v("Drafting flow...");try{let P=(await new Wf({apiKey:"PLACEHOLDER_API_KEY"}).models.generateContent({model:"gemini-3-flash-preview",contents:`Generate a valid BPMN 2.0 XML for a ${i==null?void 0:i.type} named "${i==null?void 0:i.name}". Specific requirements: "${f}". Return ONLY the raw XML code.`})).text||"";P=P.replace(/^```xml\n/,"").replace(/\n```$/,"").trim(),P.includes("<bpmn:definitions")?(await u.current.importXML(P),v("Import successful!"),p("")):v("Generated invalid XML.")}catch(E){console.error("AI Generation error",E),v("Generation failed.")}finally{h(!1),setTimeout(()=>v(""),3e3)}}},V=(E,A)=>{if(!u.current)return;const P=u.current.get("elementFactory"),O=u.current.get("create");let b=P.createShape({type:A});b&&O.start(E,b)};if(o==="dashboard"){const E=bt.find(A=>A.id===t);return C.jsxs("div",{className:"min-h-screen bg-slate-50 text-slate-900",children:[C.jsx("header",{className:"bg-white border-b border-slate-200 px-8 py-6",children:C.jsxs("div",{className:"max-w-7xl mx-auto flex justify-between items-center",children:[C.jsxs("div",{children:[C.jsxs("h1",{className:"text-2xl font-bold tracking-tight text-slate-900 flex items-center gap-2",children:[C.jsx(ri,{className:"text-indigo-600"}),"Enterprise Blueprint"]}),C.jsx("p",{className:"text-slate-500 text-sm",children:"Organize processes, capabilities, and work cycles."})]}),C.jsxs("button",{className:"bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-indigo-700 transition-colors flex items-center gap-2 shadow-sm",children:[C.jsx(fi,{size:18})," New Process"]})]})}),C.jsx("div",{className:"bg-white border-b border-slate-200 sticky top-0 z-10",children:C.jsx("div",{className:"max-w-7xl mx-auto flex gap-8 px-8",children:bt.map(A=>C.jsx("button",{onClick:()=>n(A.id),className:`py-4 text-sm font-semibold border-b-2 transition-all ${t===A.id?"border-indigo-600 text-indigo-600":"border-transparent text-slate-500 hover:text-slate-700"}`,children:A.name},A.id))})}),C.jsx("main",{className:"max-w-7xl mx-auto p-8",children:C.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:E==null?void 0:E.capabilities.map(A=>C.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 shadow-sm overflow-hidden flex flex-col h-fit",children:[C.jsxs("div",{className:"p-6 border-b border-slate-100 bg-slate-50/50",children:[C.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2 text-slate-800",children:[C.jsx(hi,{className:"text-indigo-500 w-5 h-5"}),A.name]}),C.jsx("span",{className:"text-xs font-semibold text-slate-400 uppercase tracking-widest mt-1 block",children:"Capability"})]}),C.jsxs("div",{className:"p-6 space-y-4",children:[C.jsxs("h4",{className:"text-xs font-bold text-slate-400 uppercase tracking-wider mb-2 flex items-center gap-2",children:[C.jsx($t,{size:14})," Work Cycles & Practices"]}),C.jsx("div",{className:"space-y-4",children:A.cycles.map(P=>C.jsxs("div",{className:"rounded-xl border border-slate-100 overflow-hidden bg-white shadow-sm",children:[C.jsxs("div",{className:"flex items-center justify-between p-3 bg-slate-50/50 group border-b border-slate-100",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx($t,{size:14,className:"text-indigo-400"}),C.jsx("span",{className:"text-sm font-bold text-slate-800",children:P.name})]}),C.jsx("button",{onClick:()=>x(P),className:"text-[10px] font-bold text-indigo-600 bg-indigo-100 px-2 py-1 rounded hover:bg-indigo-200 transition-colors uppercase tracking-tight",children:"Design Cycle"})]}),C.jsx("div",{className:"p-2 space-y-1",children:P.practices.length>0?P.practices.map(O=>C.jsxs("div",{className:"flex items-center justify-between p-2 pl-4 rounded-lg hover:bg-indigo-50/50 group transition-all",children:[C.jsxs("div",{className:"flex items-center gap-2",children:[C.jsx(ci,{size:12,className:"text-slate-300"}),C.jsx("span",{className:"text-xs font-medium text-slate-600",children:O.name})]}),C.jsxs("button",{onClick:()=>x(O),className:"text-[10px] font-semibold text-slate-400 opacity-0 group-hover:opacity-100 hover:text-indigo-600 flex items-center gap-1 transition-all",children:["Design Practice ",C.jsx(He,{size:10})]})]},O.id)):C.jsx("div",{className:"py-2 px-4 text-[10px] italic text-slate-400",children:"No practices defined for this cycle."})})]},P.id))})]})]},A.id))})})]})}return C.jsxs("div",{className:"flex h-screen w-full bg-white overflow-hidden text-slate-800",children:[C.jsxs("div",{className:`${d?"w-80":"w-0"} transition-all duration-300 border-r border-slate-200 bg-slate-50 flex flex-col relative z-20 shadow-xl`,children:[d&&C.jsxs("div",{className:"flex-1 flex flex-col p-6 overflow-y-auto w-80",children:[C.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[C.jsx("button",{onClick:E=>{E.preventDefault(),M()},className:"p-2 hover:bg-slate-200 rounded-lg transition-colors mr-1 flex items-center justify-center text-slate-600 hover:text-indigo-600 active:scale-95 cursor-pointer",title:"Back to Dashboard",children:C.jsx(ii,{size:18})}),C.jsx("h1",{className:"font-bold text-lg tracking-tight text-slate-900 truncate",children:i==null?void 0:i.name})]}),C.jsxs("div",{className:"space-y-6",children:[C.jsxs("section",{children:[C.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-slate-400 mb-4 flex items-center gap-2",children:"Palette"}),C.jsx("div",{className:"grid grid-cols-1 gap-2",children:[{type:"bpmn:StartEvent",icon:C.jsx(li,{size:18}),label:"Start",color:"bg-green-50 text-green-600"},{type:"bpmn:Task",icon:C.jsx(mi,{size:18}),label:"Task",color:"bg-slate-100 text-slate-600"},{type:"bpmn:IntermediateCatchEvent",icon:C.jsx(di,{size:18}),label:"Event",color:"bg-blue-50 text-blue-600"},{type:"bpmn:EndEvent",icon:C.jsx(ai,{size:18}),label:"End",color:"bg-red-50 text-red-600"}].map(E=>C.jsxs("div",{onMouseDown:A=>V(A,E.type),className:"flex items-center gap-3 p-3 bg-white border border-slate-200 rounded-xl cursor-grab hover:border-indigo-400 hover:shadow-sm transition-all group",children:[C.jsx("div",{className:`p-2 rounded-lg ${E.color}`,children:E.icon}),C.jsx("span",{className:"text-sm font-medium",children:E.label})]},E.type))})]}),C.jsx("hr",{className:"border-slate-200"}),C.jsxs("section",{children:[C.jsxs("label",{className:"block text-xs font-bold uppercase tracking-wider text-slate-400 mb-3 flex items-center gap-2",children:[C.jsx(pi,{className:"w-3 h-3 text-indigo-500"}),"AI Architect"]}),C.jsx("textarea",{className:"w-full h-24 p-3 text-sm border border-slate-300 rounded-xl focus:ring-2 focus:ring-indigo-500 bg-white outline-none resize-none transition-all",placeholder:"Ask AI to draft this process...",value:f,onChange:E=>p(E.target.value)}),C.jsx("button",{onClick:k,disabled:m||!f.trim(),className:"w-full mt-2 bg-indigo-600 hover:bg-indigo-700 disabled:bg-slate-300 text-white font-medium py-2 rounded-xl flex items-center justify-center gap-2 transition-all shadow-md active:scale-95",children:m?"Drafting...":"Generate Flow"}),g&&C.jsx("p",{className:"mt-2 text-[10px] text-center font-medium text-indigo-600",children:g})]}),C.jsx("section",{className:"mt-auto space-y-3 pt-6 border-t border-slate-200",children:C.jsxs("button",{onClick:()=>{u.current&&u.current.importXML(zo)},className:"w-full flex items-center gap-2 p-2 text-red-500 hover:bg-red-50 rounded-lg text-xs font-medium transition-all",children:[C.jsx(gi,{size:14})," Reset Canvas"]})})]})]}),C.jsx("button",{onClick:()=>c(!d),className:"absolute -right-4 top-1/2 -translate-y-1/2 bg-white border border-slate-200 rounded-full p-1 shadow-md hover:text-indigo-600 transition-all z-50",children:d?C.jsx(si,{size:20}):C.jsx(He,{size:20})})]}),C.jsxs("div",{className:"flex-1 relative flex flex-col min-w-0",children:[C.jsxs("header",{className:"h-14 border-b border-slate-200 flex items-center justify-between px-6 bg-white/80 backdrop-blur-md z-10",children:[C.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[C.jsx("span",{className:"text-slate-400",children:"Architecture"}),C.jsx(He,{size:12,className:"text-slate-300"}),C.jsx("span",{className:"text-slate-400 uppercase tracking-tighter",children:(i==null?void 0:i.type)==="cycle"?"Cycle":"Practice"}),C.jsx(He,{size:12,className:"text-slate-300"}),C.jsx("span",{className:"text-slate-900 font-bold",children:i==null?void 0:i.name})]}),C.jsx("div",{className:"flex gap-2",children:C.jsxs("button",{onClick:R,className:"text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 px-4 py-2 rounded-lg shadow-sm flex items-center gap-2 transition-all active:scale-95",children:[C.jsx(ui,{size:14})," Export BPMN"]})})]}),C.jsxs("div",{className:"flex-1 relative overflow-hidden bg-white",children:[C.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(#e5e7eb_1px,transparent_1px)] [background-size:24px_24px] pointer-events-none opacity-40"}),C.jsx("div",{ref:l,className:"h-full w-full bpmn-io-style relative"})]})]})]})};fe.BpmnFlowDesigner=Yf,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})}));