@cravern/bpmn-flow-designer 1.0.10 → 1.0.12

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.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(fe,Z){typeof exports=="object"&&typeof module<"u"?Z(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],Z):(fe=typeof globalThis<"u"?globalThis:fe||self,Z(fe.BPMNFlowDesigner={},fe.React))})(this,(function(fe,Z){"use strict";var Oe={exports:{}},De={};/**
1
+ (function(le,Z){typeof exports=="object"&&typeof module<"u"?Z(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],Z):(le=typeof globalThis<"u"?globalThis:le||self,Z(le.BPMNFlowDesigner={},le.React))})(this,(function(le,Z){"use strict";var Oe={exports:{}},De={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Vt;function Ko(){if(Vt)return De;Vt=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,l){var a=null;if(l!==void 0&&(a=""+l),i.key!==void 0&&(a=""+i.key),"key"in i){l={};for(var u in i)u!=="key"&&(l[u]=i[u])}else l=i;return i=l.ref,{$$typeof:o,type:n,key:a,ref:i!==void 0?i:null,props:l}}return De.Fragment=e,De.jsx=t,De.jsxs=t,De}var Le={};/**
9
+ */var Vt;function Xo(){if(Vt)return De;Vt=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,l){var a=null;if(l!==void 0&&(a=""+l),i.key!==void 0&&(a=""+i.key),"key"in i){l={};for(var u in i)u!=="key"&&(l[u]=i[u])}else l=i;return i=l.ref,{$$typeof:o,type:n,key:a,ref:i!==void 0?i:null,props:l}}return De.Fragment=e,De.jsx=t,De.jsxs=t,De}var Le={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,42 +14,42 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ft;function Xo(){return Ft||(Ft=1,process.env.NODE_ENV!=="production"&&(function(){function o(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===X?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case E:return"Fragment";case _:return"Profiler";case M:return"StrictMode";case V:return"Suspense";case B:return"SuspenseList";case G: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 R:return y.displayName||"Context";case A:return(y._context.displayName||"Context")+".Consumer";case k:var F=y.render;return y=y.displayName,y||(y=F.displayName||F.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case J:return F=y.displayName||null,F!==null?F:o(y.type)||"Memo";case D: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 O=F.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&y[Symbol.toStringTag]||y.constructor.name||"Object";return O.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===E)return"<>";if(typeof y=="object"&&y!==null&&y.$$typeof===D)return"<...>";try{var F=o(y);return F?"<"+F+">":"<...>"}catch{return"<...>"}}function i(){var y=Ne.A;return y===null?null:y.getOwner()}function l(){return Error("react-stack-top-frame")}function a(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 O(){Jo||(Jo=!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))}O.isReactWarning=!0,Object.defineProperty(y,"key",{get:O,configurable:!0})}function d(){var y=o(this.type);return Wo[y]||(Wo[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,O,W,lt,Dt){var Y=O.ref;return y={$$typeof:g,type:y,key:F,props:O,_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:Dt}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y}function f(y,F,O,W,lt,Dt){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 ke=Object.keys(F).filter(function(Hf){return Hf!=="key"});W=0<ke.length?"{key: someKey, "+ke.join(": ..., ")+": ...}":"{key: someKey}",zo[Y+W]||(ke=0<ke.length?"{"+ke.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var Ft;function Qo(){return Ft||(Ft=1,process.env.NODE_ENV!=="production"&&(function(){function o(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===X?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case E:return"Fragment";case _:return"Profiler";case M:return"StrictMode";case V:return"Suspense";case B:return"SuspenseList";case G: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 R:return y.displayName||"Context";case A:return(y._context.displayName||"Context")+".Consumer";case k:var F=y.render;return y=y.displayName,y||(y=F.displayName||F.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case J:return F=y.displayName||null,F!==null?F:o(y.type)||"Memo";case D: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 O=F.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&y[Symbol.toStringTag]||y.constructor.name||"Object";return O.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===E)return"<>";if(typeof y=="object"&&y!==null&&y.$$typeof===D)return"<...>";try{var F=o(y);return F?"<"+F+">":"<...>"}catch{return"<...>"}}function i(){var y=Ne.A;return y===null?null:y.getOwner()}function l(){return Error("react-stack-top-frame")}function a(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 O(){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))}O.isReactWarning=!0,Object.defineProperty(y,"key",{get:O,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,O,W,lt,Dt){var Y=O.ref;return y={$$typeof:g,type:y,key:F,props:O,_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:Dt}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y}function f(y,F,O,W,lt,Dt){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 ke=Object.keys(F).filter(function(Hf){return Hf!=="key"});W=0<ke.length?"{key: someKey, "+ke.join(": ..., ")+": ...}":"{key: someKey}",Ko[Y+W]||(ke=0<ke.length?"{"+ke.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,W,Y,ke,Y),zo[Y+W]=!0)}if(Y=null,O!==void 0&&(t(O),Y=""+O),a(F)&&(t(F.key),Y=""+F.key),"key"in F){O={};for(var Lt in F)Lt!=="key"&&(O[Lt]=F[Lt])}else O=F;return Y&&u(O,typeof y=="function"?y.displayName||y.name||"Unknown":y),c(y,Y,O,i(),lt,Dt)}function p(y){m(y)?y._store&&(y._store.validated=1):typeof y=="object"&&y!==null&&y.$$typeof===D&&(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=Z,g=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),R=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),X=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 Jo,Wo={},Yo=h.react_stack_bottom_frame.bind(h,l)(),Zo=ye(n(l)),zo={};Le.Fragment=E,Le.jsx=function(y,F,O){var W=1e4>Ne.recentlyCreatedOwnerStacks++;return f(y,F,O,!1,W?Error("react-stack-top-frame"):Yo,W?ye(n(y)):Zo)},Le.jsxs=function(y,F,O){var W=1e4>Ne.recentlyCreatedOwnerStacks++;return f(y,F,O,!0,W?Error("react-stack-top-frame"):Yo,W?ye(n(y)):Zo)}})()),Le}var Ut;function Qo(){return Ut||(Ut=1,process.env.NODE_ENV==="production"?Oe.exports=Ko():Oe.exports=Xo()),Oe.exports}var w=Qo();/**
22
+ <%s key={someKey} {...props} />`,W,Y,ke,Y),Ko[Y+W]=!0)}if(Y=null,O!==void 0&&(t(O),Y=""+O),a(F)&&(t(F.key),Y=""+F.key),"key"in F){O={};for(var Lt in F)Lt!=="key"&&(O[Lt]=F[Lt])}else O=F;return Y&&u(O,typeof y=="function"?y.displayName||y.name||"Unknown":y),c(y,Y,O,i(),lt,Dt)}function p(y){m(y)?y._store&&(y._store.validated=1):typeof y=="object"&&y!==null&&y.$$typeof===D&&(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=Z,g=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),R=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),X=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,l)(),zo=ye(n(l)),Ko={};Le.Fragment=E,Le.jsx=function(y,F,O){var W=1e4>Ne.recentlyCreatedOwnerStacks++;return f(y,F,O,!1,W?Error("react-stack-top-frame"):Zo,W?ye(n(y)):zo)},Le.jsxs=function(y,F,O){var W=1e4>Ne.recentlyCreatedOwnerStacks++;return f(y,F,O,!0,W?Error("react-stack-top-frame"):Zo,W?ye(n(y)):zo)}})()),Le}var Ut;function jo(){return Ut||(Ut=1,process.env.NODE_ENV==="production"?Oe.exports=Xo():Oe.exports=Qo()),Oe.exports}var w=jo();/**
23
23
  * @license lucide-react v0.460.0 - ISC
24
24
  *
25
25
  * This source code is licensed under the ISC license.
26
26
  * See the LICENSE file in the root directory of this source tree.
27
- */const jo=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bt=(...o)=>o.filter((e,t,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===t).join(" ").trim();/**
27
+ */const ei=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bt=(...o)=>o.filter((e,t,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===t).join(" ").trim();/**
28
28
  * @license lucide-react v0.460.0 - ISC
29
29
  *
30
30
  * This source code is licensed under the ISC license.
31
31
  * See the LICENSE file in the root directory of this source tree.
32
- */var ei={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"};/**
32
+ */var ti={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"};/**
33
33
  * @license lucide-react v0.460.0 - ISC
34
34
  *
35
35
  * This source code is licensed under the ISC license.
36
36
  * See the LICENSE file in the root directory of this source tree.
37
- */const ti=Z.forwardRef(({color:o="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:n,className:i="",children:l,iconNode:a,...u},d)=>Z.createElement("svg",{ref:d,...ei,width:e,height:e,stroke:o,strokeWidth:n?Number(t)*24/Number(e):t,className:bt("lucide",i),...u},[...a.map(([c,f])=>Z.createElement(c,f)),...Array.isArray(l)?l:[l]]));/**
37
+ */const ni=Z.forwardRef(({color:o="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:n,className:i="",children:l,iconNode:a,...u},d)=>Z.createElement("svg",{ref:d,...ti,width:e,height:e,stroke:o,strokeWidth:n?Number(t)*24/Number(e):t,className:bt("lucide",i),...u},[...a.map(([c,f])=>Z.createElement(c,f)),...Array.isArray(l)?l:[l]]));/**
38
38
  * @license lucide-react v0.460.0 - ISC
39
39
  *
40
40
  * This source code is licensed under the ISC license.
41
41
  * See the LICENSE file in the root directory of this source tree.
42
- */const ee=(o,e)=>{const t=Z.forwardRef(({className:n,...i},l)=>Z.createElement(ti,{ref:l,iconNode:e,className:bt(`lucide-${jo(o)}`,n),...i}));return t.displayName=`${o}`,t};/**
42
+ */const ee=(o,e)=>{const t=Z.forwardRef(({className:n,...i},l)=>Z.createElement(ni,{ref:l,iconNode:e,className:bt(`lucide-${ei(o)}`,n),...i}));return t.displayName=`${o}`,t};/**
43
43
  * @license lucide-react v0.460.0 - ISC
44
44
  *
45
45
  * This source code is licensed under the ISC license.
46
46
  * See the LICENSE file in the root directory of this source tree.
47
- */const ni=ee("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
47
+ */const oi=ee("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
48
48
  * @license lucide-react v0.460.0 - ISC
49
49
  *
50
50
  * This source code is licensed under the ISC license.
51
51
  * See the LICENSE file in the root directory of this source tree.
52
- */const oi=ee("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
52
+ */const ii=ee("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
53
53
  * @license lucide-react v0.460.0 - ISC
54
54
  *
55
55
  * This source code is licensed under the ISC license.
@@ -59,27 +59,27 @@ React keys must be passed directly to JSX without using spread:
59
59
  *
60
60
  * This source code is licensed under the ISC license.
61
61
  * See the LICENSE file in the root directory of this source tree.
62
- */const ii=ee("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"}]]);/**
62
+ */const ri=ee("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"}]]);/**
63
63
  * @license lucide-react v0.460.0 - ISC
64
64
  *
65
65
  * This source code is licensed under the ISC license.
66
66
  * See the LICENSE file in the root directory of this source tree.
67
- */const ri=ee("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
67
+ */const si=ee("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
68
68
  * @license lucide-react v0.460.0 - ISC
69
69
  *
70
70
  * This source code is licensed under the ISC license.
71
71
  * See the LICENSE file in the root directory of this source tree.
72
- */const si=ee("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"}]]);/**
72
+ */const li=ee("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"}]]);/**
73
73
  * @license lucide-react v0.460.0 - ISC
74
74
  *
75
75
  * This source code is licensed under the ISC license.
76
76
  * See the LICENSE file in the root directory of this source tree.
77
- */const li=ee("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
77
+ */const ai=ee("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
78
78
  * @license lucide-react v0.460.0 - ISC
79
79
  *
80
80
  * This source code is licensed under the ISC license.
81
81
  * See the LICENSE file in the root directory of this source tree.
82
- */const ai=ee("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"}]]);/**
82
+ */const ui=ee("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"}]]);/**
83
83
  * @license lucide-react v0.460.0 - ISC
84
84
  *
85
85
  * This source code is licensed under the ISC license.
@@ -89,16 +89,16 @@ React keys must be passed directly to JSX without using spread:
89
89
  *
90
90
  * This source code is licensed under the ISC license.
91
91
  * See the LICENSE file in the root directory of this source tree.
92
- */const ui=ee("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
92
+ */const ci=ee("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
93
93
  * @license lucide-react v0.460.0 - ISC
94
94
  *
95
95
  * This source code is licensed under the ISC license.
96
96
  * See the LICENSE file in the root directory of this source tree.
97
- */const ci=ee("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 b;(function(o){o.assertEqual=i=>{};function e(i){}o.assertIs=e;function t(i){throw new Error}o.assertNever=t,o.arrayToEnum=i=>{const l={};for(const a of i)l[a]=a;return l},o.getValidEnumValues=i=>{const l=o.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),a={};for(const u of l)a[u]=i[u];return o.objectValues(a)},o.objectValues=i=>o.objectKeys(i).map(function(l){return i[l]}),o.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const l=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&l.push(a);return l},o.find=(i,l)=>{for(const a of i)if(l(a))return a},o.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,l=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(l)}o.joinValues=n,o.jsonStringifyReplacer=(i,l)=>typeof l=="bigint"?l.toString():l})(b||(b={}));var qt;(function(o){o.mergeShapes=(e,t)=>({...e,...t})})(qt||(qt={}));const S=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),le=o=>{switch(typeof o){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(o)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(o)?S.array:o===null?S.null:o.then&&typeof o.then=="function"&&o.catch&&typeof o.catch=="function"?S.promise:typeof Map<"u"&&o instanceof Map?S.map:typeof Set<"u"&&o instanceof Set?S.set:typeof Date<"u"&&o instanceof Date?S.date:S.object;default:return S.unknown}},T=b.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(l){return l.message},n={_errors:[]},i=l=>{for(const a of l.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let u=n,d=0;for(;d<a.path.length;){const c=a.path[d];d===a.path.length-1?(u[c]=u[c]||{_errors:[]},u[c]._errors.push(t(a))):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,b.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 l=i.path[0];t[l]=t[l]||[],t[l].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 at=(o,e)=>{let t;switch(o.code){case T.invalid_type:o.received===S.undefined?t="Required":t=`Expected ${o.expected}, received ${o.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(o.expected,b.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(o.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(o.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${b.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}"`:b.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,b.assertNever(o)}return{message:t}};let di=at;function fi(){return di}const pi=o=>{const{data:e,path:t,errorMaps:n,issueData:i}=o,l=[...t,...i.path||[]],a={...i,path:l};if(i.message!==void 0)return{...i,path:l,message:i.message};let u="";const d=n.filter(c=>!!c).slice().reverse();for(const c of d)u=c(a,{data:e,defaultError:u}).message;return{...i,path:l,message:u}};function C(o,e){const t=fi(),n=pi({issueData:e,data:o.data,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,t,t===at?void 0:at].filter(i=>!!i)});o.common.issues.push(n)}class z{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 N;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 l=await i.key,a=await i.value;n.push({key:l,value:a})}return z.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:l,value:a}=i;if(l.status==="aborted"||a.status==="aborted")return N;l.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),l.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[l.value]=a.value)}return{status:e.value,value:n}}}const N=Object.freeze({status:"aborted"}),Ve=o=>({status:"dirty",value:o}),Q=o=>({status:"valid",value:o}),$t=o=>o.status==="aborted",Ot=o=>o.status==="dirty",ve=o=>o.status==="valid",He=o=>typeof Promise<"u"&&o instanceof Promise;var x;(function(o){o.errToObj=e=>typeof e=="string"?{message:e}:e||{},o.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(x||(x={}));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 Ht=(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:(a,u)=>{const{message:d}=o;return a.code==="invalid_enum_value"?{message:d??u.defaultError}:typeof u.data>"u"?{message:d??n??u.defaultError}:a.code!=="invalid_type"?{message:u.defaultError}:{message:d??t??u.defaultError}},description:i}}class U{get description(){return this._def.description}_getType(e){return le(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new z,ctx:{common:e.parent.common,data:e.data,parsedType:le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(He(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:le(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Ht(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:le(e)};if(!this["~standard"].async)try{const l=this._parseSync({data:e,path:[],parent:t});return ve(l)?{value:l.value}:{issues:t.common.issues}}catch(l){(i=(n=l==null?void 0:l.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(l=>ve(l)?{value:l.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:le(e)},i=this._parse({data:e,path:n.path,parent:n}),l=await(He(i)?i:Promise.resolve(i));return Ht(n,l)}refine(e,t){const n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,l)=>{const a=e(i),u=()=>l.addIssue({code:T.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(d=>d?!0:(u(),!1)):a?!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 Ee({schema:this,typeName:P.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 Se.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this)}promise(){return ze.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 Ee({...L(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new pt({...L(this._def),innerType:this,defaultValue:t,typeName:P.ZodDefault})}brand(){return new Fi({typeName:P.ZodBranded,type:this,...L(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new mt({...L(this._def),innerType:this,catchValue:t,typeName:P.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ht.create(this,e)}readonly(){return gt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mi=/^c[^\s-]{8,}$/i,hi=/^[0-9a-z]+$/,gi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yi=/^[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,vi=/^[a-z0-9_-]{21}$/i,Ti=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ci=/^[-+]?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)?)??$/,_i=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ei="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ut;const Si=/^(?:(?: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])$/,xi=/^(?:(?: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])$/,Ai=/^(([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]))$/,Mi=/^(([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])$/,Ii=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ri=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Jt="((\\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])))",wi=new RegExp(`^${Jt}$`);function Wt(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 Pi(o){return new RegExp(`^${Wt(o)}$`)}function Ni(o){let e=`${Jt}T${Wt(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 ki(o,e){return!!((e==="v4"||!e)&&Si.test(o)||(e==="v6"||!e)&&Ai.test(o))}function Di(o,e){if(!Ti.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 Li(o,e){return!!((e==="v4"||!e)&&xi.test(o)||(e==="v6"||!e)&&Mi.test(o))}class ie extends U{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.string){const l=this._getOrReturnCtx(e);return C(l,{code:T.invalid_type,expected:S.string,received:l.parsedType}),N}const n=new z;let i;for(const l of this._def.checks)if(l.kind==="min")e.data.length<l.value&&(i=this._getOrReturnCtx(e,i),C(i,{code:T.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),n.dirty());else if(l.kind==="max")e.data.length>l.value&&(i=this._getOrReturnCtx(e,i),C(i,{code:T.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),n.dirty());else if(l.kind==="length"){const a=e.data.length>l.value,u=e.data.length<l.value;(a||u)&&(i=this._getOrReturnCtx(e,i),a?C(i,{code:T.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):u&&C(i,{code:T.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),n.dirty())}else if(l.kind==="email")_i.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"email",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="emoji")ut||(ut=new RegExp(Ei,"u")),ut.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"emoji",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="uuid")yi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"uuid",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="nanoid")vi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"nanoid",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="cuid")mi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"cuid",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="cuid2")hi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"cuid2",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="ulid")gi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"ulid",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),C(i,{validation:"url",code:T.invalid_string,message:l.message}),n.dirty()}else l.kind==="regex"?(l.regex.lastIndex=0,l.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"regex",code:T.invalid_string,message:l.message}),n.dirty())):l.kind==="trim"?e.data=e.data.trim():l.kind==="includes"?e.data.includes(l.value,l.position)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),n.dirty()):l.kind==="toLowerCase"?e.data=e.data.toLowerCase():l.kind==="toUpperCase"?e.data=e.data.toUpperCase():l.kind==="startsWith"?e.data.startsWith(l.value)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:{startsWith:l.value},message:l.message}),n.dirty()):l.kind==="endsWith"?e.data.endsWith(l.value)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:{endsWith:l.value},message:l.message}),n.dirty()):l.kind==="datetime"?Ni(l).test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:"datetime",message:l.message}),n.dirty()):l.kind==="date"?wi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:"date",message:l.message}),n.dirty()):l.kind==="time"?Pi(l).test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:"time",message:l.message}),n.dirty()):l.kind==="duration"?Ci.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"duration",code:T.invalid_string,message:l.message}),n.dirty()):l.kind==="ip"?ki(e.data,l.version)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"ip",code:T.invalid_string,message:l.message}),n.dirty()):l.kind==="jwt"?Di(e.data,l.alg)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"jwt",code:T.invalid_string,message:l.message}),n.dirty()):l.kind==="cidr"?Li(e.data,l.version)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"cidr",code:T.invalid_string,message:l.message}),n.dirty()):l.kind==="base64"?Ii.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"base64",code:T.invalid_string,message:l.message}),n.dirty()):l.kind==="base64url"?Ri.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"base64url",code:T.invalid_string,message:l.message}),n.dirty()):b.assertNever(l);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:T.invalid_string,...x.errToObj(n)})}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...x.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...x.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...x.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,...x.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,...x.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...x.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...x.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...x.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...x.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...x.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...x.errToObj(t)})}nonempty(e){return this.min(1,x.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:P.ZodString,coerce:(o==null?void 0:o.coerce)??!1,...L(o)});function Vi(o,e){const t=(o.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,l=Number.parseInt(o.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return l%a/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)!==S.number){const l=this._getOrReturnCtx(e);return C(l,{code:T.invalid_type,expected:S.number,received:l.parsedType}),N}let n;const i=new z;for(const l of this._def.checks)l.kind==="int"?b.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{code:T.invalid_type,expected:"integer",received:"float",message:l.message}),i.dirty()):l.kind==="min"?(l.inclusive?e.data<l.value:e.data<=l.value)&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.too_small,minimum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?e.data>l.value:e.data>=l.value)&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.too_big,maximum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="multipleOf"?Vi(e.data,l.value)!==0&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):l.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{code:T.not_finite,message:l.message}),i.dirty()):b.assertNever(l);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,n,i){return new pe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:x.toString(i)}]})}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.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"&&b.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:P.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)!==S.bigint)return this._getInvalidInput(e);let n;const i=new z;for(const l of this._def.checks)l.kind==="min"?(l.inclusive?e.data<l.value:e.data<=l.value)&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.too_small,type:"bigint",minimum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?e.data>l.value:e.data>=l.value)&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.too_big,type:"bigint",maximum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="multipleOf"?e.data%l.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):b.assertNever(l);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return C(t,{code:T.invalid_type,expected:S.bigint,received:t.parsedType}),N}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,n,i){return new me({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:x.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:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.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:P.ZodBigInt,coerce:(o==null?void 0:o.coerce)??!1,...L(o)});class Je extends U{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.boolean){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.boolean,received:n.parsedType}),N}return Q(e.data)}}Je.create=o=>new Je({typeName:P.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)!==S.date){const l=this._getOrReturnCtx(e);return C(l,{code:T.invalid_type,expected:S.date,received:l.parsedType}),N}if(Number.isNaN(e.data.getTime())){const l=this._getOrReturnCtx(e);return C(l,{code:T.invalid_date}),N}const n=new z;let i;for(const l of this._def.checks)l.kind==="min"?e.data.getTime()<l.value&&(i=this._getOrReturnCtx(e,i),C(i,{code:T.too_small,message:l.message,inclusive:!0,exact:!1,minimum:l.value,type:"date"}),n.dirty()):l.kind==="max"?e.data.getTime()>l.value&&(i=this._getOrReturnCtx(e,i),C(i,{code:T.too_big,message:l.message,inclusive:!0,exact:!1,maximum:l.value,type:"date"}),n.dirty()):b.assertNever(l);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:x.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:x.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:P.ZodDate,...L(o)});class Yt extends U{_parse(e){if(this._getType(e)!==S.symbol){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.symbol,received:n.parsedType}),N}return Q(e.data)}}Yt.create=o=>new Yt({typeName:P.ZodSymbol,...L(o)});class Zt extends U{_parse(e){if(this._getType(e)!==S.undefined){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.undefined,received:n.parsedType}),N}return Q(e.data)}}Zt.create=o=>new Zt({typeName:P.ZodUndefined,...L(o)});class zt extends U{_parse(e){if(this._getType(e)!==S.null){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.null,received:n.parsedType}),N}return Q(e.data)}}zt.create=o=>new zt({typeName:P.ZodNull,...L(o)});class Kt extends U{constructor(){super(...arguments),this._any=!0}_parse(e){return Q(e.data)}}Kt.create=o=>new Kt({typeName:P.ZodAny,...L(o)});class ct extends U{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Q(e.data)}}ct.create=o=>new ct({typeName:P.ZodUnknown,...L(o)});class ae extends U{_parse(e){const t=this._getOrReturnCtx(e);return C(t,{code:T.invalid_type,expected:S.never,received:t.parsedType}),N}}ae.create=o=>new ae({typeName:P.ZodNever,...L(o)});class Xt extends U{_parse(e){if(this._getType(e)!==S.undefined){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.void,received:n.parsedType}),N}return Q(e.data)}}Xt.create=o=>new Xt({typeName:P.ZodVoid,...L(o)});class re extends U{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==S.array)return C(t,{code:T.invalid_type,expected:S.array,received:t.parsedType}),N;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,u=t.data.length<i.exactLength.value;(a||u)&&(C(t,{code:a?T.too_big:T.too_small,minimum:u?i.exactLength.value:void 0,maximum:a?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&&(C(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&&(C(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((a,u)=>i.type._parseAsync(new oe(t,a,t.path,u)))).then(a=>z.mergeArray(n,a));const l=[...t.data].map((a,u)=>i.type._parseSync(new oe(t,a,t.path,u)));return z.mergeArray(n,l)}get element(){return this._def.type}min(e,t){return new re({...this._def,minLength:{value:e,message:x.toString(t)}})}max(e,t){return new re({...this._def,maxLength:{value:e,message:x.toString(t)}})}length(e,t){return new re({...this._def,exactLength:{value:e,message:x.toString(t)}})}nonempty(e){return this.min(1,e)}}re.create=(o,e)=>new re({type:o,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...L(e)});function Ce(o){if(o instanceof H){const e={};for(const t in o.shape){const n=o.shape[t];e[t]=ue.create(Ce(n))}return new H({...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 Se?Se.create(Ce(o.unwrap())):o instanceof he?he.create(o.items.map(e=>Ce(e))):o}class H 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=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.object){const c=this._getOrReturnCtx(e);return C(c,{code:T.invalid_type,expected:S.object,received:c.parsedType}),N}const{status:n,ctx:i}=this._processInputParams(e),{shape:l,keys:a}=this._getCached(),u=[];if(!(this._def.catchall instanceof ae&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||u.push(c);const d=[];for(const c of a){const f=l[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 ae){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&&(C(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=>z.mergeObjectSync(n,c)):z.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return x.errToObj,new H({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var l,a;const i=((a=(l=this._def).errorMap)==null?void 0:a.call(l,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:x.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new H({...this._def,unknownKeys:"strip"})}passthrough(){return new H({...this._def,unknownKeys:"passthrough"})}extend(e){return new H({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new H({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:P.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new H({...this._def,catchall:e})}pick(e){const t={};for(const n of b.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new H({...this._def,shape:()=>t})}omit(e){const t={};for(const n of b.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new H({...this._def,shape:()=>t})}deepPartial(){return Ce(this)}partial(e){const t={};for(const n of b.objectKeys(this.shape)){const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}return new H({...this._def,shape:()=>t})}required(e){const t={};for(const n of b.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let l=this.shape[n];for(;l instanceof ue;)l=l._def.innerType;t[n]=l}return new H({...this._def,shape:()=>t})}keyof(){return en(b.objectKeys(this.shape))}}H.create=(o,e)=>new H({shape:()=>o,unknownKeys:"strip",catchall:ae.create(),typeName:P.ZodObject,...L(e)}),H.strictCreate=(o,e)=>new H({shape:()=>o,unknownKeys:"strict",catchall:ae.create(),typeName:P.ZodObject,...L(e)}),H.lazycreate=(o,e)=>new H({shape:o,unknownKeys:"strip",catchall:ae.create(),typeName:P.ZodObject,...L(e)});class We extends U{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function i(l){for(const u of l)if(u.result.status==="valid")return u.result;for(const u of l)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;const a=l.map(u=>new se(u.ctx.common.issues));return C(t,{code:T.invalid_union,unionErrors:a}),N}if(t.common.async)return Promise.all(n.map(async l=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await l._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(i);{let l;const a=[];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"&&!l&&(l={result:f,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(l)return t.common.issues.push(...l.ctx.common.issues),l.result;const u=a.map(d=>new se(d));return C(t,{code:T.invalid_union,unionErrors:u}),N}}get options(){return this._def.options}}We.create=(o,e)=>new We({options:o,typeName:P.ZodUnion,...L(e)});function dt(o,e){const t=le(o),n=le(e);if(o===e)return{valid:!0,data:o};if(t===S.object&&n===S.object){const i=b.objectKeys(e),l=b.objectKeys(o).filter(u=>i.indexOf(u)!==-1),a={...o,...e};for(const u of l){const d=dt(o[u],e[u]);if(!d.valid)return{valid:!1};a[u]=d.data}return{valid:!0,data:a}}else if(t===S.array&&n===S.array){if(o.length!==e.length)return{valid:!1};const i=[];for(let l=0;l<o.length;l++){const a=o[l],u=e[l],d=dt(a,u);if(!d.valid)return{valid:!1};i.push(d.data)}return{valid:!0,data:i}}else return t===S.date&&n===S.date&&+o==+e?{valid:!0,data:o}:{valid:!1}}class Ye extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=(l,a)=>{if($t(l)||$t(a))return N;const u=dt(l.value,a.value);return u.valid?((Ot(l)||Ot(a))&&t.dirty(),{status:t.value,value:u.data}):(C(n,{code:T.invalid_intersection_types}),N)};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(([l,a])=>i(l,a)):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:P.ZodIntersection,...L(t)});class he extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.array)return C(n,{code:T.invalid_type,expected:S.array,received:n.parsedType}),N;if(n.data.length<this._def.items.length)return C(n,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),N;!this._def.rest&&n.data.length>this._def.items.length&&(C(n,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const l=[...n.data].map((a,u)=>{const d=this._def.items[u]||this._def.rest;return d?d._parse(new oe(n,a,n.path,u)):null}).filter(a=>!!a);return n.common.async?Promise.all(l).then(a=>z.mergeArray(t,a)):z.mergeArray(t,l)}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:P.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!==S.object)return C(n,{code:T.invalid_type,expected:S.object,received:n.parsedType}),N;const i=[],l=this._def.keyType,a=this._def.valueType;for(const u in n.data)i.push({key:l._parse(new oe(n,u,n.path,u)),value:a._parse(new oe(n,n.data[u],n.path,u)),alwaysSet:u in n.data});return n.common.async?z.mergeObjectAsync(t,i):z.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:P.ZodRecord,...L(n)}):new Ze({keyType:ie.create(),valueType:e,typeName:P.ZodRecord,...L(t)})}}class Qt 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!==S.map)return C(n,{code:T.invalid_type,expected:S.map,received:n.parsedType}),N;const i=this._def.keyType,l=this._def.valueType,a=[...n.data.entries()].map(([u,d],c)=>({key:i._parse(new oe(n,u,n.path,[c,"key"])),value:l._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 a){const c=await d.key,f=await d.value;if(c.status==="aborted"||f.status==="aborted")return N;(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 a){const c=d.key,f=d.value;if(c.status==="aborted"||f.status==="aborted")return N;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),u.set(c.value,f.value)}return{status:t.value,value:u}}}}Qt.create=(o,e,t)=>new Qt({valueType:e,keyType:o,typeName:P.ZodMap,...L(t)});class Fe extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.set)return C(n,{code:T.invalid_type,expected:S.set,received:n.parsedType}),N;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(C(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&&(C(n,{code:T.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const l=this._def.valueType;function a(d){const c=new Set;for(const f of d){if(f.status==="aborted")return N;f.status==="dirty"&&t.dirty(),c.add(f.value)}return{status:t.value,value:c}}const u=[...n.data.values()].map((d,c)=>l._parse(new oe(n,d,n.path,c)));return n.common.async?Promise.all(u).then(d=>a(d)):a(u)}min(e,t){return new Fe({...this._def,minSize:{value:e,message:x.toString(t)}})}max(e,t){return new Fe({...this._def,maxSize:{value:e,message:x.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Fe.create=(o,e)=>new Fe({valueType:o,minSize:null,maxSize:null,typeName:P.ZodSet,...L(e)});class ft 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})}}ft.create=(o,e)=>new ft({getter:o,typeName:P.ZodLazy,...L(e)});class jt extends U{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return C(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),N}return{status:"valid",value:e.data}}get value(){return this._def.value}}jt.create=(o,e)=>new jt({value:o,typeName:P.ZodLiteral,...L(e)});function en(o,e){return new _e({values:o,typeName:P.ZodEnum,...L(e)})}class _e extends U{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return C(t,{expected:b.joinValues(n),received:t.parsedType,code:T.invalid_type}),N}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 C(t,{received:t.data,code:T.invalid_enum_value,options:n}),N}return Q(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=en;class tn extends U{_parse(e){const t=b.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==S.string&&n.parsedType!==S.number){const i=b.objectValues(t);return C(n,{expected:b.joinValues(i),received:n.parsedType,code:T.invalid_type}),N}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=b.objectValues(t);return C(n,{received:n.data,code:T.invalid_enum_value,options:i}),N}return Q(e.data)}get enum(){return this._def.values}}tn.create=(o,e)=>new tn({values:o,typeName:P.ZodNativeEnum,...L(e)});class ze extends U{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.promise&&t.common.async===!1)return C(t,{code:T.invalid_type,expected:S.promise,received:t.parsedType}),N;const n=t.parsedType===S.promise?t.data:Promise.resolve(t.data);return Q(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ze.create=(o,e)=>new ze({type:o,typeName:P.ZodPromise,...L(e)});class Ee extends U{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,l={addIssue:a=>{C(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(l.addIssue=l.addIssue.bind(l),i.type==="preprocess"){const a=i.transform(n.data,l);if(n.common.async)return Promise.resolve(a).then(async u=>{if(t.value==="aborted")return N;const d=await this._def.schema._parseAsync({data:u,path:n.path,parent:n});return d.status==="aborted"?N:d.status==="dirty"||t.value==="dirty"?Ve(d.value):d});{if(t.value==="aborted")return N;const u=this._def.schema._parseSync({data:a,path:n.path,parent:n});return u.status==="aborted"?N:u.status==="dirty"||t.value==="dirty"?Ve(u.value):u}}if(i.type==="refinement"){const a=u=>{const d=i.refinement(u,l);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"?N:(u.status==="dirty"&&t.dirty(),a(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"?N:(u.status==="dirty"&&t.dirty(),a(u.value).then(()=>({status:t.value,value:u.value}))))}if(i.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ve(a))return N;const u=i.transform(a.value,l);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(a=>ve(a)?Promise.resolve(i.transform(a.value,l)).then(u=>({status:t.value,value:u})):N);b.assertNever(i)}}Ee.create=(o,e,t)=>new Ee({schema:o,typeName:P.ZodEffects,effect:e,...L(t)}),Ee.createWithPreprocess=(o,e,t)=>new Ee({schema:e,effect:{type:"preprocess",transform:o},typeName:P.ZodEffects,...L(t)});class ue extends U{_parse(e){return this._getType(e)===S.undefined?Q(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ue.create=(o,e)=>new ue({innerType:o,typeName:P.ZodOptional,...L(e)});class Se extends U{_parse(e){return this._getType(e)===S.null?Q(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Se.create=(o,e)=>new Se({innerType:o,typeName:P.ZodNullable,...L(e)});class pt extends U{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===S.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}pt.create=(o,e)=>new pt({innerType:o,typeName:P.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});class mt 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 He(i)?i.then(l=>({status:"valid",value:l.status==="valid"?l.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}}mt.create=(o,e)=>new mt({innerType:o,typeName:P.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});class nn extends U{_parse(e){if(this._getType(e)!==S.nan){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.nan,received:n.parsedType}),N}return{status:"valid",value:e.data}}}nn.create=o=>new nn({typeName:P.ZodNaN,...L(o)});class Fi 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 ht extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const l=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?N:l.status==="dirty"?(t.dirty(),Ve(l.value)):this._def.out._parseAsync({data:l.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?N: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 ht({in:e,out:t,typeName:P.ZodPipeline})}}class gt extends U{_parse(e){const t=this._def.innerType._parse(e),n=i=>(ve(i)&&(i.value=Object.freeze(i.value)),i);return He(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}}gt.create=(o,e)=>new gt({innerType:o,typeName:P.ZodReadonly,...L(e)});var P;(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"})(P||(P={}));const ge=ie.create,on=pe.create;me.create;const Ui=Je.create;Te.create;const rn=ct.create;ae.create;const Ue=re.create,bi=H.create,Gi=We.create;Ye.create,he.create;const Bi=Ze.create,qi=ft.create,$i=_e.create;ze.create,ue.create,Se.create;const xe={string:(o=>ie.create({...o,coerce:!0})),number:(o=>pe.create({...o,coerce:!0})),boolean:(o=>Je.create({...o,coerce:!0})),bigint:(o=>me.create({...o,coerce:!0})),date:(o=>Te.create({...o,coerce:!0}))};/**
97
+ */const di=ee("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 b;(function(o){o.assertEqual=i=>{};function e(i){}o.assertIs=e;function t(i){throw new Error}o.assertNever=t,o.arrayToEnum=i=>{const l={};for(const a of i)l[a]=a;return l},o.getValidEnumValues=i=>{const l=o.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),a={};for(const u of l)a[u]=i[u];return o.objectValues(a)},o.objectValues=i=>o.objectKeys(i).map(function(l){return i[l]}),o.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const l=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&l.push(a);return l},o.find=(i,l)=>{for(const a of i)if(l(a))return a},o.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,l=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(l)}o.joinValues=n,o.jsonStringifyReplacer=(i,l)=>typeof l=="bigint"?l.toString():l})(b||(b={}));var qt;(function(o){o.mergeShapes=(e,t)=>({...e,...t})})(qt||(qt={}));const S=b.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 S.undefined;case"string":return S.string;case"number":return Number.isNaN(o)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(o)?S.array:o===null?S.null:o.then&&typeof o.then=="function"&&o.catch&&typeof o.catch=="function"?S.promise:typeof Map<"u"&&o instanceof Map?S.map:typeof Set<"u"&&o instanceof Set?S.set:typeof Date<"u"&&o instanceof Date?S.date:S.object;default:return S.unknown}},T=b.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(l){return l.message},n={_errors:[]},i=l=>{for(const a of l.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let u=n,d=0;for(;d<a.path.length;){const c=a.path[d];d===a.path.length-1?(u[c]=u[c]||{_errors:[]},u[c]._errors.push(t(a))):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,b.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 l=i.path[0];t[l]=t[l]||[],t[l].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 at=(o,e)=>{let t;switch(o.code){case T.invalid_type:o.received===S.undefined?t="Required":t=`Expected ${o.expected}, received ${o.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(o.expected,b.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(o.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(o.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${b.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}"`:b.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,b.assertNever(o)}return{message:t}};let fi=at;function pi(){return fi}const mi=o=>{const{data:e,path:t,errorMaps:n,issueData:i}=o,l=[...t,...i.path||[]],a={...i,path:l};if(i.message!==void 0)return{...i,path:l,message:i.message};let u="";const d=n.filter(c=>!!c).slice().reverse();for(const c of d)u=c(a,{data:e,defaultError:u}).message;return{...i,path:l,message:u}};function C(o,e){const t=pi(),n=mi({issueData:e,data:o.data,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,t,t===at?void 0:at].filter(i=>!!i)});o.common.issues.push(n)}class z{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 N;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 l=await i.key,a=await i.value;n.push({key:l,value:a})}return z.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:l,value:a}=i;if(l.status==="aborted"||a.status==="aborted")return N;l.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),l.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[l.value]=a.value)}return{status:e.value,value:n}}}const N=Object.freeze({status:"aborted"}),Ve=o=>({status:"dirty",value:o}),Q=o=>({status:"valid",value:o}),$t=o=>o.status==="aborted",Ot=o=>o.status==="dirty",ve=o=>o.status==="valid",He=o=>typeof Promise<"u"&&o instanceof Promise;var x;(function(o){o.errToObj=e=>typeof e=="string"?{message:e}:e||{},o.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(x||(x={}));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 Ht=(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:(a,u)=>{const{message:d}=o;return a.code==="invalid_enum_value"?{message:d??u.defaultError}:typeof u.data>"u"?{message:d??n??u.defaultError}:a.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 z,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(He(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 Ht(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 l=this._parseSync({data:e,path:[],parent:t});return ve(l)?{value:l.value}:{issues:t.common.issues}}catch(l){(i=(n=l==null?void 0:l.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(l=>ve(l)?{value:l.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}),l=await(He(i)?i:Promise.resolve(i));return Ht(n,l)}refine(e,t){const n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,l)=>{const a=e(i),u=()=>l.addIssue({code:T.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(d=>d?!0:(u(),!1)):a?!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 Ee({schema:this,typeName:P.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 ce.create(this,this._def)}nullable(){return Se.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this)}promise(){return ze.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 Ee({...L(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new pt({...L(this._def),innerType:this,defaultValue:t,typeName:P.ZodDefault})}brand(){return new Ui({typeName:P.ZodBranded,type:this,...L(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new mt({...L(this._def),innerType:this,catchValue:t,typeName:P.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ht.create(this,e)}readonly(){return gt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const hi=/^c[^\s-]{8,}$/i,gi=/^[0-9a-z]+$/,yi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vi=/^[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,Ti=/^[a-z0-9_-]{21}$/i,Ci=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_i=/^[-+]?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)?)??$/,Ei=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Si="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ut;const xi=/^(?:(?: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])$/,Ai=/^(?:(?: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])$/,Mi=/^(([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]))$/,Ii=/^(([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])$/,Ri=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Jt="((\\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])))",Pi=new RegExp(`^${Jt}$`);function Wt(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 Ni(o){return new RegExp(`^${Wt(o)}$`)}function ki(o){let e=`${Jt}T${Wt(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 Di(o,e){return!!((e==="v4"||!e)&&xi.test(o)||(e==="v6"||!e)&&Mi.test(o))}function Li(o,e){if(!Ci.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 Vi(o,e){return!!((e==="v4"||!e)&&Ai.test(o)||(e==="v6"||!e)&&Ii.test(o))}class ie extends U{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.string){const l=this._getOrReturnCtx(e);return C(l,{code:T.invalid_type,expected:S.string,received:l.parsedType}),N}const n=new z;let i;for(const l of this._def.checks)if(l.kind==="min")e.data.length<l.value&&(i=this._getOrReturnCtx(e,i),C(i,{code:T.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),n.dirty());else if(l.kind==="max")e.data.length>l.value&&(i=this._getOrReturnCtx(e,i),C(i,{code:T.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),n.dirty());else if(l.kind==="length"){const a=e.data.length>l.value,u=e.data.length<l.value;(a||u)&&(i=this._getOrReturnCtx(e,i),a?C(i,{code:T.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):u&&C(i,{code:T.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),n.dirty())}else if(l.kind==="email")Ei.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"email",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="emoji")ut||(ut=new RegExp(Si,"u")),ut.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"emoji",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="uuid")vi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"uuid",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="nanoid")Ti.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"nanoid",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="cuid")hi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"cuid",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="cuid2")gi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"cuid2",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="ulid")yi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"ulid",code:T.invalid_string,message:l.message}),n.dirty());else if(l.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),C(i,{validation:"url",code:T.invalid_string,message:l.message}),n.dirty()}else l.kind==="regex"?(l.regex.lastIndex=0,l.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"regex",code:T.invalid_string,message:l.message}),n.dirty())):l.kind==="trim"?e.data=e.data.trim():l.kind==="includes"?e.data.includes(l.value,l.position)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),n.dirty()):l.kind==="toLowerCase"?e.data=e.data.toLowerCase():l.kind==="toUpperCase"?e.data=e.data.toUpperCase():l.kind==="startsWith"?e.data.startsWith(l.value)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:{startsWith:l.value},message:l.message}),n.dirty()):l.kind==="endsWith"?e.data.endsWith(l.value)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:{endsWith:l.value},message:l.message}),n.dirty()):l.kind==="datetime"?ki(l).test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:"datetime",message:l.message}),n.dirty()):l.kind==="date"?Pi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:"date",message:l.message}),n.dirty()):l.kind==="time"?Ni(l).test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{code:T.invalid_string,validation:"time",message:l.message}),n.dirty()):l.kind==="duration"?_i.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"duration",code:T.invalid_string,message:l.message}),n.dirty()):l.kind==="ip"?Di(e.data,l.version)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"ip",code:T.invalid_string,message:l.message}),n.dirty()):l.kind==="jwt"?Li(e.data,l.alg)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"jwt",code:T.invalid_string,message:l.message}),n.dirty()):l.kind==="cidr"?Vi(e.data,l.version)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"cidr",code:T.invalid_string,message:l.message}),n.dirty()):l.kind==="base64"?Ri.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"base64",code:T.invalid_string,message:l.message}),n.dirty()):l.kind==="base64url"?wi.test(e.data)||(i=this._getOrReturnCtx(e,i),C(i,{validation:"base64url",code:T.invalid_string,message:l.message}),n.dirty()):b.assertNever(l);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:T.invalid_string,...x.errToObj(n)})}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...x.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...x.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...x.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,...x.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,...x.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...x.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...x.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...x.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...x.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...x.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...x.errToObj(t)})}nonempty(e){return this.min(1,x.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:P.ZodString,coerce:(o==null?void 0:o.coerce)??!1,...L(o)});function Fi(o,e){const t=(o.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,l=Number.parseInt(o.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return l%a/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)!==S.number){const l=this._getOrReturnCtx(e);return C(l,{code:T.invalid_type,expected:S.number,received:l.parsedType}),N}let n;const i=new z;for(const l of this._def.checks)l.kind==="int"?b.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{code:T.invalid_type,expected:"integer",received:"float",message:l.message}),i.dirty()):l.kind==="min"?(l.inclusive?e.data<l.value:e.data<=l.value)&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.too_small,minimum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?e.data>l.value:e.data>=l.value)&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.too_big,maximum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="multipleOf"?Fi(e.data,l.value)!==0&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):l.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{code:T.not_finite,message:l.message}),i.dirty()):b.assertNever(l);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,n,i){return new pe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:x.toString(i)}]})}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.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"&&b.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:P.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)!==S.bigint)return this._getInvalidInput(e);let n;const i=new z;for(const l of this._def.checks)l.kind==="min"?(l.inclusive?e.data<l.value:e.data<=l.value)&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.too_small,type:"bigint",minimum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?e.data>l.value:e.data>=l.value)&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.too_big,type:"bigint",maximum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="multipleOf"?e.data%l.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),C(n,{code:T.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):b.assertNever(l);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return C(t,{code:T.invalid_type,expected:S.bigint,received:t.parsedType}),N}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,n,i){return new me({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:x.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:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.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:P.ZodBigInt,coerce:(o==null?void 0:o.coerce)??!1,...L(o)});class Je extends U{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.boolean){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.boolean,received:n.parsedType}),N}return Q(e.data)}}Je.create=o=>new Je({typeName:P.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)!==S.date){const l=this._getOrReturnCtx(e);return C(l,{code:T.invalid_type,expected:S.date,received:l.parsedType}),N}if(Number.isNaN(e.data.getTime())){const l=this._getOrReturnCtx(e);return C(l,{code:T.invalid_date}),N}const n=new z;let i;for(const l of this._def.checks)l.kind==="min"?e.data.getTime()<l.value&&(i=this._getOrReturnCtx(e,i),C(i,{code:T.too_small,message:l.message,inclusive:!0,exact:!1,minimum:l.value,type:"date"}),n.dirty()):l.kind==="max"?e.data.getTime()>l.value&&(i=this._getOrReturnCtx(e,i),C(i,{code:T.too_big,message:l.message,inclusive:!0,exact:!1,maximum:l.value,type:"date"}),n.dirty()):b.assertNever(l);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:x.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:x.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:P.ZodDate,...L(o)});class Yt extends U{_parse(e){if(this._getType(e)!==S.symbol){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.symbol,received:n.parsedType}),N}return Q(e.data)}}Yt.create=o=>new Yt({typeName:P.ZodSymbol,...L(o)});class Zt extends U{_parse(e){if(this._getType(e)!==S.undefined){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.undefined,received:n.parsedType}),N}return Q(e.data)}}Zt.create=o=>new Zt({typeName:P.ZodUndefined,...L(o)});class zt extends U{_parse(e){if(this._getType(e)!==S.null){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.null,received:n.parsedType}),N}return Q(e.data)}}zt.create=o=>new zt({typeName:P.ZodNull,...L(o)});class Kt extends U{constructor(){super(...arguments),this._any=!0}_parse(e){return Q(e.data)}}Kt.create=o=>new Kt({typeName:P.ZodAny,...L(o)});class ct extends U{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Q(e.data)}}ct.create=o=>new ct({typeName:P.ZodUnknown,...L(o)});class ue extends U{_parse(e){const t=this._getOrReturnCtx(e);return C(t,{code:T.invalid_type,expected:S.never,received:t.parsedType}),N}}ue.create=o=>new ue({typeName:P.ZodNever,...L(o)});class Xt extends U{_parse(e){if(this._getType(e)!==S.undefined){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.void,received:n.parsedType}),N}return Q(e.data)}}Xt.create=o=>new Xt({typeName:P.ZodVoid,...L(o)});class re extends U{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==S.array)return C(t,{code:T.invalid_type,expected:S.array,received:t.parsedType}),N;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,u=t.data.length<i.exactLength.value;(a||u)&&(C(t,{code:a?T.too_big:T.too_small,minimum:u?i.exactLength.value:void 0,maximum:a?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&&(C(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&&(C(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((a,u)=>i.type._parseAsync(new oe(t,a,t.path,u)))).then(a=>z.mergeArray(n,a));const l=[...t.data].map((a,u)=>i.type._parseSync(new oe(t,a,t.path,u)));return z.mergeArray(n,l)}get element(){return this._def.type}min(e,t){return new re({...this._def,minLength:{value:e,message:x.toString(t)}})}max(e,t){return new re({...this._def,maxLength:{value:e,message:x.toString(t)}})}length(e,t){return new re({...this._def,exactLength:{value:e,message:x.toString(t)}})}nonempty(e){return this.min(1,e)}}re.create=(o,e)=>new re({type:o,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...L(e)});function Ce(o){if(o instanceof H){const e={};for(const t in o.shape){const n=o.shape[t];e[t]=ce.create(Ce(n))}return new H({...o._def,shape:()=>e})}else return o instanceof re?new re({...o._def,type:Ce(o.element)}):o instanceof ce?ce.create(Ce(o.unwrap())):o instanceof Se?Se.create(Ce(o.unwrap())):o instanceof he?he.create(o.items.map(e=>Ce(e))):o}class H 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=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.object){const c=this._getOrReturnCtx(e);return C(c,{code:T.invalid_type,expected:S.object,received:c.parsedType}),N}const{status:n,ctx:i}=this._processInputParams(e),{shape:l,keys:a}=this._getCached(),u=[];if(!(this._def.catchall instanceof ue&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||u.push(c);const d=[];for(const c of a){const f=l[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 ue){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&&(C(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=>z.mergeObjectSync(n,c)):z.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return x.errToObj,new H({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var l,a;const i=((a=(l=this._def).errorMap)==null?void 0:a.call(l,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:x.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new H({...this._def,unknownKeys:"strip"})}passthrough(){return new H({...this._def,unknownKeys:"passthrough"})}extend(e){return new H({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new H({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:P.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new H({...this._def,catchall:e})}pick(e){const t={};for(const n of b.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new H({...this._def,shape:()=>t})}omit(e){const t={};for(const n of b.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new H({...this._def,shape:()=>t})}deepPartial(){return Ce(this)}partial(e){const t={};for(const n of b.objectKeys(this.shape)){const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}return new H({...this._def,shape:()=>t})}required(e){const t={};for(const n of b.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let l=this.shape[n];for(;l instanceof ce;)l=l._def.innerType;t[n]=l}return new H({...this._def,shape:()=>t})}keyof(){return en(b.objectKeys(this.shape))}}H.create=(o,e)=>new H({shape:()=>o,unknownKeys:"strip",catchall:ue.create(),typeName:P.ZodObject,...L(e)}),H.strictCreate=(o,e)=>new H({shape:()=>o,unknownKeys:"strict",catchall:ue.create(),typeName:P.ZodObject,...L(e)}),H.lazycreate=(o,e)=>new H({shape:o,unknownKeys:"strip",catchall:ue.create(),typeName:P.ZodObject,...L(e)});class We extends U{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function i(l){for(const u of l)if(u.result.status==="valid")return u.result;for(const u of l)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;const a=l.map(u=>new se(u.ctx.common.issues));return C(t,{code:T.invalid_union,unionErrors:a}),N}if(t.common.async)return Promise.all(n.map(async l=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await l._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(i);{let l;const a=[];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"&&!l&&(l={result:f,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(l)return t.common.issues.push(...l.ctx.common.issues),l.result;const u=a.map(d=>new se(d));return C(t,{code:T.invalid_union,unionErrors:u}),N}}get options(){return this._def.options}}We.create=(o,e)=>new We({options:o,typeName:P.ZodUnion,...L(e)});function dt(o,e){const t=ae(o),n=ae(e);if(o===e)return{valid:!0,data:o};if(t===S.object&&n===S.object){const i=b.objectKeys(e),l=b.objectKeys(o).filter(u=>i.indexOf(u)!==-1),a={...o,...e};for(const u of l){const d=dt(o[u],e[u]);if(!d.valid)return{valid:!1};a[u]=d.data}return{valid:!0,data:a}}else if(t===S.array&&n===S.array){if(o.length!==e.length)return{valid:!1};const i=[];for(let l=0;l<o.length;l++){const a=o[l],u=e[l],d=dt(a,u);if(!d.valid)return{valid:!1};i.push(d.data)}return{valid:!0,data:i}}else return t===S.date&&n===S.date&&+o==+e?{valid:!0,data:o}:{valid:!1}}class Ye extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=(l,a)=>{if($t(l)||$t(a))return N;const u=dt(l.value,a.value);return u.valid?((Ot(l)||Ot(a))&&t.dirty(),{status:t.value,value:u.data}):(C(n,{code:T.invalid_intersection_types}),N)};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(([l,a])=>i(l,a)):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:P.ZodIntersection,...L(t)});class he extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.array)return C(n,{code:T.invalid_type,expected:S.array,received:n.parsedType}),N;if(n.data.length<this._def.items.length)return C(n,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),N;!this._def.rest&&n.data.length>this._def.items.length&&(C(n,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const l=[...n.data].map((a,u)=>{const d=this._def.items[u]||this._def.rest;return d?d._parse(new oe(n,a,n.path,u)):null}).filter(a=>!!a);return n.common.async?Promise.all(l).then(a=>z.mergeArray(t,a)):z.mergeArray(t,l)}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:P.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!==S.object)return C(n,{code:T.invalid_type,expected:S.object,received:n.parsedType}),N;const i=[],l=this._def.keyType,a=this._def.valueType;for(const u in n.data)i.push({key:l._parse(new oe(n,u,n.path,u)),value:a._parse(new oe(n,n.data[u],n.path,u)),alwaysSet:u in n.data});return n.common.async?z.mergeObjectAsync(t,i):z.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:P.ZodRecord,...L(n)}):new Ze({keyType:ie.create(),valueType:e,typeName:P.ZodRecord,...L(t)})}}class Qt 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!==S.map)return C(n,{code:T.invalid_type,expected:S.map,received:n.parsedType}),N;const i=this._def.keyType,l=this._def.valueType,a=[...n.data.entries()].map(([u,d],c)=>({key:i._parse(new oe(n,u,n.path,[c,"key"])),value:l._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 a){const c=await d.key,f=await d.value;if(c.status==="aborted"||f.status==="aborted")return N;(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 a){const c=d.key,f=d.value;if(c.status==="aborted"||f.status==="aborted")return N;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),u.set(c.value,f.value)}return{status:t.value,value:u}}}}Qt.create=(o,e,t)=>new Qt({valueType:e,keyType:o,typeName:P.ZodMap,...L(t)});class Fe extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.set)return C(n,{code:T.invalid_type,expected:S.set,received:n.parsedType}),N;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(C(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&&(C(n,{code:T.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const l=this._def.valueType;function a(d){const c=new Set;for(const f of d){if(f.status==="aborted")return N;f.status==="dirty"&&t.dirty(),c.add(f.value)}return{status:t.value,value:c}}const u=[...n.data.values()].map((d,c)=>l._parse(new oe(n,d,n.path,c)));return n.common.async?Promise.all(u).then(d=>a(d)):a(u)}min(e,t){return new Fe({...this._def,minSize:{value:e,message:x.toString(t)}})}max(e,t){return new Fe({...this._def,maxSize:{value:e,message:x.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Fe.create=(o,e)=>new Fe({valueType:o,minSize:null,maxSize:null,typeName:P.ZodSet,...L(e)});class ft 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})}}ft.create=(o,e)=>new ft({getter:o,typeName:P.ZodLazy,...L(e)});class jt extends U{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return C(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),N}return{status:"valid",value:e.data}}get value(){return this._def.value}}jt.create=(o,e)=>new jt({value:o,typeName:P.ZodLiteral,...L(e)});function en(o,e){return new _e({values:o,typeName:P.ZodEnum,...L(e)})}class _e extends U{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return C(t,{expected:b.joinValues(n),received:t.parsedType,code:T.invalid_type}),N}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 C(t,{received:t.data,code:T.invalid_enum_value,options:n}),N}return Q(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=en;class tn extends U{_parse(e){const t=b.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==S.string&&n.parsedType!==S.number){const i=b.objectValues(t);return C(n,{expected:b.joinValues(i),received:n.parsedType,code:T.invalid_type}),N}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=b.objectValues(t);return C(n,{received:n.data,code:T.invalid_enum_value,options:i}),N}return Q(e.data)}get enum(){return this._def.values}}tn.create=(o,e)=>new tn({values:o,typeName:P.ZodNativeEnum,...L(e)});class ze extends U{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.promise&&t.common.async===!1)return C(t,{code:T.invalid_type,expected:S.promise,received:t.parsedType}),N;const n=t.parsedType===S.promise?t.data:Promise.resolve(t.data);return Q(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ze.create=(o,e)=>new ze({type:o,typeName:P.ZodPromise,...L(e)});class Ee extends U{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,l={addIssue:a=>{C(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(l.addIssue=l.addIssue.bind(l),i.type==="preprocess"){const a=i.transform(n.data,l);if(n.common.async)return Promise.resolve(a).then(async u=>{if(t.value==="aborted")return N;const d=await this._def.schema._parseAsync({data:u,path:n.path,parent:n});return d.status==="aborted"?N:d.status==="dirty"||t.value==="dirty"?Ve(d.value):d});{if(t.value==="aborted")return N;const u=this._def.schema._parseSync({data:a,path:n.path,parent:n});return u.status==="aborted"?N:u.status==="dirty"||t.value==="dirty"?Ve(u.value):u}}if(i.type==="refinement"){const a=u=>{const d=i.refinement(u,l);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"?N:(u.status==="dirty"&&t.dirty(),a(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"?N:(u.status==="dirty"&&t.dirty(),a(u.value).then(()=>({status:t.value,value:u.value}))))}if(i.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ve(a))return N;const u=i.transform(a.value,l);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(a=>ve(a)?Promise.resolve(i.transform(a.value,l)).then(u=>({status:t.value,value:u})):N);b.assertNever(i)}}Ee.create=(o,e,t)=>new Ee({schema:o,typeName:P.ZodEffects,effect:e,...L(t)}),Ee.createWithPreprocess=(o,e,t)=>new Ee({schema:e,effect:{type:"preprocess",transform:o},typeName:P.ZodEffects,...L(t)});class ce extends U{_parse(e){return this._getType(e)===S.undefined?Q(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ce.create=(o,e)=>new ce({innerType:o,typeName:P.ZodOptional,...L(e)});class Se extends U{_parse(e){return this._getType(e)===S.null?Q(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Se.create=(o,e)=>new Se({innerType:o,typeName:P.ZodNullable,...L(e)});class pt extends U{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===S.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}pt.create=(o,e)=>new pt({innerType:o,typeName:P.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});class mt 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 He(i)?i.then(l=>({status:"valid",value:l.status==="valid"?l.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}}mt.create=(o,e)=>new mt({innerType:o,typeName:P.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});class nn extends U{_parse(e){if(this._getType(e)!==S.nan){const n=this._getOrReturnCtx(e);return C(n,{code:T.invalid_type,expected:S.nan,received:n.parsedType}),N}return{status:"valid",value:e.data}}}nn.create=o=>new nn({typeName:P.ZodNaN,...L(o)});class Ui 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 ht extends U{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const l=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?N:l.status==="dirty"?(t.dirty(),Ve(l.value)):this._def.out._parseAsync({data:l.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?N: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 ht({in:e,out:t,typeName:P.ZodPipeline})}}class gt extends U{_parse(e){const t=this._def.innerType._parse(e),n=i=>(ve(i)&&(i.value=Object.freeze(i.value)),i);return He(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}}gt.create=(o,e)=>new gt({innerType:o,typeName:P.ZodReadonly,...L(e)});var P;(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"})(P||(P={}));const ge=ie.create,on=pe.create;me.create;const bi=Je.create;Te.create;const rn=ct.create;ue.create;const Ue=re.create,Gi=H.create,Bi=We.create;Ye.create,he.create;const qi=Ze.create,$i=ft.create,Oi=_e.create;ze.create,ce.create,Se.create;const xe={string:(o=>ie.create({...o,coerce:!0})),number:(o=>pe.create({...o,coerce:!0})),boolean:(o=>Je.create({...o,coerce:!0})),bigint:(o=>me.create({...o,coerce:!0})),date:(o=>Te.create({...o,coerce:!0}))};/**
98
98
  * @license
99
99
  * Copyright 2025 Google LLC
100
100
  * SPDX-License-Identifier: Apache-2.0
101
- */let Oi,Hi;function Ji(){return{geminiUrl:Oi,vertexUrl:Hi}}function Wi(o,e,t){var n,i,l;if(!(!((n=o.httpOptions)===null||n===void 0)&&n.baseUrl)){const a=Ji();return o.vertexai?(i=a.vertexUrl)!==null&&i!==void 0?i:e:(l=a.geminiUrl)!==null&&l!==void 0?l:t}return o.httpOptions.baseUrl}/**
101
+ */let Hi,Ji;function Wi(){return{geminiUrl:Hi,vertexUrl:Ji}}function Yi(o,e,t){var n,i,l;if(!(!((n=o.httpOptions)===null||n===void 0)&&n.baseUrl)){const a=Wi();return o.vertexai?(i=a.vertexUrl)!==null&&i!==void 0?i:e:(l=a.geminiUrl)!==null&&l!==void 0?l:t}return o.httpOptions.baseUrl}/**
102
102
  * @license
103
103
  * Copyright 2025 Google LLC
104
104
  * SPDX-License-Identifier: Apache-2.0
@@ -106,15 +106,15 @@ React keys must be passed directly to JSX without using spread:
106
106
  * @license
107
107
  * Copyright 2025 Google LLC
108
108
  * SPDX-License-Identifier: Apache-2.0
109
- */var sn;(function(o){o.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",o.OUTCOME_OK="OUTCOME_OK",o.OUTCOME_FAILED="OUTCOME_FAILED",o.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(sn||(sn={}));var ln;(function(o){o.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",o.PYTHON="PYTHON"})(ln||(ln={}));var j;(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"})(j||(j={}));var an;(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"})(an||(an={}));var un;(function(o){o.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",o.SEVERITY="SEVERITY",o.PROBABILITY="PROBABILITY"})(un||(un={}));var cn;(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"})(cn||(cn={}));var dn;(function(o){o.MODE_UNSPECIFIED="MODE_UNSPECIFIED",o.MODE_DYNAMIC="MODE_DYNAMIC"})(dn||(dn={}));var fn;(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"})(fn||(fn={}));var pn;(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"})(pn||(pn={}));var mn;(function(o){o.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",o.NEGLIGIBLE="NEGLIGIBLE",o.LOW="LOW",o.MEDIUM="MEDIUM",o.HIGH="HIGH"})(mn||(mn={}));var hn;(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"})(hn||(hn={}));var gn;(function(o){o.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",o.SAFETY="SAFETY",o.OTHER="OTHER",o.BLOCKLIST="BLOCKLIST",o.PROHIBITED_CONTENT="PROHIBITED_CONTENT"})(gn||(gn={}));var yn;(function(o){o.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",o.ON_DEMAND="ON_DEMAND",o.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(yn||(yn={}));var Ke;(function(o){o.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",o.TEXT="TEXT",o.IMAGE="IMAGE",o.AUDIO="AUDIO"})(Ke||(Ke={}));var vn;(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"})(vn||(vn={}));var yt;(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"})(yt||(yt={}));var Tn;(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"})(Tn||(Tn={}));var Cn;(function(o){o.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",o.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",o.BALANCED="BALANCED",o.PRIORITIZE_COST="PRIORITIZE_COST"})(Cn||(Cn={}));var _n;(function(o){o.UNSPECIFIED="UNSPECIFIED",o.BLOCKING="BLOCKING",o.NON_BLOCKING="NON_BLOCKING"})(_n||(_n={}));var En;(function(o){o.MODE_UNSPECIFIED="MODE_UNSPECIFIED",o.MODE_DYNAMIC="MODE_DYNAMIC"})(En||(En={}));var Sn;(function(o){o.MODE_UNSPECIFIED="MODE_UNSPECIFIED",o.AUTO="AUTO",o.ANY="ANY",o.NONE="NONE"})(Sn||(Sn={}));var xn;(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"})(xn||(xn={}));var An;(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"})(An||(An={}));var Mn;(function(o){o.DONT_ALLOW="DONT_ALLOW",o.ALLOW_ADULT="ALLOW_ADULT",o.ALLOW_ALL="ALLOW_ALL"})(Mn||(Mn={}));var In;(function(o){o.auto="auto",o.en="en",o.ja="ja",o.ko="ko",o.hi="hi"})(In||(In={}));var Rn;(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"})(Rn||(Rn={}));var wn;(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"})(wn||(wn={}));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 Nn;(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"})(Nn||(Nn={}));var kn;(function(o){o.STATE_UNSPECIFIED="STATE_UNSPECIFIED",o.PROCESSING="PROCESSING",o.ACTIVE="ACTIVE",o.FAILED="FAILED"})(kn||(kn={}));var Dn;(function(o){o.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",o.UPLOADED="UPLOADED",o.GENERATED="GENERATED"})(Dn||(Dn={}));var Ln;(function(o){o.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",o.TEXT="TEXT",o.IMAGE="IMAGE",o.VIDEO="VIDEO",o.AUDIO="AUDIO",o.DOCUMENT="DOCUMENT"})(Ln||(Ln={}));var Vn;(function(o){o.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",o.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",o.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Vn||(Vn={}));var Fn;(function(o){o.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",o.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",o.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(Fn||(Fn={}));var Un;(function(o){o.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",o.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",o.NO_INTERRUPTION="NO_INTERRUPTION"})(Un||(Un={}));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 Gn;(function(o){o.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",o.SILENT="SILENT",o.WHEN_IDLE="WHEN_IDLE",o.INTERRUPT="INTERRUPT"})(Gn||(Gn={}));var Bn;(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"})(Bn||(Bn={}));var Me;(function(o){o.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",o.PLAY="PLAY",o.PAUSE="PAUSE",o.STOP="STOP",o.RESET_CONTEXT="RESET_CONTEXT"})(Me||(Me={}));class be{get text(){var e,t,n,i,l,a,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=(a=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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,l,a,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=(a=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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,l,a,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=(a=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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,l,a,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=(a=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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,l,a,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=(a=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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 qn{}class $n{}class Yi{}class Zi{}class On{}class Hn{}class Jn{}class zi{}class Wn{}class Yn{}class Zn{}class Ki{}class vt{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 Xi{}class Qi{}class ji{get text(){var e,t,n;let i="",l=!1;const a=[];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&&a.push(d);if(typeof u.text=="string"){if(typeof u.thought=="boolean"&&u.thought)continue;l=!0,i+=u.text}}return a.length>0&&console.warn(`there are non-text parts ${a} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),l?i:void 0}get data(){var e,t,n;let i="";const l=[];for(const a 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(a))u!=="inlineData"&&d!==null&&l.push(u);a.inlineData&&typeof a.inlineData.data=="string"&&(i+=atob(a.inlineData.data))}return l.length>0&&console.warn(`there are non-data parts ${l} 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 er{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}/**
109
+ */var sn;(function(o){o.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",o.OUTCOME_OK="OUTCOME_OK",o.OUTCOME_FAILED="OUTCOME_FAILED",o.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(sn||(sn={}));var ln;(function(o){o.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",o.PYTHON="PYTHON"})(ln||(ln={}));var j;(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"})(j||(j={}));var an;(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"})(an||(an={}));var un;(function(o){o.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",o.SEVERITY="SEVERITY",o.PROBABILITY="PROBABILITY"})(un||(un={}));var cn;(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"})(cn||(cn={}));var dn;(function(o){o.MODE_UNSPECIFIED="MODE_UNSPECIFIED",o.MODE_DYNAMIC="MODE_DYNAMIC"})(dn||(dn={}));var fn;(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"})(fn||(fn={}));var pn;(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"})(pn||(pn={}));var mn;(function(o){o.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",o.NEGLIGIBLE="NEGLIGIBLE",o.LOW="LOW",o.MEDIUM="MEDIUM",o.HIGH="HIGH"})(mn||(mn={}));var hn;(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"})(hn||(hn={}));var gn;(function(o){o.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",o.SAFETY="SAFETY",o.OTHER="OTHER",o.BLOCKLIST="BLOCKLIST",o.PROHIBITED_CONTENT="PROHIBITED_CONTENT"})(gn||(gn={}));var yn;(function(o){o.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",o.ON_DEMAND="ON_DEMAND",o.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(yn||(yn={}));var Ke;(function(o){o.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",o.TEXT="TEXT",o.IMAGE="IMAGE",o.AUDIO="AUDIO"})(Ke||(Ke={}));var vn;(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"})(vn||(vn={}));var yt;(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"})(yt||(yt={}));var Tn;(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"})(Tn||(Tn={}));var Cn;(function(o){o.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",o.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",o.BALANCED="BALANCED",o.PRIORITIZE_COST="PRIORITIZE_COST"})(Cn||(Cn={}));var _n;(function(o){o.UNSPECIFIED="UNSPECIFIED",o.BLOCKING="BLOCKING",o.NON_BLOCKING="NON_BLOCKING"})(_n||(_n={}));var En;(function(o){o.MODE_UNSPECIFIED="MODE_UNSPECIFIED",o.MODE_DYNAMIC="MODE_DYNAMIC"})(En||(En={}));var Sn;(function(o){o.MODE_UNSPECIFIED="MODE_UNSPECIFIED",o.AUTO="AUTO",o.ANY="ANY",o.NONE="NONE"})(Sn||(Sn={}));var xn;(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"})(xn||(xn={}));var An;(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"})(An||(An={}));var Mn;(function(o){o.DONT_ALLOW="DONT_ALLOW",o.ALLOW_ADULT="ALLOW_ADULT",o.ALLOW_ALL="ALLOW_ALL"})(Mn||(Mn={}));var In;(function(o){o.auto="auto",o.en="en",o.ja="ja",o.ko="ko",o.hi="hi"})(In||(In={}));var Rn;(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"})(Rn||(Rn={}));var wn;(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"})(wn||(wn={}));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 Nn;(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"})(Nn||(Nn={}));var kn;(function(o){o.STATE_UNSPECIFIED="STATE_UNSPECIFIED",o.PROCESSING="PROCESSING",o.ACTIVE="ACTIVE",o.FAILED="FAILED"})(kn||(kn={}));var Dn;(function(o){o.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",o.UPLOADED="UPLOADED",o.GENERATED="GENERATED"})(Dn||(Dn={}));var Ln;(function(o){o.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",o.TEXT="TEXT",o.IMAGE="IMAGE",o.VIDEO="VIDEO",o.AUDIO="AUDIO",o.DOCUMENT="DOCUMENT"})(Ln||(Ln={}));var Vn;(function(o){o.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",o.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",o.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Vn||(Vn={}));var Fn;(function(o){o.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",o.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",o.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(Fn||(Fn={}));var Un;(function(o){o.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",o.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",o.NO_INTERRUPTION="NO_INTERRUPTION"})(Un||(Un={}));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 Gn;(function(o){o.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",o.SILENT="SILENT",o.WHEN_IDLE="WHEN_IDLE",o.INTERRUPT="INTERRUPT"})(Gn||(Gn={}));var Bn;(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"})(Bn||(Bn={}));var Me;(function(o){o.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",o.PLAY="PLAY",o.PAUSE="PAUSE",o.STOP="STOP",o.RESET_CONTEXT="RESET_CONTEXT"})(Me||(Me={}));class be{get text(){var e,t,n,i,l,a,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=(a=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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,l,a,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=(a=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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,l,a,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=(a=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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,l,a,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=(a=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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,l,a,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=(a=(l=this.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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 qn{}class $n{}class Zi{}class zi{}class On{}class Hn{}class Jn{}class Ki{}class Wn{}class Yn{}class Zn{}class Xi{}class vt{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 Qi{}class ji{}class er{get text(){var e,t,n;let i="",l=!1;const a=[];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&&a.push(d);if(typeof u.text=="string"){if(typeof u.thought=="boolean"&&u.thought)continue;l=!0,i+=u.text}}return a.length>0&&console.warn(`there are non-text parts ${a} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),l?i:void 0}get data(){var e,t,n;let i="";const l=[];for(const a 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(a))u!=="inlineData"&&d!==null&&l.push(u);a.inlineData&&typeof a.inlineData.data=="string"&&(i+=atob(a.inlineData.data))}return l.length>0&&console.warn(`there are non-data parts ${l} 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 tr{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}/**
110
110
  * @license
111
111
  * Copyright 2025 Google LLC
112
112
  * SPDX-License-Identifier: Apache-2.0
113
- */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 zn(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 Kn(o,e){return Array.isArray(e)?e.map(t=>Xe(o,t)):[Xe(o,e)]}function Xe(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 tr(o,e){const t=Xe(o,e);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function nr(o,e){const t=Xe(o,e);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function Xn(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 Qn(o,e){if(e==null||Array.isArray(e)&&e.length===0)throw new Error("PartListUnion is required");return Array.isArray(e)?e.map(t=>Xn(o,t)):[Xn(o,e)]}function Tt(o){return o!=null&&typeof o=="object"&&"parts"in o&&Array.isArray(o.parts)}function jn(o){return o!=null&&typeof o=="object"&&"functionCall"in o}function eo(o){return o!=null&&typeof o=="object"&&"functionResponse"in o}function K(o,e){if(e==null)throw new Error("ContentUnion is required");return Tt(e)?e:{role:"user",parts:Qn(o,e)}}function to(o,e){if(!e)return[];if(o.isVertexAI()&&Array.isArray(e))return e.flatMap(t=>{const n=K(o,t);return n.parts&&n.parts.length>0&&n.parts[0].text!==void 0?[n.parts[0].text]:[]});if(o.isVertexAI()){const t=K(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=>K(o,t)):[K(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(jn(e)||eo(e))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[K(o,e)]}const t=[],n=[],i=Tt(e[0]);for(const l of e){const a=Tt(l);if(a!=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(a)t.push(l);else{if(jn(l)||eo(l))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(l)}}return i||t.push({role:"user",parts:Qn(o,n)}),t}const or=new Set(["type","format","title","description","default","items","minItems","maxItems","enum","properties","required","minProperties","maxProperties","minimum","maximum","minLength","maxLength","pattern","anyOf","propertyOrdering"]),no=$i(["string","number","integer","object","array","boolean","null"]),ir=Gi([no,Ue(no)]);function rr(o=!0){const e=qi(()=>{const t=bi({type:ir.optional(),format:ge().optional(),title:ge().optional(),description:ge().optional(),default:rn().optional(),items:e.optional(),minItems:xe.string().optional(),maxItems:xe.string().optional(),enum:Ue(rn()).optional(),properties:Bi(ge(),e).optional(),required:Ue(ge()).optional(),minProperties:xe.string().optional(),maxProperties:xe.string().optional(),propertyOrdering:Ue(ge()).optional(),minimum:on().optional(),maximum:on().optional(),minLength:xe.string().optional(),maxLength:xe.string().optional(),pattern:ge().optional(),anyOf:Ue(e).optional(),additionalProperties:Ui().optional()});return o?t.strict():t});return e}function sr(o,e){o.includes("null")&&(e.nullable=!0);const t=o.filter(n=>n!=="null");if(t.length===1)e.type=Object.keys(j).includes(t[0].toUpperCase())?j[t[0].toUpperCase()]:j.TYPE_UNSPECIFIED;else{e.anyOf=[];for(const n of t)e.anyOf.push({type:Object.keys(j).includes(n.toUpperCase())?j[n.toUpperCase()]:j.TYPE_UNSPECIFIED})}}function Ie(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 l=o.anyOf;l!=null&&l.length==2&&(l[0].type==="null"?(e.nullable=!0,o=l[1]):l[1].type==="null"&&(e.nullable=!0,o=l[0])),o.type instanceof Array&&sr(o.type,e);for(const[a,u]of Object.entries(o))if(u!=null)if(a=="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(j).includes(u.toUpperCase())?u.toUpperCase():j.TYPE_UNSPECIFIED}else if(t.includes(a))e[a]=Ie(u);else if(n.includes(a)){const d=[];for(const c of u){if(c.type=="null"){e.nullable=!0;continue}d.push(Ie(c))}e[a]=d}else if(i.includes(a)){const d={};for(const[c,f]of Object.entries(u))d[c]=Ie(f);e[a]=d}else{if(a==="additionalProperties")continue;e[a]=u}return e}function Qe(o,e){if(Object.keys(e).includes("$schema")){delete e.$schema;const t=rr().parse(e);return Ie(t)}else return Ie(e)}function oo(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 Ct(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=Qe(o,t.parameters)),t.response&&(t.response=Qe(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 lr(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 lr(o,e,"cachedContents")}function io(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 ar(o){return o!=null&&typeof o=="object"&&"name"in o}function ur(o){return o!=null&&typeof o=="object"&&"video"in o}function cr(o){return o!=null&&typeof o=="object"&&"uri"in o}function ro(o,e){var t;let n;if(ar(e)&&(n=e.name),!(cr(e)&&(n=e.uri,n===void 0))&&!(ur(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 l=n.split("files/")[1].match(/[a-z0-9]+/);if(l===null)throw new Error(`Could not extract file name from URI ${n}`);n=l[0]}else n.startsWith("files/")&&(n=n.split("files/")[1]);return n}}function so(o,e){let t;return o.isVertexAI()?t=e?"publishers/google/models":"models":t=e?"models":"tunedModels",t}function lo(o,e){for(const t of["models","tunedModels","publisherModels"])if(dr(e,t))return e[t];return[]}function dr(o,e){return o!==null&&typeof o=="object"&&e in o}function fr(o,e={}){const t=o,n={name:t.name,description:t.description,parameters:Ie(je(t.inputSchema))};return e.behavior&&(n.behavior=e.behavior),{functionDeclarations:[n]}}function pr(o,e={}){const t=[],n=new Set;for(const i of o){const l=i.name;if(n.has(l))throw new Error(`Duplicate function name ${l} found in MCP tools. Please ensure function names are unique.`);n.add(l);const a=fr(i,e);a.functionDeclarations&&t.push(...a.functionDeclarations)}return{functionDeclarations:t}}function mr(o){const e=[];for(const t of o)e.push(je(t));return e}function hr(o){const e={};for(const[t,n]of Object.entries(o)){const i=n;e[t]=je(i)}return e}function je(o){const e=new Set(["items"]),t=new Set(["anyOf"]),n=new Set(["properties"]),i={};for(const[l,a]of Object.entries(o))if(e.has(l))i[l]=je(a);else if(t.has(l))i[l]=mr(a);else if(n.has(l))i[l]=hr(a);else if(l==="type"){const u=a.toUpperCase();i[l]=Object.keys(j).includes(u)?u:j.TYPE_UNSPECIFIED}else or.has(l)&&(i[l]=a);return i}/**
113
+ */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 zn(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 Kn(o,e){return Array.isArray(e)?e.map(t=>Xe(o,t)):[Xe(o,e)]}function Xe(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 nr(o,e){const t=Xe(o,e);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function or(o,e){const t=Xe(o,e);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function Xn(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 Qn(o,e){if(e==null||Array.isArray(e)&&e.length===0)throw new Error("PartListUnion is required");return Array.isArray(e)?e.map(t=>Xn(o,t)):[Xn(o,e)]}function Tt(o){return o!=null&&typeof o=="object"&&"parts"in o&&Array.isArray(o.parts)}function jn(o){return o!=null&&typeof o=="object"&&"functionCall"in o}function eo(o){return o!=null&&typeof o=="object"&&"functionResponse"in o}function K(o,e){if(e==null)throw new Error("ContentUnion is required");return Tt(e)?e:{role:"user",parts:Qn(o,e)}}function to(o,e){if(!e)return[];if(o.isVertexAI()&&Array.isArray(e))return e.flatMap(t=>{const n=K(o,t);return n.parts&&n.parts.length>0&&n.parts[0].text!==void 0?[n.parts[0].text]:[]});if(o.isVertexAI()){const t=K(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=>K(o,t)):[K(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(jn(e)||eo(e))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[K(o,e)]}const t=[],n=[],i=Tt(e[0]);for(const l of e){const a=Tt(l);if(a!=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(a)t.push(l);else{if(jn(l)||eo(l))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(l)}}return i||t.push({role:"user",parts:Qn(o,n)}),t}const ir=new Set(["type","format","title","description","default","items","minItems","maxItems","enum","properties","required","minProperties","maxProperties","minimum","maximum","minLength","maxLength","pattern","anyOf","propertyOrdering"]),no=Oi(["string","number","integer","object","array","boolean","null"]),rr=Bi([no,Ue(no)]);function sr(o=!0){const e=$i(()=>{const t=Gi({type:rr.optional(),format:ge().optional(),title:ge().optional(),description:ge().optional(),default:rn().optional(),items:e.optional(),minItems:xe.string().optional(),maxItems:xe.string().optional(),enum:Ue(rn()).optional(),properties:qi(ge(),e).optional(),required:Ue(ge()).optional(),minProperties:xe.string().optional(),maxProperties:xe.string().optional(),propertyOrdering:Ue(ge()).optional(),minimum:on().optional(),maximum:on().optional(),minLength:xe.string().optional(),maxLength:xe.string().optional(),pattern:ge().optional(),anyOf:Ue(e).optional(),additionalProperties:bi().optional()});return o?t.strict():t});return e}function lr(o,e){o.includes("null")&&(e.nullable=!0);const t=o.filter(n=>n!=="null");if(t.length===1)e.type=Object.keys(j).includes(t[0].toUpperCase())?j[t[0].toUpperCase()]:j.TYPE_UNSPECIFIED;else{e.anyOf=[];for(const n of t)e.anyOf.push({type:Object.keys(j).includes(n.toUpperCase())?j[n.toUpperCase()]:j.TYPE_UNSPECIFIED})}}function Ie(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 l=o.anyOf;l!=null&&l.length==2&&(l[0].type==="null"?(e.nullable=!0,o=l[1]):l[1].type==="null"&&(e.nullable=!0,o=l[0])),o.type instanceof Array&&lr(o.type,e);for(const[a,u]of Object.entries(o))if(u!=null)if(a=="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(j).includes(u.toUpperCase())?u.toUpperCase():j.TYPE_UNSPECIFIED}else if(t.includes(a))e[a]=Ie(u);else if(n.includes(a)){const d=[];for(const c of u){if(c.type=="null"){e.nullable=!0;continue}d.push(Ie(c))}e[a]=d}else if(i.includes(a)){const d={};for(const[c,f]of Object.entries(u))d[c]=Ie(f);e[a]=d}else{if(a==="additionalProperties")continue;e[a]=u}return e}function Qe(o,e){if(Object.keys(e).includes("$schema")){delete e.$schema;const t=sr().parse(e);return Ie(t)}else return Ie(e)}function oo(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 Ct(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=Qe(o,t.parameters)),t.response&&(t.response=Qe(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 ar(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 de(o,e){if(typeof e!="string")throw new Error("name must be a string");return ar(o,e,"cachedContents")}function io(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 fe(o,e){if(typeof e!="string")throw new Error("fromImageBytes must be a string");return e}function ur(o){return o!=null&&typeof o=="object"&&"name"in o}function cr(o){return o!=null&&typeof o=="object"&&"video"in o}function dr(o){return o!=null&&typeof o=="object"&&"uri"in o}function ro(o,e){var t;let n;if(ur(e)&&(n=e.name),!(dr(e)&&(n=e.uri,n===void 0))&&!(cr(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 l=n.split("files/")[1].match(/[a-z0-9]+/);if(l===null)throw new Error(`Could not extract file name from URI ${n}`);n=l[0]}else n.startsWith("files/")&&(n=n.split("files/")[1]);return n}}function so(o,e){let t;return o.isVertexAI()?t=e?"publishers/google/models":"models":t=e?"models":"tunedModels",t}function lo(o,e){for(const t of["models","tunedModels","publisherModels"])if(fr(e,t))return e[t];return[]}function fr(o,e){return o!==null&&typeof o=="object"&&e in o}function pr(o,e={}){const t=o,n={name:t.name,description:t.description,parameters:Ie(je(t.inputSchema))};return e.behavior&&(n.behavior=e.behavior),{functionDeclarations:[n]}}function mr(o,e={}){const t=[],n=new Set;for(const i of o){const l=i.name;if(n.has(l))throw new Error(`Duplicate function name ${l} found in MCP tools. Please ensure function names are unique.`);n.add(l);const a=pr(i,e);a.functionDeclarations&&t.push(...a.functionDeclarations)}return{functionDeclarations:t}}function hr(o){const e=[];for(const t of o)e.push(je(t));return e}function gr(o){const e={};for(const[t,n]of Object.entries(o)){const i=n;e[t]=je(i)}return e}function je(o){const e=new Set(["items"]),t=new Set(["anyOf"]),n=new Set(["properties"]),i={};for(const[l,a]of Object.entries(o))if(e.has(l))i[l]=je(a);else if(t.has(l))i[l]=hr(a);else if(n.has(l))i[l]=gr(a);else if(l==="type"){const u=a.toUpperCase();i[l]=Object.keys(j).includes(u)?u:j.TYPE_UNSPECIFIED}else ir.has(l)&&(i[l]=a);return i}/**
114
114
  * @license
115
115
  * Copyright 2025 Google LLC
116
116
  * SPDX-License-Identifier: Apache-2.0
117
- */function gr(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function yr(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 vr(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 Tr(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],gr(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],yr(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],vr(o,a));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 ao(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Tr(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Cr(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 l=r(e,["name"]);l!=null&&s(t,["name"],l);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function _r(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 Er(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],_r(o,n)),t}function Sr(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 xr(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],Sr(o,n)),t}function Ar(){return{}}function Mr(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>Cr(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"],Er(o,i));const l=r(e,["googleSearchRetrieval"]);if(l!=null&&s(t,["googleSearchRetrieval"],xr(o,l)),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"],Ar());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function Ir(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 Rr(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 wr(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],Rr(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function Pr(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],Ir(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],wr(o,i)),t}function Nr(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const l=r(e,["expireTime"]);t!==void 0&&l!=null&&s(t,["expireTime"],l);const a=r(e,["displayName"]);t!==void 0&&a!=null&&s(t,["displayName"],a);const u=r(e,["contents"]);if(t!==void 0&&u!=null){let p=te(o,u);Array.isArray(p)&&(p=p.map(m=>ao(o,m))),s(t,["contents"],p)}const d=r(e,["systemInstruction"]);t!==void 0&&d!=null&&s(t,["systemInstruction"],ao(o,K(o,d)));const c=r(e,["tools"]);if(t!==void 0&&c!=null){let p=c;Array.isArray(p)&&(p=p.map(m=>Mr(o,m))),s(t,["tools"],p)}const f=r(e,["toolConfig"]);if(t!==void 0&&f!=null&&s(t,["toolConfig"],Pr(o,f)),r(e,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return n}function kr(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["model"],zn(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],Nr(o,i,t)),t}function Dr(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 Lr(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 Vr(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const l=r(e,["expireTime"]);return t!==void 0&&l!=null&&s(t,["expireTime"],l),n}function Fr(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"],Vr(o,i,t)),t}function Ur(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);return t!==void 0&&l!=null&&s(t,["_query","pageToken"],l),n}function br(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],Ur(o,n,t)),t}function Gr(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function Br(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function qr(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function $r(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Gr(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],Br(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],qr(o,a));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 uo(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>$r(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Or(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 l=r(e,["parameters"]);l!=null&&s(t,["parameters"],l);const a=r(e,["response"]);return a!=null&&s(t,["response"],a),t}function Hr(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 Jr(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Hr(o,n)),t}function Wr(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 Yr(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],Wr(o,n)),t}function Zr(){return{}}function zr(o,e){const t={},n=r(e,["apiKeyString"]);return n!=null&&s(t,["apiKeyString"],n),t}function Kr(o,e){const t={},n=r(e,["apiKeyConfig"]);n!=null&&s(t,["apiKeyConfig"],zr(o,n));const i=r(e,["authType"]);i!=null&&s(t,["authType"],i);const l=r(e,["googleServiceAccountConfig"]);l!=null&&s(t,["googleServiceAccountConfig"],l);const a=r(e,["httpBasicAuthConfig"]);a!=null&&s(t,["httpBasicAuthConfig"],a);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 Xr(o,e){const t={},n=r(e,["authConfig"]);return n!=null&&s(t,["authConfig"],Kr(o,n)),t}function Qr(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(p=>Or(o,p))),s(t,["functionDeclarations"],f)}const i=r(e,["retrieval"]);i!=null&&s(t,["retrieval"],i);const l=r(e,["googleSearch"]);l!=null&&s(t,["googleSearch"],Jr(o,l));const a=r(e,["googleSearchRetrieval"]);a!=null&&s(t,["googleSearchRetrieval"],Yr(o,a)),r(e,["enterpriseWebSearch"])!=null&&s(t,["enterpriseWebSearch"],Zr());const d=r(e,["googleMaps"]);if(d!=null&&s(t,["googleMaps"],Xr(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 jr(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 es(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 ts(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],es(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function ns(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],jr(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],ts(o,i)),t}function os(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const l=r(e,["expireTime"]);t!==void 0&&l!=null&&s(t,["expireTime"],l);const a=r(e,["displayName"]);t!==void 0&&a!=null&&s(t,["displayName"],a);const u=r(e,["contents"]);if(t!==void 0&&u!=null){let m=te(o,u);Array.isArray(m)&&(m=m.map(h=>uo(o,h))),s(t,["contents"],m)}const d=r(e,["systemInstruction"]);t!==void 0&&d!=null&&s(t,["systemInstruction"],uo(o,K(o,d)));const c=r(e,["tools"]);if(t!==void 0&&c!=null){let m=c;Array.isArray(m)&&(m=m.map(h=>Qr(o,h))),s(t,["tools"],m)}const f=r(e,["toolConfig"]);t!==void 0&&f!=null&&s(t,["toolConfig"],ns(o,f));const p=r(e,["kmsKeyName"]);return t!==void 0&&p!=null&&s(t,["encryption_spec","kmsKeyName"],p),n}function is(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["model"],zn(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],os(o,i,t)),t}function rs(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 ss(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 ls(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const l=r(e,["expireTime"]);return t!==void 0&&l!=null&&s(t,["expireTime"],l),n}function as(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"],ls(o,i,t)),t}function us(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);return t!==void 0&&l!=null&&s(t,["_query","pageToken"],l),n}function cs(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],us(o,n,t)),t}function et(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 l=r(e,["model"]);l!=null&&s(t,["model"],l);const a=r(e,["createTime"]);a!=null&&s(t,["createTime"],a);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 ds(){return{}}function fs(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["cachedContents"]);if(i!=null){let l=i;Array.isArray(l)&&(l=l.map(a=>et(o,a))),s(t,["cachedContents"],l)}return 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 l=r(e,["model"]);l!=null&&s(t,["model"],l);const a=r(e,["createTime"]);a!=null&&s(t,["createTime"],a);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 ps(){return{}}function ms(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["cachedContents"]);if(i!=null){let l=i;Array.isArray(l)&&(l=l.map(a=>tt(o,a))),s(t,["cachedContents"],l)}return t}/**
117
+ */function yr(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function vr(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 Tr(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 Cr(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],yr(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],vr(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Tr(o,a));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 ao(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Cr(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function _r(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 l=r(e,["name"]);l!=null&&s(t,["name"],l);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function Er(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 Sr(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Er(o,n)),t}function xr(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 Ar(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],xr(o,n)),t}function Mr(){return{}}function Ir(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>_r(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"],Sr(o,i));const l=r(e,["googleSearchRetrieval"]);if(l!=null&&s(t,["googleSearchRetrieval"],Ar(o,l)),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"],Mr());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function Rr(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 wr(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 Pr(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],wr(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function Nr(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],Rr(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],Pr(o,i)),t}function kr(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const l=r(e,["expireTime"]);t!==void 0&&l!=null&&s(t,["expireTime"],l);const a=r(e,["displayName"]);t!==void 0&&a!=null&&s(t,["displayName"],a);const u=r(e,["contents"]);if(t!==void 0&&u!=null){let p=te(o,u);Array.isArray(p)&&(p=p.map(m=>ao(o,m))),s(t,["contents"],p)}const d=r(e,["systemInstruction"]);t!==void 0&&d!=null&&s(t,["systemInstruction"],ao(o,K(o,d)));const c=r(e,["tools"]);if(t!==void 0&&c!=null){let p=c;Array.isArray(p)&&(p=p.map(m=>Ir(o,m))),s(t,["tools"],p)}const f=r(e,["toolConfig"]);if(t!==void 0&&f!=null&&s(t,["toolConfig"],Nr(o,f)),r(e,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return n}function Dr(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["model"],zn(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],kr(o,i,t)),t}function Lr(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],de(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Vr(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],de(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Fr(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const l=r(e,["expireTime"]);return t!==void 0&&l!=null&&s(t,["expireTime"],l),n}function Ur(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],de(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],Fr(o,i,t)),t}function br(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);return t!==void 0&&l!=null&&s(t,["_query","pageToken"],l),n}function Gr(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],br(o,n,t)),t}function Br(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function qr(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function $r(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Or(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Br(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],qr(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],$r(o,a));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 uo(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Or(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Hr(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 l=r(e,["parameters"]);l!=null&&s(t,["parameters"],l);const a=r(e,["response"]);return a!=null&&s(t,["response"],a),t}function Jr(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 Wr(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Jr(o,n)),t}function Yr(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 Zr(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],Yr(o,n)),t}function zr(){return{}}function Kr(o,e){const t={},n=r(e,["apiKeyString"]);return n!=null&&s(t,["apiKeyString"],n),t}function Xr(o,e){const t={},n=r(e,["apiKeyConfig"]);n!=null&&s(t,["apiKeyConfig"],Kr(o,n));const i=r(e,["authType"]);i!=null&&s(t,["authType"],i);const l=r(e,["googleServiceAccountConfig"]);l!=null&&s(t,["googleServiceAccountConfig"],l);const a=r(e,["httpBasicAuthConfig"]);a!=null&&s(t,["httpBasicAuthConfig"],a);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 Qr(o,e){const t={},n=r(e,["authConfig"]);return n!=null&&s(t,["authConfig"],Xr(o,n)),t}function jr(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(p=>Hr(o,p))),s(t,["functionDeclarations"],f)}const i=r(e,["retrieval"]);i!=null&&s(t,["retrieval"],i);const l=r(e,["googleSearch"]);l!=null&&s(t,["googleSearch"],Wr(o,l));const a=r(e,["googleSearchRetrieval"]);a!=null&&s(t,["googleSearchRetrieval"],Zr(o,a)),r(e,["enterpriseWebSearch"])!=null&&s(t,["enterpriseWebSearch"],zr());const d=r(e,["googleMaps"]);if(d!=null&&s(t,["googleMaps"],Qr(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 es(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 ts(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 ns(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],ts(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function os(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],es(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],ns(o,i)),t}function is(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const l=r(e,["expireTime"]);t!==void 0&&l!=null&&s(t,["expireTime"],l);const a=r(e,["displayName"]);t!==void 0&&a!=null&&s(t,["displayName"],a);const u=r(e,["contents"]);if(t!==void 0&&u!=null){let m=te(o,u);Array.isArray(m)&&(m=m.map(h=>uo(o,h))),s(t,["contents"],m)}const d=r(e,["systemInstruction"]);t!==void 0&&d!=null&&s(t,["systemInstruction"],uo(o,K(o,d)));const c=r(e,["tools"]);if(t!==void 0&&c!=null){let m=c;Array.isArray(m)&&(m=m.map(h=>jr(o,h))),s(t,["tools"],m)}const f=r(e,["toolConfig"]);t!==void 0&&f!=null&&s(t,["toolConfig"],os(o,f));const p=r(e,["kmsKeyName"]);return t!==void 0&&p!=null&&s(t,["encryption_spec","kmsKeyName"],p),n}function rs(o,e){const t={},n=r(e,["model"]);n!=null&&s(t,["model"],zn(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],is(o,i,t)),t}function ss(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],de(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function ls(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],de(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function as(o,e,t){const n={},i=r(e,["ttl"]);t!==void 0&&i!=null&&s(t,["ttl"],i);const l=r(e,["expireTime"]);return t!==void 0&&l!=null&&s(t,["expireTime"],l),n}function us(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","name"],de(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],as(o,i,t)),t}function cs(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);return t!==void 0&&l!=null&&s(t,["_query","pageToken"],l),n}function ds(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],cs(o,n,t)),t}function et(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 l=r(e,["model"]);l!=null&&s(t,["model"],l);const a=r(e,["createTime"]);a!=null&&s(t,["createTime"],a);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 fs(){return{}}function ps(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["cachedContents"]);if(i!=null){let l=i;Array.isArray(l)&&(l=l.map(a=>et(o,a))),s(t,["cachedContents"],l)}return 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 l=r(e,["model"]);l!=null&&s(t,["model"],l);const a=r(e,["createTime"]);a!=null&&s(t,["createTime"],a);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 ms(){return{}}function hs(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["cachedContents"]);if(i!=null){let l=i;Array.isArray(l)&&(l=l.map(a=>tt(o,a))),s(t,["cachedContents"],l)}return t}/**
118
118
  * @license
119
119
  * Copyright 2025 Google LLC
120
120
  * SPDX-License-Identifier: Apache-2.0
@@ -122,43 +122,43 @@ React keys must be passed directly to JSX without using spread:
122
122
  * @license
123
123
  * Copyright 2025 Google LLC
124
124
  * SPDX-License-Identifier: Apache-2.0
125
- */class hs extends Ae{constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new nt(Re.PAGED_ITEM_CACHED_CONTENTS,n=>this.listInternal(n),await this.listInternal(t),t)}async create(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=is(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>tt(this.apiClient,f))}else{const c=kr(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>et(this.apiClient,f))}}async get(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=rs(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>tt(this.apiClient,f))}else{const c=Dr(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>et(this.apiClient,f))}}async delete(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=ss(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(()=>{const f=ps(),p=new Yn;return Object.assign(p,f),p})}else{const c=Lr(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(()=>{const f=ds(),p=new Yn;return Object.assign(p,f),p})}}async update(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=as(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>tt(this.apiClient,f))}else{const c=Fr(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>et(this.apiClient,f))}}async listInternal(e){var t,n,i,l;let a,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,a=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()),a.then(f=>{const p=ms(this.apiClient,f),m=new Zn;return Object.assign(m,p),m})}else{const c=br(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=fs(this.apiClient,f),m=new Zn;return Object.assign(m,p),m})}}}function co(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 we(o,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(o,e||[]),i,l=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(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(E,M){l.push([h,v,E,M])>1||d(h,v)})},g&&(i[h]=g(i[h])))}function d(h,g){try{c(n[h](g))}catch(v){m(l[0][3],v)}}function c(h){h.value instanceof $?Promise.resolve(h.value.v).then(f,p):m(l[0][2],h)}function f(h){d("next",h)}function p(h){d("throw",h)}function m(h,g){h(g),l.shift(),l.length&&d(l[0][0],l[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 co=="function"?co(o):o[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(l){t[l]=o[l]&&function(a){return new Promise(function(u,d){a=o[l](a),i(u,d,a.done,a.value)})}}function i(l,a,u,d){Promise.resolve(d).then(function(c){l({value:c,done:u})},a)}}typeof SuppressedError=="function"&&SuppressedError;/**
125
+ */class gs extends Ae{constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new nt(Re.PAGED_ITEM_CACHED_CONTENTS,n=>this.listInternal(n),await this.listInternal(t),t)}async create(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=rs(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>tt(this.apiClient,f))}else{const c=Dr(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>et(this.apiClient,f))}}async get(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=ss(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>tt(this.apiClient,f))}else{const c=Lr(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>et(this.apiClient,f))}}async delete(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=ls(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(()=>{const f=ms(),p=new Yn;return Object.assign(p,f),p})}else{const c=Vr(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(()=>{const f=fs(),p=new Yn;return Object.assign(p,f),p})}}async update(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=us(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>tt(this.apiClient,f))}else{const c=Ur(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>et(this.apiClient,f))}}async listInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=ds(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=hs(this.apiClient,f),m=new Zn;return Object.assign(m,p),m})}else{const c=Gr(this.apiClient,e);return u=I("cachedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=ps(this.apiClient,f),m=new Zn;return Object.assign(m,p),m})}}}function co(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 we(o,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(o,e||[]),i,l=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(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(E,M){l.push([h,v,E,M])>1||d(h,v)})},g&&(i[h]=g(i[h])))}function d(h,g){try{c(n[h](g))}catch(v){m(l[0][3],v)}}function c(h){h.value instanceof $?Promise.resolve(h.value.v).then(f,p):m(l[0][2],h)}function f(h){d("next",h)}function p(h){d("throw",h)}function m(h,g){h(g),l.shift(),l.length&&d(l[0][0],l[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 co=="function"?co(o):o[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(l){t[l]=o[l]&&function(a){return new Promise(function(u,d){a=o[l](a),i(u,d,a.done,a.value)})}}function i(l,a,u,d){Promise.resolve(d).then(function(c){l({value:c,done:u})},a)}}typeof SuppressedError=="function"&&SuppressedError;/**
126
126
  * @license
127
127
  * Copyright 2025 Google LLC
128
128
  * SPDX-License-Identifier: Apache-2.0
129
- */function gs(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:fo(t)}function fo(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 ys(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 po(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 l=!0;for(;n<t&&o[n].role==="model";)i.push(o[n]),l&&!fo(o[n])&&(l=!1),n++;l?e.push(...i):e.pop()}return e}class vs{constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new Ts(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}}class Ts{constructor(e,t,n,i={},l=[]){this.apiClient=e,this.modelsModule=t,this.model=n,this.config=i,this.history=l,this.sendPromise=Promise.resolve(),ys(l)}async sendMessage(e){var t;await this.sendPromise;const n=K(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 l,a,u;const d=await i,c=(a=(l=d.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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=K(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 l=await i;return this.processStreamResponse(l,n)}getHistory(e=!1){const t=e?po(this.history):this.history;return structuredClone(t)}processStreamResponse(e,t){var n,i;return we(this,arguments,function*(){var a,u,d,c;const f=[];try{for(var p=!0,m=qe(e),h;h=yield $(m.next()),a=h.done,!a;p=!0){c=h.value,p=!1;const g=c;if(gs(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&&!a&&(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(l=>l.role!==void 0)?i=t:i.push({role:"model",parts:[]}),n&&n.length>0?this.history.push(...po(n)):this.history.push(e),this.history.push(...i)}}/**
129
+ */function ys(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:fo(t)}function fo(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 vs(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 po(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 l=!0;for(;n<t&&o[n].role==="model";)i.push(o[n]),l&&!fo(o[n])&&(l=!1),n++;l?e.push(...i):e.pop()}return e}class Ts{constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new Cs(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}}class Cs{constructor(e,t,n,i={},l=[]){this.apiClient=e,this.modelsModule=t,this.model=n,this.config=i,this.history=l,this.sendPromise=Promise.resolve(),vs(l)}async sendMessage(e){var t;await this.sendPromise;const n=K(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 l,a,u;const d=await i,c=(a=(l=d.candidates)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.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=K(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 l=await i;return this.processStreamResponse(l,n)}getHistory(e=!1){const t=e?po(this.history):this.history;return structuredClone(t)}processStreamResponse(e,t){var n,i;return we(this,arguments,function*(){var a,u,d,c;const f=[];try{for(var p=!0,m=qe(e),h;h=yield $(m.next()),a=h.done,!a;p=!0){c=h.value,p=!1;const g=c;if(ys(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&&!a&&(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(l=>l.role!==void 0)?i=t:i.push({role:"model",parts:[]}),n&&n.length>0?this.history.push(...po(n)):this.history.push(e),this.history.push(...i)}}/**
130
130
  * @license
131
131
  * Copyright 2025 Google LLC
132
132
  * SPDX-License-Identifier: Apache-2.0
133
- */function Cs(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);return t!==void 0&&l!=null&&s(t,["_query","pageToken"],l),n}function _s(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],Cs(o,n,t)),t}function Es(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 l=r(e,["code"]);return l!=null&&s(t,["code"],l),t}function Ss(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 l=r(e,["mimeType"]);l!=null&&s(t,["mimeType"],l);const a=r(e,["sizeBytes"]);a!=null&&s(t,["sizeBytes"],a);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 E=r(e,["error"]);return E!=null&&s(t,["error"],Es(o,E)),t}function xs(o,e){const t={},n=r(e,["file"]);n!=null&&s(t,["file"],Ss(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function As(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","file"],ro(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Ms(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","file"],ro(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),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 l=r(e,["code"]);return l!=null&&s(t,["code"],l),t}function _t(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 l=r(e,["mimeType"]);l!=null&&s(t,["mimeType"],l);const a=r(e,["sizeBytes"]);a!=null&&s(t,["sizeBytes"],a);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 E=r(e,["error"]);return E!=null&&s(t,["error"],Is(o,E)),t}function Rs(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["files"]);if(i!=null){let l=i;Array.isArray(l)&&(l=l.map(a=>_t(o,a))),s(t,["files"],l)}return t}function ws(){return{}}function Ps(){return{}}/**
133
+ */function _s(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);return t!==void 0&&l!=null&&s(t,["_query","pageToken"],l),n}function Es(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],_s(o,n,t)),t}function Ss(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 l=r(e,["code"]);return l!=null&&s(t,["code"],l),t}function xs(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 l=r(e,["mimeType"]);l!=null&&s(t,["mimeType"],l);const a=r(e,["sizeBytes"]);a!=null&&s(t,["sizeBytes"],a);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 E=r(e,["error"]);return E!=null&&s(t,["error"],Ss(o,E)),t}function As(o,e){const t={},n=r(e,["file"]);n!=null&&s(t,["file"],xs(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Ms(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","file"],ro(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Is(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["_url","file"],ro(o,n));const i=r(e,["config"]);return i!=null&&s(t,["config"],i),t}function Rs(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 l=r(e,["code"]);return l!=null&&s(t,["code"],l),t}function _t(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 l=r(e,["mimeType"]);l!=null&&s(t,["mimeType"],l);const a=r(e,["sizeBytes"]);a!=null&&s(t,["sizeBytes"],a);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 E=r(e,["error"]);return E!=null&&s(t,["error"],Rs(o,E)),t}function ws(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["files"]);if(i!=null){let l=i;Array.isArray(l)&&(l=l.map(a=>_t(o,a))),s(t,["files"],l)}return t}function Ps(){return{}}function Ns(){return{}}/**
134
134
  * @license
135
135
  * Copyright 2025 Google LLC
136
136
  * SPDX-License-Identifier: Apache-2.0
137
- */class Ns extends Ae{constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new nt(Re.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=>_t(this.apiClient,t))}async download(e){await this.apiClient.downloadFile(e)}async listInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=_s(this.apiClient,e);return l=I("files",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=Rs(this.apiClient,d),f=new Ki;return Object.assign(f,c),f})}}async createInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=xs(this.apiClient,e);return l=I("upload/v1beta/files",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=ws(),c=new Xi;return Object.assign(c,d),c})}}async get(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=As(this.apiClient,e);return l=I("files/{file}",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=>_t(this.apiClient,d))}}async delete(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=Ms(this.apiClient,e);return l=I("files/{file}",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=Ps(),c=new Qi;return Object.assign(c,d),c})}}}/**
137
+ */class ks extends Ae{constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new nt(Re.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=>_t(this.apiClient,t))}async download(e){await this.apiClient.downloadFile(e)}async listInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=Es(this.apiClient,e);return l=I("files",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=ws(this.apiClient,d),f=new Xi;return Object.assign(f,c),f})}}async createInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=As(this.apiClient,e);return l=I("upload/v1beta/files",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=Ps(),c=new Qi;return Object.assign(c,d),c})}}async get(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=Ms(this.apiClient,e);return l=I("files/{file}",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=>_t(this.apiClient,d))}}async delete(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=Is(this.apiClient,e);return l=I("files/{file}",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=Ns(),c=new ji;return Object.assign(c,d),c})}}}/**
138
138
  * @license
139
139
  * Copyright 2025 Google LLC
140
140
  * SPDX-License-Identifier: Apache-2.0
141
- */function ks(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function Ds(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function mo(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],ks(o,n)),t}function Ls(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Ds(o,n)),t}function Vs(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"],mo(o,i)),t}function Fs(o,e){const t={},n=r(e,["speakerVoiceConfigs"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>Vs(o,l))),s(t,["speakerVoiceConfigs"],i)}return t}function Us(o,e){const t={},n=r(e,["voiceConfig"]);n!=null&&s(t,["voiceConfig"],mo(o,n));const i=r(e,["multiSpeakerVoiceConfig"]);i!=null&&s(t,["multiSpeakerVoiceConfig"],Fs(o,i));const l=r(e,["languageCode"]);return l!=null&&s(t,["languageCode"],l),t}function bs(o,e){const t={},n=r(e,["voiceConfig"]);if(n!=null&&s(t,["voiceConfig"],Ls(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 Gs(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function Bs(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function qs(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 $s(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Os(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 Hs(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Js(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Gs(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],qs(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Os(o,a));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 Ws(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Bs(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],$s(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Hs(o,a));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 Ys(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Js(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Zs(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Ws(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function zs(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 l=r(e,["name"]);l!=null&&s(t,["name"],l);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function Ks(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 l=r(e,["parameters"]);l!=null&&s(t,["parameters"],l);const a=r(e,["response"]);return a!=null&&s(t,["response"],a),t}function Xs(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 Qs(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 js(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Xs(o,n)),t}function el(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Qs(o,n)),t}function tl(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 nl(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 ol(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],tl(o,n)),t}function il(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],nl(o,n)),t}function rl(){return{}}function sl(o,e){const t={},n=r(e,["apiKeyString"]);return n!=null&&s(t,["apiKeyString"],n),t}function ll(o,e){const t={},n=r(e,["apiKeyConfig"]);n!=null&&s(t,["apiKeyConfig"],sl(o,n));const i=r(e,["authType"]);i!=null&&s(t,["authType"],i);const l=r(e,["googleServiceAccountConfig"]);l!=null&&s(t,["googleServiceAccountConfig"],l);const a=r(e,["httpBasicAuthConfig"]);a!=null&&s(t,["httpBasicAuthConfig"],a);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 al(o,e){const t={},n=r(e,["authConfig"]);return n!=null&&s(t,["authConfig"],ll(o,n)),t}function ul(){return{}}function cl(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>zs(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"],js(o,i));const l=r(e,["googleSearchRetrieval"]);if(l!=null&&s(t,["googleSearchRetrieval"],ol(o,l)),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 dl(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(p=>Ks(o,p))),s(t,["functionDeclarations"],f)}const i=r(e,["retrieval"]);i!=null&&s(t,["retrieval"],i);const l=r(e,["googleSearch"]);l!=null&&s(t,["googleSearch"],el(o,l));const a=r(e,["googleSearchRetrieval"]);a!=null&&s(t,["googleSearchRetrieval"],il(o,a)),r(e,["enterpriseWebSearch"])!=null&&s(t,["enterpriseWebSearch"],rl());const d=r(e,["googleMaps"]);if(d!=null&&s(t,["googleMaps"],al(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 fl(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 pl(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 ho(){return{}}function go(){return{}}function ml(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 l=r(e,["endOfSpeechSensitivity"]);l!=null&&s(t,["endOfSpeechSensitivity"],l);const a=r(e,["prefixPaddingMs"]);a!=null&&s(t,["prefixPaddingMs"],a);const u=r(e,["silenceDurationMs"]);return u!=null&&s(t,["silenceDurationMs"],u),t}function hl(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 l=r(e,["endOfSpeechSensitivity"]);l!=null&&s(t,["endOfSpeechSensitivity"],l);const a=r(e,["prefixPaddingMs"]);a!=null&&s(t,["prefixPaddingMs"],a);const u=r(e,["silenceDurationMs"]);return u!=null&&s(t,["silenceDurationMs"],u),t}function gl(o,e){const t={},n=r(e,["automaticActivityDetection"]);n!=null&&s(t,["automaticActivityDetection"],ml(o,n));const i=r(e,["activityHandling"]);i!=null&&s(t,["activityHandling"],i);const l=r(e,["turnCoverage"]);return l!=null&&s(t,["turnCoverage"],l),t}function yl(o,e){const t={},n=r(e,["automaticActivityDetection"]);n!=null&&s(t,["automaticActivityDetection"],hl(o,n));const i=r(e,["activityHandling"]);i!=null&&s(t,["activityHandling"],i);const l=r(e,["turnCoverage"]);return l!=null&&s(t,["turnCoverage"],l),t}function vl(o,e){const t={},n=r(e,["targetTokens"]);return n!=null&&s(t,["targetTokens"],n),t}function Tl(o,e){const t={},n=r(e,["targetTokens"]);return n!=null&&s(t,["targetTokens"],n),t}function Cl(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"],vl(o,i)),t}function _l(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"],Tl(o,i)),t}function El(o,e){const t={},n=r(e,["proactiveAudio"]);return n!=null&&s(t,["proactiveAudio"],n),t}function Sl(o,e){const t={},n=r(e,["proactiveAudio"]);return n!=null&&s(t,["proactiveAudio"],n),t}function xl(o,e,t){const n={},i=r(e,["generationConfig"]);t!==void 0&&i!=null&&s(t,["setup","generationConfig"],i);const l=r(e,["responseModalities"]);t!==void 0&&l!=null&&s(t,["setup","generationConfig","responseModalities"],l);const a=r(e,["temperature"]);t!==void 0&&a!=null&&s(t,["setup","generationConfig","temperature"],a);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"],Us(o,Ct(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"],Ys(o,K(o,g)));const v=r(e,["tools"]);if(t!==void 0&&v!=null){let V=Be(o,v);Array.isArray(V)&&(V=V.map(B=>cl(o,Ge(o,B)))),s(t,["setup","tools"],V)}const E=r(e,["sessionResumption"]);t!==void 0&&E!=null&&s(t,["setup","sessionResumption"],fl(o,E));const M=r(e,["inputAudioTranscription"]);t!==void 0&&M!=null&&s(t,["setup","inputAudioTranscription"],ho());const _=r(e,["outputAudioTranscription"]);t!==void 0&&_!=null&&s(t,["setup","outputAudioTranscription"],ho());const A=r(e,["realtimeInputConfig"]);t!==void 0&&A!=null&&s(t,["setup","realtimeInputConfig"],gl(o,A));const R=r(e,["contextWindowCompression"]);t!==void 0&&R!=null&&s(t,["setup","contextWindowCompression"],Cl(o,R));const k=r(e,["proactivity"]);return t!==void 0&&k!=null&&s(t,["setup","proactivity"],El(o,k)),n}function Al(o,e,t){const n={},i=r(e,["generationConfig"]);t!==void 0&&i!=null&&s(t,["setup","generationConfig"],i);const l=r(e,["responseModalities"]);t!==void 0&&l!=null&&s(t,["setup","generationConfig","responseModalities"],l);const a=r(e,["temperature"]);t!==void 0&&a!=null&&s(t,["setup","generationConfig","temperature"],a);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"],bs(o,Ct(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"],Zs(o,K(o,g)));const v=r(e,["tools"]);if(t!==void 0&&v!=null){let V=Be(o,v);Array.isArray(V)&&(V=V.map(B=>dl(o,Ge(o,B)))),s(t,["setup","tools"],V)}const E=r(e,["sessionResumption"]);t!==void 0&&E!=null&&s(t,["setup","sessionResumption"],pl(o,E));const M=r(e,["inputAudioTranscription"]);t!==void 0&&M!=null&&s(t,["setup","inputAudioTranscription"],go());const _=r(e,["outputAudioTranscription"]);t!==void 0&&_!=null&&s(t,["setup","outputAudioTranscription"],go());const A=r(e,["realtimeInputConfig"]);t!==void 0&&A!=null&&s(t,["setup","realtimeInputConfig"],yl(o,A));const R=r(e,["contextWindowCompression"]);t!==void 0&&R!=null&&s(t,["setup","contextWindowCompression"],_l(o,R));const k=r(e,["proactivity"]);return t!==void 0&&k!=null&&s(t,["setup","proactivity"],Sl(o,k)),n}function Ml(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"],xl(o,i,t)),t}function Il(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"],Al(o,i,t)),t}function Rl(){return{}}function wl(){return{}}function Pl(){return{}}function Nl(){return{}}function kl(o,e){const t={},n=r(e,["media"]);n!=null&&s(t,["mediaChunks"],Kn(o,n));const i=r(e,["audio"]);i!=null&&s(t,["audio"],nr(o,i));const l=r(e,["audioStreamEnd"]);l!=null&&s(t,["audioStreamEnd"],l);const a=r(e,["video"]);a!=null&&s(t,["video"],tr(o,a));const u=r(e,["text"]);return u!=null&&s(t,["text"],u),r(e,["activityStart"])!=null&&s(t,["activityStart"],Rl()),r(e,["activityEnd"])!=null&&s(t,["activityEnd"],Pl()),t}function Dl(o,e){const t={},n=r(e,["media"]);if(n!=null&&s(t,["mediaChunks"],Kn(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"],wl()),r(e,["activityEnd"])!=null&&s(t,["activityEnd"],Nl()),t}function yo(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 Ll(o,e){const t={},n=r(e,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>yo(o,l))),s(t,["weightedPrompts"],i)}return t}function vo(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 l=r(e,["seed"]);l!=null&&s(t,["seed"],l);const a=r(e,["guidance"]);a!=null&&s(t,["guidance"],a);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 Vl(o,e){const t={},n=r(e,["musicGenerationConfig"]);return n!=null&&s(t,["musicGenerationConfig"],vo(o,n)),t}function To(o,e){const t={},n=r(e,["model"]);return n!=null&&s(t,["model"],n),t}function Co(o,e){const t={},n=r(e,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>yo(o,l))),s(t,["weightedPrompts"],i)}return t}function Et(o,e){const t={},n=r(e,["setup"]);n!=null&&s(t,["setup"],To(o,n));const i=r(e,["clientContent"]);i!=null&&s(t,["clientContent"],Co(o,i));const l=r(e,["musicGenerationConfig"]);l!=null&&s(t,["musicGenerationConfig"],vo(o,l));const a=r(e,["playbackControl"]);return a!=null&&s(t,["playbackControl"],a),t}function Fl(){return{}}function Ul(){return{}}function bl(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function Gl(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function Bl(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 ql(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function $l(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 Ol(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Hl(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],bl(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],Bl(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],$l(o,a));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 Jl(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Gl(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],ql(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Ol(o,a));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 Wl(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Hl(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Yl(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Jl(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function _o(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 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 Zl(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 zl(o,e){const t={},n=r(e,["urlMetadata"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>Zl(o,l))),s(t,["urlMetadata"],i)}return t}function Kl(o,e){const t={},n=r(e,["modelTurn"]);n!=null&&s(t,["modelTurn"],Wl(o,n));const i=r(e,["turnComplete"]);i!=null&&s(t,["turnComplete"],i);const l=r(e,["interrupted"]);l!=null&&s(t,["interrupted"],l);const a=r(e,["groundingMetadata"]);a!=null&&s(t,["groundingMetadata"],a);const u=r(e,["generationComplete"]);u!=null&&s(t,["generationComplete"],u);const d=r(e,["inputTranscription"]);d!=null&&s(t,["inputTranscription"],_o(o,d));const c=r(e,["outputTranscription"]);c!=null&&s(t,["outputTranscription"],_o(o,c));const f=r(e,["urlContextMetadata"]);return f!=null&&s(t,["urlContextMetadata"],zl(o,f)),t}function Xl(o,e){const t={},n=r(e,["modelTurn"]);n!=null&&s(t,["modelTurn"],Yl(o,n));const i=r(e,["turnComplete"]);i!=null&&s(t,["turnComplete"],i);const l=r(e,["interrupted"]);l!=null&&s(t,["interrupted"],l);const a=r(e,["groundingMetadata"]);a!=null&&s(t,["groundingMetadata"],a);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"]);return c!=null&&s(t,["outputTranscription"],Eo(o,c)),t}function Ql(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 l=r(e,["name"]);return l!=null&&s(t,["name"],l),t}function jl(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 ea(o,e){const t={},n=r(e,["functionCalls"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>Ql(o,l))),s(t,["functionCalls"],i)}return t}function ta(o,e){const t={},n=r(e,["functionCalls"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>jl(o,l))),s(t,["functionCalls"],i)}return t}function na(o,e){const t={},n=r(e,["ids"]);return n!=null&&s(t,["ids"],n),t}function oa(o,e){const t={},n=r(e,["ids"]);return n!=null&&s(t,["ids"],n),t}function ot(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 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 ia(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 l=r(e,["responseTokenCount"]);l!=null&&s(t,["responseTokenCount"],l);const a=r(e,["toolUsePromptTokenCount"]);a!=null&&s(t,["toolUsePromptTokenCount"],a);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=>ot(o,g))),s(t,["promptTokensDetails"],h)}const f=r(e,["cacheTokensDetails"]);if(f!=null){let h=f;Array.isArray(h)&&(h=h.map(g=>ot(o,g))),s(t,["cacheTokensDetails"],h)}const p=r(e,["responseTokensDetails"]);if(p!=null){let h=p;Array.isArray(h)&&(h=h.map(g=>ot(o,g))),s(t,["responseTokensDetails"],h)}const m=r(e,["toolUsePromptTokensDetails"]);if(m!=null){let h=m;Array.isArray(h)&&(h=h.map(g=>ot(o,g))),s(t,["toolUsePromptTokensDetails"],h)}return t}function ra(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 l=r(e,["candidatesTokenCount"]);l!=null&&s(t,["responseTokenCount"],l);const a=r(e,["toolUsePromptTokenCount"]);a!=null&&s(t,["toolUsePromptTokenCount"],a);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=>it(o,v))),s(t,["promptTokensDetails"],g)}const f=r(e,["cacheTokensDetails"]);if(f!=null){let g=f;Array.isArray(g)&&(g=g.map(v=>it(o,v))),s(t,["cacheTokensDetails"],g)}const p=r(e,["candidatesTokensDetails"]);if(p!=null){let g=p;Array.isArray(g)&&(g=g.map(v=>it(o,v))),s(t,["responseTokensDetails"],g)}const m=r(e,["toolUsePromptTokensDetails"]);if(m!=null){let g=m;Array.isArray(g)&&(g=g.map(v=>it(o,v))),s(t,["toolUsePromptTokensDetails"],g)}const h=r(e,["trafficType"]);return h!=null&&s(t,["trafficType"],h),t}function sa(o,e){const t={},n=r(e,["timeLeft"]);return n!=null&&s(t,["timeLeft"],n),t}function la(o,e){const t={},n=r(e,["timeLeft"]);return n!=null&&s(t,["timeLeft"],n),t}function aa(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 l=r(e,["lastConsumedClientMessageIndex"]);return l!=null&&s(t,["lastConsumedClientMessageIndex"],l),t}function ua(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 l=r(e,["lastConsumedClientMessageIndex"]);return l!=null&&s(t,["lastConsumedClientMessageIndex"],l),t}function ca(o,e){const t={};r(e,["setupComplete"])!=null&&s(t,["setupComplete"],Fl());const i=r(e,["serverContent"]);i!=null&&s(t,["serverContent"],Kl(o,i));const l=r(e,["toolCall"]);l!=null&&s(t,["toolCall"],ea(o,l));const a=r(e,["toolCallCancellation"]);a!=null&&s(t,["toolCallCancellation"],na(o,a));const u=r(e,["usageMetadata"]);u!=null&&s(t,["usageMetadata"],ia(o,u));const d=r(e,["goAway"]);d!=null&&s(t,["goAway"],sa(o,d));const c=r(e,["sessionResumptionUpdate"]);return c!=null&&s(t,["sessionResumptionUpdate"],aa(o,c)),t}function da(o,e){const t={};r(e,["setupComplete"])!=null&&s(t,["setupComplete"],Ul());const i=r(e,["serverContent"]);i!=null&&s(t,["serverContent"],Xl(o,i));const l=r(e,["toolCall"]);l!=null&&s(t,["toolCall"],ta(o,l));const a=r(e,["toolCallCancellation"]);a!=null&&s(t,["toolCallCancellation"],oa(o,a));const u=r(e,["usageMetadata"]);u!=null&&s(t,["usageMetadata"],ra(o,u));const d=r(e,["goAway"]);d!=null&&s(t,["goAway"],la(o,d));const c=r(e,["sessionResumptionUpdate"]);return c!=null&&s(t,["sessionResumptionUpdate"],ua(o,c)),t}function fa(){return{}}function pa(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 ma(o,e){const t={},n=r(e,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>pa(o,l))),s(t,["weightedPrompts"],i)}return t}function ha(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 l=r(e,["seed"]);l!=null&&s(t,["seed"],l);const a=r(e,["guidance"]);a!=null&&s(t,["guidance"],a);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 ga(o,e){const t={},n=r(e,["clientContent"]);n!=null&&s(t,["clientContent"],ma(o,n));const i=r(e,["musicGenerationConfig"]);return i!=null&&s(t,["musicGenerationConfig"],ha(o,i)),t}function ya(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 l=r(e,["sourceMetadata"]);return l!=null&&s(t,["sourceMetadata"],ga(o,l)),t}function va(o,e){const t={},n=r(e,["audioChunks"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>ya(o,l))),s(t,["audioChunks"],i)}return t}function Ta(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 Ca(o,e){const t={};r(e,["setupComplete"])!=null&&s(t,["setupComplete"],fa());const i=r(e,["serverContent"]);i!=null&&s(t,["serverContent"],va(o,i));const l=r(e,["filteredPrompt"]);return l!=null&&s(t,["filteredPrompt"],Ta(o,l)),t}/**
141
+ */function Ds(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function Ls(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function mo(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Ds(o,n)),t}function Vs(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Ls(o,n)),t}function Fs(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"],mo(o,i)),t}function Us(o,e){const t={},n=r(e,["speakerVoiceConfigs"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>Fs(o,l))),s(t,["speakerVoiceConfigs"],i)}return t}function bs(o,e){const t={},n=r(e,["voiceConfig"]);n!=null&&s(t,["voiceConfig"],mo(o,n));const i=r(e,["multiSpeakerVoiceConfig"]);i!=null&&s(t,["multiSpeakerVoiceConfig"],Us(o,i));const l=r(e,["languageCode"]);return l!=null&&s(t,["languageCode"],l),t}function Gs(o,e){const t={},n=r(e,["voiceConfig"]);if(n!=null&&s(t,["voiceConfig"],Vs(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 Bs(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function qs(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function $s(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 Os(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Hs(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 Js(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Ws(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Bs(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],$s(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Hs(o,a));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 Ys(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],qs(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],Os(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Js(o,a));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 Zs(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Ws(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function zs(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Ys(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Ks(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 l=r(e,["name"]);l!=null&&s(t,["name"],l);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function Xs(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 l=r(e,["parameters"]);l!=null&&s(t,["parameters"],l);const a=r(e,["response"]);return a!=null&&s(t,["response"],a),t}function Qs(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 js(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 el(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Qs(o,n)),t}function tl(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],js(o,n)),t}function nl(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 ol(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 il(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],nl(o,n)),t}function rl(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],ol(o,n)),t}function sl(){return{}}function ll(o,e){const t={},n=r(e,["apiKeyString"]);return n!=null&&s(t,["apiKeyString"],n),t}function al(o,e){const t={},n=r(e,["apiKeyConfig"]);n!=null&&s(t,["apiKeyConfig"],ll(o,n));const i=r(e,["authType"]);i!=null&&s(t,["authType"],i);const l=r(e,["googleServiceAccountConfig"]);l!=null&&s(t,["googleServiceAccountConfig"],l);const a=r(e,["httpBasicAuthConfig"]);a!=null&&s(t,["httpBasicAuthConfig"],a);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 ul(o,e){const t={},n=r(e,["authConfig"]);return n!=null&&s(t,["authConfig"],al(o,n)),t}function cl(){return{}}function dl(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>Ks(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"],el(o,i));const l=r(e,["googleSearchRetrieval"]);if(l!=null&&s(t,["googleSearchRetrieval"],il(o,l)),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"],cl());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function fl(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(p=>Xs(o,p))),s(t,["functionDeclarations"],f)}const i=r(e,["retrieval"]);i!=null&&s(t,["retrieval"],i);const l=r(e,["googleSearch"]);l!=null&&s(t,["googleSearch"],tl(o,l));const a=r(e,["googleSearchRetrieval"]);a!=null&&s(t,["googleSearchRetrieval"],rl(o,a)),r(e,["enterpriseWebSearch"])!=null&&s(t,["enterpriseWebSearch"],sl());const d=r(e,["googleMaps"]);if(d!=null&&s(t,["googleMaps"],ul(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 pl(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 ml(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 ho(){return{}}function go(){return{}}function hl(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 l=r(e,["endOfSpeechSensitivity"]);l!=null&&s(t,["endOfSpeechSensitivity"],l);const a=r(e,["prefixPaddingMs"]);a!=null&&s(t,["prefixPaddingMs"],a);const u=r(e,["silenceDurationMs"]);return u!=null&&s(t,["silenceDurationMs"],u),t}function gl(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 l=r(e,["endOfSpeechSensitivity"]);l!=null&&s(t,["endOfSpeechSensitivity"],l);const a=r(e,["prefixPaddingMs"]);a!=null&&s(t,["prefixPaddingMs"],a);const u=r(e,["silenceDurationMs"]);return u!=null&&s(t,["silenceDurationMs"],u),t}function yl(o,e){const t={},n=r(e,["automaticActivityDetection"]);n!=null&&s(t,["automaticActivityDetection"],hl(o,n));const i=r(e,["activityHandling"]);i!=null&&s(t,["activityHandling"],i);const l=r(e,["turnCoverage"]);return l!=null&&s(t,["turnCoverage"],l),t}function vl(o,e){const t={},n=r(e,["automaticActivityDetection"]);n!=null&&s(t,["automaticActivityDetection"],gl(o,n));const i=r(e,["activityHandling"]);i!=null&&s(t,["activityHandling"],i);const l=r(e,["turnCoverage"]);return l!=null&&s(t,["turnCoverage"],l),t}function Tl(o,e){const t={},n=r(e,["targetTokens"]);return n!=null&&s(t,["targetTokens"],n),t}function Cl(o,e){const t={},n=r(e,["targetTokens"]);return n!=null&&s(t,["targetTokens"],n),t}function _l(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"],Tl(o,i)),t}function El(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"],Cl(o,i)),t}function Sl(o,e){const t={},n=r(e,["proactiveAudio"]);return n!=null&&s(t,["proactiveAudio"],n),t}function xl(o,e){const t={},n=r(e,["proactiveAudio"]);return n!=null&&s(t,["proactiveAudio"],n),t}function Al(o,e,t){const n={},i=r(e,["generationConfig"]);t!==void 0&&i!=null&&s(t,["setup","generationConfig"],i);const l=r(e,["responseModalities"]);t!==void 0&&l!=null&&s(t,["setup","generationConfig","responseModalities"],l);const a=r(e,["temperature"]);t!==void 0&&a!=null&&s(t,["setup","generationConfig","temperature"],a);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"],bs(o,Ct(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"],Zs(o,K(o,g)));const v=r(e,["tools"]);if(t!==void 0&&v!=null){let V=Be(o,v);Array.isArray(V)&&(V=V.map(B=>dl(o,Ge(o,B)))),s(t,["setup","tools"],V)}const E=r(e,["sessionResumption"]);t!==void 0&&E!=null&&s(t,["setup","sessionResumption"],pl(o,E));const M=r(e,["inputAudioTranscription"]);t!==void 0&&M!=null&&s(t,["setup","inputAudioTranscription"],ho());const _=r(e,["outputAudioTranscription"]);t!==void 0&&_!=null&&s(t,["setup","outputAudioTranscription"],ho());const A=r(e,["realtimeInputConfig"]);t!==void 0&&A!=null&&s(t,["setup","realtimeInputConfig"],yl(o,A));const R=r(e,["contextWindowCompression"]);t!==void 0&&R!=null&&s(t,["setup","contextWindowCompression"],_l(o,R));const k=r(e,["proactivity"]);return t!==void 0&&k!=null&&s(t,["setup","proactivity"],Sl(o,k)),n}function Ml(o,e,t){const n={},i=r(e,["generationConfig"]);t!==void 0&&i!=null&&s(t,["setup","generationConfig"],i);const l=r(e,["responseModalities"]);t!==void 0&&l!=null&&s(t,["setup","generationConfig","responseModalities"],l);const a=r(e,["temperature"]);t!==void 0&&a!=null&&s(t,["setup","generationConfig","temperature"],a);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"],Gs(o,Ct(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"],zs(o,K(o,g)));const v=r(e,["tools"]);if(t!==void 0&&v!=null){let V=Be(o,v);Array.isArray(V)&&(V=V.map(B=>fl(o,Ge(o,B)))),s(t,["setup","tools"],V)}const E=r(e,["sessionResumption"]);t!==void 0&&E!=null&&s(t,["setup","sessionResumption"],ml(o,E));const M=r(e,["inputAudioTranscription"]);t!==void 0&&M!=null&&s(t,["setup","inputAudioTranscription"],go());const _=r(e,["outputAudioTranscription"]);t!==void 0&&_!=null&&s(t,["setup","outputAudioTranscription"],go());const A=r(e,["realtimeInputConfig"]);t!==void 0&&A!=null&&s(t,["setup","realtimeInputConfig"],vl(o,A));const R=r(e,["contextWindowCompression"]);t!==void 0&&R!=null&&s(t,["setup","contextWindowCompression"],El(o,R));const k=r(e,["proactivity"]);return t!==void 0&&k!=null&&s(t,["setup","proactivity"],xl(o,k)),n}function Il(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"],Al(o,i,t)),t}function Rl(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"],Ml(o,i,t)),t}function wl(){return{}}function Pl(){return{}}function Nl(){return{}}function kl(){return{}}function Dl(o,e){const t={},n=r(e,["media"]);n!=null&&s(t,["mediaChunks"],Kn(o,n));const i=r(e,["audio"]);i!=null&&s(t,["audio"],or(o,i));const l=r(e,["audioStreamEnd"]);l!=null&&s(t,["audioStreamEnd"],l);const a=r(e,["video"]);a!=null&&s(t,["video"],nr(o,a));const u=r(e,["text"]);return u!=null&&s(t,["text"],u),r(e,["activityStart"])!=null&&s(t,["activityStart"],wl()),r(e,["activityEnd"])!=null&&s(t,["activityEnd"],Nl()),t}function Ll(o,e){const t={},n=r(e,["media"]);if(n!=null&&s(t,["mediaChunks"],Kn(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"],Pl()),r(e,["activityEnd"])!=null&&s(t,["activityEnd"],kl()),t}function yo(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 Vl(o,e){const t={},n=r(e,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>yo(o,l))),s(t,["weightedPrompts"],i)}return t}function vo(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 l=r(e,["seed"]);l!=null&&s(t,["seed"],l);const a=r(e,["guidance"]);a!=null&&s(t,["guidance"],a);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 Fl(o,e){const t={},n=r(e,["musicGenerationConfig"]);return n!=null&&s(t,["musicGenerationConfig"],vo(o,n)),t}function To(o,e){const t={},n=r(e,["model"]);return n!=null&&s(t,["model"],n),t}function Co(o,e){const t={},n=r(e,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>yo(o,l))),s(t,["weightedPrompts"],i)}return t}function Et(o,e){const t={},n=r(e,["setup"]);n!=null&&s(t,["setup"],To(o,n));const i=r(e,["clientContent"]);i!=null&&s(t,["clientContent"],Co(o,i));const l=r(e,["musicGenerationConfig"]);l!=null&&s(t,["musicGenerationConfig"],vo(o,l));const a=r(e,["playbackControl"]);return a!=null&&s(t,["playbackControl"],a),t}function Ul(){return{}}function bl(){return{}}function Gl(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function Bl(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function ql(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 $l(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Ol(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 Hl(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Jl(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Gl(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],ql(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Ol(o,a));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 Wl(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Bl(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],$l(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Hl(o,a));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 Yl(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Jl(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Zl(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Wl(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function _o(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 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 zl(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 Kl(o,e){const t={},n=r(e,["urlMetadata"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>zl(o,l))),s(t,["urlMetadata"],i)}return t}function Xl(o,e){const t={},n=r(e,["modelTurn"]);n!=null&&s(t,["modelTurn"],Yl(o,n));const i=r(e,["turnComplete"]);i!=null&&s(t,["turnComplete"],i);const l=r(e,["interrupted"]);l!=null&&s(t,["interrupted"],l);const a=r(e,["groundingMetadata"]);a!=null&&s(t,["groundingMetadata"],a);const u=r(e,["generationComplete"]);u!=null&&s(t,["generationComplete"],u);const d=r(e,["inputTranscription"]);d!=null&&s(t,["inputTranscription"],_o(o,d));const c=r(e,["outputTranscription"]);c!=null&&s(t,["outputTranscription"],_o(o,c));const f=r(e,["urlContextMetadata"]);return f!=null&&s(t,["urlContextMetadata"],Kl(o,f)),t}function Ql(o,e){const t={},n=r(e,["modelTurn"]);n!=null&&s(t,["modelTurn"],Zl(o,n));const i=r(e,["turnComplete"]);i!=null&&s(t,["turnComplete"],i);const l=r(e,["interrupted"]);l!=null&&s(t,["interrupted"],l);const a=r(e,["groundingMetadata"]);a!=null&&s(t,["groundingMetadata"],a);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"]);return c!=null&&s(t,["outputTranscription"],Eo(o,c)),t}function jl(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 l=r(e,["name"]);return l!=null&&s(t,["name"],l),t}function ea(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 ta(o,e){const t={},n=r(e,["functionCalls"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>jl(o,l))),s(t,["functionCalls"],i)}return t}function na(o,e){const t={},n=r(e,["functionCalls"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>ea(o,l))),s(t,["functionCalls"],i)}return t}function oa(o,e){const t={},n=r(e,["ids"]);return n!=null&&s(t,["ids"],n),t}function ia(o,e){const t={},n=r(e,["ids"]);return n!=null&&s(t,["ids"],n),t}function ot(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 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 ra(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 l=r(e,["responseTokenCount"]);l!=null&&s(t,["responseTokenCount"],l);const a=r(e,["toolUsePromptTokenCount"]);a!=null&&s(t,["toolUsePromptTokenCount"],a);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=>ot(o,g))),s(t,["promptTokensDetails"],h)}const f=r(e,["cacheTokensDetails"]);if(f!=null){let h=f;Array.isArray(h)&&(h=h.map(g=>ot(o,g))),s(t,["cacheTokensDetails"],h)}const p=r(e,["responseTokensDetails"]);if(p!=null){let h=p;Array.isArray(h)&&(h=h.map(g=>ot(o,g))),s(t,["responseTokensDetails"],h)}const m=r(e,["toolUsePromptTokensDetails"]);if(m!=null){let h=m;Array.isArray(h)&&(h=h.map(g=>ot(o,g))),s(t,["toolUsePromptTokensDetails"],h)}return t}function sa(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 l=r(e,["candidatesTokenCount"]);l!=null&&s(t,["responseTokenCount"],l);const a=r(e,["toolUsePromptTokenCount"]);a!=null&&s(t,["toolUsePromptTokenCount"],a);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=>it(o,v))),s(t,["promptTokensDetails"],g)}const f=r(e,["cacheTokensDetails"]);if(f!=null){let g=f;Array.isArray(g)&&(g=g.map(v=>it(o,v))),s(t,["cacheTokensDetails"],g)}const p=r(e,["candidatesTokensDetails"]);if(p!=null){let g=p;Array.isArray(g)&&(g=g.map(v=>it(o,v))),s(t,["responseTokensDetails"],g)}const m=r(e,["toolUsePromptTokensDetails"]);if(m!=null){let g=m;Array.isArray(g)&&(g=g.map(v=>it(o,v))),s(t,["toolUsePromptTokensDetails"],g)}const h=r(e,["trafficType"]);return h!=null&&s(t,["trafficType"],h),t}function la(o,e){const t={},n=r(e,["timeLeft"]);return n!=null&&s(t,["timeLeft"],n),t}function aa(o,e){const t={},n=r(e,["timeLeft"]);return n!=null&&s(t,["timeLeft"],n),t}function ua(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 l=r(e,["lastConsumedClientMessageIndex"]);return l!=null&&s(t,["lastConsumedClientMessageIndex"],l),t}function ca(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 l=r(e,["lastConsumedClientMessageIndex"]);return l!=null&&s(t,["lastConsumedClientMessageIndex"],l),t}function da(o,e){const t={};r(e,["setupComplete"])!=null&&s(t,["setupComplete"],Ul());const i=r(e,["serverContent"]);i!=null&&s(t,["serverContent"],Xl(o,i));const l=r(e,["toolCall"]);l!=null&&s(t,["toolCall"],ta(o,l));const a=r(e,["toolCallCancellation"]);a!=null&&s(t,["toolCallCancellation"],oa(o,a));const u=r(e,["usageMetadata"]);u!=null&&s(t,["usageMetadata"],ra(o,u));const d=r(e,["goAway"]);d!=null&&s(t,["goAway"],la(o,d));const c=r(e,["sessionResumptionUpdate"]);return c!=null&&s(t,["sessionResumptionUpdate"],ua(o,c)),t}function fa(o,e){const t={};r(e,["setupComplete"])!=null&&s(t,["setupComplete"],bl());const i=r(e,["serverContent"]);i!=null&&s(t,["serverContent"],Ql(o,i));const l=r(e,["toolCall"]);l!=null&&s(t,["toolCall"],na(o,l));const a=r(e,["toolCallCancellation"]);a!=null&&s(t,["toolCallCancellation"],ia(o,a));const u=r(e,["usageMetadata"]);u!=null&&s(t,["usageMetadata"],sa(o,u));const d=r(e,["goAway"]);d!=null&&s(t,["goAway"],aa(o,d));const c=r(e,["sessionResumptionUpdate"]);return c!=null&&s(t,["sessionResumptionUpdate"],ca(o,c)),t}function pa(){return{}}function ma(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 ha(o,e){const t={},n=r(e,["weightedPrompts"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>ma(o,l))),s(t,["weightedPrompts"],i)}return t}function ga(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 l=r(e,["seed"]);l!=null&&s(t,["seed"],l);const a=r(e,["guidance"]);a!=null&&s(t,["guidance"],a);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 ya(o,e){const t={},n=r(e,["clientContent"]);n!=null&&s(t,["clientContent"],ha(o,n));const i=r(e,["musicGenerationConfig"]);return i!=null&&s(t,["musicGenerationConfig"],ga(o,i)),t}function va(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 l=r(e,["sourceMetadata"]);return l!=null&&s(t,["sourceMetadata"],ya(o,l)),t}function Ta(o,e){const t={},n=r(e,["audioChunks"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>va(o,l))),s(t,["audioChunks"],i)}return t}function Ca(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 _a(o,e){const t={};r(e,["setupComplete"])!=null&&s(t,["setupComplete"],pa());const i=r(e,["serverContent"]);i!=null&&s(t,["serverContent"],Ta(o,i));const l=r(e,["filteredPrompt"]);return l!=null&&s(t,["filteredPrompt"],Ca(o,l)),t}/**
142
142
  * @license
143
143
  * Copyright 2025 Google LLC
144
144
  * SPDX-License-Identifier: Apache-2.0
145
- */function _a(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function Ea(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 Sa(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 xa(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],_a(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],Ea(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Sa(o,a));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 rt(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>xa(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Aa(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 l=r(e,["description"]);l!=null&&s(t,["description"],l);const a=r(e,["enum"]);a!=null&&s(t,["enum"],a);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 E=r(e,["minProperties"]);E!=null&&s(t,["minProperties"],E);const M=r(e,["minimum"]);M!=null&&s(t,["minimum"],M);const _=r(e,["nullable"]);_!=null&&s(t,["nullable"],_);const A=r(e,["pattern"]);A!=null&&s(t,["pattern"],A);const R=r(e,["properties"]);R!=null&&s(t,["properties"],R);const k=r(e,["propertyOrdering"]);k!=null&&s(t,["propertyOrdering"],k);const V=r(e,["required"]);V!=null&&s(t,["required"],V);const B=r(e,["title"]);B!=null&&s(t,["title"],B);const J=r(e,["type"]);return J!=null&&s(t,["type"],J),t}function Ma(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 Ia(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 l=r(e,["name"]);l!=null&&s(t,["name"],l);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function Ra(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 wa(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Ra(o,n)),t}function Pa(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 Na(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],Pa(o,n)),t}function ka(){return{}}function Da(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>Ia(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"],wa(o,i));const l=r(e,["googleSearchRetrieval"]);if(l!=null&&s(t,["googleSearchRetrieval"],Na(o,l)),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"],ka());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function La(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 Va(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 Fa(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],Va(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function Ua(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],La(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],Fa(o,i)),t}function ba(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"],ba(o,n)),t}function Ga(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 Ba(o,e){const t={},n=r(e,["speakerVoiceConfigs"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>Ga(o,l))),s(t,["speakerVoiceConfigs"],i)}return t}function qa(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"],Ba(o,i));const l=r(e,["languageCode"]);return l!=null&&s(t,["languageCode"],l),t}function $a(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 Oa(o,e,t){const n={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&s(t,["systemInstruction"],rt(o,K(o,i)));const l=r(e,["temperature"]);l!=null&&s(n,["temperature"],l);const a=r(e,["topP"]);a!=null&&s(n,["topP"],a);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 E=r(e,["responseMimeType"]);E!=null&&s(n,["responseMimeType"],E);const M=r(e,["responseSchema"]);if(M!=null&&s(n,["responseSchema"],Aa(o,Qe(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(e,["safetySettings"]);if(t!==void 0&&_!=null){let G=_;Array.isArray(G)&&(G=G.map(X=>Ma(o,X))),s(t,["safetySettings"],G)}const A=r(e,["tools"]);if(t!==void 0&&A!=null){let G=Be(o,A);Array.isArray(G)&&(G=G.map(X=>Da(o,Ge(o,X)))),s(t,["tools"],G)}const R=r(e,["toolConfig"]);if(t!==void 0&&R!=null&&s(t,["toolConfig"],Ua(o,R)),r(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const k=r(e,["cachedContent"]);t!==void 0&&k!=null&&s(t,["cachedContent"],ce(o,k));const V=r(e,["responseModalities"]);V!=null&&s(n,["responseModalities"],V);const B=r(e,["mediaResolution"]);B!=null&&s(n,["mediaResolution"],B);const J=r(e,["speechConfig"]);if(J!=null&&s(n,["speechConfig"],qa(o,oo(o,J))),r(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const D=r(e,["thinkingConfig"]);return D!=null&&s(n,["thinkingConfig"],$a(o,D)),n}function xo(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 a=te(o,i);Array.isArray(a)&&(a=a.map(u=>rt(o,u))),s(t,["contents"],a)}const l=r(e,["config"]);return l!=null&&s(t,["generationConfig"],Oa(o,l,t)),t}function Ha(o,e,t){const n={},i=r(e,["taskType"]);t!==void 0&&i!=null&&s(t,["requests[]","taskType"],i);const l=r(e,["title"]);t!==void 0&&l!=null&&s(t,["requests[]","title"],l);const a=r(e,["outputDimensionality"]);if(t!==void 0&&a!=null&&s(t,["requests[]","outputDimensionality"],a),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 Ja(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"],to(o,i));const l=r(e,["config"]);l!=null&&s(t,["config"],Ha(o,l,t));const a=r(e,["model"]);return a!==void 0&&s(t,["requests[]","model"],q(o,a)),t}function Wa(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 l=r(e,["aspectRatio"]);t!==void 0&&l!=null&&s(t,["parameters","aspectRatio"],l);const a=r(e,["guidanceScale"]);if(t!==void 0&&a!=null&&s(t,["parameters","guidanceScale"],a),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 Ya(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 l=r(e,["config"]);return l!=null&&s(t,["config"],Wa(o,l,t)),t}function Za(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 za(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);t!==void 0&&l!=null&&s(t,["_query","pageToken"],l);const a=r(e,["filter"]);t!==void 0&&a!=null&&s(t,["_query","filter"],a);const u=r(e,["queryBase"]);return t!==void 0&&u!=null&&s(t,["_url","models_url"],so(o,u)),n}function Ka(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],za(o,n,t)),t}function Xa(o,e,t){const n={},i=r(e,["displayName"]);t!==void 0&&i!=null&&s(t,["displayName"],i);const l=r(e,["description"]);t!==void 0&&l!=null&&s(t,["description"],l);const a=r(e,["defaultCheckpointId"]);return t!==void 0&&a!=null&&s(t,["defaultCheckpointId"],a),n}function Qa(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"],Xa(o,i,t)),t}function ja(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 eu(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 tu(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 a=te(o,i);Array.isArray(a)&&(a=a.map(u=>rt(o,u))),s(t,["contents"],a)}const l=r(e,["config"]);return l!=null&&s(t,["config"],eu(o,l)),t}function nu(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 ou(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 l=r(e,["durationSeconds"]);if(t!==void 0&&l!=null&&s(t,["parameters","durationSeconds"],l),r(e,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const a=r(e,["aspectRatio"]);if(t!==void 0&&a!=null&&s(t,["parameters","aspectRatio"],a),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 iu(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 l=r(e,["image"]);l!=null&&s(t,["instances[0]","image"],nu(o,l));const a=r(e,["config"]);return a!=null&&s(t,["config"],ou(o,a,t)),t}function ru(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function su(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function lu(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function au(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],ru(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],su(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],lu(o,a));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 Pe(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>au(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function uu(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 l=r(e,["description"]);l!=null&&s(t,["description"],l);const a=r(e,["enum"]);a!=null&&s(t,["enum"],a);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 E=r(e,["minProperties"]);E!=null&&s(t,["minProperties"],E);const M=r(e,["minimum"]);M!=null&&s(t,["minimum"],M);const _=r(e,["nullable"]);_!=null&&s(t,["nullable"],_);const A=r(e,["pattern"]);A!=null&&s(t,["pattern"],A);const R=r(e,["properties"]);R!=null&&s(t,["properties"],R);const k=r(e,["propertyOrdering"]);k!=null&&s(t,["propertyOrdering"],k);const V=r(e,["required"]);V!=null&&s(t,["required"],V);const B=r(e,["title"]);B!=null&&s(t,["title"],B);const J=r(e,["type"]);return J!=null&&s(t,["type"],J),t}function cu(o,e){const t={},n=r(e,["featureSelectionPreference"]);return n!=null&&s(t,["featureSelectionPreference"],n),t}function du(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 l=r(e,["threshold"]);return l!=null&&s(t,["threshold"],l),t}function fu(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 l=r(e,["parameters"]);l!=null&&s(t,["parameters"],l);const a=r(e,["response"]);return a!=null&&s(t,["response"],a),t}function pu(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 mu(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],pu(o,n)),t}function hu(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 gu(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],hu(o,n)),t}function yu(){return{}}function vu(o,e){const t={},n=r(e,["apiKeyString"]);return n!=null&&s(t,["apiKeyString"],n),t}function Tu(o,e){const t={},n=r(e,["apiKeyConfig"]);n!=null&&s(t,["apiKeyConfig"],vu(o,n));const i=r(e,["authType"]);i!=null&&s(t,["authType"],i);const l=r(e,["googleServiceAccountConfig"]);l!=null&&s(t,["googleServiceAccountConfig"],l);const a=r(e,["httpBasicAuthConfig"]);a!=null&&s(t,["httpBasicAuthConfig"],a);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 Cu(o,e){const t={},n=r(e,["authConfig"]);return n!=null&&s(t,["authConfig"],Tu(o,n)),t}function Ao(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(p=>fu(o,p))),s(t,["functionDeclarations"],f)}const i=r(e,["retrieval"]);i!=null&&s(t,["retrieval"],i);const l=r(e,["googleSearch"]);l!=null&&s(t,["googleSearch"],mu(o,l));const a=r(e,["googleSearchRetrieval"]);a!=null&&s(t,["googleSearchRetrieval"],gu(o,a)),r(e,["enterpriseWebSearch"])!=null&&s(t,["enterpriseWebSearch"],yu());const d=r(e,["googleMaps"]);if(d!=null&&s(t,["googleMaps"],Cu(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 _u(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 Eu(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 Su(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],Eu(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function xu(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],_u(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],Su(o,i)),t}function Au(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function Mu(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Au(o,n)),t}function Iu(o,e){const t={},n=r(e,["voiceConfig"]);if(n!=null&&s(t,["voiceConfig"],Mu(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 Ru(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 wu(o,e,t){const n={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&s(t,["systemInstruction"],Pe(o,K(o,i)));const l=r(e,["temperature"]);l!=null&&s(n,["temperature"],l);const a=r(e,["topP"]);a!=null&&s(n,["topP"],a);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 E=r(e,["responseMimeType"]);E!=null&&s(n,["responseMimeType"],E);const M=r(e,["responseSchema"]);M!=null&&s(n,["responseSchema"],uu(o,Qe(o,M)));const _=r(e,["routingConfig"]);_!=null&&s(n,["routingConfig"],_);const A=r(e,["modelSelectionConfig"]);A!=null&&s(n,["modelConfig"],cu(o,A));const R=r(e,["safetySettings"]);if(t!==void 0&&R!=null){let ne=R;Array.isArray(ne)&&(ne=ne.map(ye=>du(o,ye))),s(t,["safetySettings"],ne)}const k=r(e,["tools"]);if(t!==void 0&&k!=null){let ne=Be(o,k);Array.isArray(ne)&&(ne=ne.map(ye=>Ao(o,Ge(o,ye)))),s(t,["tools"],ne)}const V=r(e,["toolConfig"]);t!==void 0&&V!=null&&s(t,["toolConfig"],xu(o,V));const B=r(e,["labels"]);t!==void 0&&B!=null&&s(t,["labels"],B);const J=r(e,["cachedContent"]);t!==void 0&&J!=null&&s(t,["cachedContent"],ce(o,J));const D=r(e,["responseModalities"]);D!=null&&s(n,["responseModalities"],D);const G=r(e,["mediaResolution"]);G!=null&&s(n,["mediaResolution"],G);const X=r(e,["speechConfig"]);X!=null&&s(n,["speechConfig"],Iu(o,oo(o,X)));const Ne=r(e,["audioTimestamp"]);Ne!=null&&s(n,["audioTimestamp"],Ne);const $e=r(e,["thinkingConfig"]);return $e!=null&&s(n,["thinkingConfig"],Ru(o,$e)),n}function Mo(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 a=te(o,i);Array.isArray(a)&&(a=a.map(u=>Pe(o,u))),s(t,["contents"],a)}const l=r(e,["config"]);return l!=null&&s(t,["generationConfig"],wu(o,l,t)),t}function Pu(o,e,t){const n={},i=r(e,["taskType"]);t!==void 0&&i!=null&&s(t,["instances[]","task_type"],i);const l=r(e,["title"]);t!==void 0&&l!=null&&s(t,["instances[]","title"],l);const a=r(e,["outputDimensionality"]);t!==void 0&&a!=null&&s(t,["parameters","outputDimensionality"],a);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 Nu(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"],to(o,i));const l=r(e,["config"]);return l!=null&&s(t,["config"],Pu(o,l,t)),t}function ku(o,e,t){const n={},i=r(e,["outputGcsUri"]);t!==void 0&&i!=null&&s(t,["parameters","storageUri"],i);const l=r(e,["negativePrompt"]);t!==void 0&&l!=null&&s(t,["parameters","negativePrompt"],l);const a=r(e,["numberOfImages"]);t!==void 0&&a!=null&&s(t,["parameters","sampleCount"],a);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 E=r(e,["outputCompressionQuality"]);t!==void 0&&E!=null&&s(t,["parameters","outputOptions","compressionQuality"],E);const M=r(e,["addWatermark"]);t!==void 0&&M!=null&&s(t,["parameters","addWatermark"],M);const _=r(e,["enhancePrompt"]);return t!==void 0&&_!=null&&s(t,["parameters","enhancePrompt"],_),n}function Du(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 l=r(e,["config"]);return l!=null&&s(t,["config"],ku(o,l,t)),t}function St(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Lu(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 l=r(e,["maskDilation"]);return l!=null&&s(t,["dilation"],l),t}function Vu(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 Fu(o,e){const t={},n=r(e,["styleDescription"]);return n!=null&&s(t,["styleDescription"],n),t}function Uu(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 bu(o,e){const t={},n=r(e,["referenceImage"]);n!=null&&s(t,["referenceImage"],St(o,n));const i=r(e,["referenceId"]);i!=null&&s(t,["referenceId"],i);const l=r(e,["referenceType"]);l!=null&&s(t,["referenceType"],l);const a=r(e,["maskImageConfig"]);a!=null&&s(t,["maskImageConfig"],Lu(o,a));const u=r(e,["controlImageConfig"]);u!=null&&s(t,["controlImageConfig"],Vu(o,u));const d=r(e,["styleImageConfig"]);d!=null&&s(t,["styleImageConfig"],Fu(o,d));const c=r(e,["subjectImageConfig"]);return c!=null&&s(t,["subjectImageConfig"],Uu(o,c)),t}function Gu(o,e,t){const n={},i=r(e,["outputGcsUri"]);t!==void 0&&i!=null&&s(t,["parameters","storageUri"],i);const l=r(e,["negativePrompt"]);t!==void 0&&l!=null&&s(t,["parameters","negativePrompt"],l);const a=r(e,["numberOfImages"]);t!==void 0&&a!=null&&s(t,["parameters","sampleCount"],a);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 E=r(e,["outputCompressionQuality"]);t!==void 0&&E!=null&&s(t,["parameters","outputOptions","compressionQuality"],E);const M=r(e,["editMode"]);t!==void 0&&M!=null&&s(t,["parameters","editMode"],M);const _=r(e,["baseSteps"]);return t!==void 0&&_!=null&&s(t,["parameters","editConfig","baseSteps"],_),n}function Bu(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 l=r(e,["referenceImages"]);if(l!=null){let u=l;Array.isArray(u)&&(u=u.map(d=>bu(o,d))),s(t,["instances[0]","referenceImages"],u)}const a=r(e,["config"]);return a!=null&&s(t,["config"],Gu(o,a,t)),t}function qu(o,e,t){const n={},i=r(e,["includeRaiReason"]);t!==void 0&&i!=null&&s(t,["parameters","includeRaiReason"],i);const l=r(e,["outputMimeType"]);t!==void 0&&l!=null&&s(t,["parameters","outputOptions","mimeType"],l);const a=r(e,["outputCompressionQuality"]);t!==void 0&&a!=null&&s(t,["parameters","outputOptions","compressionQuality"],a);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 $u(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"],St(o,i));const l=r(e,["upscaleFactor"]);l!=null&&s(t,["parameters","upscaleConfig","upscaleFactor"],l);const a=r(e,["config"]);return a!=null&&s(t,["config"],qu(o,a,t)),t}function Ou(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 Hu(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);t!==void 0&&l!=null&&s(t,["_query","pageToken"],l);const a=r(e,["filter"]);t!==void 0&&a!=null&&s(t,["_query","filter"],a);const u=r(e,["queryBase"]);return t!==void 0&&u!=null&&s(t,["_url","models_url"],so(o,u)),n}function Ju(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],Hu(o,n,t)),t}function Wu(o,e,t){const n={},i=r(e,["displayName"]);t!==void 0&&i!=null&&s(t,["displayName"],i);const l=r(e,["description"]);t!==void 0&&l!=null&&s(t,["description"],l);const a=r(e,["defaultCheckpointId"]);return t!==void 0&&a!=null&&s(t,["defaultCheckpointId"],a),n}function Yu(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"],Wu(o,i,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 zu(o,e,t){const n={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&s(t,["systemInstruction"],Pe(o,K(o,i)));const l=r(e,["tools"]);if(t!==void 0&&l!=null){let u=l;Array.isArray(u)&&(u=u.map(d=>Ao(o,d))),s(t,["tools"],u)}const a=r(e,["generationConfig"]);return t!==void 0&&a!=null&&s(t,["generationConfig"],a),n}function Ku(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 a=te(o,i);Array.isArray(a)&&(a=a.map(u=>Pe(o,u))),s(t,["contents"],a)}const l=r(e,["config"]);return l!=null&&s(t,["config"],zu(o,l,t)),t}function Xu(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 a=te(o,i);Array.isArray(a)&&(a=a.map(u=>Pe(o,u))),s(t,["contents"],a)}const l=r(e,["config"]);return l!=null&&s(t,["config"],l),t}function Qu(o,e,t){const n={},i=r(e,["numberOfVideos"]);t!==void 0&&i!=null&&s(t,["parameters","sampleCount"],i);const l=r(e,["outputGcsUri"]);t!==void 0&&l!=null&&s(t,["parameters","storageUri"],l);const a=r(e,["fps"]);t!==void 0&&a!=null&&s(t,["parameters","fps"],a);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 ju(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 l=r(e,["image"]);l!=null&&s(t,["instances[0]","image"],St(o,l));const a=r(e,["config"]);return a!=null&&s(t,["config"],Qu(o,a,t)),t}function ec(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function tc(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 nc(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 oc(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],ec(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],tc(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],nc(o,a));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 ic(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>oc(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function rc(o,e){const t={},n=r(e,["citationSources"]);return n!=null&&s(t,["citations"],n),t}function sc(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 lc(o,e){const t={},n=r(e,["urlMetadata"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>sc(o,l))),s(t,["urlMetadata"],i)}return t}function ac(o,e){const t={},n=r(e,["content"]);n!=null&&s(t,["content"],ic(o,n));const i=r(e,["citationMetadata"]);i!=null&&s(t,["citationMetadata"],rc(o,i));const l=r(e,["tokenCount"]);l!=null&&s(t,["tokenCount"],l);const a=r(e,["finishReason"]);a!=null&&s(t,["finishReason"],a);const u=r(e,["urlContextMetadata"]);u!=null&&s(t,["urlContextMetadata"],lc(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 Io(o,e){const t={},n=r(e,["candidates"]);if(n!=null){let u=n;Array.isArray(u)&&(u=u.map(d=>ac(o,d))),s(t,["candidates"],u)}const i=r(e,["modelVersion"]);i!=null&&s(t,["modelVersion"],i);const l=r(e,["promptFeedback"]);l!=null&&s(t,["promptFeedback"],l);const a=r(e,["usageMetadata"]);return a!=null&&s(t,["usageMetadata"],a),t}function uc(o,e){const t={},n=r(e,["values"]);return n!=null&&s(t,["values"],n),t}function cc(){return{}}function dc(o,e){const t={},n=r(e,["embeddings"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>uc(o,a))),s(t,["embeddings"],l)}return r(e,["metadata"])!=null&&s(t,["metadata"],cc()),t}function fc(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 Ro(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 l=r(e,["contentType"]);return l!=null&&s(t,["contentType"],l),t}function pc(o,e){const t={},n=r(e,["_self"]);n!=null&&s(t,["image"],fc(o,n));const i=r(e,["raiFilteredReason"]);i!=null&&s(t,["raiFilteredReason"],i);const l=r(e,["_self"]);return l!=null&&s(t,["safetyAttributes"],Ro(o,l)),t}function mc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>pc(o,a))),s(t,["generatedImages"],l)}const i=r(e,["positivePromptSafetyAttributes"]);return i!=null&&s(t,["positivePromptSafetyAttributes"],Ro(o,i)),t}function hc(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 l=r(e,["updateTime"]);return l!=null&&s(t,["updateTime"],l),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 l=r(e,["description"]);l!=null&&s(t,["description"],l);const a=r(e,["version"]);a!=null&&s(t,["version"],a);const u=r(e,["_self"]);u!=null&&s(t,["tunedModelInfo"],hc(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 gc(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["_self"]);if(i!=null){let l=lo(o,i);Array.isArray(l)&&(l=l.map(a=>xt(o,a))),s(t,["models"],l)}return t}function yc(){return{}}function vc(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 Tc(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 l=r(e,["encoding"]);return l!=null&&s(t,["mimeType"],l),t}function Cc(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Tc(o,n)),t}function _c(o,e){const t={},n=r(e,["generatedSamples"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(u=>Cc(o,u))),s(t,["generatedVideos"],a)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const l=r(e,["raiMediaFilteredReasons"]);return l!=null&&s(t,["raiMediaFilteredReasons"],l),t}function Ec(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 l=r(e,["done"]);l!=null&&s(t,["done"],l);const a=r(e,["error"]);a!=null&&s(t,["error"],a);const u=r(e,["response","generateVideoResponse"]);return u!=null&&s(t,["response"],_c(o,u)),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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function xc(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Ac(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Mc(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 l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],xc(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Ac(o,a));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 Ic(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Mc(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Rc(o,e){const t={},n=r(e,["citations"]);return n!=null&&s(t,["citations"],n),t}function wc(o,e){const t={},n=r(e,["content"]);n!=null&&s(t,["content"],Ic(o,n));const i=r(e,["citationMetadata"]);i!=null&&s(t,["citationMetadata"],Rc(o,i));const l=r(e,["finishMessage"]);l!=null&&s(t,["finishMessage"],l);const a=r(e,["finishReason"]);a!=null&&s(t,["finishReason"],a);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 wo(o,e){const t={},n=r(e,["candidates"]);if(n!=null){let c=n;Array.isArray(c)&&(c=c.map(f=>wc(o,f))),s(t,["candidates"],c)}const i=r(e,["createTime"]);i!=null&&s(t,["createTime"],i);const l=r(e,["responseId"]);l!=null&&s(t,["responseId"],l);const a=r(e,["modelVersion"]);a!=null&&s(t,["modelVersion"],a);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 Pc(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 Nc(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"],Pc(o,i)),t}function kc(o,e){const t={},n=r(e,["billableCharacterCount"]);return n!=null&&s(t,["billableCharacterCount"],n),t}function Dc(o,e){const t={},n=r(e,["predictions[]","embeddings"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Nc(o,a))),s(t,["embeddings"],l)}const i=r(e,["metadata"]);return i!=null&&s(t,["metadata"],kc(o,i)),t}function Lc(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),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 l=r(e,["contentType"]);return l!=null&&s(t,["contentType"],l),t}function At(o,e){const t={},n=r(e,["_self"]);n!=null&&s(t,["image"],Lc(o,n));const i=r(e,["raiFilteredReason"]);i!=null&&s(t,["raiFilteredReason"],i);const l=r(e,["_self"]);l!=null&&s(t,["safetyAttributes"],Po(o,l));const a=r(e,["prompt"]);return a!=null&&s(t,["enhancedPrompt"],a),t}function Vc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>At(o,a))),s(t,["generatedImages"],l)}const i=r(e,["positivePromptSafetyAttributes"]);return i!=null&&s(t,["positivePromptSafetyAttributes"],Po(o,i)),t}function Fc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>At(o,l))),s(t,["generatedImages"],i)}return t}function Uc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>At(o,l))),s(t,["generatedImages"],i)}return t}function bc(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 Gc(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 l=r(e,["updateTime"]);return l!=null&&s(t,["updateTime"],l),t}function Bc(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 l=r(e,["step"]);return l!=null&&s(t,["step"],l),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 l=r(e,["description"]);l!=null&&s(t,["description"],l);const a=r(e,["versionId"]);a!=null&&s(t,["version"],a);const u=r(e,["deployedModels"]);if(u!=null){let m=u;Array.isArray(m)&&(m=m.map(h=>bc(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"],Gc(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=>Bc(o,h))),s(t,["checkpoints"],m)}return t}function qc(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["_self"]);if(i!=null){let l=lo(o,i);Array.isArray(l)&&(l=l.map(a=>Mt(o,a))),s(t,["models"],l)}return t}function $c(){return{}}function Oc(o,e){const t={},n=r(e,["totalTokens"]);return n!=null&&s(t,["totalTokens"],n),t}function Hc(o,e){const t={},n=r(e,["tokensInfo"]);return n!=null&&s(t,["tokensInfo"],n),t}function Jc(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Wc(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Jc(o,n)),t}function Yc(o,e){const t={},n=r(e,["videos"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(u=>Wc(o,u))),s(t,["generatedVideos"],a)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const l=r(e,["raiMediaFilteredReasons"]);return l!=null&&s(t,["raiMediaFilteredReasons"],l),t}function Zc(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 l=r(e,["done"]);l!=null&&s(t,["done"],l);const a=r(e,["error"]);a!=null&&s(t,["error"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],Yc(o,u)),t}/**
145
+ */function Ea(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function Sa(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 xa(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 Aa(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Ea(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],Sa(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],xa(o,a));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 rt(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Aa(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Ma(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 l=r(e,["description"]);l!=null&&s(t,["description"],l);const a=r(e,["enum"]);a!=null&&s(t,["enum"],a);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 E=r(e,["minProperties"]);E!=null&&s(t,["minProperties"],E);const M=r(e,["minimum"]);M!=null&&s(t,["minimum"],M);const _=r(e,["nullable"]);_!=null&&s(t,["nullable"],_);const A=r(e,["pattern"]);A!=null&&s(t,["pattern"],A);const R=r(e,["properties"]);R!=null&&s(t,["properties"],R);const k=r(e,["propertyOrdering"]);k!=null&&s(t,["propertyOrdering"],k);const V=r(e,["required"]);V!=null&&s(t,["required"],V);const B=r(e,["title"]);B!=null&&s(t,["title"],B);const J=r(e,["type"]);return J!=null&&s(t,["type"],J),t}function Ia(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 Ra(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 l=r(e,["name"]);l!=null&&s(t,["name"],l);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function wa(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 Pa(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],wa(o,n)),t}function Na(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 ka(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],Na(o,n)),t}function Da(){return{}}function La(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>Ra(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"],Pa(o,i));const l=r(e,["googleSearchRetrieval"]);if(l!=null&&s(t,["googleSearchRetrieval"],ka(o,l)),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"],Da());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function Va(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 Fa(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 Ua(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],Fa(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function ba(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],Va(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],Ua(o,i)),t}function Ga(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"],Ga(o,n)),t}function Ba(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 qa(o,e){const t={},n=r(e,["speakerVoiceConfigs"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>Ba(o,l))),s(t,["speakerVoiceConfigs"],i)}return t}function $a(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"],qa(o,i));const l=r(e,["languageCode"]);return l!=null&&s(t,["languageCode"],l),t}function Oa(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 Ha(o,e,t){const n={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&s(t,["systemInstruction"],rt(o,K(o,i)));const l=r(e,["temperature"]);l!=null&&s(n,["temperature"],l);const a=r(e,["topP"]);a!=null&&s(n,["topP"],a);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 E=r(e,["responseMimeType"]);E!=null&&s(n,["responseMimeType"],E);const M=r(e,["responseSchema"]);if(M!=null&&s(n,["responseSchema"],Ma(o,Qe(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(e,["safetySettings"]);if(t!==void 0&&_!=null){let G=_;Array.isArray(G)&&(G=G.map(X=>Ia(o,X))),s(t,["safetySettings"],G)}const A=r(e,["tools"]);if(t!==void 0&&A!=null){let G=Be(o,A);Array.isArray(G)&&(G=G.map(X=>La(o,Ge(o,X)))),s(t,["tools"],G)}const R=r(e,["toolConfig"]);if(t!==void 0&&R!=null&&s(t,["toolConfig"],ba(o,R)),r(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const k=r(e,["cachedContent"]);t!==void 0&&k!=null&&s(t,["cachedContent"],de(o,k));const V=r(e,["responseModalities"]);V!=null&&s(n,["responseModalities"],V);const B=r(e,["mediaResolution"]);B!=null&&s(n,["mediaResolution"],B);const J=r(e,["speechConfig"]);if(J!=null&&s(n,["speechConfig"],$a(o,oo(o,J))),r(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const D=r(e,["thinkingConfig"]);return D!=null&&s(n,["thinkingConfig"],Oa(o,D)),n}function xo(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 a=te(o,i);Array.isArray(a)&&(a=a.map(u=>rt(o,u))),s(t,["contents"],a)}const l=r(e,["config"]);return l!=null&&s(t,["generationConfig"],Ha(o,l,t)),t}function Ja(o,e,t){const n={},i=r(e,["taskType"]);t!==void 0&&i!=null&&s(t,["requests[]","taskType"],i);const l=r(e,["title"]);t!==void 0&&l!=null&&s(t,["requests[]","title"],l);const a=r(e,["outputDimensionality"]);if(t!==void 0&&a!=null&&s(t,["requests[]","outputDimensionality"],a),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 Wa(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"],to(o,i));const l=r(e,["config"]);l!=null&&s(t,["config"],Ja(o,l,t));const a=r(e,["model"]);return a!==void 0&&s(t,["requests[]","model"],q(o,a)),t}function Ya(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 l=r(e,["aspectRatio"]);t!==void 0&&l!=null&&s(t,["parameters","aspectRatio"],l);const a=r(e,["guidanceScale"]);if(t!==void 0&&a!=null&&s(t,["parameters","guidanceScale"],a),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 Za(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 l=r(e,["config"]);return l!=null&&s(t,["config"],Ya(o,l,t)),t}function za(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 Ka(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);t!==void 0&&l!=null&&s(t,["_query","pageToken"],l);const a=r(e,["filter"]);t!==void 0&&a!=null&&s(t,["_query","filter"],a);const u=r(e,["queryBase"]);return t!==void 0&&u!=null&&s(t,["_url","models_url"],so(o,u)),n}function Xa(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],Ka(o,n,t)),t}function Qa(o,e,t){const n={},i=r(e,["displayName"]);t!==void 0&&i!=null&&s(t,["displayName"],i);const l=r(e,["description"]);t!==void 0&&l!=null&&s(t,["description"],l);const a=r(e,["defaultCheckpointId"]);return t!==void 0&&a!=null&&s(t,["defaultCheckpointId"],a),n}function ja(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"],Qa(o,i,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){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 nu(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 a=te(o,i);Array.isArray(a)&&(a=a.map(u=>rt(o,u))),s(t,["contents"],a)}const l=r(e,["config"]);return l!=null&&s(t,["config"],tu(o,l)),t}function ou(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"],fe(o,n));const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function iu(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 l=r(e,["durationSeconds"]);if(t!==void 0&&l!=null&&s(t,["parameters","durationSeconds"],l),r(e,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const a=r(e,["aspectRatio"]);if(t!==void 0&&a!=null&&s(t,["parameters","aspectRatio"],a),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 ru(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 l=r(e,["image"]);l!=null&&s(t,["instances[0]","image"],ou(o,l));const a=r(e,["config"]);return a!=null&&s(t,["config"],iu(o,a,t)),t}function su(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function lu(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function au(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function uu(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],su(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],lu(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],au(o,a));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 Pe(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>uu(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function cu(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 l=r(e,["description"]);l!=null&&s(t,["description"],l);const a=r(e,["enum"]);a!=null&&s(t,["enum"],a);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 E=r(e,["minProperties"]);E!=null&&s(t,["minProperties"],E);const M=r(e,["minimum"]);M!=null&&s(t,["minimum"],M);const _=r(e,["nullable"]);_!=null&&s(t,["nullable"],_);const A=r(e,["pattern"]);A!=null&&s(t,["pattern"],A);const R=r(e,["properties"]);R!=null&&s(t,["properties"],R);const k=r(e,["propertyOrdering"]);k!=null&&s(t,["propertyOrdering"],k);const V=r(e,["required"]);V!=null&&s(t,["required"],V);const B=r(e,["title"]);B!=null&&s(t,["title"],B);const J=r(e,["type"]);return J!=null&&s(t,["type"],J),t}function du(o,e){const t={},n=r(e,["featureSelectionPreference"]);return n!=null&&s(t,["featureSelectionPreference"],n),t}function fu(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 l=r(e,["threshold"]);return l!=null&&s(t,["threshold"],l),t}function pu(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 l=r(e,["parameters"]);l!=null&&s(t,["parameters"],l);const a=r(e,["response"]);return a!=null&&s(t,["response"],a),t}function mu(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 hu(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],mu(o,n)),t}function gu(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 yu(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],gu(o,n)),t}function vu(){return{}}function Tu(o,e){const t={},n=r(e,["apiKeyString"]);return n!=null&&s(t,["apiKeyString"],n),t}function Cu(o,e){const t={},n=r(e,["apiKeyConfig"]);n!=null&&s(t,["apiKeyConfig"],Tu(o,n));const i=r(e,["authType"]);i!=null&&s(t,["authType"],i);const l=r(e,["googleServiceAccountConfig"]);l!=null&&s(t,["googleServiceAccountConfig"],l);const a=r(e,["httpBasicAuthConfig"]);a!=null&&s(t,["httpBasicAuthConfig"],a);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 _u(o,e){const t={},n=r(e,["authConfig"]);return n!=null&&s(t,["authConfig"],Cu(o,n)),t}function Ao(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let f=n;Array.isArray(f)&&(f=f.map(p=>pu(o,p))),s(t,["functionDeclarations"],f)}const i=r(e,["retrieval"]);i!=null&&s(t,["retrieval"],i);const l=r(e,["googleSearch"]);l!=null&&s(t,["googleSearch"],hu(o,l));const a=r(e,["googleSearchRetrieval"]);a!=null&&s(t,["googleSearchRetrieval"],yu(o,a)),r(e,["enterpriseWebSearch"])!=null&&s(t,["enterpriseWebSearch"],vu());const d=r(e,["googleMaps"]);if(d!=null&&s(t,["googleMaps"],_u(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 Eu(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 Su(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 xu(o,e){const t={},n=r(e,["latLng"]);n!=null&&s(t,["latLng"],Su(o,n));const i=r(e,["languageCode"]);return i!=null&&s(t,["languageCode"],i),t}function Au(o,e){const t={},n=r(e,["functionCallingConfig"]);n!=null&&s(t,["functionCallingConfig"],Eu(o,n));const i=r(e,["retrievalConfig"]);return i!=null&&s(t,["retrievalConfig"],xu(o,i)),t}function Mu(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function Iu(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Mu(o,n)),t}function Ru(o,e){const t={},n=r(e,["voiceConfig"]);if(n!=null&&s(t,["voiceConfig"],Iu(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 wu(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 Pu(o,e,t){const n={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&s(t,["systemInstruction"],Pe(o,K(o,i)));const l=r(e,["temperature"]);l!=null&&s(n,["temperature"],l);const a=r(e,["topP"]);a!=null&&s(n,["topP"],a);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 E=r(e,["responseMimeType"]);E!=null&&s(n,["responseMimeType"],E);const M=r(e,["responseSchema"]);M!=null&&s(n,["responseSchema"],cu(o,Qe(o,M)));const _=r(e,["routingConfig"]);_!=null&&s(n,["routingConfig"],_);const A=r(e,["modelSelectionConfig"]);A!=null&&s(n,["modelConfig"],du(o,A));const R=r(e,["safetySettings"]);if(t!==void 0&&R!=null){let ne=R;Array.isArray(ne)&&(ne=ne.map(ye=>fu(o,ye))),s(t,["safetySettings"],ne)}const k=r(e,["tools"]);if(t!==void 0&&k!=null){let ne=Be(o,k);Array.isArray(ne)&&(ne=ne.map(ye=>Ao(o,Ge(o,ye)))),s(t,["tools"],ne)}const V=r(e,["toolConfig"]);t!==void 0&&V!=null&&s(t,["toolConfig"],Au(o,V));const B=r(e,["labels"]);t!==void 0&&B!=null&&s(t,["labels"],B);const J=r(e,["cachedContent"]);t!==void 0&&J!=null&&s(t,["cachedContent"],de(o,J));const D=r(e,["responseModalities"]);D!=null&&s(n,["responseModalities"],D);const G=r(e,["mediaResolution"]);G!=null&&s(n,["mediaResolution"],G);const X=r(e,["speechConfig"]);X!=null&&s(n,["speechConfig"],Ru(o,oo(o,X)));const Ne=r(e,["audioTimestamp"]);Ne!=null&&s(n,["audioTimestamp"],Ne);const $e=r(e,["thinkingConfig"]);return $e!=null&&s(n,["thinkingConfig"],wu(o,$e)),n}function Mo(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 a=te(o,i);Array.isArray(a)&&(a=a.map(u=>Pe(o,u))),s(t,["contents"],a)}const l=r(e,["config"]);return l!=null&&s(t,["generationConfig"],Pu(o,l,t)),t}function Nu(o,e,t){const n={},i=r(e,["taskType"]);t!==void 0&&i!=null&&s(t,["instances[]","task_type"],i);const l=r(e,["title"]);t!==void 0&&l!=null&&s(t,["instances[]","title"],l);const a=r(e,["outputDimensionality"]);t!==void 0&&a!=null&&s(t,["parameters","outputDimensionality"],a);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 ku(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"],to(o,i));const l=r(e,["config"]);return l!=null&&s(t,["config"],Nu(o,l,t)),t}function Du(o,e,t){const n={},i=r(e,["outputGcsUri"]);t!==void 0&&i!=null&&s(t,["parameters","storageUri"],i);const l=r(e,["negativePrompt"]);t!==void 0&&l!=null&&s(t,["parameters","negativePrompt"],l);const a=r(e,["numberOfImages"]);t!==void 0&&a!=null&&s(t,["parameters","sampleCount"],a);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 E=r(e,["outputCompressionQuality"]);t!==void 0&&E!=null&&s(t,["parameters","outputOptions","compressionQuality"],E);const M=r(e,["addWatermark"]);t!==void 0&&M!=null&&s(t,["parameters","addWatermark"],M);const _=r(e,["enhancePrompt"]);return t!==void 0&&_!=null&&s(t,["parameters","enhancePrompt"],_),n}function Lu(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 l=r(e,["config"]);return l!=null&&s(t,["config"],Du(o,l,t)),t}function St(o,e){const t={},n=r(e,["gcsUri"]);n!=null&&s(t,["gcsUri"],n);const i=r(e,["imageBytes"]);i!=null&&s(t,["bytesBase64Encoded"],fe(o,i));const l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Vu(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 l=r(e,["maskDilation"]);return l!=null&&s(t,["dilation"],l),t}function Fu(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 Uu(o,e){const t={},n=r(e,["styleDescription"]);return n!=null&&s(t,["styleDescription"],n),t}function bu(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 Gu(o,e){const t={},n=r(e,["referenceImage"]);n!=null&&s(t,["referenceImage"],St(o,n));const i=r(e,["referenceId"]);i!=null&&s(t,["referenceId"],i);const l=r(e,["referenceType"]);l!=null&&s(t,["referenceType"],l);const a=r(e,["maskImageConfig"]);a!=null&&s(t,["maskImageConfig"],Vu(o,a));const u=r(e,["controlImageConfig"]);u!=null&&s(t,["controlImageConfig"],Fu(o,u));const d=r(e,["styleImageConfig"]);d!=null&&s(t,["styleImageConfig"],Uu(o,d));const c=r(e,["subjectImageConfig"]);return c!=null&&s(t,["subjectImageConfig"],bu(o,c)),t}function Bu(o,e,t){const n={},i=r(e,["outputGcsUri"]);t!==void 0&&i!=null&&s(t,["parameters","storageUri"],i);const l=r(e,["negativePrompt"]);t!==void 0&&l!=null&&s(t,["parameters","negativePrompt"],l);const a=r(e,["numberOfImages"]);t!==void 0&&a!=null&&s(t,["parameters","sampleCount"],a);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 E=r(e,["outputCompressionQuality"]);t!==void 0&&E!=null&&s(t,["parameters","outputOptions","compressionQuality"],E);const M=r(e,["editMode"]);t!==void 0&&M!=null&&s(t,["parameters","editMode"],M);const _=r(e,["baseSteps"]);return t!==void 0&&_!=null&&s(t,["parameters","editConfig","baseSteps"],_),n}function qu(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 l=r(e,["referenceImages"]);if(l!=null){let u=l;Array.isArray(u)&&(u=u.map(d=>Gu(o,d))),s(t,["instances[0]","referenceImages"],u)}const a=r(e,["config"]);return a!=null&&s(t,["config"],Bu(o,a,t)),t}function $u(o,e,t){const n={},i=r(e,["includeRaiReason"]);t!==void 0&&i!=null&&s(t,["parameters","includeRaiReason"],i);const l=r(e,["outputMimeType"]);t!==void 0&&l!=null&&s(t,["parameters","outputOptions","mimeType"],l);const a=r(e,["outputCompressionQuality"]);t!==void 0&&a!=null&&s(t,["parameters","outputOptions","compressionQuality"],a);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 Ou(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"],St(o,i));const l=r(e,["upscaleFactor"]);l!=null&&s(t,["parameters","upscaleConfig","upscaleFactor"],l);const a=r(e,["config"]);return a!=null&&s(t,["config"],$u(o,a,t)),t}function Hu(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 Ju(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);t!==void 0&&l!=null&&s(t,["_query","pageToken"],l);const a=r(e,["filter"]);t!==void 0&&a!=null&&s(t,["_query","filter"],a);const u=r(e,["queryBase"]);return t!==void 0&&u!=null&&s(t,["_url","models_url"],so(o,u)),n}function Wu(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],Ju(o,n,t)),t}function Yu(o,e,t){const n={},i=r(e,["displayName"]);t!==void 0&&i!=null&&s(t,["displayName"],i);const l=r(e,["description"]);t!==void 0&&l!=null&&s(t,["description"],l);const a=r(e,["defaultCheckpointId"]);return t!==void 0&&a!=null&&s(t,["defaultCheckpointId"],a),n}function Zu(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"],Yu(o,i,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,["systemInstruction"]);t!==void 0&&i!=null&&s(t,["systemInstruction"],Pe(o,K(o,i)));const l=r(e,["tools"]);if(t!==void 0&&l!=null){let u=l;Array.isArray(u)&&(u=u.map(d=>Ao(o,d))),s(t,["tools"],u)}const a=r(e,["generationConfig"]);return t!==void 0&&a!=null&&s(t,["generationConfig"],a),n}function Xu(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 a=te(o,i);Array.isArray(a)&&(a=a.map(u=>Pe(o,u))),s(t,["contents"],a)}const l=r(e,["config"]);return l!=null&&s(t,["config"],Ku(o,l,t)),t}function Qu(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 a=te(o,i);Array.isArray(a)&&(a=a.map(u=>Pe(o,u))),s(t,["contents"],a)}const l=r(e,["config"]);return l!=null&&s(t,["config"],l),t}function ju(o,e,t){const n={},i=r(e,["numberOfVideos"]);t!==void 0&&i!=null&&s(t,["parameters","sampleCount"],i);const l=r(e,["outputGcsUri"]);t!==void 0&&l!=null&&s(t,["parameters","storageUri"],l);const a=r(e,["fps"]);t!==void 0&&a!=null&&s(t,["parameters","fps"],a);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 ec(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 l=r(e,["image"]);l!=null&&s(t,["instances[0]","image"],St(o,l));const a=r(e,["config"]);return a!=null&&s(t,["config"],ju(o,a,t)),t}function tc(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function nc(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 oc(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 ic(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],tc(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],nc(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],oc(o,a));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 rc(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>ic(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function sc(o,e){const t={},n=r(e,["citationSources"]);return n!=null&&s(t,["citations"],n),t}function lc(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 ac(o,e){const t={},n=r(e,["urlMetadata"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>lc(o,l))),s(t,["urlMetadata"],i)}return t}function uc(o,e){const t={},n=r(e,["content"]);n!=null&&s(t,["content"],rc(o,n));const i=r(e,["citationMetadata"]);i!=null&&s(t,["citationMetadata"],sc(o,i));const l=r(e,["tokenCount"]);l!=null&&s(t,["tokenCount"],l);const a=r(e,["finishReason"]);a!=null&&s(t,["finishReason"],a);const u=r(e,["urlContextMetadata"]);u!=null&&s(t,["urlContextMetadata"],ac(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 Io(o,e){const t={},n=r(e,["candidates"]);if(n!=null){let u=n;Array.isArray(u)&&(u=u.map(d=>uc(o,d))),s(t,["candidates"],u)}const i=r(e,["modelVersion"]);i!=null&&s(t,["modelVersion"],i);const l=r(e,["promptFeedback"]);l!=null&&s(t,["promptFeedback"],l);const a=r(e,["usageMetadata"]);return a!=null&&s(t,["usageMetadata"],a),t}function cc(o,e){const t={},n=r(e,["values"]);return n!=null&&s(t,["values"],n),t}function dc(){return{}}function fc(o,e){const t={},n=r(e,["embeddings"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>cc(o,a))),s(t,["embeddings"],l)}return r(e,["metadata"])!=null&&s(t,["metadata"],dc()),t}function pc(o,e){const t={},n=r(e,["bytesBase64Encoded"]);n!=null&&s(t,["imageBytes"],fe(o,n));const i=r(e,["mimeType"]);return i!=null&&s(t,["mimeType"],i),t}function Ro(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 l=r(e,["contentType"]);return l!=null&&s(t,["contentType"],l),t}function mc(o,e){const t={},n=r(e,["_self"]);n!=null&&s(t,["image"],pc(o,n));const i=r(e,["raiFilteredReason"]);i!=null&&s(t,["raiFilteredReason"],i);const l=r(e,["_self"]);return l!=null&&s(t,["safetyAttributes"],Ro(o,l)),t}function hc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>mc(o,a))),s(t,["generatedImages"],l)}const i=r(e,["positivePromptSafetyAttributes"]);return i!=null&&s(t,["positivePromptSafetyAttributes"],Ro(o,i)),t}function gc(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 l=r(e,["updateTime"]);return l!=null&&s(t,["updateTime"],l),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 l=r(e,["description"]);l!=null&&s(t,["description"],l);const a=r(e,["version"]);a!=null&&s(t,["version"],a);const u=r(e,["_self"]);u!=null&&s(t,["tunedModelInfo"],gc(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 yc(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["_self"]);if(i!=null){let l=lo(o,i);Array.isArray(l)&&(l=l.map(a=>xt(o,a))),s(t,["models"],l)}return t}function vc(){return{}}function Tc(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 Cc(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"],fe(o,i));const l=r(e,["encoding"]);return l!=null&&s(t,["mimeType"],l),t}function _c(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Cc(o,n)),t}function Ec(o,e){const t={},n=r(e,["generatedSamples"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(u=>_c(o,u))),s(t,["generatedVideos"],a)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const l=r(e,["raiMediaFilteredReasons"]);return l!=null&&s(t,["raiMediaFilteredReasons"],l),t}function Sc(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 l=r(e,["done"]);l!=null&&s(t,["done"],l);const a=r(e,["error"]);a!=null&&s(t,["error"],a);const u=r(e,["response","generateVideoResponse"]);return u!=null&&s(t,["response"],Ec(o,u)),t}function xc(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function Ac(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Mc(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Ic(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],xc(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],Ac(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Mc(o,a));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 Rc(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Ic(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function wc(o,e){const t={},n=r(e,["citations"]);return n!=null&&s(t,["citations"],n),t}function Pc(o,e){const t={},n=r(e,["content"]);n!=null&&s(t,["content"],Rc(o,n));const i=r(e,["citationMetadata"]);i!=null&&s(t,["citationMetadata"],wc(o,i));const l=r(e,["finishMessage"]);l!=null&&s(t,["finishMessage"],l);const a=r(e,["finishReason"]);a!=null&&s(t,["finishReason"],a);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 wo(o,e){const t={},n=r(e,["candidates"]);if(n!=null){let c=n;Array.isArray(c)&&(c=c.map(f=>Pc(o,f))),s(t,["candidates"],c)}const i=r(e,["createTime"]);i!=null&&s(t,["createTime"],i);const l=r(e,["responseId"]);l!=null&&s(t,["responseId"],l);const a=r(e,["modelVersion"]);a!=null&&s(t,["modelVersion"],a);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 Nc(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 kc(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"],Nc(o,i)),t}function Dc(o,e){const t={},n=r(e,["billableCharacterCount"]);return n!=null&&s(t,["billableCharacterCount"],n),t}function Lc(o,e){const t={},n=r(e,["predictions[]","embeddings"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>kc(o,a))),s(t,["embeddings"],l)}const i=r(e,["metadata"]);return i!=null&&s(t,["metadata"],Dc(o,i)),t}function Vc(o,e){const t={},n=r(e,["gcsUri"]);n!=null&&s(t,["gcsUri"],n);const i=r(e,["bytesBase64Encoded"]);i!=null&&s(t,["imageBytes"],fe(o,i));const l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),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 l=r(e,["contentType"]);return l!=null&&s(t,["contentType"],l),t}function At(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 l=r(e,["_self"]);l!=null&&s(t,["safetyAttributes"],Po(o,l));const a=r(e,["prompt"]);return a!=null&&s(t,["enhancedPrompt"],a),t}function Fc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>At(o,a))),s(t,["generatedImages"],l)}const i=r(e,["positivePromptSafetyAttributes"]);return i!=null&&s(t,["positivePromptSafetyAttributes"],Po(o,i)),t}function Uc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>At(o,l))),s(t,["generatedImages"],i)}return t}function bc(o,e){const t={},n=r(e,["predictions"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>At(o,l))),s(t,["generatedImages"],i)}return t}function Gc(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 Bc(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 l=r(e,["updateTime"]);return l!=null&&s(t,["updateTime"],l),t}function qc(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 l=r(e,["step"]);return l!=null&&s(t,["step"],l),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 l=r(e,["description"]);l!=null&&s(t,["description"],l);const a=r(e,["versionId"]);a!=null&&s(t,["version"],a);const u=r(e,["deployedModels"]);if(u!=null){let m=u;Array.isArray(m)&&(m=m.map(h=>Gc(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"],Bc(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=>qc(o,h))),s(t,["checkpoints"],m)}return t}function $c(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["_self"]);if(i!=null){let l=lo(o,i);Array.isArray(l)&&(l=l.map(a=>Mt(o,a))),s(t,["models"],l)}return t}function Oc(){return{}}function Hc(o,e){const t={},n=r(e,["totalTokens"]);return n!=null&&s(t,["totalTokens"],n),t}function Jc(o,e){const t={},n=r(e,["tokensInfo"]);return n!=null&&s(t,["tokensInfo"],n),t}function Wc(o,e){const t={},n=r(e,["gcsUri"]);n!=null&&s(t,["uri"],n);const i=r(e,["bytesBase64Encoded"]);i!=null&&s(t,["videoBytes"],fe(o,i));const l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Yc(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Wc(o,n)),t}function Zc(o,e){const t={},n=r(e,["videos"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(u=>Yc(o,u))),s(t,["generatedVideos"],a)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const l=r(e,["raiMediaFilteredReasons"]);return l!=null&&s(t,["raiMediaFilteredReasons"],l),t}function zc(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 l=r(e,["done"]);l!=null&&s(t,["done"],l);const a=r(e,["error"]);a!=null&&s(t,["error"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],Zc(o,u)),t}/**
146
146
  * @license
147
147
  * Copyright 2025 Google LLC
148
148
  * SPDX-License-Identifier: Apache-2.0
149
- */const zc="Content-Type",Kc="X-Server-Timeout",Xc="User-Agent",It="x-goog-api-client",Qc="google-genai-sdk/1.3.0",jc="v1beta1",ed="v1beta",No=/^data: (.*)(?:\n\n|\r\r|\r\n\r\n)/;class ko 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 td{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:jc,i.baseUrl=this.baseUrlFromProjectLocation(),this.normalizeAuthParameters()):(i.apiVersion=(n=this.clientOptions.apiVersion)!==null&&n!==void 0?n:ed,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[a,u]of Object.entries(e.queryParams))i.searchParams.append(a,String(u));let l={};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 l.body=e.body;return l=await this.includeExtraHttpOptionsToRequestInit(l,t,e.abortSignal),this.unaryApiCall(i,l,e.httpMethod)}patchHttpOptions(e,t){const n=JSON.parse(JSON.stringify(e));for(const[i,l]of Object.entries(t))typeof l=="object"?n[i]=Object.assign(Object.assign({},n[i]),l):l!==void 0&&(n[i]=l);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 l={};return l.body=e.body,l=await this.includeExtraHttpOptionsToRequestInit(l,t,e.abortSignal),this.streamApiCall(i,l,e.httpMethod)}async includeExtraHttpOptionsToRequestInit(e,t,n){if(t&&t.timeout||n){const i=new AbortController,l=i.signal;t.timeout&&(t==null?void 0:t.timeout)>0&&setTimeout(()=>i.abort(),t.timeout),n&&n.addEventListener("abort",()=>{i.abort()}),e.signal=l}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 Do(i),new vt(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 Do(i),this.processStreamResponse(i))).catch(i=>{throw i instanceof Error?i:new Error(JSON.stringify(i))})}processStreamResponse(e){var t;return we(this,arguments,function*(){const i=(t=e==null?void 0:e.body)===null||t===void 0?void 0:t.getReader(),l=new TextDecoder("utf-8");if(!i)throw new Error("Response body is empty");try{let a="";for(;;){const{done:u,value:d}=yield $(i.read());if(u){if(a.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const c=l.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 ko(v);if(g>=500&&g<600)throw new Rt(v)}}catch(p){const m=p;if(m.name==="ClientError"||m.name==="ServerError")throw p}a+=c;let f=a.match(No);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 vt(m)),a=a.slice(f[0].length),f=a.match(No)}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=Qc+" "+this.clientOptions.userAgentExtra;return e[Xc]=t,e[It]=t,e[zc]="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(Kc,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 l=this.clientOptions.uploader,a=await l.stat(e);i.sizeBytes=String(a.size);const u=(n=t==null?void 0:t.mimeType)!==null&&n!==void 0?n:a.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 l.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 l={file:e},a=await this.request({path:I("upload/v1beta/files",l._url),body:JSON.stringify(l),httpMethod:"POST",httpOptions:i});if(!a||!(a!=null&&a.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const u=(n=a==null?void 0:a.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 Do(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 l=`got status: ${t} ${n}. ${JSON.stringify(i)}`;throw t>=400&&t<500?new ko(l):t>=500&&t<600?new Rt(l):new Error(l)}}/**
149
+ */const Kc="Content-Type",Xc="X-Server-Timeout",Qc="User-Agent",It="x-goog-api-client",jc="google-genai-sdk/1.3.0",ed="v1beta1",td="v1beta",No=/^data: (.*)(?:\n\n|\r\r|\r\n\r\n)/;class ko 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 nd{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:ed,i.baseUrl=this.baseUrlFromProjectLocation(),this.normalizeAuthParameters()):(i.apiVersion=(n=this.clientOptions.apiVersion)!==null&&n!==void 0?n:td,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[a,u]of Object.entries(e.queryParams))i.searchParams.append(a,String(u));let l={};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 l.body=e.body;return l=await this.includeExtraHttpOptionsToRequestInit(l,t,e.abortSignal),this.unaryApiCall(i,l,e.httpMethod)}patchHttpOptions(e,t){const n=JSON.parse(JSON.stringify(e));for(const[i,l]of Object.entries(t))typeof l=="object"?n[i]=Object.assign(Object.assign({},n[i]),l):l!==void 0&&(n[i]=l);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 l={};return l.body=e.body,l=await this.includeExtraHttpOptionsToRequestInit(l,t,e.abortSignal),this.streamApiCall(i,l,e.httpMethod)}async includeExtraHttpOptionsToRequestInit(e,t,n){if(t&&t.timeout||n){const i=new AbortController,l=i.signal;t.timeout&&(t==null?void 0:t.timeout)>0&&setTimeout(()=>i.abort(),t.timeout),n&&n.addEventListener("abort",()=>{i.abort()}),e.signal=l}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 Do(i),new vt(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 Do(i),this.processStreamResponse(i))).catch(i=>{throw i instanceof Error?i:new Error(JSON.stringify(i))})}processStreamResponse(e){var t;return we(this,arguments,function*(){const i=(t=e==null?void 0:e.body)===null||t===void 0?void 0:t.getReader(),l=new TextDecoder("utf-8");if(!i)throw new Error("Response body is empty");try{let a="";for(;;){const{done:u,value:d}=yield $(i.read());if(u){if(a.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const c=l.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 ko(v);if(g>=500&&g<600)throw new Rt(v)}}catch(p){const m=p;if(m.name==="ClientError"||m.name==="ServerError")throw p}a+=c;let f=a.match(No);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 vt(m)),a=a.slice(f[0].length),f=a.match(No)}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=jc+" "+this.clientOptions.userAgentExtra;return e[Qc]=t,e[It]=t,e[Kc]="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(Xc,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 l=this.clientOptions.uploader,a=await l.stat(e);i.sizeBytes=String(a.size);const u=(n=t==null?void 0:t.mimeType)!==null&&n!==void 0?n:a.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 l.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 l={file:e},a=await this.request({path:I("upload/v1beta/files",l._url),body:JSON.stringify(l),httpMethod:"POST",httpOptions:i});if(!a||!(a!=null&&a.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const u=(n=a==null?void 0:a.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 Do(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 l=`got status: ${t} ${n}. ${JSON.stringify(i)}`;throw t>=400&&t<500?new ko(l):t>=500&&t<600?new Rt(l):new Error(l)}}/**
150
150
  * @license
151
151
  * Copyright 2025 Google LLC
152
152
  * SPDX-License-Identifier: Apache-2.0
153
- */const nd="mcp_used/unknown";function Lo(o){for(const e of o)if(wt(e)||typeof e=="object"&&"inputSchema"in e)return!0;return!1}function Vo(o){var e;const t=(e=o[It])!==null&&e!==void 0?e:"";o[It]=(t+` ${nd}`).trimStart()}function od(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=>wt(i)))!==null&&n!==void 0?n:!1}function id(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=>!wt(i)))!==null&&n!==void 0?n:!1}function wt(o){return o!==null&&typeof o=="object"&&o instanceof Pt}function rd(o,e=100){return we(this,arguments,function*(){let n,i=0;for(;i<e;){const l=yield $(o.listTools({cursor:n}));for(const a of l.tools)yield yield $(a),i++;if(!l.nextCursor)break;n=l.nextCursor}})}class Pt{constructor(e=[],t){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=e,this.config=t}static create(e,t){return new Pt(e,t)}async initialize(){var e,t,n,i;if(this.mcpTools.length>0)return;const l={},a=[];for(const f of this.mcpClients)try{for(var u=!0,d=(t=void 0,qe(rd(f))),c;c=await d.next(),e=c.done,!e;u=!0){i=c.value,u=!1;const p=i;a.push(p);const m=p.name;if(l[m])throw new Error(`Duplicate function name ${m} found in MCP tools. Please ensure function names are unique.`);l[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=a,this.functionNameToMcpClient=l}async tool(){return await this.initialize(),pr(this.mcpTools,this.config)}async callTool(e){await this.initialize();const t=[];for(const n of e)if(n.name in this.functionNameToMcpClient){const l=await this.functionNameToMcpClient[n.name].callTool({name:n.name,arguments:n.args});t.push({functionResponse:{name:n.name,response:l.isError?{error:l}:l}})}return t}}/**
153
+ */const od="mcp_used/unknown";function Lo(o){for(const e of o)if(wt(e)||typeof e=="object"&&"inputSchema"in e)return!0;return!1}function Vo(o){var e;const t=(e=o[It])!==null&&e!==void 0?e:"";o[It]=(t+` ${od}`).trimStart()}function id(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=>wt(i)))!==null&&n!==void 0?n:!1}function rd(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=>!wt(i)))!==null&&n!==void 0?n:!1}function wt(o){return o!==null&&typeof o=="object"&&o instanceof Pt}function sd(o,e=100){return we(this,arguments,function*(){let n,i=0;for(;i<e;){const l=yield $(o.listTools({cursor:n}));for(const a of l.tools)yield yield $(a),i++;if(!l.nextCursor)break;n=l.nextCursor}})}class Pt{constructor(e=[],t){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=e,this.config=t}static create(e,t){return new Pt(e,t)}async initialize(){var e,t,n,i;if(this.mcpTools.length>0)return;const l={},a=[];for(const f of this.mcpClients)try{for(var u=!0,d=(t=void 0,qe(sd(f))),c;c=await d.next(),e=c.done,!e;u=!0){i=c.value,u=!1;const p=i;a.push(p);const m=p.name;if(l[m])throw new Error(`Duplicate function name ${m} found in MCP tools. Please ensure function names are unique.`);l[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=a,this.functionNameToMcpClient=l}async tool(){return await this.initialize(),mr(this.mcpTools,this.config)}async callTool(e){await this.initialize();const t=[];for(const n of e)if(n.name in this.functionNameToMcpClient){const l=await this.functionNameToMcpClient[n.name].callTool({name:n.name,arguments:n.args});t.push({functionResponse:{name:n.name,response:l.isError?{error:l}:l}})}return t}}/**
154
154
  * @license
155
155
  * Copyright 2025 Google LLC
156
156
  * SPDX-License-Identifier: Apache-2.0
157
- */async function sd(o,e,t){const n=new er;let i;t.data instanceof Blob?i=JSON.parse(await t.data.text()):i=JSON.parse(t.data);const l=Ca(o,i);Object.assign(n,l),e(n)}class ld{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(),l=this.apiClient.getApiVersion(),a=cd(this.apiClient.getDefaultHeaders()),u=this.apiClient.getApiKey(),d=`${i}/ws/google.ai.generativelanguage.${l}.GenerativeService.BidiGenerateMusic?key=${u}`;let c=()=>{};const f=new Promise(A=>{c=A}),p=e.callbacks,m=function(){c({})},h=this.apiClient,g={onopen:m,onmessage:A=>{sd(h,p.onmessage,A)},onerror:(t=p==null?void 0:p.onerror)!==null&&t!==void 0?t:function(A){},onclose:(n=p==null?void 0:p.onclose)!==null&&n!==void 0?n:function(A){}},v=this.webSocketFactory.create(d,ud(a),g);v.connect(),await f;const E=q(this.apiClient,e.model),M=To(this.apiClient,{model:E}),_=Et(this.apiClient,{setup:M});return v.send(JSON.stringify(_)),new ad(v,this.apiClient)}}class ad{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=Ll(this.apiClient,e),n=Co(this.apiClient,t);this.conn.send(JSON.stringify({clientContent:n}))}async setMusicGenerationConfig(e){e.musicGenerationConfig||(e.musicGenerationConfig={});const t=Vl(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(Me.PLAY)}pause(){this.sendPlaybackControl(Me.PAUSE)}stop(){this.sendPlaybackControl(Me.STOP)}resetContext(){this.sendPlaybackControl(Me.RESET_CONTEXT)}close(){this.conn.close()}}function ud(o){const e={};return o.forEach((t,n)=>{e[n]=t}),e}function cd(o){const e=new Headers;for(const[t,n]of Object.entries(o))e.append(t,n);return e}/**
157
+ */async function ld(o,e,t){const n=new tr;let i;t.data instanceof Blob?i=JSON.parse(await t.data.text()):i=JSON.parse(t.data);const l=_a(o,i);Object.assign(n,l),e(n)}class ad{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(),l=this.apiClient.getApiVersion(),a=dd(this.apiClient.getDefaultHeaders()),u=this.apiClient.getApiKey(),d=`${i}/ws/google.ai.generativelanguage.${l}.GenerativeService.BidiGenerateMusic?key=${u}`;let c=()=>{};const f=new Promise(A=>{c=A}),p=e.callbacks,m=function(){c({})},h=this.apiClient,g={onopen:m,onmessage:A=>{ld(h,p.onmessage,A)},onerror:(t=p==null?void 0:p.onerror)!==null&&t!==void 0?t:function(A){},onclose:(n=p==null?void 0:p.onclose)!==null&&n!==void 0?n:function(A){}},v=this.webSocketFactory.create(d,cd(a),g);v.connect(),await f;const E=q(this.apiClient,e.model),M=To(this.apiClient,{model:E}),_=Et(this.apiClient,{setup:M});return v.send(JSON.stringify(_)),new ud(v,this.apiClient)}}class ud{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=Vl(this.apiClient,e),n=Co(this.apiClient,t);this.conn.send(JSON.stringify({clientContent:n}))}async setMusicGenerationConfig(e){e.musicGenerationConfig||(e.musicGenerationConfig={});const t=Fl(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(Me.PLAY)}pause(){this.sendPlaybackControl(Me.PAUSE)}stop(){this.sendPlaybackControl(Me.STOP)}resetContext(){this.sendPlaybackControl(Me.RESET_CONTEXT)}close(){this.conn.close()}}function cd(o){const e={};return o.forEach((t,n)=>{e[n]=t}),e}function dd(o){const e=new Headers;for(const[t,n]of Object.entries(o))e.append(t,n);return e}/**
158
158
  * @license
159
159
  * Copyright 2025 Google LLC
160
160
  * SPDX-License-Identifier: Apache-2.0
161
- */const dd="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function fd(o,e,t){const n=new ji;let i;if(t.data instanceof Blob?i=JSON.parse(await t.data.text()):i=JSON.parse(t.data),o.isVertexAI()){const l=da(o,i);Object.assign(n,l)}else{const l=ca(o,i);Object.assign(n,l)}e(n)}class pd{constructor(e,t,n){this.apiClient=e,this.auth=t,this.webSocketFactory=n,this.music=new ld(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){var t,n,i,l,a,u;const d=this.apiClient.getWebsocketBaseUrl(),c=this.apiClient.getApiVersion();let f;const p=this.apiClient.getDefaultHeaders();e.config&&e.config.tools&&Lo(e.config.tools)&&Vo(p);const m=yd(p);if(this.apiClient.isVertexAI())f=`${d}/ws/google.cloud.aiplatform.${c}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(m);else{const D=this.apiClient.getApiKey();let G="BidiGenerateContent",X="key";D!=null&&D.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),G="BidiGenerateContentConstrained",X="access_token"),f=`${d}/ws/google.ai.generativelanguage.${c}.GenerativeService.${G}?${X}=${D}`}let h=()=>{};const g=new Promise(D=>{h=D}),v=e.callbacks,E=function(){var D;(D=v==null?void 0:v.onopen)===null||D===void 0||D.call(v),h({})},M=this.apiClient,_={onopen:E,onmessage:D=>{fd(M,v.onmessage,D)},onerror:(t=v==null?void 0:v.onerror)!==null&&t!==void 0?t:function(D){},onclose:(n=v==null?void 0:v.onclose)!==null&&n!==void 0?n:function(D){}},A=this.webSocketFactory.create(f,gd(m),_);A.connect(),await g;let R=q(this.apiClient,e.model);if(this.apiClient.isVertexAI()&&R.startsWith("publishers/")){const D=this.apiClient.getProject(),G=this.apiClient.getLocation();R=`projects/${D}/locations/${G}/`+R}let k={};this.apiClient.isVertexAI()&&((i=e.config)===null||i===void 0?void 0:i.responseModalities)===void 0&&(e.config===void 0?e.config={responseModalities:[Ke.AUDIO]}:e.config.responseModalities=[Ke.AUDIO]),!((l=e.config)===null||l===void 0)&&l.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 V=(u=(a=e.config)===null||a===void 0?void 0:a.tools)!==null&&u!==void 0?u:[],B=[];for(const D of V)if(this.isCallableTool(D)){const G=D;B.push(await G.tool())}else B.push(D);B.length>0&&(e.config.tools=B);const J={model:R,config:e.config,callbacks:e.callbacks};return this.apiClient.isVertexAI()?k=Il(this.apiClient,J):k=Ml(this.apiClient,J),delete k.config,A.send(JSON.stringify(k)),new hd(A,this.apiClient)}isCallableTool(e){return"callTool"in e&&typeof e.callTool=="function"}}const md={turnComplete:!0};class hd{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=>Pe(e,i)):n=n.map(i=>rt(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 l of n){if(typeof l!="object"||l===null||!("name"in l)||!("response"in l))throw new Error(`Could not parse function response, type '${typeof l}'.`);if(!e.isVertexAI()&&!("id"in l))throw new Error(dd)}return{toolResponse:{functionResponses:n}}}sendClientContent(e){e=Object.assign(Object.assign({},md),e);const t=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(t))}sendRealtimeInput(e){let t={};this.apiClient.isVertexAI()?t={realtimeInput:Dl(this.apiClient,e)}:t={realtimeInput:kl(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 gd(o){const e={};return o.forEach((t,n)=>{e[n]=t}),e}function yd(o){const e=new Headers;for(const[t,n]of Object.entries(o))e.append(t,n);return e}/**
161
+ */const fd="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function pd(o,e,t){const n=new er;let i;if(t.data instanceof Blob?i=JSON.parse(await t.data.text()):i=JSON.parse(t.data),o.isVertexAI()){const l=fa(o,i);Object.assign(n,l)}else{const l=da(o,i);Object.assign(n,l)}e(n)}class md{constructor(e,t,n){this.apiClient=e,this.auth=t,this.webSocketFactory=n,this.music=new ad(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){var t,n,i,l,a,u;const d=this.apiClient.getWebsocketBaseUrl(),c=this.apiClient.getApiVersion();let f;const p=this.apiClient.getDefaultHeaders();e.config&&e.config.tools&&Lo(e.config.tools)&&Vo(p);const m=vd(p);if(this.apiClient.isVertexAI())f=`${d}/ws/google.cloud.aiplatform.${c}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(m);else{const D=this.apiClient.getApiKey();let G="BidiGenerateContent",X="key";D!=null&&D.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),G="BidiGenerateContentConstrained",X="access_token"),f=`${d}/ws/google.ai.generativelanguage.${c}.GenerativeService.${G}?${X}=${D}`}let h=()=>{};const g=new Promise(D=>{h=D}),v=e.callbacks,E=function(){var D;(D=v==null?void 0:v.onopen)===null||D===void 0||D.call(v),h({})},M=this.apiClient,_={onopen:E,onmessage:D=>{pd(M,v.onmessage,D)},onerror:(t=v==null?void 0:v.onerror)!==null&&t!==void 0?t:function(D){},onclose:(n=v==null?void 0:v.onclose)!==null&&n!==void 0?n:function(D){}},A=this.webSocketFactory.create(f,yd(m),_);A.connect(),await g;let R=q(this.apiClient,e.model);if(this.apiClient.isVertexAI()&&R.startsWith("publishers/")){const D=this.apiClient.getProject(),G=this.apiClient.getLocation();R=`projects/${D}/locations/${G}/`+R}let k={};this.apiClient.isVertexAI()&&((i=e.config)===null||i===void 0?void 0:i.responseModalities)===void 0&&(e.config===void 0?e.config={responseModalities:[Ke.AUDIO]}:e.config.responseModalities=[Ke.AUDIO]),!((l=e.config)===null||l===void 0)&&l.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 V=(u=(a=e.config)===null||a===void 0?void 0:a.tools)!==null&&u!==void 0?u:[],B=[];for(const D of V)if(this.isCallableTool(D)){const G=D;B.push(await G.tool())}else B.push(D);B.length>0&&(e.config.tools=B);const J={model:R,config:e.config,callbacks:e.callbacks};return this.apiClient.isVertexAI()?k=Rl(this.apiClient,J):k=Il(this.apiClient,J),delete k.config,A.send(JSON.stringify(k)),new gd(A,this.apiClient)}isCallableTool(e){return"callTool"in e&&typeof e.callTool=="function"}}const hd={turnComplete:!0};class gd{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=>Pe(e,i)):n=n.map(i=>rt(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 l of n){if(typeof l!="object"||l===null||!("name"in l)||!("response"in l))throw new Error(`Could not parse function response, type '${typeof l}'.`);if(!e.isVertexAI()&&!("id"in l))throw new Error(fd)}return{toolResponse:{functionResponses:n}}}sendClientContent(e){e=Object.assign(Object.assign({},hd),e);const t=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(t))}sendRealtimeInput(e){let t={};this.apiClient.isVertexAI()?t={realtimeInput:Ll(this.apiClient,e)}:t={realtimeInput:Dl(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 yd(o){const e={};return o.forEach((t,n)=>{e[n]=t}),e}function vd(o){const e=new Headers;for(const[t,n]of Object.entries(o))e.append(t,n);return e}/**
162
162
  * @license
163
163
  * Copyright 2025 Google LLC
164
164
  * SPDX-License-Identifier: Apache-2.0
@@ -166,47 +166,47 @@ React keys must be passed directly to JSX without using spread:
166
166
  * @license
167
167
  * Copyright 2025 Google LLC
168
168
  * SPDX-License-Identifier: Apache-2.0
169
- */class vd extends Ae{constructor(e){super(),this.apiClient=e,this.generateContent=async t=>{var n,i,l,a,u;const d=await this.processParamsForMcpUsage(t);if(!od(t)||Uo(t.config))return await this.generateContentInternal(d);if(id(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=(l=(i=(n=d.config)===null||n===void 0?void 0:n.automaticFunctionCalling)===null||i===void 0?void 0:i.maximumRemoteCalls)!==null&&l!==void 0?l:Fo;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 E of(u=(a=t.config)===null||a===void 0?void 0:a.tools)!==null&&u!==void 0?u:[])if(st(E)){const _=await E.callTool(c.functionCalls);v.push(..._)}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(Uo(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 l;const a=[];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"?l=d==null?void 0:d.safetyAttributes:a.push(d);let u;return l?u={generatedImages:a,positivePromptSafetyAttributes:l}:u={generatedImages:a},u}),this.list=async t=>{var n;const a={config:Object.assign(Object.assign({},{queryBase:!0}),t==null?void 0:t.config)};if(this.apiClient.isVertexAI()&&!a.config.queryBase){if(!((n=a.config)===null||n===void 0)&&n.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");a.config.filter="labels.tune-type:*"}return new nt(Re.PAGED_ITEM_MODELS,u=>this.listInternal(u),await this.listInternal(a),a)},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 l=(t=e.config)===null||t===void 0?void 0:t.tools;if(!l)return e;const a=await Promise.all(l.map(async d=>st(d)?await d.tool():d)),u={model:e.model,contents:e.contents,config:Object.assign(Object.assign({},e.config),{tools:a})};if(u.config.tools=a,e.config&&e.config.tools&&Lo(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()),Vo(c),u.config.httpOptions=Object.assign(Object.assign({},e.config.httpOptions),{headers:c})}return u}async initAfcToolsMap(e){var t,n,i;const l=new Map;for(const a of(n=(t=e.config)===null||t===void 0?void 0:t.tools)!==null&&n!==void 0?n:[])if(st(a)){const u=a,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(l.has(c.name))throw new Error(`Duplicate tool declaration name: ${c.name}`);l.set(c.name,u)}}return l}async processAfcStream(e){var t,n,i;const l=(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:Fo;let a=!1,u=0;const d=await this.initAfcToolsMap(e);return(function(c,f,p){var m,h;return we(this,arguments,function*(){for(var g,v,E,M;u<l;){a&&(u++,a=!1);const k=yield $(c.processParamsForMcpUsage(p)),V=yield $(c.generateContentStreamInternal(k)),B=[],J=[];try{for(var _=!0,A=(v=void 0,qe(V)),R;R=yield $(A.next()),g=R.done,!g;_=!0){M=R.value,_=!1;const D=M;if(yield yield $(D),D.candidates&&(!((m=D.candidates[0])===null||m===void 0)&&m.content)){J.push(D.candidates[0].content);for(const G of(h=D.candidates[0].content.parts)!==null&&h!==void 0?h:[])if(u<l&&G.functionCall){if(!G.functionCall.name)throw new Error("Function call name was not returned by the model.");if(f.has(G.functionCall.name)){const X=yield $(f.get(G.functionCall.name).callTool([G.functionCall]));B.push(...X)}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: ${G.functionCall.name}`)}}}}catch(D){v={error:D}}finally{try{!_&&!g&&(E=A.return)&&(yield $(E.call(A)))}finally{if(v)throw v.error}}if(B.length>0){a=!0;const D=new be;D.candidates=[{content:{role:"user",parts:B}}],yield yield $(D);const G=[];G.push(...J),G.push({role:"user",parts:B});const X=te(c.apiClient,p.contents).concat(G);p.contents=X}else break}})})(this,d,e)}async generateContentInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Mo(this.apiClient,e);return u=I("{model}:generateContent",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=wo(this.apiClient,f),m=new be;return Object.assign(m,p),m})}else{const c=xo(this.apiClient,e);return u=I("{model}:generateContent",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=Io(this.apiClient,f),m=new be;return Object.assign(m,p),m})}}async generateContentStreamInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Mo(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 a=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}),a.then(function(p){return we(this,arguments,function*(){var m,h,g,v;try{for(var E=!0,M=qe(p),_;_=yield $(M.next()),m=_.done,!m;E=!0){v=_.value,E=!1;const R=wo(f,yield $(v.json())),k=new be;Object.assign(k,R),yield yield $(k)}}catch(A){h={error:A}}finally{try{!E&&!m&&(g=M.return)&&(yield $(g.call(M)))}finally{if(h)throw h.error}}})})}else{const c=xo(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 a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}),a.then(function(p){return we(this,arguments,function*(){var m,h,g,v;try{for(var E=!0,M=qe(p),_;_=yield $(M.next()),m=_.done,!m;E=!0){v=_.value,E=!1;const R=Io(f,yield $(v.json())),k=new be;Object.assign(k,R),yield yield $(k)}}catch(A){h={error:A}}finally{try{!E&&!m&&(g=M.return)&&(yield $(g.call(M)))}finally{if(h)throw h.error}}})})}}async embedContent(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Nu(this.apiClient,e);return u=I("{model}:predict",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=Dc(this.apiClient,f),m=new qn;return Object.assign(m,p),m})}else{const c=Ja(this.apiClient,e);return u=I("{model}:batchEmbedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=dc(this.apiClient,f),m=new qn;return Object.assign(m,p),m})}}async generateImagesInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Du(this.apiClient,e);return u=I("{model}:predict",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=Vc(this.apiClient,f),m=new $n;return Object.assign(m,p),m})}else{const c=Ya(this.apiClient,e);return u=I("{model}:predict",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=mc(this.apiClient,f),m=new $n;return Object.assign(m,p),m})}}async editImageInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI()){const u=Bu(this.apiClient,e);return l=I("{model}:predict",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=Fc(this.apiClient,d),f=new Yi;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,l="",a={};if(this.apiClient.isVertexAI()){const u=$u(this.apiClient,e);return l=I("{model}:predict",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=Uc(this.apiClient,d),f=new Zi;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,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Ou(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>Mt(this.apiClient,f))}else{const c=Za(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>xt(this.apiClient,f))}}async listInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Ju(this.apiClient,e);return u=I("{models_url}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=qc(this.apiClient,f),m=new On;return Object.assign(m,p),m})}else{const c=Ka(this.apiClient,e);return u=I("{models_url}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=gc(this.apiClient,f),m=new On;return Object.assign(m,p),m})}}async update(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Yu(this.apiClient,e);return u=I("{model}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>Mt(this.apiClient,f))}else{const c=Qa(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>xt(this.apiClient,f))}}async delete(e){var t,n,i,l;let a,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,a=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()),a.then(()=>{const f=$c(),p=new Hn;return Object.assign(p,f),p})}else{const c=ja(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(()=>{const f=yc(),p=new Hn;return Object.assign(p,f),p})}}async countTokens(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Ku(this.apiClient,e);return u=I("{model}:countTokens",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=Oc(this.apiClient,f),m=new Jn;return Object.assign(m,p),m})}else{const c=tu(this.apiClient,e);return u=I("{model}:countTokens",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=vc(this.apiClient,f),m=new Jn;return Object.assign(m,p),m})}}async computeTokens(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI()){const u=Xu(this.apiClient,e);return l=I("{model}:computeTokens",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=Hc(this.apiClient,d),f=new zi;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,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=ju(this.apiClient,e);return u=I("{model}:predictLongRunning",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>Zc(this.apiClient,f))}else{const c=iu(this.apiClient,e);return u=I("{model}:predictLongRunning",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>Ec(this.apiClient,f))}}}/**
169
+ */class Td extends Ae{constructor(e){super(),this.apiClient=e,this.generateContent=async t=>{var n,i,l,a,u;const d=await this.processParamsForMcpUsage(t);if(!id(t)||Uo(t.config))return await this.generateContentInternal(d);if(rd(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=(l=(i=(n=d.config)===null||n===void 0?void 0:n.automaticFunctionCalling)===null||i===void 0?void 0:i.maximumRemoteCalls)!==null&&l!==void 0?l:Fo;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 E of(u=(a=t.config)===null||a===void 0?void 0:a.tools)!==null&&u!==void 0?u:[])if(st(E)){const _=await E.callTool(c.functionCalls);v.push(..._)}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(Uo(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 l;const a=[];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"?l=d==null?void 0:d.safetyAttributes:a.push(d);let u;return l?u={generatedImages:a,positivePromptSafetyAttributes:l}:u={generatedImages:a},u}),this.list=async t=>{var n;const a={config:Object.assign(Object.assign({},{queryBase:!0}),t==null?void 0:t.config)};if(this.apiClient.isVertexAI()&&!a.config.queryBase){if(!((n=a.config)===null||n===void 0)&&n.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");a.config.filter="labels.tune-type:*"}return new nt(Re.PAGED_ITEM_MODELS,u=>this.listInternal(u),await this.listInternal(a),a)},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 l=(t=e.config)===null||t===void 0?void 0:t.tools;if(!l)return e;const a=await Promise.all(l.map(async d=>st(d)?await d.tool():d)),u={model:e.model,contents:e.contents,config:Object.assign(Object.assign({},e.config),{tools:a})};if(u.config.tools=a,e.config&&e.config.tools&&Lo(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()),Vo(c),u.config.httpOptions=Object.assign(Object.assign({},e.config.httpOptions),{headers:c})}return u}async initAfcToolsMap(e){var t,n,i;const l=new Map;for(const a of(n=(t=e.config)===null||t===void 0?void 0:t.tools)!==null&&n!==void 0?n:[])if(st(a)){const u=a,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(l.has(c.name))throw new Error(`Duplicate tool declaration name: ${c.name}`);l.set(c.name,u)}}return l}async processAfcStream(e){var t,n,i;const l=(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:Fo;let a=!1,u=0;const d=await this.initAfcToolsMap(e);return(function(c,f,p){var m,h;return we(this,arguments,function*(){for(var g,v,E,M;u<l;){a&&(u++,a=!1);const k=yield $(c.processParamsForMcpUsage(p)),V=yield $(c.generateContentStreamInternal(k)),B=[],J=[];try{for(var _=!0,A=(v=void 0,qe(V)),R;R=yield $(A.next()),g=R.done,!g;_=!0){M=R.value,_=!1;const D=M;if(yield yield $(D),D.candidates&&(!((m=D.candidates[0])===null||m===void 0)&&m.content)){J.push(D.candidates[0].content);for(const G of(h=D.candidates[0].content.parts)!==null&&h!==void 0?h:[])if(u<l&&G.functionCall){if(!G.functionCall.name)throw new Error("Function call name was not returned by the model.");if(f.has(G.functionCall.name)){const X=yield $(f.get(G.functionCall.name).callTool([G.functionCall]));B.push(...X)}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: ${G.functionCall.name}`)}}}}catch(D){v={error:D}}finally{try{!_&&!g&&(E=A.return)&&(yield $(E.call(A)))}finally{if(v)throw v.error}}if(B.length>0){a=!0;const D=new be;D.candidates=[{content:{role:"user",parts:B}}],yield yield $(D);const G=[];G.push(...J),G.push({role:"user",parts:B});const X=te(c.apiClient,p.contents).concat(G);p.contents=X}else break}})})(this,d,e)}async generateContentInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Mo(this.apiClient,e);return u=I("{model}:generateContent",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=wo(this.apiClient,f),m=new be;return Object.assign(m,p),m})}else{const c=xo(this.apiClient,e);return u=I("{model}:generateContent",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=Io(this.apiClient,f),m=new be;return Object.assign(m,p),m})}}async generateContentStreamInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Mo(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 a=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}),a.then(function(p){return we(this,arguments,function*(){var m,h,g,v;try{for(var E=!0,M=qe(p),_;_=yield $(M.next()),m=_.done,!m;E=!0){v=_.value,E=!1;const R=wo(f,yield $(v.json())),k=new be;Object.assign(k,R),yield yield $(k)}}catch(A){h={error:A}}finally{try{!E&&!m&&(g=M.return)&&(yield $(g.call(M)))}finally{if(h)throw h.error}}})})}else{const c=xo(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 a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}),a.then(function(p){return we(this,arguments,function*(){var m,h,g,v;try{for(var E=!0,M=qe(p),_;_=yield $(M.next()),m=_.done,!m;E=!0){v=_.value,E=!1;const R=Io(f,yield $(v.json())),k=new be;Object.assign(k,R),yield yield $(k)}}catch(A){h={error:A}}finally{try{!E&&!m&&(g=M.return)&&(yield $(g.call(M)))}finally{if(h)throw h.error}}})})}}async embedContent(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=ku(this.apiClient,e);return u=I("{model}:predict",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=Lc(this.apiClient,f),m=new qn;return Object.assign(m,p),m})}else{const c=Wa(this.apiClient,e);return u=I("{model}:batchEmbedContents",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=fc(this.apiClient,f),m=new qn;return Object.assign(m,p),m})}}async generateImagesInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Lu(this.apiClient,e);return u=I("{model}:predict",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=Fc(this.apiClient,f),m=new $n;return Object.assign(m,p),m})}else{const c=Za(this.apiClient,e);return u=I("{model}:predict",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=hc(this.apiClient,f),m=new $n;return Object.assign(m,p),m})}}async editImageInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI()){const u=qu(this.apiClient,e);return l=I("{model}:predict",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=Uc(this.apiClient,d),f=new Zi;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,l="",a={};if(this.apiClient.isVertexAI()){const u=Ou(this.apiClient,e);return l=I("{model}:predict",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=bc(this.apiClient,d),f=new zi;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,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Hu(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>Mt(this.apiClient,f))}else{const c=za(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>xt(this.apiClient,f))}}async listInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Wu(this.apiClient,e);return u=I("{models_url}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=$c(this.apiClient,f),m=new On;return Object.assign(m,p),m})}else{const c=Xa(this.apiClient,e);return u=I("{models_url}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=yc(this.apiClient,f),m=new On;return Object.assign(m,p),m})}}async update(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Zu(this.apiClient,e);return u=I("{model}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>Mt(this.apiClient,f))}else{const c=ja(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>xt(this.apiClient,f))}}async delete(e){var t,n,i,l;let a,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,a=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()),a.then(()=>{const f=Oc(),p=new Hn;return Object.assign(p,f),p})}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,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(()=>{const f=vc(),p=new Hn;return Object.assign(p,f),p})}}async countTokens(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Xu(this.apiClient,e);return u=I("{model}:countTokens",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=Hc(this.apiClient,f),m=new Jn;return Object.assign(m,p),m})}else{const c=nu(this.apiClient,e);return u=I("{model}:countTokens",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=Tc(this.apiClient,f),m=new Jn;return Object.assign(m,p),m})}}async computeTokens(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI()){const u=Qu(this.apiClient,e);return l=I("{model}:computeTokens",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=Jc(this.apiClient,d),f=new Ki;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,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=ec(this.apiClient,e);return u=I("{model}:predictLongRunning",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>zc(this.apiClient,f))}else{const c=ru(this.apiClient,e);return u=I("{model}:predictLongRunning",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>Sc(this.apiClient,f))}}}/**
170
170
  * @license
171
171
  * Copyright 2025 Google LLC
172
172
  * SPDX-License-Identifier: Apache-2.0
173
- */function Td(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 Cd(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 _d(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 l=r(e,["config"]);return l!=null&&s(t,["config"],l),t}function Ed(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 l=r(e,["encoding"]);return l!=null&&s(t,["mimeType"],l),t}function Sd(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Ed(o,n)),t}function xd(o,e){const t={},n=r(e,["generatedSamples"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(u=>Sd(o,u))),s(t,["generatedVideos"],a)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const l=r(e,["raiMediaFilteredReasons"]);return l!=null&&s(t,["raiMediaFilteredReasons"],l),t}function Ad(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 l=r(e,["done"]);l!=null&&s(t,["done"],l);const a=r(e,["error"]);a!=null&&s(t,["error"],a);const u=r(e,["response","generateVideoResponse"]);return u!=null&&s(t,["response"],xd(o,u)),t}function Md(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 l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Id(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Md(o,n)),t}function Rd(o,e){const t={},n=r(e,["videos"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(u=>Id(o,u))),s(t,["generatedVideos"],a)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const l=r(e,["raiMediaFilteredReasons"]);return l!=null&&s(t,["raiMediaFilteredReasons"],l),t}function Go(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 l=r(e,["done"]);l!=null&&s(t,["done"],l);const a=r(e,["error"]);a!=null&&s(t,["error"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],Rd(o,u)),t}/**
173
+ */function Cd(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 _d(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 Ed(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 l=r(e,["config"]);return l!=null&&s(t,["config"],l),t}function Sd(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"],fe(o,i));const l=r(e,["encoding"]);return l!=null&&s(t,["mimeType"],l),t}function xd(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Sd(o,n)),t}function Ad(o,e){const t={},n=r(e,["generatedSamples"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(u=>xd(o,u))),s(t,["generatedVideos"],a)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const l=r(e,["raiMediaFilteredReasons"]);return l!=null&&s(t,["raiMediaFilteredReasons"],l),t}function Md(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 l=r(e,["done"]);l!=null&&s(t,["done"],l);const a=r(e,["error"]);a!=null&&s(t,["error"],a);const u=r(e,["response","generateVideoResponse"]);return u!=null&&s(t,["response"],Ad(o,u)),t}function Id(o,e){const t={},n=r(e,["gcsUri"]);n!=null&&s(t,["uri"],n);const i=r(e,["bytesBase64Encoded"]);i!=null&&s(t,["videoBytes"],fe(o,i));const l=r(e,["mimeType"]);return l!=null&&s(t,["mimeType"],l),t}function Rd(o,e){const t={},n=r(e,["_self"]);return n!=null&&s(t,["video"],Id(o,n)),t}function wd(o,e){const t={},n=r(e,["videos"]);if(n!=null){let a=n;Array.isArray(a)&&(a=a.map(u=>Rd(o,u))),s(t,["generatedVideos"],a)}const i=r(e,["raiMediaFilteredCount"]);i!=null&&s(t,["raiMediaFilteredCount"],i);const l=r(e,["raiMediaFilteredReasons"]);return l!=null&&s(t,["raiMediaFilteredReasons"],l),t}function Go(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 l=r(e,["done"]);l!=null&&s(t,["done"],l);const a=r(e,["error"]);a!=null&&s(t,["error"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],wd(o,u)),t}/**
174
174
  * @license
175
175
  * Copyright 2025 Google LLC
176
176
  * SPDX-License-Identifier: Apache-2.0
177
- */class wd extends Ae{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 l;return n&&"httpOptions"in n&&(l=n.httpOptions),this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:i,config:{httpOptions:l}})}else return this.getVideosOperationInternal({operationName:t.name,config:n})}async getVideosOperationInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=Cd(this.apiClient,e);return u=I("{operationName}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>Go(this.apiClient,f))}else{const c=Td(this.apiClient,e);return u=I("{operationName}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>Ad(this.apiClient,f))}}async fetchPredictVideosOperationInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI()){const u=_d(this.apiClient,e);return l=I("{resourceName}:fetchPredictOperation",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=>Go(this.apiClient,d))}else throw new Error("This method is only supported by the Vertex AI.")}}/**
177
+ */class Pd extends Ae{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 l;return n&&"httpOptions"in n&&(l=n.httpOptions),this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:i,config:{httpOptions:l}})}else return this.getVideosOperationInternal({operationName:t.name,config:n})}async getVideosOperationInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=_d(this.apiClient,e);return u=I("{operationName}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>Go(this.apiClient,f))}else{const c=Cd(this.apiClient,e);return u=I("{operationName}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>Md(this.apiClient,f))}}async fetchPredictVideosOperationInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI()){const u=Ed(this.apiClient,e);return l=I("{resourceName}:fetchPredictOperation",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=>Go(this.apiClient,d))}else throw new Error("This method is only supported by the Vertex AI.")}}/**
178
178
  * @license
179
179
  * Copyright 2025 Google LLC
180
180
  * SPDX-License-Identifier: Apache-2.0
181
- */function Pd(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function Bo(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Pd(o,n)),t}function Nd(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"],Bo(o,i)),t}function kd(o,e){const t={},n=r(e,["speakerVoiceConfigs"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>Nd(o,l))),s(t,["speakerVoiceConfigs"],i)}return t}function Dd(o,e){const t={},n=r(e,["voiceConfig"]);n!=null&&s(t,["voiceConfig"],Bo(o,n));const i=r(e,["multiSpeakerVoiceConfig"]);i!=null&&s(t,["multiSpeakerVoiceConfig"],kd(o,i));const l=r(e,["languageCode"]);return l!=null&&s(t,["languageCode"],l),t}function Ld(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function Vd(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 Fd(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 Ud(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Ld(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],Vd(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Fd(o,a));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 bd(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>Ud(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Gd(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 l=r(e,["name"]);l!=null&&s(t,["name"],l);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function Bd(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 qd(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],Bd(o,n)),t}function $d(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 Od(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],$d(o,n)),t}function Hd(){return{}}function Jd(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>Gd(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"],qd(o,i));const l=r(e,["googleSearchRetrieval"]);if(l!=null&&s(t,["googleSearchRetrieval"],Od(o,l)),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"],Hd());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function Wd(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 qo(){return{}}function Yd(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 l=r(e,["endOfSpeechSensitivity"]);l!=null&&s(t,["endOfSpeechSensitivity"],l);const a=r(e,["prefixPaddingMs"]);a!=null&&s(t,["prefixPaddingMs"],a);const u=r(e,["silenceDurationMs"]);return u!=null&&s(t,["silenceDurationMs"],u),t}function Zd(o,e){const t={},n=r(e,["automaticActivityDetection"]);n!=null&&s(t,["automaticActivityDetection"],Yd(o,n));const i=r(e,["activityHandling"]);i!=null&&s(t,["activityHandling"],i);const l=r(e,["turnCoverage"]);return l!=null&&s(t,["turnCoverage"],l),t}function zd(o,e){const t={},n=r(e,["targetTokens"]);return n!=null&&s(t,["targetTokens"],n),t}function Kd(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"],zd(o,i)),t}function Xd(o,e){const t={},n=r(e,["proactiveAudio"]);return n!=null&&s(t,["proactiveAudio"],n),t}function Qd(o,e,t){const n={},i=r(e,["generationConfig"]);t!==void 0&&i!=null&&s(t,["setup","generationConfig"],i);const l=r(e,["responseModalities"]);t!==void 0&&l!=null&&s(t,["setup","generationConfig","responseModalities"],l);const a=r(e,["temperature"]);t!==void 0&&a!=null&&s(t,["setup","generationConfig","temperature"],a);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"],Dd(o,Ct(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"],bd(o,K(o,g)));const v=r(e,["tools"]);if(t!==void 0&&v!=null){let V=Be(o,v);Array.isArray(V)&&(V=V.map(B=>Jd(o,Ge(o,B)))),s(t,["setup","tools"],V)}const E=r(e,["sessionResumption"]);t!==void 0&&E!=null&&s(t,["setup","sessionResumption"],Wd(o,E));const M=r(e,["inputAudioTranscription"]);t!==void 0&&M!=null&&s(t,["setup","inputAudioTranscription"],qo());const _=r(e,["outputAudioTranscription"]);t!==void 0&&_!=null&&s(t,["setup","outputAudioTranscription"],qo());const A=r(e,["realtimeInputConfig"]);t!==void 0&&A!=null&&s(t,["setup","realtimeInputConfig"],Zd(o,A));const R=r(e,["contextWindowCompression"]);t!==void 0&&R!=null&&s(t,["setup","contextWindowCompression"],Kd(o,R));const k=r(e,["proactivity"]);return t!==void 0&&k!=null&&s(t,["setup","proactivity"],Xd(o,k)),n}function jd(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"],Qd(o,i,t)),t}function ef(o,e,t){const n={},i=r(e,["expireTime"]);t!==void 0&&i!=null&&s(t,["expireTime"],i);const l=r(e,["newSessionExpireTime"]);t!==void 0&&l!=null&&s(t,["newSessionExpireTime"],l);const a=r(e,["uses"]);t!==void 0&&a!=null&&s(t,["uses"],a);const u=r(e,["liveConnectConstraints"]);t!==void 0&&u!=null&&s(t,["bidiGenerateContentSetup"],jd(o,u));const d=r(e,["lockAdditionalFields"]);return t!==void 0&&d!=null&&s(t,["fieldMask"],d),n}function tf(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],ef(o,n,t)),t}function nf(o,e){const t={},n=r(e,["name"]);return n!=null&&s(t,["name"],n),t}/**
181
+ */function Nd(o,e){const t={},n=r(e,["voiceName"]);return n!=null&&s(t,["voiceName"],n),t}function Bo(o,e){const t={},n=r(e,["prebuiltVoiceConfig"]);return n!=null&&s(t,["prebuiltVoiceConfig"],Nd(o,n)),t}function kd(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"],Bo(o,i)),t}function Dd(o,e){const t={},n=r(e,["speakerVoiceConfigs"]);if(n!=null){let i=n;Array.isArray(i)&&(i=i.map(l=>kd(o,l))),s(t,["speakerVoiceConfigs"],i)}return t}function Ld(o,e){const t={},n=r(e,["voiceConfig"]);n!=null&&s(t,["voiceConfig"],Bo(o,n));const i=r(e,["multiSpeakerVoiceConfig"]);i!=null&&s(t,["multiSpeakerVoiceConfig"],Dd(o,i));const l=r(e,["languageCode"]);return l!=null&&s(t,["languageCode"],l),t}function Vd(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 l=r(e,["startOffset"]);return l!=null&&s(t,["startOffset"],l),t}function Fd(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 Ud(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 bd(o,e){const t={},n=r(e,["videoMetadata"]);n!=null&&s(t,["videoMetadata"],Vd(o,n));const i=r(e,["thought"]);i!=null&&s(t,["thought"],i);const l=r(e,["inlineData"]);l!=null&&s(t,["inlineData"],Fd(o,l));const a=r(e,["fileData"]);a!=null&&s(t,["fileData"],Ud(o,a));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 Gd(o,e){const t={},n=r(e,["parts"]);if(n!=null){let l=n;Array.isArray(l)&&(l=l.map(a=>bd(o,a))),s(t,["parts"],l)}const i=r(e,["role"]);return i!=null&&s(t,["role"],i),t}function Bd(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 l=r(e,["name"]);l!=null&&s(t,["name"],l);const a=r(e,["parameters"]);a!=null&&s(t,["parameters"],a);const u=r(e,["response"]);return u!=null&&s(t,["response"],u),t}function qd(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 $d(o,e){const t={},n=r(e,["timeRangeFilter"]);return n!=null&&s(t,["timeRangeFilter"],qd(o,n)),t}function Od(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 Hd(o,e){const t={},n=r(e,["dynamicRetrievalConfig"]);return n!=null&&s(t,["dynamicRetrievalConfig"],Od(o,n)),t}function Jd(){return{}}function Wd(o,e){const t={},n=r(e,["functionDeclarations"]);if(n!=null){let d=n;Array.isArray(d)&&(d=d.map(c=>Bd(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"],$d(o,i));const l=r(e,["googleSearchRetrieval"]);if(l!=null&&s(t,["googleSearchRetrieval"],Hd(o,l)),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"],Jd());const u=r(e,["codeExecution"]);return u!=null&&s(t,["codeExecution"],u),t}function Yd(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 qo(){return{}}function Zd(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 l=r(e,["endOfSpeechSensitivity"]);l!=null&&s(t,["endOfSpeechSensitivity"],l);const a=r(e,["prefixPaddingMs"]);a!=null&&s(t,["prefixPaddingMs"],a);const u=r(e,["silenceDurationMs"]);return u!=null&&s(t,["silenceDurationMs"],u),t}function zd(o,e){const t={},n=r(e,["automaticActivityDetection"]);n!=null&&s(t,["automaticActivityDetection"],Zd(o,n));const i=r(e,["activityHandling"]);i!=null&&s(t,["activityHandling"],i);const l=r(e,["turnCoverage"]);return l!=null&&s(t,["turnCoverage"],l),t}function Kd(o,e){const t={},n=r(e,["targetTokens"]);return n!=null&&s(t,["targetTokens"],n),t}function Xd(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"],Kd(o,i)),t}function Qd(o,e){const t={},n=r(e,["proactiveAudio"]);return n!=null&&s(t,["proactiveAudio"],n),t}function jd(o,e,t){const n={},i=r(e,["generationConfig"]);t!==void 0&&i!=null&&s(t,["setup","generationConfig"],i);const l=r(e,["responseModalities"]);t!==void 0&&l!=null&&s(t,["setup","generationConfig","responseModalities"],l);const a=r(e,["temperature"]);t!==void 0&&a!=null&&s(t,["setup","generationConfig","temperature"],a);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"],Ld(o,Ct(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"],Gd(o,K(o,g)));const v=r(e,["tools"]);if(t!==void 0&&v!=null){let V=Be(o,v);Array.isArray(V)&&(V=V.map(B=>Wd(o,Ge(o,B)))),s(t,["setup","tools"],V)}const E=r(e,["sessionResumption"]);t!==void 0&&E!=null&&s(t,["setup","sessionResumption"],Yd(o,E));const M=r(e,["inputAudioTranscription"]);t!==void 0&&M!=null&&s(t,["setup","inputAudioTranscription"],qo());const _=r(e,["outputAudioTranscription"]);t!==void 0&&_!=null&&s(t,["setup","outputAudioTranscription"],qo());const A=r(e,["realtimeInputConfig"]);t!==void 0&&A!=null&&s(t,["setup","realtimeInputConfig"],zd(o,A));const R=r(e,["contextWindowCompression"]);t!==void 0&&R!=null&&s(t,["setup","contextWindowCompression"],Xd(o,R));const k=r(e,["proactivity"]);return t!==void 0&&k!=null&&s(t,["setup","proactivity"],Qd(o,k)),n}function ef(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"],jd(o,i,t)),t}function tf(o,e,t){const n={},i=r(e,["expireTime"]);t!==void 0&&i!=null&&s(t,["expireTime"],i);const l=r(e,["newSessionExpireTime"]);t!==void 0&&l!=null&&s(t,["newSessionExpireTime"],l);const a=r(e,["uses"]);t!==void 0&&a!=null&&s(t,["uses"],a);const u=r(e,["liveConnectConstraints"]);t!==void 0&&u!=null&&s(t,["bidiGenerateContentSetup"],ef(o,u));const d=r(e,["lockAdditionalFields"]);return t!==void 0&&d!=null&&s(t,["fieldMask"],d),n}function nf(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],tf(o,n,t)),t}function of(o,e){const t={},n=r(e,["name"]);return n!=null&&s(t,["name"],n),t}/**
182
182
  * @license
183
183
  * Copyright 2025 Google LLC
184
184
  * SPDX-License-Identifier: Apache-2.0
185
- */function of(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(l=>`${t}.${l}`);e.push(...i)}else e.push(t)}return e.join(",")}function rf(o,e){let t=null;const n=o.bidiGenerateContentSetup;if(typeof n=="object"&&n!==null&&"setup"in n){const l=n.setup;typeof l=="object"&&l!==null?(o.bidiGenerateContentSetup=l,t=l):delete o.bidiGenerateContentSetup}else n!==void 0&&delete o.bidiGenerateContentSetup;const i=o.fieldMask;if(t){const l=of(t);if(Array.isArray(e==null?void 0:e.lockAdditionalFields)&&(e==null?void 0:e.lockAdditionalFields.length)===0)l?o.fieldMask=l:delete o.fieldMask;else if(e!=null&&e.lockAdditionalFields&&e.lockAdditionalFields.length>0&&i!==null&&Array.isArray(i)&&i.length>0){const a=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let u=[];i.length>0&&(u=i.map(c=>a.includes(c)?`generationConfig.${c}`:c));const d=[];l&&d.push(l),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 sf extends Ae{constructor(e){super(),this.apiClient=e}async create(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const u=tf(this.apiClient,e);l=I("auth_tokens",u._url),a=u._query,delete u.config,delete u._url,delete u._query;const d=rf(u,e.config);return i=this.apiClient.request({path:l,queryParams:a,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=>nf(this.apiClient,c))}}}/**
185
+ */function rf(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(l=>`${t}.${l}`);e.push(...i)}else e.push(t)}return e.join(",")}function sf(o,e){let t=null;const n=o.bidiGenerateContentSetup;if(typeof n=="object"&&n!==null&&"setup"in n){const l=n.setup;typeof l=="object"&&l!==null?(o.bidiGenerateContentSetup=l,t=l):delete o.bidiGenerateContentSetup}else n!==void 0&&delete o.bidiGenerateContentSetup;const i=o.fieldMask;if(t){const l=rf(t);if(Array.isArray(e==null?void 0:e.lockAdditionalFields)&&(e==null?void 0:e.lockAdditionalFields.length)===0)l?o.fieldMask=l:delete o.fieldMask;else if(e!=null&&e.lockAdditionalFields&&e.lockAdditionalFields.length>0&&i!==null&&Array.isArray(i)&&i.length>0){const a=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let u=[];i.length>0&&(u=i.map(c=>a.includes(c)?`generationConfig.${c}`:c));const d=[];l&&d.push(l),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 lf extends Ae{constructor(e){super(),this.apiClient=e}async create(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const u=nf(this.apiClient,e);l=I("auth_tokens",u._url),a=u._query,delete u.config,delete u._url,delete u._query;const d=sf(u,e.config);return i=this.apiClient.request({path:l,queryParams:a,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=>of(this.apiClient,c))}}}/**
186
186
  * @license
187
187
  * Copyright 2025 Google LLC
188
188
  * SPDX-License-Identifier: Apache-2.0
189
- */function lf(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 af(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);t!==void 0&&l!=null&&s(t,["_query","pageToken"],l);const a=r(e,["filter"]);return t!==void 0&&a!=null&&s(t,["_query","filter"],a),n}function uf(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],af(o,n,t)),t}function cf(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 df(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(l=>cf(o,l))),s(t,["examples","examples"],i)}return t}function ff(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 l=r(e,["epochCount"]);t!==void 0&&l!=null&&s(t,["tuningTask","hyperparameters","epochCount"],l);const a=r(e,["learningRateMultiplier"]);if(a!=null&&s(n,["tuningTask","hyperparameters","learningRateMultiplier"],a),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 pf(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"],df(o,i));const l=r(e,["config"]);return l!=null&&s(t,["config"],ff(o,l,t)),t}function mf(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 hf(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);t!==void 0&&l!=null&&s(t,["_query","pageToken"],l);const a=r(e,["filter"]);return t!==void 0&&a!=null&&s(t,["_query","filter"],a),n}function gf(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],hf(o,n,t)),t}function yf(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 vf(o,e){const t={},n=r(e,["gcsUri"]);return n!=null&&s(t,["validationDatasetUri"],n),t}function Tf(o,e,t){const n={},i=r(e,["validationDataset"]);t!==void 0&&i!=null&&s(t,["supervisedTuningSpec"],vf(o,i));const l=r(e,["tunedModelDisplayName"]);t!==void 0&&l!=null&&s(t,["tunedModelDisplayName"],l);const a=r(e,["description"]);t!==void 0&&a!=null&&s(t,["description"],a);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 Cf(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"],yf(o,i,t));const l=r(e,["config"]);return l!=null&&s(t,["config"],Tf(o,l,t)),t}function _f(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 $o(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["state"]);i!=null&&s(t,["state"],io(o,i));const l=r(e,["createTime"]);l!=null&&s(t,["createTime"],l);const a=r(e,["tuningTask","startTime"]);a!=null&&s(t,["startTime"],a);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"],_f(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 E=r(e,["serviceAccount"]);E!=null&&s(t,["serviceAccount"],E);const M=r(e,["tunedModelDisplayName"]);return M!=null&&s(t,["tunedModelDisplayName"],M),t}function Ef(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["tunedModels"]);if(i!=null){let l=i;Array.isArray(l)&&(l=l.map(a=>$o(o,a))),s(t,["tuningJobs"],l)}return t}function Sf(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 l=r(e,["done"]);l!=null&&s(t,["done"],l);const a=r(e,["error"]);return a!=null&&s(t,["error"],a),t}function xf(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 l=r(e,["step"]);l!=null&&s(t,["step"],l);const a=r(e,["endpoint"]);return a!=null&&s(t,["endpoint"],a),t}function Af(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 l=r(e,["checkpoints"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(u=>xf(o,u))),s(t,["checkpoints"],a)}return t}function Nt(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["state"]);i!=null&&s(t,["state"],io(o,i));const l=r(e,["createTime"]);l!=null&&s(t,["createTime"],l);const a=r(e,["startTime"]);a!=null&&s(t,["startTime"],a);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"],Af(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 E=r(e,["partnerModelTuningSpec"]);E!=null&&s(t,["partnerModelTuningSpec"],E);const M=r(e,["distillationSpec"]);M!=null&&s(t,["distillationSpec"],M);const _=r(e,["experiment"]);_!=null&&s(t,["experiment"],_);const A=r(e,["labels"]);A!=null&&s(t,["labels"],A);const R=r(e,["pipelineJob"]);R!=null&&s(t,["pipelineJob"],R);const k=r(e,["serviceAccount"]);k!=null&&s(t,["serviceAccount"],k);const V=r(e,["tunedModelDisplayName"]);return V!=null&&s(t,["tunedModelDisplayName"],V),t}function Mf(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["tuningJobs"]);if(i!=null){let l=i;Array.isArray(l)&&(l=l.map(a=>Nt(o,a))),s(t,["tuningJobs"],l)}return t}/**
189
+ */function af(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 uf(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);t!==void 0&&l!=null&&s(t,["_query","pageToken"],l);const a=r(e,["filter"]);return t!==void 0&&a!=null&&s(t,["_query","filter"],a),n}function cf(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],uf(o,n,t)),t}function df(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 ff(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(l=>df(o,l))),s(t,["examples","examples"],i)}return t}function pf(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 l=r(e,["epochCount"]);t!==void 0&&l!=null&&s(t,["tuningTask","hyperparameters","epochCount"],l);const a=r(e,["learningRateMultiplier"]);if(a!=null&&s(n,["tuningTask","hyperparameters","learningRateMultiplier"],a),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 mf(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"],ff(o,i));const l=r(e,["config"]);return l!=null&&s(t,["config"],pf(o,l,t)),t}function hf(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 gf(o,e,t){const n={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&s(t,["_query","pageSize"],i);const l=r(e,["pageToken"]);t!==void 0&&l!=null&&s(t,["_query","pageToken"],l);const a=r(e,["filter"]);return t!==void 0&&a!=null&&s(t,["_query","filter"],a),n}function yf(o,e){const t={},n=r(e,["config"]);return n!=null&&s(t,["config"],gf(o,n,t)),t}function vf(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 Tf(o,e){const t={},n=r(e,["gcsUri"]);return n!=null&&s(t,["validationDatasetUri"],n),t}function Cf(o,e,t){const n={},i=r(e,["validationDataset"]);t!==void 0&&i!=null&&s(t,["supervisedTuningSpec"],Tf(o,i));const l=r(e,["tunedModelDisplayName"]);t!==void 0&&l!=null&&s(t,["tunedModelDisplayName"],l);const a=r(e,["description"]);t!==void 0&&a!=null&&s(t,["description"],a);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 _f(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"],vf(o,i,t));const l=r(e,["config"]);return l!=null&&s(t,["config"],Cf(o,l,t)),t}function Ef(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 $o(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["state"]);i!=null&&s(t,["state"],io(o,i));const l=r(e,["createTime"]);l!=null&&s(t,["createTime"],l);const a=r(e,["tuningTask","startTime"]);a!=null&&s(t,["startTime"],a);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"],Ef(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 E=r(e,["serviceAccount"]);E!=null&&s(t,["serviceAccount"],E);const M=r(e,["tunedModelDisplayName"]);return M!=null&&s(t,["tunedModelDisplayName"],M),t}function Sf(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["tunedModels"]);if(i!=null){let l=i;Array.isArray(l)&&(l=l.map(a=>$o(o,a))),s(t,["tuningJobs"],l)}return t}function xf(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 l=r(e,["done"]);l!=null&&s(t,["done"],l);const a=r(e,["error"]);return a!=null&&s(t,["error"],a),t}function Af(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 l=r(e,["step"]);l!=null&&s(t,["step"],l);const a=r(e,["endpoint"]);return a!=null&&s(t,["endpoint"],a),t}function Mf(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 l=r(e,["checkpoints"]);if(l!=null){let a=l;Array.isArray(a)&&(a=a.map(u=>Af(o,u))),s(t,["checkpoints"],a)}return t}function Nt(o,e){const t={},n=r(e,["name"]);n!=null&&s(t,["name"],n);const i=r(e,["state"]);i!=null&&s(t,["state"],io(o,i));const l=r(e,["createTime"]);l!=null&&s(t,["createTime"],l);const a=r(e,["startTime"]);a!=null&&s(t,["startTime"],a);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"],Mf(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 E=r(e,["partnerModelTuningSpec"]);E!=null&&s(t,["partnerModelTuningSpec"],E);const M=r(e,["distillationSpec"]);M!=null&&s(t,["distillationSpec"],M);const _=r(e,["experiment"]);_!=null&&s(t,["experiment"],_);const A=r(e,["labels"]);A!=null&&s(t,["labels"],A);const R=r(e,["pipelineJob"]);R!=null&&s(t,["pipelineJob"],R);const k=r(e,["serviceAccount"]);k!=null&&s(t,["serviceAccount"],k);const V=r(e,["tunedModelDisplayName"]);return V!=null&&s(t,["tunedModelDisplayName"],V),t}function If(o,e){const t={},n=r(e,["nextPageToken"]);n!=null&&s(t,["nextPageToken"],n);const i=r(e,["tuningJobs"]);if(i!=null){let l=i;Array.isArray(l)&&(l=l.map(a=>Nt(o,a))),s(t,["tuningJobs"],l)}return t}/**
190
190
  * @license
191
191
  * Copyright 2025 Google LLC
192
192
  * SPDX-License-Identifier: Apache-2.0
193
- */class If extends Ae{constructor(e){super(),this.apiClient=e,this.get=async t=>await this.getInternal(t),this.list=async(t={})=>new nt(Re.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:yt.JOB_STATE_QUEUED}}}}async getInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=mf(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>Nt(this.apiClient,f))}else{const c=lf(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>$o(this.apiClient,f))}}async listInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=gf(this.apiClient,e);return u=I("tuningJobs",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=Mf(this.apiClient,f),m=new Wn;return Object.assign(m,p),m})}else{const c=uf(this.apiClient,e);return u=I("tunedModels",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=Ef(this.apiClient,f),m=new Wn;return Object.assign(m,p),m})}}async tuneInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI()){const u=Cf(this.apiClient,e);return l=I("tuningJobs",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=>Nt(this.apiClient,d))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=pf(this.apiClient,e);return l=I("tunedModels",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=>Sf(this.apiClient,d))}}}/**
193
+ */class Rf extends Ae{constructor(e){super(),this.apiClient=e,this.get=async t=>await this.getInternal(t),this.list=async(t={})=>new nt(Re.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:yt.JOB_STATE_QUEUED}}}}async getInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=hf(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>Nt(this.apiClient,f))}else{const c=af(this.apiClient,e);return u=I("{name}",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>$o(this.apiClient,f))}}async listInternal(e){var t,n,i,l;let a,u="",d={};if(this.apiClient.isVertexAI()){const c=yf(this.apiClient,e);return u=I("tuningJobs",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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()),a.then(f=>{const p=If(this.apiClient,f),m=new Wn;return Object.assign(m,p),m})}else{const c=cf(this.apiClient,e);return u=I("tunedModels",c._url),d=c._query,delete c.config,delete c._url,delete c._query,a=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:(l=e.config)===null||l===void 0?void 0:l.abortSignal}).then(f=>f.json()),a.then(f=>{const p=Sf(this.apiClient,f),m=new Wn;return Object.assign(m,p),m})}}async tuneInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI()){const u=_f(this.apiClient,e);return l=I("tuningJobs",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=>Nt(this.apiClient,d))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(e){var t,n;let i,l="",a={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const u=mf(this.apiClient,e);return l=I("tunedModels",u._url),a=u._query,delete u.config,delete u._url,delete u._query,i=this.apiClient.request({path:l,queryParams:a,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=>xf(this.apiClient,d))}}}/**
194
194
  * @license
195
195
  * Copyright 2025 Google LLC
196
196
  * SPDX-License-Identifier: Apache-2.0
197
- */class Rf{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 wf=1024*1024*8,Pf=3,Nf=1e3,kf=2,kt="x-goog-upload-status";async function Df(o,e,t){var n,i,l;let a=0,u=0,d=new vt(new Response),c="upload";for(a=o.size;u<a;){const p=Math.min(wf,a-u),m=o.slice(u,u+p);u+p>=a&&(c+=", finalize");let h=0,g=Nf;for(;h<Pf&&(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[kt]));)h++,await Vf(g),g=g*kf;if(u+=p,((i=d==null?void 0:d.headers)===null||i===void 0?void 0:i[kt])!=="active")break;if(a<=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(((l=d==null?void 0:d.headers)===null||l===void 0?void 0:l[kt])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return f.file}async function Lf(o){return{size:o.size,type:o.type}}function Vf(o){return new Promise(e=>setTimeout(e,o))}class Ff{async upload(e,t,n){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await Df(e,t,n)}async stat(e){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await Lf(e)}}/**
197
+ */class wf{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 Pf=1024*1024*8,Nf=3,kf=1e3,Df=2,kt="x-goog-upload-status";async function Lf(o,e,t){var n,i,l;let a=0,u=0,d=new vt(new Response),c="upload";for(a=o.size;u<a;){const p=Math.min(Pf,a-u),m=o.slice(u,u+p);u+p>=a&&(c+=", finalize");let h=0,g=kf;for(;h<Nf&&(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[kt]));)h++,await Ff(g),g=g*Df;if(u+=p,((i=d==null?void 0:d.headers)===null||i===void 0?void 0:i[kt])!=="active")break;if(a<=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(((l=d==null?void 0:d.headers)===null||l===void 0?void 0:l[kt])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return f.file}async function Vf(o){return{size:o.size,type:o.type}}function Ff(o){return new Promise(e=>setTimeout(e,o))}class Uf{async upload(e,t,n){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await Lf(e,t,n)}async stat(e){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await Vf(e)}}/**
198
198
  * @license
199
199
  * Copyright 2025 Google LLC
200
200
  * SPDX-License-Identifier: Apache-2.0
201
- */class Uf{create(e,t,n){return new bf(e,t,n)}}class bf{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()}}/**
201
+ */class bf{create(e,t,n){return new Gf(e,t,n)}}class Gf{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()}}/**
202
202
  * @license
203
203
  * Copyright 2025 Google LLC
204
204
  * SPDX-License-Identifier: Apache-2.0
205
- */const Oo="x-goog-api-key";class Gf{constructor(e){this.apiKey=e}async addAuthHeaders(e){if(e.get(Oo)===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(Oo,this.apiKey)}}}/**
205
+ */const Oo="x-goog-api-key";class Bf{constructor(e){this.apiKey=e}async addAuthHeaders(e){if(e.get(Oo)===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(Oo,this.apiKey)}}}/**
206
206
  * @license
207
207
  * Copyright 2025 Google LLC
208
208
  * SPDX-License-Identifier: Apache-2.0
209
- */const Bf="gl-node/";class qf{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=Wi(e,void 0,void 0);n&&(e.httpOptions?e.httpOptions.baseUrl=n:e.httpOptions={baseUrl:n}),this.apiVersion=e.apiVersion;const i=new Gf(this.apiKey);this.apiClient=new td({auth:i,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:e.httpOptions,userAgentExtra:Bf+"web",uploader:new Ff,downloader:new Rf}),this.models=new vd(this.apiClient),this.live=new pd(this.apiClient,i,new Uf),this.chats=new vs(this.models,this.apiClient),this.caches=new hs(this.apiClient),this.files=new Ns(this.apiClient),this.operations=new wd(this.apiClient),this.authTokens=new sf(this.apiClient),this.tunings=new If(this.apiClient)}}const Ho=`<?xml version="1.0" encoding="UTF-8"?>
209
+ */const qf="gl-node/";class $f{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=Yi(e,void 0,void 0);n&&(e.httpOptions?e.httpOptions.baseUrl=n:e.httpOptions={baseUrl:n}),this.apiVersion=e.apiVersion;const i=new Bf(this.apiKey);this.apiClient=new nd({auth:i,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:e.httpOptions,userAgentExtra:qf+"web",uploader:new Uf,downloader:new wf}),this.models=new Td(this.apiClient),this.live=new md(this.apiClient,i,new bf),this.chats=new Ts(this.models,this.apiClient),this.caches=new gs(this.apiClient),this.files=new ks(this.apiClient),this.operations=new Pd(this.apiClient),this.authTokens=new lf(this.apiClient),this.tunings=new Rf(this.apiClient)}}const Ho=`<?xml version="1.0" encoding="UTF-8"?>
210
210
  <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">
211
211
  <bpmn:process id="Process_1" isExecutable="false">
212
212
  <bpmn:startEvent id="StartEvent_1" name="Start" />
@@ -218,4 +218,4 @@ React keys must be passed directly to JSX without using spread:
218
218
  </bpmndi:BPMNShape>
219
219
  </bpmndi:BPMNPlane>
220
220
  </bpmndi:BPMNDiagram>
221
- </bpmn:definitions>`,$f=({initialXml:o=Ho,onSave:e,onBack:t,title:n="Flow Designer",geminiApiKey:i})=>{const l=Z.useRef(null),a=Z.useRef(null),[u,d]=Z.useState(!0),[c,f]=Z.useState(""),[p,m]=Z.useState(!1),[h,g]=Z.useState("");Z.useEffect(()=>{const A=setTimeout(async()=>{if(l.current){a.current&&a.current.destroy(),a.current=new BpmnJS({container:l.current,keyboard:{}});try{await a.current.importXML(o)}catch(R){console.error("Error importing BPMN XML",R)}}},50);return()=>{clearTimeout(A),a.current&&(a.current.destroy(),a.current=null)}},[o]);const v=async()=>{if(a.current)try{const{xml:_}=await a.current.saveXML({format:!0});e&&e(_);const A=new Blob([_],{type:"application/xml"}),R=document.createElement("a");R.href=URL.createObjectURL(A),R.download="process-design.bpmn",R.click()}catch(_){console.error("Error exporting BPMN",_)}},E=async()=>{const _=i||"PLACEHOLDER_API_KEY";if(!(!c.trim()||!a.current||!_)){m(!0),g("Drafting flow...");try{let k=(await new qf({apiKey:_}).models.generateContent({model:"gemini-3-flash-preview",contents:`Generate a valid BPMN 2.0 XML based on this description: "${c}". Return ONLY the raw XML code without markdown blocks.`})).text||"";k=k.replace(/^```xml\n/,"").replace(/\n```$/,"").trim(),k.includes("<bpmn:definitions")?(await a.current.importXML(k),g("Import successful!"),f("")):g("Generated invalid XML. Try again.")}catch(A){console.error("AI Generation error",A),g("Generation failed.")}finally{m(!1),setTimeout(()=>g(""),3e3)}}},M=(_,A)=>{if(!a.current)return;const R=a.current.get("elementFactory"),k=a.current.get("create");let V=R.createShape({type:A});V&&k.start(_,V)};return w.jsxs("div",{className:"flex h-screen w-full bg-white overflow-hidden text-slate-800 font-sans border border-slate-200 rounded-lg",children:[w.jsxs("div",{className:`${u?"w-80":"w-0"} transition-all duration-300 border-r border-slate-200 bg-slate-50 flex flex-col relative z-20 shadow-xl overflow-hidden`,children:[u&&w.jsxs("div",{className:"flex-1 flex flex-col p-6 overflow-y-auto w-80",children:[w.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[t&&w.jsx("button",{onClick:t,className:"p-2 hover:bg-slate-200 rounded-lg transition-colors mr-1 text-slate-600 cursor-pointer",children:w.jsx(ni,{size:18})}),w.jsx("h1",{className:"font-bold text-lg tracking-tight text-slate-900 truncate",children:n})]}),w.jsxs("div",{className:"space-y-6",children:[w.jsxs("section",{children:[w.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-slate-400 mb-4",children:"Tools"}),w.jsx("div",{className:"grid grid-cols-1 gap-2",children:[{type:"bpmn:StartEvent",icon:w.jsx(ri,{size:18}),label:"Start Event",color:"bg-green-50 text-green-600"},{type:"bpmn:Task",icon:w.jsx(ui,{size:18}),label:"User Task",color:"bg-slate-100 text-slate-600"},{type:"bpmn:IntermediateCatchEvent",icon:w.jsx(li,{size:18}),label:"Message Catch",color:"bg-blue-50 text-blue-600"},{type:"bpmn:EndEvent",icon:w.jsx(ii,{size:18}),label:"End Event",color:"bg-red-50 text-red-600"}].map(_=>w.jsxs("div",{onMouseDown:A=>M(A,_.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 active:scale-95",children:[w.jsx("div",{className:`p-2 rounded-lg ${_.color}`,children:_.icon}),w.jsx("span",{className:"text-sm font-medium",children:_.label})]},_.type))})]}),w.jsx("hr",{className:"border-slate-200"}),w.jsxs("section",{children:[w.jsxs("label",{className:"block text-xs font-bold uppercase tracking-wider text-slate-400 mb-3 flex items-center gap-2",children:[w.jsx(Bt,{className:"w-3 h-3 text-indigo-500"}),"AI Architect"]}),w.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:"Describe your business process...",value:c,onChange:_=>f(_.target.value)}),w.jsxs("button",{onClick:E,disabled:p||!c.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:[p?w.jsx(ai,{className:"animate-spin",size:16}):w.jsx(Bt,{size:16}),p?"Processing...":"Generate Diagram"]}),h&&w.jsx("p",{className:"mt-2 text-[10px] text-center font-bold text-indigo-600",children:h})]}),w.jsx("section",{className:"mt-auto space-y-3 pt-6 border-t border-slate-200",children:w.jsxs("button",{onClick:()=>{var _;return(_=a.current)==null?void 0:_.importXML(Ho)},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:[w.jsx(ci,{size:14})," Reset Canvas"]})})]})]}),w.jsx("button",{onClick:()=>d(!u),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 focus:outline-none",children:u?w.jsx(oi,{size:20}):w.jsx(Gt,{size:20})})]}),w.jsxs("div",{className:"flex-1 relative flex flex-col min-w-0",children:[w.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:[w.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[w.jsx("span",{className:"text-slate-400",children:"Project"}),w.jsx(Gt,{size:12,className:"text-slate-300"}),w.jsx("span",{className:"text-slate-900 font-bold",children:n})]}),w.jsx("div",{className:"flex gap-2",children:w.jsxs("button",{onClick:v,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:[w.jsx(si,{size:14})," Save & Export"]})})]}),w.jsxs("div",{className:"flex-1 relative overflow-hidden bg-white",children:[w.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(#e5e7eb_1px,transparent_1px)] [background-size:24px_24px] pointer-events-none opacity-40"}),w.jsx("div",{ref:l,className:"h-full w-full bpmn-io-style relative"})]})]})]})},Of=()=>w.jsx($f,{title:"Sample Process Design",onSave:o=>console.log("Saved XML:",o)});fe.BPMNFlowDesigner=Of,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})}));
221
+ </bpmn:definitions>`,Of=({initialXml:o=Ho,onSave:e,onBack:t,title:n="Flow Designer",geminiApiKey:i})=>{const l=Z.useRef(null),a=Z.useRef(null),[u,d]=Z.useState(!0),[c,f]=Z.useState(""),[p,m]=Z.useState(!1),[h,g]=Z.useState("");Z.useEffect(()=>{const A=setTimeout(async()=>{if(l.current){a.current&&a.current.destroy(),a.current=new BpmnJS({container:l.current,keyboard:{}});try{await a.current.importXML(o)}catch(R){console.error("Error importing BPMN XML",R)}}},50);return()=>{clearTimeout(A),a.current&&(a.current.destroy(),a.current=null)}},[o]);const v=async()=>{if(a.current)try{const{xml:_}=await a.current.saveXML({format:!0});e&&e(_);const A=new Blob([_],{type:"application/xml"}),R=document.createElement("a");R.href=URL.createObjectURL(A),R.download="process-design.bpmn",R.click()}catch(_){console.error("Error exporting BPMN",_)}},E=async()=>{const _=i||"PLACEHOLDER_API_KEY";if(!(!c.trim()||!a.current||!_)){m(!0),g("Drafting flow...");try{let k=(await new $f({apiKey:_}).models.generateContent({model:"gemini-3-flash-preview",contents:`Generate a valid BPMN 2.0 XML based on this description: "${c}". Return ONLY the raw XML code without markdown blocks.`})).text||"";k=k.replace(/^```xml\n/,"").replace(/\n```$/,"").trim(),k.includes("<bpmn:definitions")?(await a.current.importXML(k),g("Import successful!"),f("")):g("Generated invalid XML. Try again.")}catch(A){console.error("AI Generation error",A),g("Generation failed.")}finally{m(!1),setTimeout(()=>g(""),3e3)}}},M=(_,A)=>{if(!a.current)return;const R=a.current.get("elementFactory"),k=a.current.get("create");let V=R.createShape({type:A});V&&k.start(_,V)};return w.jsxs("div",{className:"flex h-screen w-full bg-white overflow-hidden text-slate-800 font-sans border border-slate-200 rounded-lg",children:[w.jsxs("div",{className:`${u?"w-80":"w-0"} transition-all duration-300 border-r border-slate-200 bg-slate-50 flex flex-col relative z-20 shadow-xl overflow-hidden`,children:[u&&w.jsxs("div",{className:"flex-1 flex flex-col p-6 overflow-y-auto w-80",children:[w.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[t&&w.jsx("button",{onClick:t,className:"p-2 hover:bg-slate-200 rounded-lg transition-colors mr-1 text-slate-600 cursor-pointer",children:w.jsx(oi,{size:18})}),w.jsx("h1",{className:"font-bold text-lg tracking-tight text-slate-900 truncate",children:n})]}),w.jsxs("div",{className:"space-y-6",children:[w.jsxs("section",{children:[w.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-slate-400 mb-4",children:"Tools"}),w.jsx("div",{className:"grid grid-cols-1 gap-2",children:[{type:"bpmn:StartEvent",icon:w.jsx(si,{size:18}),label:"Start Event",color:"bg-green-50 text-green-600"},{type:"bpmn:Task",icon:w.jsx(ci,{size:18}),label:"User Task",color:"bg-slate-100 text-slate-600"},{type:"bpmn:IntermediateCatchEvent",icon:w.jsx(ai,{size:18}),label:"Message Catch",color:"bg-blue-50 text-blue-600"},{type:"bpmn:EndEvent",icon:w.jsx(ri,{size:18}),label:"End Event",color:"bg-red-50 text-red-600"}].map(_=>w.jsxs("div",{onMouseDown:A=>M(A,_.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 active:scale-95",children:[w.jsx("div",{className:`p-2 rounded-lg ${_.color}`,children:_.icon}),w.jsx("span",{className:"text-sm font-medium",children:_.label})]},_.type))})]}),w.jsx("hr",{className:"border-slate-200"}),w.jsxs("section",{children:[w.jsxs("label",{className:"block text-xs font-bold uppercase tracking-wider text-slate-400 mb-3 flex items-center gap-2",children:[w.jsx(Bt,{className:"w-3 h-3 text-indigo-500"}),"AI Architect"]}),w.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:"Describe your business process...",value:c,onChange:_=>f(_.target.value)}),w.jsxs("button",{onClick:E,disabled:p||!c.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:[p?w.jsx(ui,{className:"animate-spin",size:16}):w.jsx(Bt,{size:16}),p?"Processing...":"Generate Diagram"]}),h&&w.jsx("p",{className:"mt-2 text-[10px] text-center font-bold text-indigo-600",children:h})]}),w.jsx("section",{className:"mt-auto space-y-3 pt-6 border-t border-slate-200",children:w.jsxs("button",{onClick:()=>{var _;return(_=a.current)==null?void 0:_.importXML(Ho)},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:[w.jsx(di,{size:14})," Reset Canvas"]})})]})]}),w.jsx("button",{onClick:()=>d(!u),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 focus:outline-none",children:u?w.jsx(ii,{size:20}):w.jsx(Gt,{size:20})})]}),w.jsxs("div",{className:"flex-1 relative flex flex-col min-w-0",children:[w.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:[w.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[w.jsx("span",{className:"text-slate-400",children:"Project"}),w.jsx(Gt,{size:12,className:"text-slate-300"}),w.jsx("span",{className:"text-slate-900 font-bold",children:n})]}),w.jsx("div",{className:"flex gap-2",children:w.jsxs("button",{onClick:v,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:[w.jsx(li,{size:14})," Save & Export"]})})]}),w.jsxs("div",{className:"flex-1 relative overflow-hidden bg-white",children:[w.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(#e5e7eb_1px,transparent_1px)] [background-size:24px_24px] pointer-events-none opacity-40"}),w.jsx("div",{ref:l,className:"h-full w-full bpmn-io-style relative"})]})]})]})},Jo=()=>w.jsx(Of,{title:"Sample Process Design",onSave:o=>console.log("Saved XML:",o)});le.BPMNFlowDesigner=Jo,le.default=Jo,Object.defineProperties(le,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));