(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const f of r)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&a(p)}).observe(document,{childList:!0,subtree:!0});function o(r){const f={};return r.integrity&&(f.integrity=r.integrity),r.referrerPolicy&&(f.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?f.credentials="include":r.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(r){if(r.ep)return;r.ep=!0;const f=o(r);fetch(r.href,f)}})();function sc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var wu={exports:{}},pl={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var gh;function Mv(){if(gh)return pl;gh=1;var i=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(a,r,f){var p=null;if(f!==void 0&&(p=""+f),r.key!==void 0&&(p=""+r.key),"key"in r){f={};for(var g in r)g!=="key"&&(f[g]=r[g])}else f=r;return r=f.ref,{$$typeof:i,type:a,key:p,ref:r!==void 0?r:null,props:f}}return pl.Fragment=t,pl.jsx=o,pl.jsxs=o,pl}var yh;function Iv(){return yh||(yh=1,wu.exports=Mv()),wu.exports}var C=Iv(),bu={exports:{}},ue={};/** * @license React * react.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var vh;function wv(){if(vh)return ue;vh=1;var i=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),p=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),E=Symbol.iterator;function A(N){return N===null||typeof N!="object"?null:(N=E&&N[E]||N["@@iterator"],typeof N=="function"?N:null)}var I={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,U={};function P(N,O,K){this.props=N,this.context=O,this.refs=U,this.updater=K||I}P.prototype.isReactComponent={},P.prototype.setState=function(N,O){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,O,"setState")},P.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function Q(){}Q.prototype=P.prototype;function F(N,O,K){this.props=N,this.context=O,this.refs=U,this.updater=K||I}var J=F.prototype=new Q;J.constructor=F,H(J,P.prototype),J.isPureReactComponent=!0;var ee=Array.isArray;function B(){}var X={H:null,A:null,T:null,S:null},me=Object.prototype.hasOwnProperty;function W(N,O,K){var j=K.ref;return{$$typeof:i,type:N,key:O,ref:j!==void 0?j:null,props:K}}function de(N,O){return W(N.type,O,N.props)}function ce(N){return typeof N=="object"&&N!==null&&N.$$typeof===i}function Re(N){var O={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(K){return O[K]})}var qe=/\/+/g;function we(N,O){return typeof N=="object"&&N!==null&&N.key!=null?Re(""+N.key):O.toString(36)}function Xe(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(B,B):(N.status="pending",N.then(function(O){N.status==="pending"&&(N.status="fulfilled",N.value=O)},function(O){N.status==="pending"&&(N.status="rejected",N.reason=O)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function z(N,O,K,j,le){var pe=typeof N;(pe==="undefined"||pe==="boolean")&&(N=null);var xe=!1;if(N===null)xe=!0;else switch(pe){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(N.$$typeof){case i:case t:xe=!0;break;case v:return xe=N._init,z(xe(N._payload),O,K,j,le)}}if(xe)return le=le(N),xe=j===""?"."+we(N,0):j,ee(le)?(K="",xe!=null&&(K=xe.replace(qe,"$&/")+"/"),z(le,O,K,"",function(Kt){return Kt})):le!=null&&(ce(le)&&(le=de(le,K+(le.key==null||N&&N.key===le.key?"":(""+le.key).replace(qe,"$&/")+"/")+xe)),O.push(le)),1;xe=0;var st=j===""?".":j+":";if(ee(N))for(var Fe=0;Fe>>1,Se=z[ve];if(0>>1;ver(K,ne))jr(le,K)?(z[ve]=le,z[j]=ne,ve=j):(z[ve]=K,z[O]=ne,ve=O);else if(jr(le,ne))z[ve]=le,z[j]=ne,ve=j;else break e}}return Y}function r(z,Y){var ne=z.sortIndex-Y.sortIndex;return ne!==0?ne:z.id-Y.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var p=Date,g=p.now();i.unstable_now=function(){return p.now()-g}}var y=[],m=[],v=1,_=null,E=3,A=!1,I=!1,H=!1,U=!1,P=typeof setTimeout=="function"?setTimeout:null,Q=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function J(z){for(var Y=o(m);Y!==null;){if(Y.callback===null)a(m);else if(Y.startTime<=z)a(m),Y.sortIndex=Y.expirationTime,t(y,Y);else break;Y=o(m)}}function ee(z){if(H=!1,J(z),!I)if(o(y)!==null)I=!0,B||(B=!0,Re());else{var Y=o(m);Y!==null&&Xe(ee,Y.startTime-z)}}var B=!1,X=-1,me=5,W=-1;function de(){return U?!0:!(i.unstable_now()-Wz&&de());){var ve=_.callback;if(typeof ve=="function"){_.callback=null,E=_.priorityLevel;var Se=ve(_.expirationTime<=z);if(z=i.unstable_now(),typeof Se=="function"){_.callback=Se,J(z),Y=!0;break t}_===o(y)&&a(y),J(z)}else a(y);_=o(y)}if(_!==null)Y=!0;else{var N=o(m);N!==null&&Xe(ee,N.startTime-z),Y=!1}}break e}finally{_=null,E=ne,A=!1}Y=void 0}}finally{Y?Re():B=!1}}}var Re;if(typeof F=="function")Re=function(){F(ce)};else if(typeof MessageChannel<"u"){var qe=new MessageChannel,we=qe.port2;qe.port1.onmessage=ce,Re=function(){we.postMessage(null)}}else Re=function(){P(ce,0)};function Xe(z,Y){X=P(function(){z(i.unstable_now())},Y)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(z){z.callback=null},i.unstable_forceFrameRate=function(z){0>z||125ve?(z.sortIndex=ne,t(m,z),o(y)===null&&z===o(m)&&(H?(Q(X),X=-1):H=!0,Xe(ee,ne-ve))):(z.sortIndex=Se,t(y,z),I||A||(I=!0,B||(B=!0,Re()))),z},i.unstable_shouldYield=de,i.unstable_wrapCallback=function(z){var Y=E;return function(){var ne=E;E=Y;try{return z.apply(this,arguments)}finally{E=ne}}}})(Lu)),Lu}var Eh;function Dv(){return Eh||(Eh=1,Uu.exports=bv()),Uu.exports}var Gu={exports:{}},ht={};/** * @license React * react-dom.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Sh;function Uv(){if(Sh)return ht;Sh=1;var i=rc();function t(y){var m="https://react.dev/errors/"+y;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),Gu.exports=Uv(),Gu.exports}/** * @license React * react-dom-client.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ah;function Gv(){if(Ah)return hl;Ah=1;var i=Dv(),t=rc(),o=Lv();function a(e){var n="https://react.dev/errors/"+e;if(1Se||(e.current=ve[Se],ve[Se]=null,Se--)}function K(e,n){Se++,ve[Se]=e.current,e.current=n}var j=N(null),le=N(null),pe=N(null),xe=N(null);function st(e,n){switch(K(pe,n),K(le,e),K(j,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Vp(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Vp(n),e=qp(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}O(j),K(j,e)}function Fe(){O(j),O(le),O(pe)}function Kt(e){e.memoizedState!==null&&K(xe,e);var n=j.current,l=qp(n,e.type);n!==l&&(K(le,e),K(j,l))}function jn(e){le.current===e&&(O(j),O(le)),xe.current===e&&(O(xe),ul._currentValue=ne)}var ei,vo;function en(e){if(ei===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);ei=n&&n[1]||"",vo=-1)":-1d||x[s]!==b[d]){var k=` `+x[s].replace(" at new "," at ");return e.displayName&&k.includes("")&&(k=k.replace("",e.displayName)),k}while(1<=s&&0<=d);break}}}finally{ti=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?en(l):""}function El(e,n){switch(e.tag){case 26:case 27:case 5:return en(e.type);case 16:return en("Lazy");case 13:return e.child!==n&&n!==null?en("Suspense Fallback"):en("Suspense");case 19:return en("SuspenseList");case 0:case 15:return Rt(e.type,!1);case 11:return Rt(e.type.render,!1);case 1:return Rt(e.type,!0);case 31:return en("Activity");default:return""}}function Sl(e){try{var n="",l=null;do n+=El(e,l),l=e,e=e.return;while(e);return n}catch(s){return` Error generating stack: `+s.message+` `+s.stack}}var To=Object.prototype.hasOwnProperty,_o=i.unstable_scheduleCallback,Si=i.unstable_cancelCallback,gs=i.unstable_shouldYield,Cl=i.unstable_requestPaint,pt=i.unstable_now,ys=i.unstable_getCurrentPriorityLevel,Al=i.unstable_ImmediatePriority,xl=i.unstable_UserBlockingPriority,Ci=i.unstable_NormalPriority,Rl=i.unstable_LowPriority,G=i.unstable_IdlePriority,ae=i.log,re=i.unstable_setDisableYieldValue,ze=null,Ve=null;function Nt(e){if(typeof ae=="function"&&re(e),Ve&&typeof Ve.setStrictMode=="function")try{Ve.setStrictMode(ze,e)}catch{}}var $e=Math.clz32?Math.clz32:Eo,Nl=Math.log,Ml=Math.LN2;function Eo(e){return e>>>=0,e===0?32:31-(Nl(e)/Ml|0)|0}var Nn=256,Il=262144,wl=4194304;function ni(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function bl(e,n,l){var s=e.pendingLanes;if(s===0)return 0;var d=0,h=e.suspendedLanes,T=e.pingedLanes;e=e.warmLanes;var S=s&134217727;return S!==0?(s=S&~h,s!==0?d=ni(s):(T&=S,T!==0?d=ni(T):l||(l=S&~e,l!==0&&(d=ni(l))))):(S=s&~h,S!==0?d=ni(S):T!==0?d=ni(T):l||(l=s&~e,l!==0&&(d=ni(l)))),d===0?0:n!==0&&n!==d&&(n&h)===0&&(h=d&-d,l=n&-n,h>=l||h===32&&(l&4194048)!==0)?n:d}function So(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function my(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Tc(){var e=wl;return wl<<=1,(wl&62914560)===0&&(wl=4194304),e}function vs(e){for(var n=[],l=0;31>l;l++)n.push(e);return n}function Co(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function gy(e,n,l,s,d,h){var T=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var S=e.entanglements,x=e.expirationTimes,b=e.hiddenUpdates;for(l=T&~l;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Sy=/[\n"\\]/g;function zt(e){return e.replace(Sy,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function As(e,n,l,s,d,h,T,S){e.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?e.type=T:e.removeAttribute("type"),n!=null?T==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Ht(n)):e.value!==""+Ht(n)&&(e.value=""+Ht(n)):T!=="submit"&&T!=="reset"||e.removeAttribute("value"),n!=null?xs(e,T,Ht(n)):l!=null?xs(e,T,Ht(l)):s!=null&&e.removeAttribute("value"),d==null&&h!=null&&(e.defaultChecked=!!h),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+Ht(S):e.removeAttribute("name")}function Dc(e,n,l,s,d,h,T,S){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||l!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){Cs(e);return}l=l!=null?""+Ht(l):"",n=n!=null?""+Ht(n):l,S||n===e.value||(e.value=n),e.defaultValue=n}s=s??d,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=S?e.checked:!!s,e.defaultChecked=!!s,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(e.name=T),Cs(e)}function xs(e,n,l){n==="number"&&Ll(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Ii(e,n,l,s){if(e=e.options,n){n={};for(var d=0;d"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ws=!1;if(rn)try{var No={};Object.defineProperty(No,"passive",{get:function(){ws=!0}}),window.addEventListener("test",No,No),window.removeEventListener("test",No,No)}catch{ws=!1}var In=null,bs=null,Hl=null;function Vc(){if(Hl)return Hl;var e,n=bs,l=n.length,s,d="value"in In?In.value:In.textContent,h=d.length;for(e=0;e=wo),Yc=" ",Jc=!1;function Kc(e,n){switch(e){case"keyup":return Zy.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ui=!1;function Wy(e,n){switch(e){case"compositionend":return Xc(n);case"keypress":return n.which!==32?null:(Jc=!0,Yc);case"textInput":return e=n.data,e===Yc&&Jc?null:e;default:return null}}function jy(e,n){if(Ui)return e==="compositionend"||!Hs&&Kc(e,n)?(e=Vc(),Hl=bs=In=null,Ui=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:l,offset:n-e};e=s}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=nf(l)}}function lf(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?lf(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function af(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Ll(e.document);n instanceof e.HTMLIFrameElement;){try{var l=typeof n.contentWindow.location.href=="string"}catch{l=!1}if(l)e=n.contentWindow;else break;n=Ll(e.document)}return n}function Vs(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var s0=rn&&"documentMode"in document&&11>=document.documentMode,Li=null,qs=null,Lo=null,Os=!1;function sf(e,n,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Os||Li==null||Li!==Ll(s)||(s=Li,"selectionStart"in s&&Vs(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Lo&&Uo(Lo,s)||(Lo=s,s=Ia(qs,"onSelect"),0>=T,d-=T,tn=1<<32-$e(n)+d|l<he?(_e=te,te=null):_e=te.sibling;var Me=D(M,te,w[he],V);if(Me===null){te===null&&(te=_e);break}e&&te&&Me.alternate===null&&n(M,te),R=h(Me,R,he),Ne===null?ie=Me:Ne.sibling=Me,Ne=Me,te=_e}if(he===w.length)return l(M,te),Ce&&cn(M,he),ie;if(te===null){for(;hehe?(_e=te,te=null):_e=te.sibling;var $n=D(M,te,Me.value,V);if($n===null){te===null&&(te=_e);break}e&&te&&$n.alternate===null&&n(M,te),R=h($n,R,he),Ne===null?ie=$n:Ne.sibling=$n,Ne=$n,te=_e}if(Me.done)return l(M,te),Ce&&cn(M,he),ie;if(te===null){for(;!Me.done;he++,Me=w.next())Me=q(M,Me.value,V),Me!==null&&(R=h(Me,R,he),Ne===null?ie=Me:Ne.sibling=Me,Ne=Me);return Ce&&cn(M,he),ie}for(te=s(te);!Me.done;he++,Me=w.next())Me=L(te,M,he,Me.value,V),Me!==null&&(e&&Me.alternate!==null&&te.delete(Me.key===null?he:Me.key),R=h(Me,R,he),Ne===null?ie=Me:Ne.sibling=Me,Ne=Me);return e&&te.forEach(function(Nv){return n(M,Nv)}),Ce&&cn(M,he),ie}function He(M,R,w,V){if(typeof w=="object"&&w!==null&&w.type===H&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case A:e:{for(var ie=w.key;R!==null;){if(R.key===ie){if(ie=w.type,ie===H){if(R.tag===7){l(M,R.sibling),V=d(R,w.props.children),V.return=M,M=V;break e}}else if(R.elementType===ie||typeof ie=="object"&&ie!==null&&ie.$$typeof===me&&pi(ie)===R.type){l(M,R.sibling),V=d(R,w.props),qo(V,w),V.return=M,M=V;break e}l(M,R);break}else n(M,R);R=R.sibling}w.type===H?(V=ri(w.props.children,M.mode,V,w.key),V.return=M,M=V):(V=Jl(w.type,w.key,w.props,null,M.mode,V),qo(V,w),V.return=M,M=V)}return T(M);case I:e:{for(ie=w.key;R!==null;){if(R.key===ie)if(R.tag===4&&R.stateNode.containerInfo===w.containerInfo&&R.stateNode.implementation===w.implementation){l(M,R.sibling),V=d(R,w.children||[]),V.return=M,M=V;break e}else{l(M,R);break}else n(M,R);R=R.sibling}V=Xs(w,M.mode,V),V.return=M,M=V}return T(M);case me:return w=pi(w),He(M,R,w,V)}if(Xe(w))return $(M,R,w,V);if(Re(w)){if(ie=Re(w),typeof ie!="function")throw Error(a(150));return w=ie.call(w),oe(M,R,w,V)}if(typeof w.then=="function")return He(M,R,jl(w),V);if(w.$$typeof===F)return He(M,R,Ql(M,w),V);ea(M,w)}return typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint"?(w=""+w,R!==null&&R.tag===6?(l(M,R.sibling),V=d(R,w),V.return=M,M=V):(l(M,R),V=Ks(w,M.mode,V),V.return=M,M=V),T(M)):l(M,R)}return function(M,R,w,V){try{Vo=0;var ie=He(M,R,w,V);return Yi=null,ie}catch(te){if(te===Fi||te===$l)throw te;var Ne=It(29,te,null,M.mode);return Ne.lanes=V,Ne.return=M,Ne}finally{}}}var mi=wf(!0),bf=wf(!1),Ln=!1;function ar(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sr(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Gn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Hn(e,n,l){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(be&2)!==0){var d=s.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),s.pending=n,n=Yl(e),hf(e,null,l),n}return Fl(e,s,n,l),Yl(e)}function Oo(e,n,l){if(n=n.updateQueue,n!==null&&(n=n.shared,(l&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,l|=s,n.lanes=l,Ec(e,l)}}function rr(e,n){var l=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var d=null,h=null;if(l=l.firstBaseUpdate,l!==null){do{var T={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};h===null?d=h=T:h=h.next=T,l=l.next}while(l!==null);h===null?d=h=n:h=h.next=n}else d=h=n;l={baseState:s.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:s.shared,callbacks:s.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=n:e.next=n,l.lastBaseUpdate=n}var ur=!1;function Bo(){if(ur){var e=Pi;if(e!==null)throw e}}function Po(e,n,l,s){ur=!1;var d=e.updateQueue;Ln=!1;var h=d.firstBaseUpdate,T=d.lastBaseUpdate,S=d.shared.pending;if(S!==null){d.shared.pending=null;var x=S,b=x.next;x.next=null,T===null?h=b:T.next=b,T=x;var k=e.alternate;k!==null&&(k=k.updateQueue,S=k.lastBaseUpdate,S!==T&&(S===null?k.firstBaseUpdate=b:S.next=b,k.lastBaseUpdate=x))}if(h!==null){var q=d.baseState;T=0,k=b=x=null,S=h;do{var D=S.lane&-536870913,L=D!==S.lane;if(L?(Te&D)===D:(s&D)===D){D!==0&&D===Bi&&(ur=!0),k!==null&&(k=k.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var $=e,oe=S;D=n;var He=l;switch(oe.tag){case 1:if($=oe.payload,typeof $=="function"){q=$.call(He,q,D);break e}q=$;break e;case 3:$.flags=$.flags&-65537|128;case 0:if($=oe.payload,D=typeof $=="function"?$.call(He,q,D):$,D==null)break e;q=_({},q,D);break e;case 2:Ln=!0}}D=S.callback,D!==null&&(e.flags|=64,L&&(e.flags|=8192),L=d.callbacks,L===null?d.callbacks=[D]:L.push(D))}else L={lane:D,tag:S.tag,payload:S.payload,callback:S.callback,next:null},k===null?(b=k=L,x=q):k=k.next=L,T|=D;if(S=S.next,S===null){if(S=d.shared.pending,S===null)break;L=S,S=L.next,L.next=null,d.lastBaseUpdate=L,d.shared.pending=null}}while(!0);k===null&&(x=q),d.baseState=x,d.firstBaseUpdate=b,d.lastBaseUpdate=k,h===null&&(d.shared.lanes=0),On|=T,e.lanes=T,e.memoizedState=q}}function Df(e,n){if(typeof e!="function")throw Error(a(191,e));e.call(n)}function Uf(e,n){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;eh?h:8;var T=z.T,S={};z.T=S,Mr(e,!1,n,l);try{var x=d(),b=z.S;if(b!==null&&b(S,x),x!==null&&typeof x=="object"&&typeof x.then=="function"){var k=g0(x,s);Jo(e,n,k,Lt(e))}else Jo(e,n,s,Lt(e))}catch(q){Jo(e,n,{then:function(){},status:"rejected",reason:q},Lt())}finally{Y.p=h,T!==null&&S.types!==null&&(T.types=S.types),z.T=T}}function S0(){}function Rr(e,n,l,s){if(e.tag!==5)throw Error(a(476));var d=fd(e).queue;cd(e,d,n,ne,l===null?S0:function(){return dd(e),l(s)})}function fd(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hn,lastRenderedState:ne},next:null};var l={};return n.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hn,lastRenderedState:l},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function dd(e){var n=fd(e);n.next===null&&(n=e.alternate.memoizedState),Jo(e,n.next.queue,{},Lt())}function Nr(){return ct(ul)}function pd(){return Ze().memoizedState}function hd(){return Ze().memoizedState}function C0(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var l=Lt();e=Gn(l);var s=Hn(n,e,l);s!==null&&(At(s,n,l),Oo(s,n,l)),n={cache:nr()},e.payload=n;return}n=n.return}}function A0(e,n,l){var s=Lt();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ca(e)?gd(n,l):(l=Ys(e,n,l,s),l!==null&&(At(l,e,s),yd(l,n,s)))}function md(e,n,l){var s=Lt();Jo(e,n,l,s)}function Jo(e,n,l,s){var d={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ca(e))gd(n,d);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var T=n.lastRenderedState,S=h(T,l);if(d.hasEagerState=!0,d.eagerState=S,Mt(S,T))return Fl(e,n,d,0),ke===null&&Pl(),!1}catch{}finally{}if(l=Ys(e,n,d,s),l!==null)return At(l,e,s),yd(l,n,s),!0}return!1}function Mr(e,n,l,s){if(s={lane:2,revertLane:au(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},ca(e)){if(n)throw Error(a(479))}else n=Ys(e,l,s,2),n!==null&&At(n,e,2)}function ca(e){var n=e.alternate;return e===fe||n!==null&&n===fe}function gd(e,n){Ki=ia=!0;var l=e.pending;l===null?n.next=n:(n.next=l.next,l.next=n),e.pending=n}function yd(e,n,l){if((l&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,l|=s,n.lanes=l,Ec(e,l)}}var Ko={readContext:ct,use:aa,useCallback:Je,useContext:Je,useEffect:Je,useImperativeHandle:Je,useLayoutEffect:Je,useInsertionEffect:Je,useMemo:Je,useReducer:Je,useRef:Je,useState:Je,useDebugValue:Je,useDeferredValue:Je,useTransition:Je,useSyncExternalStore:Je,useId:Je,useHostTransitionStatus:Je,useFormState:Je,useActionState:Je,useOptimistic:Je,useMemoCache:Je,useCacheRefresh:Je};Ko.useEffectEvent=Je;var vd={readContext:ct,use:aa,useCallback:function(e,n){return mt().memoizedState=[e,n===void 0?null:n],e},useContext:ct,useEffect:td,useImperativeHandle:function(e,n,l){l=l!=null?l.concat([e]):null,ra(4194308,4,ld.bind(null,n,e),l)},useLayoutEffect:function(e,n){return ra(4194308,4,e,n)},useInsertionEffect:function(e,n){ra(4,2,e,n)},useMemo:function(e,n){var l=mt();n=n===void 0?null:n;var s=e();if(gi){Nt(!0);try{e()}finally{Nt(!1)}}return l.memoizedState=[s,n],s},useReducer:function(e,n,l){var s=mt();if(l!==void 0){var d=l(n);if(gi){Nt(!0);try{l(n)}finally{Nt(!1)}}}else d=n;return s.memoizedState=s.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},s.queue=e,e=e.dispatch=A0.bind(null,fe,e),[s.memoizedState,e]},useRef:function(e){var n=mt();return e={current:e},n.memoizedState=e},useState:function(e){e=Er(e);var n=e.queue,l=md.bind(null,fe,n);return n.dispatch=l,[e.memoizedState,l]},useDebugValue:Ar,useDeferredValue:function(e,n){var l=mt();return xr(l,e,n)},useTransition:function(){var e=Er(!1);return e=cd.bind(null,fe,e.queue,!0,!1),mt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,l){var s=fe,d=mt();if(Ce){if(l===void 0)throw Error(a(407));l=l()}else{if(l=n(),ke===null)throw Error(a(349));(Te&127)!==0||Vf(s,n,l)}d.memoizedState=l;var h={value:l,getSnapshot:n};return d.queue=h,td(Of.bind(null,s,h,e),[e]),s.flags|=2048,Qi(9,{destroy:void 0},qf.bind(null,s,h,l,n),null),l},useId:function(){var e=mt(),n=ke.identifierPrefix;if(Ce){var l=nn,s=tn;l=(s&~(1<<32-$e(s)-1)).toString(32)+l,n="_"+n+"R_"+l,l=oa++,0<\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof s.is=="string"?T.createElement("select",{is:s.is}):T.createElement("select"),s.multiple?h.multiple=!0:s.size&&(h.size=s.size);break;default:h=typeof s.is=="string"?T.createElement(d,{is:s.is}):T.createElement(d)}}h[rt]=n,h[vt]=s;e:for(T=n.child;T!==null;){if(T.tag===5||T.tag===6)h.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===n)break e;for(;T.sibling===null;){if(T.return===null||T.return===n)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}n.stateNode=h;e:switch(dt(h,d,s),d){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&gn(n)}}return Be(n),Br(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,l),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&gn(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(a(166));if(e=pe.current,qi(n)){if(e=n.stateNode,l=n.memoizedProps,s=null,d=ut,d!==null)switch(d.tag){case 27:case 5:s=d.memoizedProps}e[rt]=n,e=!!(e.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||zp(e.nodeValue,l)),e||Dn(n,!0)}else e=wa(e).createTextNode(s),e[rt]=n,n.stateNode=e}return Be(n),null;case 31:if(l=n.memoizedState,e===null||e.memoizedState!==null){if(s=qi(n),l!==null){if(e===null){if(!s)throw Error(a(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[rt]=n}else ui(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Be(n),e=!1}else l=Ws(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return n.flags&256?(bt(n),n):(bt(n),null);if((n.flags&128)!==0)throw Error(a(558))}return Be(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=qi(n),s!==null&&s.dehydrated!==null){if(e===null){if(!d)throw Error(a(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(a(317));d[rt]=n}else ui(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Be(n),d=!1}else d=Ws(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(bt(n),n):(bt(n),null)}return bt(n),(n.flags&128)!==0?(n.lanes=l,n):(l=s!==null,e=e!==null&&e.memoizedState!==null,l&&(s=n.child,d=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(d=s.alternate.memoizedState.cachePool.pool),h=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(h=s.memoizedState.cachePool.pool),h!==d&&(s.flags|=2048)),l!==e&&l&&(n.child.flags|=8192),ma(n,n.updateQueue),Be(n),null);case 4:return Fe(),e===null&&cu(n.stateNode.containerInfo),Be(n),null;case 10:return dn(n.type),Be(n),null;case 19:if(O(Qe),s=n.memoizedState,s===null)return Be(n),null;if(d=(n.flags&128)!==0,h=s.rendering,h===null)if(d)Qo(s,!1);else{if(Ke!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=na(e),h!==null){for(n.flags|=128,Qo(s,!1),e=h.updateQueue,n.updateQueue=e,ma(n,e),n.subtreeFlags=0,e=l,l=n.child;l!==null;)mf(l,e),l=l.sibling;return K(Qe,Qe.current&1|2),Ce&&cn(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&pt()>_a&&(n.flags|=128,d=!0,Qo(s,!1),n.lanes=4194304)}else{if(!d)if(e=na(h),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,ma(n,e),Qo(s,!0),s.tail===null&&s.tailMode==="hidden"&&!h.alternate&&!Ce)return Be(n),null}else 2*pt()-s.renderingStartTime>_a&&l!==536870912&&(n.flags|=128,d=!0,Qo(s,!1),n.lanes=4194304);s.isBackwards?(h.sibling=n.child,n.child=h):(e=s.last,e!==null?e.sibling=h:n.child=h,s.last=h)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=pt(),e.sibling=null,l=Qe.current,K(Qe,d?l&1|2:l&1),Ce&&cn(n,s.treeForkCount),e):(Be(n),null);case 22:case 23:return bt(n),fr(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(l&536870912)!==0&&(n.flags&128)===0&&(Be(n),n.subtreeFlags&6&&(n.flags|=8192)):Be(n),l=n.updateQueue,l!==null&&ma(n,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==l&&(n.flags|=2048),e!==null&&O(di),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),dn(We),Be(n),null;case 25:return null;case 30:return null}throw Error(a(156,n.tag))}function I0(e,n){switch(Zs(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return dn(We),Fe(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return jn(n),null;case 31:if(n.memoizedState!==null){if(bt(n),n.alternate===null)throw Error(a(340));ui()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(bt(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(a(340));ui()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return O(Qe),null;case 4:return Fe(),null;case 10:return dn(n.type),null;case 22:case 23:return bt(n),fr(),e!==null&&O(di),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return dn(We),null;case 25:return null;default:return null}}function Bd(e,n){switch(Zs(n),n.tag){case 3:dn(We),Fe();break;case 26:case 27:case 5:jn(n);break;case 4:Fe();break;case 31:n.memoizedState!==null&&bt(n);break;case 13:bt(n);break;case 19:O(Qe);break;case 10:dn(n.type);break;case 22:case 23:bt(n),fr(),e!==null&&O(di);break;case 24:dn(We)}}function Zo(e,n){try{var l=n.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var d=s.next;l=d;do{if((l.tag&e)===e){s=void 0;var h=l.create,T=l.inst;s=h(),T.destroy=s}l=l.next}while(l!==d)}}catch(S){Ue(n,n.return,S)}}function Vn(e,n,l){try{var s=n.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var h=d.next;s=h;do{if((s.tag&e)===e){var T=s.inst,S=T.destroy;if(S!==void 0){T.destroy=void 0,d=n;var x=l,b=S;try{b()}catch(k){Ue(d,x,k)}}}s=s.next}while(s!==h)}}catch(k){Ue(n,n.return,k)}}function Pd(e){var n=e.updateQueue;if(n!==null){var l=e.stateNode;try{Uf(n,l)}catch(s){Ue(e,e.return,s)}}}function Fd(e,n,l){l.props=yi(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(s){Ue(e,n,s)}}function $o(e,n){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof l=="function"?e.refCleanup=l(s):l.current=s}}catch(d){Ue(e,n,d)}}function on(e,n){var l=e.ref,s=e.refCleanup;if(l!==null)if(typeof s=="function")try{s()}catch(d){Ue(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(d){Ue(e,n,d)}else l.current=null}function Yd(e){var n=e.type,l=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":l.autoFocus&&s.focus();break e;case"img":l.src?s.src=l.src:l.srcSet&&(s.srcset=l.srcSet)}}catch(d){Ue(e,e.return,d)}}function Pr(e,n,l){try{var s=e.stateNode;$0(s,e.type,l,n),s[vt]=n}catch(d){Ue(e,e.return,d)}}function Jd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jn(e.type)||e.tag===4}function Fr(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Jn(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Yr(e,n,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,n):(n=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,n.appendChild(e),l=l._reactRootContainer,l!=null||n.onclick!==null||(n.onclick=sn));else if(s!==4&&(s===27&&Jn(e.type)&&(l=e.stateNode,n=null),e=e.child,e!==null))for(Yr(e,n,l),e=e.sibling;e!==null;)Yr(e,n,l),e=e.sibling}function ga(e,n,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?l.insertBefore(e,n):l.appendChild(e);else if(s!==4&&(s===27&&Jn(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(ga(e,n,l),e=e.sibling;e!==null;)ga(e,n,l),e=e.sibling}function Kd(e){var n=e.stateNode,l=e.memoizedProps;try{for(var s=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);dt(n,s,l),n[rt]=e,n[vt]=l}catch(h){Ue(e,e.return,h)}}var yn=!1,tt=!1,Jr=!1,Xd=typeof WeakSet=="function"?WeakSet:Set,ot=null;function w0(e,n){if(e=e.containerInfo,pu=za,e=af(e),Vs(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var s=l.getSelection&&l.getSelection();if(s&&s.rangeCount!==0){l=s.anchorNode;var d=s.anchorOffset,h=s.focusNode;s=s.focusOffset;try{l.nodeType,h.nodeType}catch{l=null;break e}var T=0,S=-1,x=-1,b=0,k=0,q=e,D=null;t:for(;;){for(var L;q!==l||d!==0&&q.nodeType!==3||(S=T+d),q!==h||s!==0&&q.nodeType!==3||(x=T+s),q.nodeType===3&&(T+=q.nodeValue.length),(L=q.firstChild)!==null;)D=q,q=L;for(;;){if(q===e)break t;if(D===l&&++b===d&&(S=T),D===h&&++k===s&&(x=T),(L=q.nextSibling)!==null)break;q=D,D=q.parentNode}q=L}l=S===-1||x===-1?null:{start:S,end:x}}else l=null}l=l||{start:0,end:0}}else l=null;for(hu={focusedElem:e,selectionRange:l},za=!1,ot=n;ot!==null;)if(n=ot,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ot=e;else for(;ot!==null;){switch(n=ot,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l title"))),dt(h,s,l),h[rt]=e,it(h),s=h;break e;case"link":var T=eh("link","href",d).get(s+(l.href||""));if(T){for(var S=0;SHe&&(T=He,He=oe,oe=T);var M=of(S,oe),R=of(S,He);if(M&&R&&(L.rangeCount!==1||L.anchorNode!==M.node||L.anchorOffset!==M.offset||L.focusNode!==R.node||L.focusOffset!==R.offset)){var w=q.createRange();w.setStart(M.node,M.offset),L.removeAllRanges(),oe>He?(L.addRange(w),L.extend(R.node,R.offset)):(w.setEnd(R.node,R.offset),L.addRange(w))}}}}for(q=[],L=S;L=L.parentNode;)L.nodeType===1&&q.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;Sl?32:l,z.T=null,l=jr,jr=null;var h=Pn,T=Sn;if(nt=0,eo=Pn=null,Sn=0,(be&6)!==0)throw Error(a(331));var S=be;if(be|=4,lp(h.current),np(h,h.current,T,l),be=S,il(0,!1),Ve&&typeof Ve.onPostCommitFiberRoot=="function")try{Ve.onPostCommitFiberRoot(ze,h)}catch{}return!0}finally{Y.p=d,z.T=s,Cp(e,n)}}function xp(e,n,l){n=Vt(l,n),n=Dr(e.stateNode,n,2),e=Hn(e,n,2),e!==null&&(Co(e,2),ln(e))}function Ue(e,n,l){if(e.tag===3)xp(e,e,l);else for(;n!==null;){if(n.tag===3){xp(n,e,l);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Bn===null||!Bn.has(s))){e=Vt(l,e),l=Rd(2),s=Hn(n,l,2),s!==null&&(Nd(l,s,n,e),Co(s,2),ln(s));break}}n=n.return}}function iu(e,n,l){var s=e.pingCache;if(s===null){s=e.pingCache=new U0;var d=new Set;s.set(n,d)}else d=s.get(n),d===void 0&&(d=new Set,s.set(n,d));d.has(l)||(Qr=!0,d.add(l),e=k0.bind(null,e,n,l),n.then(e,e))}function k0(e,n,l){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ke===e&&(Te&l)===l&&(Ke===4||Ke===3&&(Te&62914560)===Te&&300>pt()-Ta?(be&2)===0&&to(e,0):Zr|=l,ji===Te&&(ji=0)),ln(e)}function Rp(e,n){n===0&&(n=Tc()),e=si(e,n),e!==null&&(Co(e,n),ln(e))}function V0(e){var n=e.memoizedState,l=0;n!==null&&(l=n.retryLane),Rp(e,l)}function q0(e,n){var l=0;switch(e.tag){case 31:case 13:var s=e.stateNode,d=e.memoizedState;d!==null&&(l=d.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(a(314))}s!==null&&s.delete(n),Rp(e,l)}function O0(e,n){return _o(e,n)}var Ra=null,io=null,ou=!1,Na=!1,lu=!1,Yn=0;function ln(e){e!==io&&e.next===null&&(io===null?Ra=io=e:io=io.next=e),Na=!0,ou||(ou=!0,P0())}function il(e,n){if(!lu&&Na){lu=!0;do for(var l=!1,s=Ra;s!==null;){if(e!==0){var d=s.pendingLanes;if(d===0)var h=0;else{var T=s.suspendedLanes,S=s.pingedLanes;h=(1<<31-$e(42|e)+1)-1,h&=d&~(T&~S),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(l=!0,wp(s,h))}else h=Te,h=bl(s,s===ke?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(h&3)===0||So(s,h)||(l=!0,wp(s,h));s=s.next}while(l);lu=!1}}function B0(){Np()}function Np(){Na=ou=!1;var e=0;Yn!==0&&j0()&&(e=Yn);for(var n=pt(),l=null,s=Ra;s!==null;){var d=s.next,h=Mp(s,n);h===0?(s.next=null,l===null?Ra=d:l.next=d,d===null&&(io=l)):(l=s,(e!==0||(h&3)!==0)&&(Na=!0)),s=d}nt!==0&&nt!==5||il(e),Yn!==0&&(Yn=0)}function Mp(e,n){for(var l=e.suspendedLanes,s=e.pingedLanes,d=e.expirationTimes,h=e.pendingLanes&-62914561;0S)break;var k=x.transferSize,q=x.initiatorType;k&&kp(q)&&(x=x.responseEnd,T+=k*(x"u"?null:document;function Zp(e,n,l){var s=oo;if(s&&typeof n=="string"&&n){var d=zt(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof l=="string"&&(d+='[crossorigin="'+l+'"]'),Qp.has(d)||(Qp.add(d),e={rel:e,crossOrigin:l,href:n},s.querySelector(d)===null&&(n=s.createElement("link"),dt(n,"link",e),it(n),s.head.appendChild(n)))}}function rv(e){Cn.D(e),Zp("dns-prefetch",e,null)}function uv(e,n){Cn.C(e,n),Zp("preconnect",e,n)}function cv(e,n,l){Cn.L(e,n,l);var s=oo;if(s&&e&&n){var d='link[rel="preload"][as="'+zt(n)+'"]';n==="image"&&l&&l.imageSrcSet?(d+='[imagesrcset="'+zt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(d+='[imagesizes="'+zt(l.imageSizes)+'"]')):d+='[href="'+zt(e)+'"]';var h=d;switch(n){case"style":h=lo(e);break;case"script":h=ao(e)}Yt.has(h)||(e=_({rel:"preload",href:n==="image"&&l&&l.imageSrcSet?void 0:e,as:n},l),Yt.set(h,e),s.querySelector(d)!==null||n==="style"&&s.querySelector(sl(h))||n==="script"&&s.querySelector(rl(h))||(n=s.createElement("link"),dt(n,"link",e),it(n),s.head.appendChild(n)))}}function fv(e,n){Cn.m(e,n);var l=oo;if(l&&e){var s=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+zt(s)+'"][href="'+zt(e)+'"]',h=d;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=ao(e)}if(!Yt.has(h)&&(e=_({rel:"modulepreload",href:e},n),Yt.set(h,e),l.querySelector(d)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(rl(h)))return}s=l.createElement("link"),dt(s,"link",e),it(s),l.head.appendChild(s)}}}function dv(e,n,l){Cn.S(e,n,l);var s=oo;if(s&&e){var d=Ni(s).hoistableStyles,h=lo(e);n=n||"default";var T=d.get(h);if(!T){var S={loading:0,preload:null};if(T=s.querySelector(sl(h)))S.loading=5;else{e=_({rel:"stylesheet",href:e,"data-precedence":n},l),(l=Yt.get(h))&&Eu(e,l);var x=T=s.createElement("link");it(x),dt(x,"link",e),x._p=new Promise(function(b,k){x.onload=b,x.onerror=k}),x.addEventListener("load",function(){S.loading|=1}),x.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Da(T,n,s)}T={type:"stylesheet",instance:T,count:1,state:S},d.set(h,T)}}}function pv(e,n){Cn.X(e,n);var l=oo;if(l&&e){var s=Ni(l).hoistableScripts,d=ao(e),h=s.get(d);h||(h=l.querySelector(rl(d)),h||(e=_({src:e,async:!0},n),(n=Yt.get(d))&&Su(e,n),h=l.createElement("script"),it(h),dt(h,"link",e),l.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},s.set(d,h))}}function hv(e,n){Cn.M(e,n);var l=oo;if(l&&e){var s=Ni(l).hoistableScripts,d=ao(e),h=s.get(d);h||(h=l.querySelector(rl(d)),h||(e=_({src:e,async:!0,type:"module"},n),(n=Yt.get(d))&&Su(e,n),h=l.createElement("script"),it(h),dt(h,"link",e),l.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},s.set(d,h))}}function $p(e,n,l,s){var d=(d=pe.current)?ba(d):null;if(!d)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(n=lo(l.href),l=Ni(d).hoistableStyles,s=l.get(n),s||(s={type:"style",instance:null,count:0,state:null},l.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=lo(l.href);var h=Ni(d).hoistableStyles,T=h.get(e);if(T||(d=d.ownerDocument||d,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,T),(h=d.querySelector(sl(e)))&&!h._p&&(T.instance=h,T.state.loading=5),Yt.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Yt.set(e,l),h||mv(d,e,l,T.state))),n&&s===null)throw Error(a(528,""));return T}if(n&&s!==null)throw Error(a(529,""));return null;case"script":return n=l.async,l=l.src,typeof l=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ao(l),l=Ni(d).hoistableScripts,s=l.get(n),s||(s={type:"script",instance:null,count:0,state:null},l.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function lo(e){return'href="'+zt(e)+'"'}function sl(e){return'link[rel="stylesheet"]['+e+"]"}function Wp(e){return _({},e,{"data-precedence":e.precedence,precedence:null})}function mv(e,n,l,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),dt(n,"link",l),it(n),e.head.appendChild(n))}function ao(e){return'[src="'+zt(e)+'"]'}function rl(e){return"script[async]"+e}function jp(e,n,l){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+zt(l.href)+'"]');if(s)return n.instance=s,it(s),s;var d=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),it(s),dt(s,"style",d),Da(s,l.precedence,e),n.instance=s;case"stylesheet":d=lo(l.href);var h=e.querySelector(sl(d));if(h)return n.state.loading|=4,n.instance=h,it(h),h;s=Wp(l),(d=Yt.get(d))&&Eu(s,d),h=(e.ownerDocument||e).createElement("link"),it(h);var T=h;return T._p=new Promise(function(S,x){T.onload=S,T.onerror=x}),dt(h,"link",s),n.state.loading|=4,Da(h,l.precedence,e),n.instance=h;case"script":return h=ao(l.src),(d=e.querySelector(rl(h)))?(n.instance=d,it(d),d):(s=l,(d=Yt.get(h))&&(s=_({},l),Su(s,d)),e=e.ownerDocument||e,d=e.createElement("script"),it(d),dt(d,"link",s),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(a(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,Da(s,l.precedence,e));return n.instance}function Da(e,n,l){for(var s=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=s.length?s[s.length-1]:null,h=d,T=0;T title"):null)}function gv(e,n,l){if(l===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function nh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function yv(e,n,l,s){if(l.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var d=lo(s.href),h=n.querySelector(sl(d));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=La.bind(e),n.then(e,e)),l.state.loading|=4,l.instance=h,it(h);return}h=n.ownerDocument||n,s=Wp(s),(d=Yt.get(d))&&Eu(s,d),h=h.createElement("link"),it(h);var T=h;T._p=new Promise(function(S,x){T.onload=S,T.onerror=x}),dt(h,"link",s),l.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,n),(n=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=La.bind(e),n.addEventListener("load",l),n.addEventListener("error",l))}}var Cu=0;function vv(e,n){return e.stylesheets&&e.count===0&&Ha(e,e.stylesheets),0Cu?50:800)+n);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(d)}}:null}function La(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ha(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ga=null;function Ha(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ga=new Map,n.forEach(Tv,e),Ga=null,La.call(e))}function Tv(e,n){if(!(n.state.loading&4)){var l=Ga.get(e);if(l)var s=l.get(null);else{l=new Map,Ga.set(e,l);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(t){console.error(t)}}return i(),Du.exports=Gv(),Du.exports}var zv=Hv();const kv=sc(zv);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vv=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qv=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,o,a)=>a?a.toUpperCase():o.toLowerCase()),Rh=i=>{const t=qv(i);return t.charAt(0).toUpperCase()+t.slice(1)},yg=(...i)=>i.filter((t,o,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===o).join(" ").trim(),Ov=i=>{for(const t in i)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Bv={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"};/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pv=Ae.forwardRef(({color:i="currentColor",size:t=24,strokeWidth:o=2,absoluteStrokeWidth:a,className:r="",children:f,iconNode:p,...g},y)=>Ae.createElement("svg",{ref:y,...Bv,width:t,height:t,stroke:i,strokeWidth:a?Number(o)*24/Number(t):o,className:yg("lucide",r),...!f&&!Ov(g)&&{"aria-hidden":"true"},...g},[...p.map(([m,v])=>Ae.createElement(m,v)),...Array.isArray(f)?f:[f]]));/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ee=(i,t)=>{const o=Ae.forwardRef(({className:a,...r},f)=>Ae.createElement(Pv,{ref:f,iconNode:t,className:yg(`lucide-${Vv(Rh(i))}`,`lucide-${i}`,a),...r}));return o.displayName=Rh(i),o};/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fv=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Yv=Ee("archive",Fv);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jv=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Nh=Ee("arrow-left",Jv);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kv=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Fa=Ee("brain",Kv);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xv=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Qv=Ee("chevron-right",Xv);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zv=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Mh=Ee("circle-check",Zv);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $v=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Wv=Ee("clock",$v);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jv=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]],eT=Ee("cloud-off",jv);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tT=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],ja=Ee("cloud",tT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nT=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],iT=Ee("cpu",nT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oT=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],lT=Ee("eye",oT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aT=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],sT=Ee("file-text",aT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rT=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],uT=Ee("file-up",rT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cT=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],fT=Ee("file",cT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dT=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],pT=Ee("folder",dT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hT=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Hu=Ee("github",hT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],gT=Ee("globe",mT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yT=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],es=Ee("hard-drive",yT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],vg=Ee("image",vT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TT=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],_T=Ee("layout-grid",TT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ET=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],ST=Ee("list",ET);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CT=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ih=Ee("loader-circle",CT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AT=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],xT=Ee("lock",AT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RT=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],NT=Ee("mail",RT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MT=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],IT=Ee("message-square",MT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wT=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],bT=Ee("music",wT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DT=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],zu=Ee("palette",DT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],LT=Ee("search",UT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GT=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],HT=Ee("shield",GT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zT=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],kT=Ee("smartphone",zT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VT=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Ya=Ee("sparkles",VT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qT=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],OT=Ee("star",qT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BT=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],PT=Ee("trash-2",BT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FT=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],YT=Ee("user-plus",FT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JT=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],KT=Ee("user",JT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XT=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],QT=Ee("video",XT);/** * @license lucide-react v0.562.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ja=Ee("x",ZT);var Pe=(i=>(i.FOLDER="folder",i.IMAGE="image",i.VIDEO="video",i.AUDIO="audio",i.DOCUMENT="document",i.ARCHIVE="archive",i.GENERIC="generic",i))(Pe||{});const $T={A11Y_VOLUME_EJECT:"$1 has been ejected.",ALL_FILES_FILTER:"All files",ANDROID_FILES_ROOT_LABEL:"Play files",AUDIO_FILE_TYPE:"$1 audio",CANCEL_LABEL:"Cancel",CLOSE_LABEL:"Close",DATE_COLUMN_LABEL:"Date modified",DELETE_BUTTON_LABEL:"Delete",DOWNLOADS_DIRECTORY_LABEL:"Downloads",DRIVE_DIRECTORY_LABEL:"Google Drive",DRIVE_MY_DRIVE_LABEL:"My Drive",DRIVE_RECENT_COLLECTION_LABEL:"Recent",DRIVE_SHARED_WITH_ME_COLLECTION_LABEL:"Shared with me",DRIVE_OFFLINE_COLLECTION_LABEL:"Offline",EMPTY_TRASH_BUTTON_LABEL:"Empty trash now",FILES_SETTINGS_LABEL:"Files settings",FOLDER:"Folder",GENERIC_FILE_TYPE:"$1 file",IMAGE_FILE_TYPE:"$1 image",LINUX_FILES_ROOT_LABEL:"Linux files",MY_FILES_ROOT_LABEL:"My files",NAME_COLUMN_LABEL:"Name",NEW_FOLDER_BUTTON_LABEL:"New folder",OPEN_LABEL:"Open",RECENT_ROOT_LABEL:"Recent",SEARCH_TEXT_LABEL:"Search",SIZE_COLUMN_LABEL:"Size",TRASH_ROOT_LABEL:"Trash",VIDEO_FILE_TYPE:"$1 video",DRIVE_PREPARING_TO_SYNC:"Preparing to sync Drive files…",DRIVE_SINGLE_FILE_SYNCING:"Syncing 1 Drive file",BULK_PINNING_FILE_SYNC_ON:"File sync is on",FILEMANAGER_APP_NAME:"Files",GOOGLE_DRIVE_SETTINGS_LINK:"Google Drive settings",ONE_FILE_SELECTED:"1 file selected"};function ro(i){return $T[i]||i}const wh=[{id:"recent",label:ro("RECENT_ROOT_LABEL"),icon:C.jsx(Wv,{size:18}),section:"top"},{id:"starred",label:"Starred",icon:C.jsx(OT,{size:18}),section:"top"},{id:"root",label:ro("MY_FILES_ROOT_LABEL"),icon:C.jsx(es,{size:18}),section:"my_files"},{id:"drive",label:ro("DRIVE_DIRECTORY_LABEL"),icon:C.jsx(ja,{size:18}),section:"google_drive"},{id:"linux",label:ro("LINUX_FILES_ROOT_LABEL"),icon:C.jsx(iT,{size:18}),section:"my_files"},{id:"android",label:ro("ANDROID_FILES_ROOT_LABEL"),icon:C.jsx(kT,{size:18}),section:"my_files"},{id:"trash",label:ro("TRASH_ROOT_LABEL"),icon:C.jsx(PT,{size:18}),section:"trash"}],ku=(i,t=!0)=>{const o={size:20,className:t?"":"text-gray-500"};switch(i){case Pe.FOLDER:return C.jsx(pT,{...o,className:t?"text-blue-500 fill-blue-500/10":""});case Pe.IMAGE:return C.jsx(vg,{...o,className:t?"text-red-400":""});case Pe.VIDEO:return C.jsx(QT,{...o,className:t?"text-red-500":""});case Pe.AUDIO:return C.jsx(bT,{...o,className:t?"text-orange-400":""});case Pe.DOCUMENT:return C.jsx(sT,{...o,className:t?"text-blue-400":""});case Pe.ARCHIVE:return C.jsx(Yv,{...o,className:t?"text-amber-500":""});default:return C.jsx(fT,{...o})}},Vu=i=>{if(i===null)return"--";if(i===0)return"0 B";const t=1024,o=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(i)/Math.log(t));return parseFloat((i/Math.pow(t,a)).toFixed(1))+" "+o[a]};var ml={exports:{}},qu={},Ou,bh;function WT(){if(bh)return Ou;bh=1;function i(t,o){typeof o=="boolean"&&(o={forever:o}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=o||{},this._maxRetryTime=o&&o.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return Ou=i,i.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},i.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},i.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var o=new Date().getTime();if(t&&o-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var a=this._timeouts.shift();if(a===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),a=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},a),this._options.unref&&this._timer.unref(),!0},i.prototype.attempt=function(t,o){this._fn=t,o&&(o.timeout&&(this._operationTimeout=o.timeout),o.cb&&(this._operationTimeoutCb=o.cb));var a=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){a._operationTimeoutCb()},a._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},i.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},i.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},i.prototype.start=i.prototype.try,i.prototype.errors=function(){return this._errors},i.prototype.attempts=function(){return this._attempts},i.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},o=null,a=0,r=0;r=a&&(o=f,a=g)}return o},Ou}var Dh;function jT(){return Dh||(Dh=1,(function(i){var t=WT();i.operation=function(o){var a=i.timeouts(o);return new t(a,{forever:o&&(o.forever||o.retries===1/0),unref:o&&o.unref,maxRetryTime:o&&o.maxRetryTime})},i.timeouts=function(o){if(o instanceof Array)return[].concat(o);var a={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in o)a[r]=o[r];if(a.minTimeout>a.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var f=[],p=0;p{const m=y.retries-(g-1);return p.attemptNumber=g,p.retriesLeft=m,p},r=p=>t.includes(p),f=(p,g)=>new Promise((y,m)=>{g={onFailedAttempt:()=>{},retries:10,...g};const v=i.operation(g);v.attempt(async _=>{try{y(await p(_))}catch(E){if(!(E instanceof Error)){m(new TypeError(`Non-error was thrown: "${E}". You should only throw errors.`));return}if(E instanceof o)v.stop(),m(E.originalError);else if(E instanceof TypeError&&!r(E.message))v.stop(),m(E);else{a(E,_,g);try{await g.onFailedAttempt(E)}catch(A){m(A);return}v.retry(E)||m(v.mainError())}}})});return ml.exports=f,ml.exports.default=f,ml.exports.AbortError=o,ml.exports}var Tg=t_();const n_=sc(Tg);var i_={};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */let o_,l_;function a_(){return{geminiUrl:o_,vertexUrl:l_}}function s_(i,t,o,a){var r,f;if(!(i!=null&&i.baseUrl)){const p=a_();return t?(r=p.vertexUrl)!==null&&r!==void 0?r:o:(f=p.geminiUrl)!==null&&f!==void 0?f:a}return i.baseUrl}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class xn{}function Z(i,t){const o=/\{([^}]+)\}/g;return i.replace(o,(a,r)=>{if(Object.prototype.hasOwnProperty.call(t,r)){const f=t[r];return f!=null?String(f):""}else throw new Error(`Key '${r}' not found in valueMap.`)})}function c(i,t,o){for(let f=0;f({}));else throw new Error(`Value must be a list given an array path ${p}`);if(Array.isArray(i[g])){const y=i[g];if(Array.isArray(o))for(let m=0;mu(g,t.slice(a+1),o)):o}else return o}else i=i[r]}return i}catch(a){if(a instanceof TypeError)return o;throw a}}function r_(i,t){for(const[o,a]of Object.entries(t)){const r=o.split("."),f=a.split("."),p=new Set;let g=-1;for(let y=0;yg)for(let y=g;y=t.length||typeof i!="object"||i===null)return;const f=t[a];if(f.endsWith("[]")){const p=f.slice(0,-2),g=i;if(p in g&&Array.isArray(g[p]))for(const y of g[p])Ju(y,t,o,a+1,r)}else if(f==="*"){if(typeof i=="object"&&i!==null&&!Array.isArray(i)){const p=i,g=Object.keys(p).filter(m=>!m.startsWith("_")&&!r.has(m)),y={};for(const m of g)y[m]=p[m];for(const[m,v]of Object.entries(y)){const _=[];for(const E of o.slice(a))E==="*"?_.push(m):_.push(E);c(p,_,v)}for(const m of g)delete p[m]}}else{const p=i;f in p&&Ju(p[f],t,o,a+1,r)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function uc(i){if(typeof i!="string")throw new Error("fromImageBytes must be a string");return i}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function u_(i){const t={},o=u(i,["operationName"]);o!=null&&c(t,["operationName"],o);const a=u(i,["resourceName"]);return a!=null&&c(t,["_url","resourceName"],a),t}function c_(i){const t={},o=u(i,["name"]);o!=null&&c(t,["name"],o);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const p=u(i,["response","generateVideoResponse"]);return p!=null&&c(t,["response"],d_(p)),t}function f_(i){const t={},o=u(i,["name"]);o!=null&&c(t,["name"],o);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const p=u(i,["response"]);return p!=null&&c(t,["response"],p_(p)),t}function d_(i){const t={},o=u(i,["generatedSamples"]);if(o!=null){let f=o;Array.isArray(f)&&(f=f.map(p=>h_(p))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function p_(i){const t={},o=u(i,["videos"]);if(o!=null){let f=o;Array.isArray(f)&&(f=f.map(p=>m_(p))),c(t,["generatedVideos"],f)}const a=u(i,["raiMediaFilteredCount"]);a!=null&&c(t,["raiMediaFilteredCount"],a);const r=u(i,["raiMediaFilteredReasons"]);return r!=null&&c(t,["raiMediaFilteredReasons"],r),t}function h_(i){const t={},o=u(i,["video"]);return o!=null&&c(t,["video"],E_(o)),t}function m_(i){const t={},o=u(i,["_self"]);return o!=null&&c(t,["video"],S_(o)),t}function g_(i){const t={},o=u(i,["operationName"]);return o!=null&&c(t,["_url","operationName"],o),t}function y_(i){const t={},o=u(i,["operationName"]);return o!=null&&c(t,["_url","operationName"],o),t}function v_(i){const t={},o=u(i,["name"]);o!=null&&c(t,["name"],o);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const p=u(i,["response"]);return p!=null&&c(t,["response"],T_(p)),t}function T_(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function _g(i){const t={},o=u(i,["name"]);o!=null&&c(t,["name"],o);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const p=u(i,["response"]);return p!=null&&c(t,["response"],__(p)),t}function __(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function E_(i){const t={},o=u(i,["uri"]);o!=null&&c(t,["uri"],o);const a=u(i,["encodedVideo"]);a!=null&&c(t,["videoBytes"],uc(a));const r=u(i,["encoding"]);return r!=null&&c(t,["mimeType"],r),t}function S_(i){const t={},o=u(i,["gcsUri"]);o!=null&&c(t,["uri"],o);const a=u(i,["bytesBase64Encoded"]);a!=null&&c(t,["videoBytes"],uc(a));const r=u(i,["mimeType"]);return r!=null&&c(t,["mimeType"],r),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var Gh;(function(i){i.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",i.OUTCOME_OK="OUTCOME_OK",i.OUTCOME_FAILED="OUTCOME_FAILED",i.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(Gh||(Gh={}));var Hh;(function(i){i.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",i.PYTHON="PYTHON"})(Hh||(Hh={}));var zh;(function(i){i.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",i.SILENT="SILENT",i.WHEN_IDLE="WHEN_IDLE",i.INTERRUPT="INTERRUPT"})(zh||(zh={}));var xt;(function(i){i.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",i.STRING="STRING",i.NUMBER="NUMBER",i.INTEGER="INTEGER",i.BOOLEAN="BOOLEAN",i.ARRAY="ARRAY",i.OBJECT="OBJECT",i.NULL="NULL"})(xt||(xt={}));var kh;(function(i){i.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",i.SIMPLE_SEARCH="SIMPLE_SEARCH",i.ELASTIC_SEARCH="ELASTIC_SEARCH"})(kh||(kh={}));var Vh;(function(i){i.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",i.NO_AUTH="NO_AUTH",i.API_KEY_AUTH="API_KEY_AUTH",i.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",i.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",i.OAUTH="OAUTH",i.OIDC_AUTH="OIDC_AUTH"})(Vh||(Vh={}));var qh;(function(i){i.HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",i.HTTP_IN_QUERY="HTTP_IN_QUERY",i.HTTP_IN_HEADER="HTTP_IN_HEADER",i.HTTP_IN_PATH="HTTP_IN_PATH",i.HTTP_IN_BODY="HTTP_IN_BODY",i.HTTP_IN_COOKIE="HTTP_IN_COOKIE"})(qh||(qh={}));var Oh;(function(i){i.PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",i.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",i.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",i.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH"})(Oh||(Oh={}));var Bh;(function(i){i.UNSPECIFIED="UNSPECIFIED",i.BLOCKING="BLOCKING",i.NON_BLOCKING="NON_BLOCKING"})(Bh||(Bh={}));var Ph;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.MODE_DYNAMIC="MODE_DYNAMIC"})(Ph||(Ph={}));var Fh;(function(i){i.MODE_UNSPECIFIED="MODE_UNSPECIFIED",i.AUTO="AUTO",i.ANY="ANY",i.NONE="NONE",i.VALIDATED="VALIDATED"})(Fh||(Fh={}));var Yh;(function(i){i.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",i.LOW="LOW",i.MEDIUM="MEDIUM",i.HIGH="HIGH",i.MINIMAL="MINIMAL"})(Yh||(Yh={}));var Jh;(function(i){i.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",i.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",i.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",i.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",i.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",i.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",i.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",i.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",i.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",i.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",i.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK"})(Jh||(Jh={}));var Kh;(function(i){i.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",i.SEVERITY="SEVERITY",i.PROBABILITY="PROBABILITY"})(Kh||(Kh={}));var Xh;(function(i){i.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",i.BLOCK_NONE="BLOCK_NONE",i.OFF="OFF"})(Xh||(Xh={}));var Qh;(function(i){i.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",i.STOP="STOP",i.MAX_TOKENS="MAX_TOKENS",i.SAFETY="SAFETY",i.RECITATION="RECITATION",i.LANGUAGE="LANGUAGE",i.OTHER="OTHER",i.BLOCKLIST="BLOCKLIST",i.PROHIBITED_CONTENT="PROHIBITED_CONTENT",i.SPII="SPII",i.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",i.IMAGE_SAFETY="IMAGE_SAFETY",i.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",i.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",i.NO_IMAGE="NO_IMAGE",i.IMAGE_RECITATION="IMAGE_RECITATION",i.IMAGE_OTHER="IMAGE_OTHER"})(Qh||(Qh={}));var Zh;(function(i){i.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",i.NEGLIGIBLE="NEGLIGIBLE",i.LOW="LOW",i.MEDIUM="MEDIUM",i.HIGH="HIGH"})(Zh||(Zh={}));var $h;(function(i){i.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",i.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",i.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",i.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",i.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})($h||($h={}));var Wh;(function(i){i.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",i.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",i.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",i.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",i.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE"})(Wh||(Wh={}));var jh;(function(i){i.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",i.SAFETY="SAFETY",i.OTHER="OTHER",i.BLOCKLIST="BLOCKLIST",i.PROHIBITED_CONTENT="PROHIBITED_CONTENT",i.IMAGE_SAFETY="IMAGE_SAFETY",i.MODEL_ARMOR="MODEL_ARMOR",i.JAILBREAK="JAILBREAK"})(jh||(jh={}));var em;(function(i){i.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",i.ON_DEMAND="ON_DEMAND",i.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(em||(em={}));var is;(function(i){i.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",i.TEXT="TEXT",i.IMAGE="IMAGE",i.AUDIO="AUDIO"})(is||(is={}));var tm;(function(i){i.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",i.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",i.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",i.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(tm||(tm={}));var nm;(function(i){i.TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",i.TUNING_MODE_FULL="TUNING_MODE_FULL",i.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER"})(nm||(nm={}));var im;(function(i){i.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",i.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",i.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",i.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",i.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",i.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",i.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(im||(im={}));var Ku;(function(i){i.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",i.JOB_STATE_QUEUED="JOB_STATE_QUEUED",i.JOB_STATE_PENDING="JOB_STATE_PENDING",i.JOB_STATE_RUNNING="JOB_STATE_RUNNING",i.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",i.JOB_STATE_FAILED="JOB_STATE_FAILED",i.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",i.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",i.JOB_STATE_PAUSED="JOB_STATE_PAUSED",i.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",i.JOB_STATE_UPDATING="JOB_STATE_UPDATING",i.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(Ku||(Ku={}));var om;(function(i){i.TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",i.TUNING_TASK_I2V="TUNING_TASK_I2V",i.TUNING_TASK_T2V="TUNING_TASK_T2V",i.TUNING_TASK_R2V="TUNING_TASK_R2V"})(om||(om={}));var lm;(function(i){i.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",i.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",i.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",i.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH",i.MEDIA_RESOLUTION_ULTRA_HIGH="MEDIA_RESOLUTION_ULTRA_HIGH"})(lm||(lm={}));var Xu;(function(i){i.COLLECTION="COLLECTION"})(Xu||(Xu={}));var am;(function(i){i.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",i.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",i.BALANCED="BALANCED",i.PRIORITIZE_COST="PRIORITIZE_COST"})(am||(am={}));var sm;(function(i){i.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",i.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER"})(sm||(sm={}));var os;(function(i){i.PREDICT="PREDICT",i.EMBED_CONTENT="EMBED_CONTENT"})(os||(os={}));var rm;(function(i){i.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",i.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",i.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",i.BLOCK_NONE="BLOCK_NONE"})(rm||(rm={}));var um;(function(i){i.DONT_ALLOW="DONT_ALLOW",i.ALLOW_ADULT="ALLOW_ADULT",i.ALLOW_ALL="ALLOW_ALL"})(um||(um={}));var cm;(function(i){i.auto="auto",i.en="en",i.ja="ja",i.ko="ko",i.hi="hi",i.zh="zh",i.pt="pt",i.es="es"})(cm||(cm={}));var fm;(function(i){i.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",i.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",i.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",i.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",i.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})(fm||(fm={}));var dm;(function(i){i.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",i.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",i.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",i.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(dm||(dm={}));var pm;(function(i){i.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",i.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",i.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",i.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(pm||(pm={}));var hm;(function(i){i.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",i.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",i.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",i.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",i.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",i.EDIT_MODE_STYLE="EDIT_MODE_STYLE",i.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",i.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(hm||(hm={}));var mm;(function(i){i.FOREGROUND="FOREGROUND",i.BACKGROUND="BACKGROUND",i.PROMPT="PROMPT",i.SEMANTIC="SEMANTIC",i.INTERACTIVE="INTERACTIVE"})(mm||(mm={}));var gm;(function(i){i.ASSET="ASSET",i.STYLE="STYLE"})(gm||(gm={}));var ym;(function(i){i.INSERT="INSERT",i.REMOVE="REMOVE",i.REMOVE_STATIC="REMOVE_STATIC",i.OUTPAINT="OUTPAINT"})(ym||(ym={}));var vm;(function(i){i.OPTIMIZED="OPTIMIZED",i.LOSSLESS="LOSSLESS"})(vm||(vm={}));var Tm;(function(i){i.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",i.PREFERENCE_TUNING="PREFERENCE_TUNING",i.DISTILLATION="DISTILLATION"})(Tm||(Tm={}));var _m;(function(i){i.STATE_UNSPECIFIED="STATE_UNSPECIFIED",i.STATE_PENDING="STATE_PENDING",i.STATE_ACTIVE="STATE_ACTIVE",i.STATE_FAILED="STATE_FAILED"})(_m||(_m={}));var Em;(function(i){i.STATE_UNSPECIFIED="STATE_UNSPECIFIED",i.PROCESSING="PROCESSING",i.ACTIVE="ACTIVE",i.FAILED="FAILED"})(Em||(Em={}));var Sm;(function(i){i.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",i.UPLOADED="UPLOADED",i.GENERATED="GENERATED",i.REGISTERED="REGISTERED"})(Sm||(Sm={}));var Cm;(function(i){i.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",i.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",i.RESPONSE_REJECTED="RESPONSE_REJECTED",i.NEED_MORE_INPUT="NEED_MORE_INPUT"})(Cm||(Cm={}));var Am;(function(i){i.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",i.TEXT="TEXT",i.IMAGE="IMAGE",i.VIDEO="VIDEO",i.AUDIO="AUDIO",i.DOCUMENT="DOCUMENT"})(Am||(Am={}));var xm;(function(i){i.VAD_SIGNAL_TYPE_UNSPECIFIED="VAD_SIGNAL_TYPE_UNSPECIFIED",i.VAD_SIGNAL_TYPE_SOS="VAD_SIGNAL_TYPE_SOS",i.VAD_SIGNAL_TYPE_EOS="VAD_SIGNAL_TYPE_EOS"})(xm||(xm={}));var Rm;(function(i){i.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",i.ACTIVITY_START="ACTIVITY_START",i.ACTIVITY_END="ACTIVITY_END"})(Rm||(Rm={}));var Nm;(function(i){i.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",i.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",i.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Nm||(Nm={}));var Mm;(function(i){i.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",i.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",i.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(Mm||(Mm={}));var Im;(function(i){i.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",i.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",i.NO_INTERRUPTION="NO_INTERRUPTION"})(Im||(Im={}));var wm;(function(i){i.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",i.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",i.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT"})(wm||(wm={}));var bm;(function(i){i.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",i.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",i.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",i.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",i.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",i.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",i.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",i.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",i.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",i.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",i.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",i.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",i.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})(bm||(bm={}));var Dm;(function(i){i.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",i.QUALITY="QUALITY",i.DIVERSITY="DIVERSITY",i.VOCALIZATION="VOCALIZATION"})(Dm||(Dm={}));var co;(function(i){i.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",i.PLAY="PLAY",i.PAUSE="PAUSE",i.STOP="STOP",i.RESET_CONTEXT="RESET_CONTEXT"})(co||(co={}));class Qu{constructor(t){const o={};for(const a of t.headers.entries())o[a[0]]=a[1];this.headers=o,this.responseInternal=t}json(){return this.responseInternal.json()}}class gl{get text(){var t,o,a,r,f,p,g,y;if(((r=(a=(o=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 m="",v=!1;const _=[];for(const E of(y=(g=(p=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||p===void 0?void 0:p.content)===null||g===void 0?void 0:g.parts)!==null&&y!==void 0?y:[]){for(const[A,I]of Object.entries(E))A!=="text"&&A!=="thought"&&A!=="thoughtSignature"&&(I!==null||I!==void 0)&&_.push(A);if(typeof E.text=="string"){if(typeof E.thought=="boolean"&&E.thought)continue;v=!0,m+=E.text}}return _.length>0&&console.warn(`there are non-text parts ${_} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),v?m:void 0}get data(){var t,o,a,r,f,p,g,y;if(((r=(a=(o=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 m="";const v=[];for(const _ of(y=(g=(p=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||p===void 0?void 0:p.content)===null||g===void 0?void 0:g.parts)!==null&&y!==void 0?y:[]){for(const[E,A]of Object.entries(_))E!=="inlineData"&&(A!==null||A!==void 0)&&v.push(E);_.inlineData&&typeof _.inlineData.data=="string"&&(m+=atob(_.inlineData.data))}return v.length>0&&console.warn(`there are non-data parts ${v} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),m.length>0?btoa(m):void 0}get functionCalls(){var t,o,a,r,f,p,g,y;if(((r=(a=(o=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 m=(y=(g=(p=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||p===void 0?void 0:p.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(v=>v.functionCall).map(v=>v.functionCall).filter(v=>v!==void 0);if((m==null?void 0:m.length)!==0)return m}get executableCode(){var t,o,a,r,f,p,g,y,m;if(((r=(a=(o=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 v=(y=(g=(p=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||p===void 0?void 0:p.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(_=>_.executableCode).map(_=>_.executableCode).filter(_=>_!==void 0);if((v==null?void 0:v.length)!==0)return(m=v==null?void 0:v[0])===null||m===void 0?void 0:m.code}get codeExecutionResult(){var t,o,a,r,f,p,g,y,m;if(((r=(a=(o=(t=this.candidates)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.content)===null||a===void 0?void 0:a.parts)===null||r===void 0?void 0:r.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 v=(y=(g=(p=(f=this.candidates)===null||f===void 0?void 0:f[0])===null||p===void 0?void 0:p.content)===null||g===void 0?void 0:g.parts)===null||y===void 0?void 0:y.filter(_=>_.codeExecutionResult).map(_=>_.codeExecutionResult).filter(_=>_!==void 0);if((v==null?void 0:v.length)!==0)return(m=v==null?void 0:v[0])===null||m===void 0?void 0:m.output}}class Um{}class Lm{}class C_{}class A_{}class x_{}class R_{}class Gm{}class Hm{}class zm{}class N_{}class ls{_fromAPIResponse({apiResponse:t,_isVertexAI:o}){const a=new ls;let r;const f=t;return o?r=f_(f):r=c_(f),Object.assign(a,r),a}}class km{}class Vm{}class qm{}class Om{}class M_{}class I_{}class w_{}class cc{_fromAPIResponse({apiResponse:t,_isVertexAI:o}){const a=new cc,f=v_(t);return Object.assign(a,f),a}}class b_{}class D_{}class U_{}class L_{}class Bm{}class G_{get text(){var t,o,a;let r="",f=!1;const p=[];for(const g of(a=(o=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||o===void 0?void 0:o.parts)!==null&&a!==void 0?a:[]){for(const[y,m]of Object.entries(g))y!=="text"&&y!=="thought"&&m!==null&&p.push(y);if(typeof g.text=="string"){if(typeof g.thought=="boolean"&&g.thought)continue;f=!0,r+=g.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?r:void 0}get data(){var t,o,a;let r="";const f=[];for(const p of(a=(o=(t=this.serverContent)===null||t===void 0?void 0:t.modelTurn)===null||o===void 0?void 0:o.parts)!==null&&a!==void 0?a:[]){for(const[g,y]of Object.entries(p))g!=="inlineData"&&y!==null&&f.push(g);p.inlineData&&typeof p.inlineData.data=="string"&&(r+=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.`),r.length>0?btoa(r):void 0}}class H_{get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}}class fc{_fromAPIResponse({apiResponse:t,_isVertexAI:o}){const a=new fc,f=_g(t);return Object.assign(a,f),a}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function Ie(i,t){if(!t||typeof t!="string")throw new Error("model is required and must be a string");if(t.includes("..")||t.includes("?")||t.includes("&"))throw new Error("invalid model parameter");if(i.isVertexAI()){if(t.startsWith("publishers/")||t.startsWith("projects/")||t.startsWith("models/"))return t;if(t.indexOf("/")>=0){const o=t.split("/",2);return`publishers/${o[0]}/models/${o[1]}`}else return`publishers/google/models/${t}`}else return t.startsWith("models/")||t.startsWith("tunedModels/")?t:`models/${t}`}function Eg(i,t){const o=Ie(i,t);return o?o.startsWith("publishers/")&&i.isVertexAI()?`projects/${i.getProject()}/locations/${i.getLocation()}/${o}`:o.startsWith("models/")&&i.isVertexAI()?`projects/${i.getProject()}/locations/${i.getLocation()}/publishers/google/${o}`:o:""}function Sg(i){return Array.isArray(i)?i.map(t=>as(t)):[as(i)]}function as(i){if(typeof i=="object"&&i!==null)return i;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof i}`)}function Cg(i){const t=as(i);if(t.mimeType&&t.mimeType.startsWith("image/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function Ag(i){const t=as(i);if(t.mimeType&&t.mimeType.startsWith("audio/"))return t;throw new Error(`Unsupported mime type: ${t.mimeType}`)}function Pm(i){if(i==null)throw new Error("PartUnion is required");if(typeof i=="object")return i;if(typeof i=="string")return{text:i};throw new Error(`Unsupported part type: ${typeof i}`)}function xg(i){if(i==null||Array.isArray(i)&&i.length===0)throw new Error("PartListUnion is required");return Array.isArray(i)?i.map(t=>Pm(t)):[Pm(i)]}function Zu(i){return i!=null&&typeof i=="object"&&"parts"in i&&Array.isArray(i.parts)}function Fm(i){return i!=null&&typeof i=="object"&&"functionCall"in i}function Ym(i){return i!=null&&typeof i=="object"&&"functionResponse"in i}function lt(i){if(i==null)throw new Error("ContentUnion is required");return Zu(i)?i:{role:"user",parts:xg(i)}}function dc(i,t){if(!t)return[];if(i.isVertexAI()&&Array.isArray(t))return t.flatMap(o=>{const a=lt(o);return a.parts&&a.parts.length>0&&a.parts[0].text!==void 0?[a.parts[0].text]:[]});if(i.isVertexAI()){const o=lt(t);return o.parts&&o.parts.length>0&&o.parts[0].text!==void 0?[o.parts[0].text]:[]}return Array.isArray(t)?t.map(o=>lt(o)):[lt(t)]}function Gt(i){if(i==null||Array.isArray(i)&&i.length===0)throw new Error("contents are required");if(!Array.isArray(i)){if(Fm(i)||Ym(i))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[lt(i)]}const t=[],o=[],a=Zu(i[0]);for(const r of i){const f=Zu(r);if(f!=a)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(f)t.push(r);else{if(Fm(r)||Ym(r))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");o.push(r)}}return a||t.push({role:"user",parts:xg(o)}),t}function z_(i,t){i.includes("null")&&(t.nullable=!0);const o=i.filter(a=>a!=="null");if(o.length===1)t.type=Object.values(xt).includes(o[0].toUpperCase())?o[0].toUpperCase():xt.TYPE_UNSPECIFIED;else{t.anyOf=[];for(const a of o)t.anyOf.push({type:Object.values(xt).includes(a.toUpperCase())?a.toUpperCase():xt.TYPE_UNSPECIFIED})}}function po(i){const t={},o=["items"],a=["anyOf"],r=["properties"];if(i.type&&i.anyOf)throw new Error("type and anyOf cannot be both populated.");const f=i.anyOf;f!=null&&f.length==2&&(f[0].type==="null"?(t.nullable=!0,i=f[1]):f[1].type==="null"&&(t.nullable=!0,i=f[0])),i.type instanceof Array&&z_(i.type,t);for(const[p,g]of Object.entries(i))if(g!=null)if(p=="type"){if(g==="null")throw new Error("type: null can not be the only possible type for the field.");if(g instanceof Array)continue;t.type=Object.values(xt).includes(g.toUpperCase())?g.toUpperCase():xt.TYPE_UNSPECIFIED}else if(o.includes(p))t[p]=po(g);else if(a.includes(p)){const y=[];for(const m of g){if(m.type=="null"){t.nullable=!0;continue}y.push(po(m))}t[p]=y}else if(r.includes(p)){const y={};for(const[m,v]of Object.entries(g))y[m]=po(v);t[p]=y}else{if(p==="additionalProperties")continue;t[p]=g}return t}function pc(i){return po(i)}function hc(i){if(typeof i=="object")return i;if(typeof i=="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:i}}};throw new Error(`Unsupported speechConfig type: ${typeof i}`)}function mc(i){if("multiSpeakerVoiceConfig"in i)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return i}function mo(i){if(i.functionDeclarations)for(const t of i.functionDeclarations)t.parameters&&(Object.keys(t.parameters).includes("$schema")?t.parametersJsonSchema||(t.parametersJsonSchema=t.parameters,delete t.parameters):t.parameters=po(t.parameters)),t.response&&(Object.keys(t.response).includes("$schema")?t.responseJsonSchema||(t.responseJsonSchema=t.response,delete t.response):t.response=po(t.response));return i}function go(i){if(i==null)throw new Error("tools is required");if(!Array.isArray(i))throw new Error("tools is required and must be an array of Tools");const t=[];for(const o of i)t.push(o);return t}function k_(i,t,o,a=1){const r=!t.startsWith(`${o}/`)&&t.split("/").length===a;return i.isVertexAI()?t.startsWith("projects/")?t:t.startsWith("locations/")?`projects/${i.getProject()}/${t}`:t.startsWith(`${o}/`)?`projects/${i.getProject()}/locations/${i.getLocation()}/${t}`:r?`projects/${i.getProject()}/locations/${i.getLocation()}/${o}/${t}`:t:r?`${o}/${t}`:t}function Rn(i,t){if(typeof t!="string")throw new Error("name must be a string");return k_(i,t,"cachedContents")}function Rg(i){switch(i){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 i}}function Wn(i){return uc(i)}function V_(i){return i!=null&&typeof i=="object"&&"name"in i}function q_(i){return i!=null&&typeof i=="object"&&"video"in i}function O_(i){return i!=null&&typeof i=="object"&&"uri"in i}function Ng(i){var t;let o;if(V_(i)&&(o=i.name),!(O_(i)&&(o=i.uri,o===void 0))&&!(q_(i)&&(o=(t=i.video)===null||t===void 0?void 0:t.uri,o===void 0))){if(typeof i=="string"&&(o=i),o===void 0)throw new Error("Could not extract file name from the provided input.");if(o.startsWith("https://")){const r=o.split("files/")[1].match(/[a-z0-9]+/);if(r===null)throw new Error(`Could not extract file name from URI ${o}`);o=r[0]}else o.startsWith("files/")&&(o=o.split("files/")[1]);return o}}function Mg(i,t){let o;return i.isVertexAI()?o=t?"publishers/google/models":"models":o=t?"models":"tunedModels",o}function Ig(i){for(const t of["models","tunedModels","publisherModels"])if(B_(i,t))return i[t];return[]}function B_(i,t){return i!==null&&typeof i=="object"&&t in i}function P_(i,t={}){const o=i,a={name:o.name,description:o.description,parametersJsonSchema:o.inputSchema};return o.outputSchema&&(a.responseJsonSchema=o.outputSchema),t.behavior&&(a.behavior=t.behavior),{functionDeclarations:[a]}}function F_(i,t={}){const o=[],a=new Set;for(const r of i){const f=r.name;if(a.has(f))throw new Error(`Duplicate function name ${f} found in MCP tools. Please ensure function names are unique.`);a.add(f);const p=P_(r,t);p.functionDeclarations&&o.push(...p.functionDeclarations)}return{functionDeclarations:o}}function wg(i,t){let o;if(typeof t=="string")if(i.isVertexAI())if(t.startsWith("gs://"))o={format:"jsonl",gcsUri:[t]};else if(t.startsWith("bq://"))o={format:"bigquery",bigqueryUri:t};else throw new Error(`Unsupported string source for Vertex AI: ${t}`);else if(t.startsWith("files/"))o={fileName:t};else throw new Error(`Unsupported string source for Gemini API: ${t}`);else if(Array.isArray(t)){if(i.isVertexAI())throw new Error("InlinedRequest[] is not supported in Vertex AI.");o={inlinedRequests:t}}else o=t;const a=[o.gcsUri,o.bigqueryUri].filter(Boolean).length,r=[o.inlinedRequests,o.fileName].filter(Boolean).length;if(i.isVertexAI()){if(r>0||a!==1)throw new Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(a>0||r!==1)throw new Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return o}function Y_(i){if(typeof i!="string")return i;const t=i;if(t.startsWith("gs://"))return{format:"jsonl",gcsUri:t};if(t.startsWith("bq://"))return{format:"bigquery",bigqueryUri:t};throw new Error(`Unsupported destination: ${t}`)}function bg(i){if(typeof i!="object"||i===null)return{};const t=i,o=t.inlinedResponses;if(typeof o!="object"||o===null)return i;const r=o.inlinedResponses;if(!Array.isArray(r)||r.length===0)return i;let f=!1;for(const p of r){if(typeof p!="object"||p===null)continue;const y=p.response;if(typeof y!="object"||y===null)continue;if(y.embedding!==void 0){f=!0;break}}return f&&(t.inlinedEmbedContentResponses=t.inlinedResponses,delete t.inlinedResponses),i}function yo(i,t){const o=t;if(!i.isVertexAI()){if(/batches\/[^/]+$/.test(o))return o.split("/").pop();throw new Error(`Invalid batch job name: ${o}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(o))return o.split("/").pop();if(/^\d+$/.test(o))return o;throw new Error(`Invalid batch job name: ${o}.`)}function Dg(i){const t=i;return t==="BATCH_STATE_UNSPECIFIED"?"JOB_STATE_UNSPECIFIED":t==="BATCH_STATE_PENDING"?"JOB_STATE_PENDING":t==="BATCH_STATE_RUNNING"?"JOB_STATE_RUNNING":t==="BATCH_STATE_SUCCEEDED"?"JOB_STATE_SUCCEEDED":t==="BATCH_STATE_FAILED"?"JOB_STATE_FAILED":t==="BATCH_STATE_CANCELLED"?"JOB_STATE_CANCELLED":t==="BATCH_STATE_EXPIRED"?"JOB_STATE_EXPIRED":t}function J_(i){return i.includes("gemini")&&i!=="gemini-embedding-001"||i.includes("maas")}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function K_(i){const t={},o=u(i,["responsesFile"]);o!=null&&c(t,["fileName"],o);const a=u(i,["inlinedResponses","inlinedResponses"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(p=>NE(p))),c(t,["inlinedResponses"],f)}const r=u(i,["inlinedEmbedContentResponses","inlinedResponses"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>p)),c(t,["inlinedEmbedContentResponses"],f)}return t}function X_(i){const t={},o=u(i,["predictionsFormat"]);o!=null&&c(t,["format"],o);const a=u(i,["gcsDestination","outputUriPrefix"]);a!=null&&c(t,["gcsUri"],a);const r=u(i,["bigqueryDestination","outputUri"]);return r!=null&&c(t,["bigqueryUri"],r),t}function Q_(i){const t={},o=u(i,["format"]);o!=null&&c(t,["predictionsFormat"],o);const a=u(i,["gcsUri"]);a!=null&&c(t,["gcsDestination","outputUriPrefix"],a);const r=u(i,["bigqueryUri"]);if(r!=null&&c(t,["bigqueryDestination","outputUri"],r),u(i,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(u(i,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Vertex AI.");if(u(i,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Vertex AI.");return t}function ts(i){const t={},o=u(i,["name"]);o!=null&&c(t,["name"],o);const a=u(i,["metadata","displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["metadata","state"]);r!=null&&c(t,["state"],Dg(r));const f=u(i,["metadata","createTime"]);f!=null&&c(t,["createTime"],f);const p=u(i,["metadata","endTime"]);p!=null&&c(t,["endTime"],p);const g=u(i,["metadata","updateTime"]);g!=null&&c(t,["updateTime"],g);const y=u(i,["metadata","model"]);y!=null&&c(t,["model"],y);const m=u(i,["metadata","output"]);return m!=null&&c(t,["dest"],K_(bg(m))),t}function $u(i){const t={},o=u(i,["name"]);o!=null&&c(t,["name"],o);const a=u(i,["displayName"]);a!=null&&c(t,["displayName"],a);const r=u(i,["state"]);r!=null&&c(t,["state"],Dg(r));const f=u(i,["error"]);f!=null&&c(t,["error"],f);const p=u(i,["createTime"]);p!=null&&c(t,["createTime"],p);const g=u(i,["startTime"]);g!=null&&c(t,["startTime"],g);const y=u(i,["endTime"]);y!=null&&c(t,["endTime"],y);const m=u(i,["updateTime"]);m!=null&&c(t,["updateTime"],m);const v=u(i,["model"]);v!=null&&c(t,["model"],v);const _=u(i,["inputConfig"]);_!=null&&c(t,["src"],Z_(_));const E=u(i,["outputConfig"]);E!=null&&c(t,["dest"],X_(bg(E)));const A=u(i,["completionStats"]);return A!=null&&c(t,["completionStats"],A),t}function Z_(i){const t={},o=u(i,["instancesFormat"]);o!=null&&c(t,["format"],o);const a=u(i,["gcsSource","uris"]);a!=null&&c(t,["gcsUri"],a);const r=u(i,["bigquerySource","inputUri"]);return r!=null&&c(t,["bigqueryUri"],r),t}function $_(i,t){const o={};if(u(t,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(u(t,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(u(t,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");const a=u(t,["fileName"]);a!=null&&c(o,["fileName"],a);const r=u(t,["inlinedRequests"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>RE(i,p))),c(o,["requests","requests"],f)}return o}function W_(i){const t={},o=u(i,["format"]);o!=null&&c(t,["instancesFormat"],o);const a=u(i,["gcsUri"]);a!=null&&c(t,["gcsSource","uris"],a);const r=u(i,["bigqueryUri"]);if(r!=null&&c(t,["bigquerySource","inputUri"],r),u(i,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(u(i,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Vertex AI.");return t}function j_(i){const t={},o=u(i,["data"]);if(o!=null&&c(t,["data"],o),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function eE(i,t){const o={},a=u(t,["name"]);return a!=null&&c(o,["_url","name"],yo(i,a)),o}function tE(i,t){const o={},a=u(t,["name"]);return a!=null&&c(o,["_url","name"],yo(i,a)),o}function nE(i){const t={},o=u(i,["content"]);o!=null&&c(t,["content"],o);const a=u(i,["citationMetadata"]);a!=null&&c(t,["citationMetadata"],iE(a));const r=u(i,["tokenCount"]);r!=null&&c(t,["tokenCount"],r);const f=u(i,["finishReason"]);f!=null&&c(t,["finishReason"],f);const p=u(i,["avgLogprobs"]);p!=null&&c(t,["avgLogprobs"],p);const g=u(i,["groundingMetadata"]);g!=null&&c(t,["groundingMetadata"],g);const y=u(i,["index"]);y!=null&&c(t,["index"],y);const m=u(i,["logprobsResult"]);m!=null&&c(t,["logprobsResult"],m);const v=u(i,["safetyRatings"]);if(v!=null){let E=v;Array.isArray(E)&&(E=E.map(A=>A)),c(t,["safetyRatings"],E)}const _=u(i,["urlContextMetadata"]);return _!=null&&c(t,["urlContextMetadata"],_),t}function iE(i){const t={},o=u(i,["citationSources"]);if(o!=null){let a=o;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["citations"],a)}return t}function Ug(i){const t={},o=u(i,["parts"]);if(o!=null){let r=o;Array.isArray(r)&&(r=r.map(f=>LE(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function oE(i,t){const o={},a=u(i,["displayName"]);if(t!==void 0&&a!=null&&c(t,["batch","displayName"],a),u(i,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");return o}function lE(i,t){const o={},a=u(i,["displayName"]);t!==void 0&&a!=null&&c(t,["displayName"],a);const r=u(i,["dest"]);return t!==void 0&&r!=null&&c(t,["outputConfig"],Q_(Y_(r))),o}function Jm(i,t){const o={},a=u(t,["model"]);a!=null&&c(o,["_url","model"],Ie(i,a));const r=u(t,["src"]);r!=null&&c(o,["batch","inputConfig"],$_(i,wg(i,r)));const f=u(t,["config"]);return f!=null&&oE(f,o),o}function aE(i,t){const o={},a=u(t,["model"]);a!=null&&c(o,["model"],Ie(i,a));const r=u(t,["src"]);r!=null&&c(o,["inputConfig"],W_(wg(i,r)));const f=u(t,["config"]);return f!=null&&lE(f,o),o}function sE(i,t){const o={},a=u(i,["displayName"]);return t!==void 0&&a!=null&&c(t,["batch","displayName"],a),o}function rE(i,t){const o={},a=u(t,["model"]);a!=null&&c(o,["_url","model"],Ie(i,a));const r=u(t,["src"]);r!=null&&c(o,["batch","inputConfig"],mE(i,r));const f=u(t,["config"]);return f!=null&&sE(f,o),o}function uE(i,t){const o={},a=u(t,["name"]);return a!=null&&c(o,["_url","name"],yo(i,a)),o}function cE(i,t){const o={},a=u(t,["name"]);return a!=null&&c(o,["_url","name"],yo(i,a)),o}function fE(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);return f!=null&&c(t,["error"],f),t}function dE(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);return f!=null&&c(t,["error"],f),t}function pE(i,t){const o={},a=u(t,["contents"]);if(a!=null){let f=dc(i,a);Array.isArray(f)&&(f=f.map(p=>p)),c(o,["requests[]","request","content"],f)}const r=u(t,["config"]);return r!=null&&(c(o,["_self"],hE(r,o)),r_(o,{"requests[].*":"requests[].request.*"})),o}function hE(i,t){const o={},a=u(i,["taskType"]);t!==void 0&&a!=null&&c(t,["requests[]","taskType"],a);const r=u(i,["title"]);t!==void 0&&r!=null&&c(t,["requests[]","title"],r);const f=u(i,["outputDimensionality"]);if(t!==void 0&&f!=null&&c(t,["requests[]","outputDimensionality"],f),u(i,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(u(i,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return o}function mE(i,t){const o={},a=u(t,["fileName"]);a!=null&&c(o,["file_name"],a);const r=u(t,["inlinedRequests"]);return r!=null&&c(o,["requests"],pE(i,r)),o}function gE(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const o=u(i,["fileUri"]);o!=null&&c(t,["fileUri"],o);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function yE(i){const t={},o=u(i,["id"]);o!=null&&c(t,["id"],o);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function vE(i){const t={},o=u(i,["allowedFunctionNames"]);o!=null&&c(t,["allowedFunctionNames"],o);const a=u(i,["mode"]);if(a!=null&&c(t,["mode"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function TE(i,t,o){const a={},r=u(t,["systemInstruction"]);o!==void 0&&r!=null&&c(o,["systemInstruction"],Ug(lt(r)));const f=u(t,["temperature"]);f!=null&&c(a,["temperature"],f);const p=u(t,["topP"]);p!=null&&c(a,["topP"],p);const g=u(t,["topK"]);g!=null&&c(a,["topK"],g);const y=u(t,["candidateCount"]);y!=null&&c(a,["candidateCount"],y);const m=u(t,["maxOutputTokens"]);m!=null&&c(a,["maxOutputTokens"],m);const v=u(t,["stopSequences"]);v!=null&&c(a,["stopSequences"],v);const _=u(t,["responseLogprobs"]);_!=null&&c(a,["responseLogprobs"],_);const E=u(t,["logprobs"]);E!=null&&c(a,["logprobs"],E);const A=u(t,["presencePenalty"]);A!=null&&c(a,["presencePenalty"],A);const I=u(t,["frequencyPenalty"]);I!=null&&c(a,["frequencyPenalty"],I);const H=u(t,["seed"]);H!=null&&c(a,["seed"],H);const U=u(t,["responseMimeType"]);U!=null&&c(a,["responseMimeType"],U);const P=u(t,["responseSchema"]);P!=null&&c(a,["responseSchema"],pc(P));const Q=u(t,["responseJsonSchema"]);if(Q!=null&&c(a,["responseJsonSchema"],Q),u(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(u(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const F=u(t,["safetySettings"]);if(o!==void 0&&F!=null){let qe=F;Array.isArray(qe)&&(qe=qe.map(we=>GE(we))),c(o,["safetySettings"],qe)}const J=u(t,["tools"]);if(o!==void 0&&J!=null){let qe=go(J);Array.isArray(qe)&&(qe=qe.map(we=>zE(mo(we)))),c(o,["tools"],qe)}const ee=u(t,["toolConfig"]);if(o!==void 0&&ee!=null&&c(o,["toolConfig"],HE(ee)),u(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const B=u(t,["cachedContent"]);o!==void 0&&B!=null&&c(o,["cachedContent"],Rn(i,B));const X=u(t,["responseModalities"]);X!=null&&c(a,["responseModalities"],X);const me=u(t,["mediaResolution"]);me!=null&&c(a,["mediaResolution"],me);const W=u(t,["speechConfig"]);if(W!=null&&c(a,["speechConfig"],hc(W)),u(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const de=u(t,["thinkingConfig"]);de!=null&&c(a,["thinkingConfig"],de);const ce=u(t,["imageConfig"]);ce!=null&&c(a,["imageConfig"],xE(ce));const Re=u(t,["enableEnhancedCivicAnswers"]);if(Re!=null&&c(a,["enableEnhancedCivicAnswers"],Re),u(t,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is not supported in Gemini API.");return a}function _E(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["candidates"]);if(a!=null){let y=a;Array.isArray(y)&&(y=y.map(m=>nE(m))),c(t,["candidates"],y)}const r=u(i,["modelVersion"]);r!=null&&c(t,["modelVersion"],r);const f=u(i,["promptFeedback"]);f!=null&&c(t,["promptFeedback"],f);const p=u(i,["responseId"]);p!=null&&c(t,["responseId"],p);const g=u(i,["usageMetadata"]);return g!=null&&c(t,["usageMetadata"],g),t}function EE(i,t){const o={},a=u(t,["name"]);return a!=null&&c(o,["_url","name"],yo(i,a)),o}function SE(i,t){const o={},a=u(t,["name"]);return a!=null&&c(o,["_url","name"],yo(i,a)),o}function CE(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const o=u(i,["enableWidget"]);return o!=null&&c(t,["enableWidget"],o),t}function AE(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const o=u(i,["timeRangeFilter"]);return o!=null&&c(t,["timeRangeFilter"],o),t}function xE(i){const t={},o=u(i,["aspectRatio"]);o!=null&&c(t,["aspectRatio"],o);const a=u(i,["imageSize"]);if(a!=null&&c(t,["imageSize"],a),u(i,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is not supported in Gemini API.");if(u(i,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(u(i,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return t}function RE(i,t){const o={},a=u(t,["model"]);a!=null&&c(o,["request","model"],Ie(i,a));const r=u(t,["contents"]);if(r!=null){let g=Gt(r);Array.isArray(g)&&(g=g.map(y=>Ug(y))),c(o,["request","contents"],g)}const f=u(t,["metadata"]);f!=null&&c(o,["metadata"],f);const p=u(t,["config"]);return p!=null&&c(o,["request","generationConfig"],TE(i,p,u(o,["request"],{}))),o}function NE(i){const t={},o=u(i,["response"]);o!=null&&c(t,["response"],_E(o));const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["error"]);return r!=null&&c(t,["error"],r),t}function ME(i,t){const o={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);if(t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),u(i,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return o}function IE(i,t){const o={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);t!==void 0&&r!=null&&c(t,["_query","pageToken"],r);const f=u(i,["filter"]);return t!==void 0&&f!=null&&c(t,["_query","filter"],f),o}function wE(i){const t={},o=u(i,["config"]);return o!=null&&ME(o,t),t}function bE(i){const t={},o=u(i,["config"]);return o!=null&&IE(o,t),t}function DE(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["operations"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>ts(p))),c(t,["batchJobs"],f)}return t}function UE(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["batchPredictionJobs"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>$u(p))),c(t,["batchJobs"],f)}return t}function LE(i){const t={},o=u(i,["mediaResolution"]);o!=null&&c(t,["mediaResolution"],o);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],gE(f));const p=u(i,["functionCall"]);p!=null&&c(t,["functionCall"],yE(p));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],j_(y));const m=u(i,["text"]);m!=null&&c(t,["text"],m);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const _=u(i,["thoughtSignature"]);_!=null&&c(t,["thoughtSignature"],_);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function GE(i){const t={},o=u(i,["category"]);if(o!=null&&c(t,["category"],o),u(i,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const a=u(i,["threshold"]);return a!=null&&c(t,["threshold"],a),t}function HE(i){const t={},o=u(i,["retrievalConfig"]);o!=null&&c(t,["retrievalConfig"],o);const a=u(i,["functionCallingConfig"]);return a!=null&&c(t,["functionCallingConfig"],vE(a)),t}function zE(i){const t={};if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const o=u(i,["computerUse"]);o!=null&&c(t,["computerUse"],o);const a=u(i,["fileSearch"]);a!=null&&c(t,["fileSearch"],a);const r=u(i,["codeExecution"]);if(r!=null&&c(t,["codeExecution"],r),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const f=u(i,["functionDeclarations"]);if(f!=null){let v=f;Array.isArray(v)&&(v=v.map(_=>_)),c(t,["functionDeclarations"],v)}const p=u(i,["googleMaps"]);p!=null&&c(t,["googleMaps"],CE(p));const g=u(i,["googleSearch"]);g!=null&&c(t,["googleSearch"],AE(g));const y=u(i,["googleSearchRetrieval"]);y!=null&&c(t,["googleSearchRetrieval"],y);const m=u(i,["urlContext"]);return m!=null&&c(t,["urlContext"],m),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var An;(function(i){i.PAGED_ITEM_BATCH_JOBS="batchJobs",i.PAGED_ITEM_MODELS="models",i.PAGED_ITEM_TUNING_JOBS="tuningJobs",i.PAGED_ITEM_FILES="files",i.PAGED_ITEM_CACHED_CONTENTS="cachedContents",i.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",i.PAGED_ITEM_DOCUMENTS="documents"})(An||(An={}));class Ei{constructor(t,o,a,r){this.pageInternal=[],this.paramsInternal={},this.requestInternal=o,this.init(t,a,r)}init(t,o,a){var r,f;this.nameInternal=t,this.pageInternal=o[this.nameInternal]||[],this.sdkHttpResponseInternal=o==null?void 0:o.sdkHttpResponse,this.idxInternal=0;let p={config:{}};!a||Object.keys(a).length===0?p={config:{}}:typeof a=="object"?p=Object.assign({},a):p=a,p.config&&(p.config.pageToken=o.nextPageToken),this.paramsInternal=p,this.pageInternalSize=(f=(r=p.config)===null||r===void 0?void 0:r.pageSize)!==null&&f!==void 0?f:this.pageInternal.length}initNextPage(t){this.init(this.nameInternal,t,this.paramsInternal)}get page(){return this.pageInternal}get name(){return this.nameInternal}get pageSize(){return this.pageInternalSize}get sdkHttpResponse(){return this.sdkHttpResponseInternal}get params(){return this.paramsInternal}get pageLength(){return this.pageInternal.length}getItem(t){return this.pageInternal[t]}[Symbol.asyncIterator](){return{next:async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};const t=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:t,done:!1}},return:async()=>({value:void 0,done:!0})}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");const t=await this.requestInternal(this.params);return this.initNextPage(t),this.page}hasNextPage(){var t;return((t=this.params.config)===null||t===void 0?void 0:t.pageToken)!==void 0}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class kE extends xn{constructor(t){super(),this.apiClient=t,this.list=async(o={})=>new Ei(An.PAGED_ITEM_BATCH_JOBS,a=>this.listInternal(a),await this.listInternal(o),o),this.create=async o=>(this.apiClient.isVertexAI()&&(o.config=this.formatDestination(o.src,o.config)),this.createInternal(o)),this.createEmbeddings=async o=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw new Error("Vertex AI does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(o)}}createInlinedGenerateContentRequest(t){const o=Jm(this.apiClient,t),a=o._url,r=Z("{model}:batchGenerateContent",a),g=o.batch.inputConfig.requests,y=g.requests,m=[];for(const v of y){const _=Object.assign({},v);if(_.systemInstruction){const E=_.systemInstruction;delete _.systemInstruction;const A=_.request;A.systemInstruction=E,_.request=A}m.push(_)}return g.requests=m,delete o.config,delete o._url,delete o._query,{path:r,body:o}}getGcsUri(t){if(typeof t=="string")return t.startsWith("gs://")?t:void 0;if(!Array.isArray(t)&&t.gcsUri&&t.gcsUri.length>0)return t.gcsUri[0]}getBigqueryUri(t){if(typeof t=="string")return t.startsWith("bq://")?t:void 0;if(!Array.isArray(t))return t.bigqueryUri}formatDestination(t,o){const a=o?Object.assign({},o):{},r=Date.now().toString();if(a.displayName||(a.displayName=`genaiBatchJob_${r}`),a.dest===void 0){const f=this.getGcsUri(t),p=this.getBigqueryUri(t);if(f)f.endsWith(".jsonl")?a.dest=`${f.slice(0,-6)}/dest`:a.dest=`${f}_dest_${r}`;else if(p)a.dest=`${p}_dest_${r}`;else throw new Error("Unsupported source for Vertex AI: No GCS or BigQuery URI found.")}return a}async createInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=aE(this.apiClient,t);return g=Z("batchPredictionJobs",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),p.then(v=>$u(v))}else{const m=Jm(this.apiClient,t);return g=Z("{model}:batchGenerateContent",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),p.then(v=>ts(v))}}async createEmbeddingsInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=rE(this.apiClient,t);return f=Z("{model}:asyncBatchEmbedContent",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>ts(y))}}async get(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=SE(this.apiClient,t);return g=Z("batchPredictionJobs/{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),p.then(v=>$u(v))}else{const m=EE(this.apiClient,t);return g=Z("batches/{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),p.then(v=>ts(v))}}async cancel(t){var o,a,r,f;let p="",g={};if(this.apiClient.isVertexAI()){const y=tE(this.apiClient,t);p=Z("batchPredictionJobs/{name}:cancel",y._url),g=y._query,delete y._url,delete y._query,await this.apiClient.request({path:p,queryParams:g,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}else{const y=eE(this.apiClient,t);p=Z("batches/{name}:cancel",y._url),g=y._query,delete y._url,delete y._query,await this.apiClient.request({path:p,queryParams:g,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal})}}async listInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=bE(t);return g=Z("batchPredictionJobs",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=UE(v),E=new Bm;return Object.assign(E,_),E})}else{const m=wE(t);return g=Z("batches",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=DE(v),E=new Bm;return Object.assign(E,_),E})}}async delete(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=cE(this.apiClient,t);return g=Z("batchPredictionJobs/{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>dE(v))}else{const m=uE(this.apiClient,t);return g=Z("batches/{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>fE(v))}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function VE(i){const t={},o=u(i,["data"]);if(o!=null&&c(t,["data"],o),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function Km(i){const t={},o=u(i,["parts"]);if(o!=null){let r=o;Array.isArray(r)&&(r=r.map(f=>rS(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function qE(i,t){const o={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);t!==void 0&&r!=null&&c(t,["expireTime"],r);const f=u(i,["displayName"]);t!==void 0&&f!=null&&c(t,["displayName"],f);const p=u(i,["contents"]);if(t!==void 0&&p!=null){let v=Gt(p);Array.isArray(v)&&(v=v.map(_=>Km(_))),c(t,["contents"],v)}const g=u(i,["systemInstruction"]);t!==void 0&&g!=null&&c(t,["systemInstruction"],Km(lt(g)));const y=u(i,["tools"]);if(t!==void 0&&y!=null){let v=y;Array.isArray(v)&&(v=v.map(_=>cS(_))),c(t,["tools"],v)}const m=u(i,["toolConfig"]);if(t!==void 0&&m!=null&&c(t,["toolConfig"],uS(m)),u(i,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return o}function OE(i,t){const o={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);t!==void 0&&r!=null&&c(t,["expireTime"],r);const f=u(i,["displayName"]);t!==void 0&&f!=null&&c(t,["displayName"],f);const p=u(i,["contents"]);if(t!==void 0&&p!=null){let _=Gt(p);Array.isArray(_)&&(_=_.map(E=>E)),c(t,["contents"],_)}const g=u(i,["systemInstruction"]);t!==void 0&&g!=null&&c(t,["systemInstruction"],lt(g));const y=u(i,["tools"]);if(t!==void 0&&y!=null){let _=y;Array.isArray(_)&&(_=_.map(E=>fS(E))),c(t,["tools"],_)}const m=u(i,["toolConfig"]);t!==void 0&&m!=null&&c(t,["toolConfig"],m);const v=u(i,["kmsKeyName"]);return t!==void 0&&v!=null&&c(t,["encryption_spec","kmsKeyName"],v),o}function BE(i,t){const o={},a=u(t,["model"]);a!=null&&c(o,["model"],Eg(i,a));const r=u(t,["config"]);return r!=null&&qE(r,o),o}function PE(i,t){const o={},a=u(t,["model"]);a!=null&&c(o,["model"],Eg(i,a));const r=u(t,["config"]);return r!=null&&OE(r,o),o}function FE(i,t){const o={},a=u(t,["name"]);return a!=null&&c(o,["_url","name"],Rn(i,a)),o}function YE(i,t){const o={},a=u(t,["name"]);return a!=null&&c(o,["_url","name"],Rn(i,a)),o}function JE(i){const t={},o=u(i,["sdkHttpResponse"]);return o!=null&&c(t,["sdkHttpResponse"],o),t}function KE(i){const t={},o=u(i,["sdkHttpResponse"]);return o!=null&&c(t,["sdkHttpResponse"],o),t}function XE(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const o=u(i,["fileUri"]);o!=null&&c(t,["fileUri"],o);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function QE(i){const t={},o=u(i,["id"]);o!=null&&c(t,["id"],o);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function ZE(i){const t={},o=u(i,["allowedFunctionNames"]);o!=null&&c(t,["allowedFunctionNames"],o);const a=u(i,["mode"]);if(a!=null&&c(t,["mode"],a),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return t}function $E(i){const t={},o=u(i,["description"]);o!=null&&c(t,["description"],o);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const p=u(i,["response"]);p!=null&&c(t,["response"],p);const g=u(i,["responseJsonSchema"]);if(g!=null&&c(t,["responseJsonSchema"],g),u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");return t}function WE(i,t){const o={},a=u(t,["name"]);return a!=null&&c(o,["_url","name"],Rn(i,a)),o}function jE(i,t){const o={},a=u(t,["name"]);return a!=null&&c(o,["_url","name"],Rn(i,a)),o}function eS(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const o=u(i,["enableWidget"]);return o!=null&&c(t,["enableWidget"],o),t}function tS(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const o=u(i,["timeRangeFilter"]);return o!=null&&c(t,["timeRangeFilter"],o),t}function nS(i,t){const o={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),o}function iS(i,t){const o={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),o}function oS(i){const t={},o=u(i,["config"]);return o!=null&&nS(o,t),t}function lS(i){const t={},o=u(i,["config"]);return o!=null&&iS(o,t),t}function aS(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["cachedContents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>p)),c(t,["cachedContents"],f)}return t}function sS(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["cachedContents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>p)),c(t,["cachedContents"],f)}return t}function rS(i){const t={},o=u(i,["mediaResolution"]);o!=null&&c(t,["mediaResolution"],o);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],XE(f));const p=u(i,["functionCall"]);p!=null&&c(t,["functionCall"],QE(p));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],VE(y));const m=u(i,["text"]);m!=null&&c(t,["text"],m);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const _=u(i,["thoughtSignature"]);_!=null&&c(t,["thoughtSignature"],_);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function uS(i){const t={},o=u(i,["retrievalConfig"]);o!=null&&c(t,["retrievalConfig"],o);const a=u(i,["functionCallingConfig"]);return a!=null&&c(t,["functionCallingConfig"],ZE(a)),t}function cS(i){const t={};if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const o=u(i,["computerUse"]);o!=null&&c(t,["computerUse"],o);const a=u(i,["fileSearch"]);a!=null&&c(t,["fileSearch"],a);const r=u(i,["codeExecution"]);if(r!=null&&c(t,["codeExecution"],r),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const f=u(i,["functionDeclarations"]);if(f!=null){let v=f;Array.isArray(v)&&(v=v.map(_=>_)),c(t,["functionDeclarations"],v)}const p=u(i,["googleMaps"]);p!=null&&c(t,["googleMaps"],eS(p));const g=u(i,["googleSearch"]);g!=null&&c(t,["googleSearch"],tS(g));const y=u(i,["googleSearchRetrieval"]);y!=null&&c(t,["googleSearchRetrieval"],y);const m=u(i,["urlContext"]);return m!=null&&c(t,["urlContext"],m),t}function fS(i){const t={},o=u(i,["retrieval"]);o!=null&&c(t,["retrieval"],o);const a=u(i,["computerUse"]);if(a!=null&&c(t,["computerUse"],a),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const r=u(i,["codeExecution"]);r!=null&&c(t,["codeExecution"],r);const f=u(i,["enterpriseWebSearch"]);f!=null&&c(t,["enterpriseWebSearch"],f);const p=u(i,["functionDeclarations"]);if(p!=null){let _=p;Array.isArray(_)&&(_=_.map(E=>$E(E))),c(t,["functionDeclarations"],_)}const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],g);const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],y);const m=u(i,["googleSearchRetrieval"]);m!=null&&c(t,["googleSearchRetrieval"],m);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function dS(i,t){const o={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);return t!==void 0&&r!=null&&c(t,["expireTime"],r),o}function pS(i,t){const o={},a=u(i,["ttl"]);t!==void 0&&a!=null&&c(t,["ttl"],a);const r=u(i,["expireTime"]);return t!==void 0&&r!=null&&c(t,["expireTime"],r),o}function hS(i,t){const o={},a=u(t,["name"]);a!=null&&c(o,["_url","name"],Rn(i,a));const r=u(t,["config"]);return r!=null&&dS(r,o),o}function mS(i,t){const o={},a=u(t,["name"]);a!=null&&c(o,["_url","name"],Rn(i,a));const r=u(t,["config"]);return r!=null&&pS(r,o),o}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class gS extends xn{constructor(t){super(),this.apiClient=t,this.list=async(o={})=>new Ei(An.PAGED_ITEM_CACHED_CONTENTS,a=>this.listInternal(a),await this.listInternal(o),o)}async create(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=PE(this.apiClient,t);return g=Z("cachedContents",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),p.then(v=>v)}else{const m=BE(this.apiClient,t);return g=Z("cachedContents",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),p.then(v=>v)}}async get(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=jE(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),p.then(v=>v)}else{const m=WE(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),p.then(v=>v)}}async delete(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=YE(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=KE(v),E=new qm;return Object.assign(E,_),E})}else{const m=FE(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=JE(v),E=new qm;return Object.assign(E,_),E})}}async update(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=mS(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"PATCH",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),p.then(v=>v)}else{const m=hS(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"PATCH",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),p.then(v=>v)}}async listInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=lS(t);return g=Z("cachedContents",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=sS(v),E=new Om;return Object.assign(E,_),E})}else{const m=oS(t);return g=Z("cachedContents",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=aS(v),E=new Om;return Object.assign(E,_),E})}}}function ss(i,t){var o={};for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&t.indexOf(a)<0&&(o[a]=i[a]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(i);r=i.length&&(i=void 0),{value:i&&i[a++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function se(i){return this instanceof se?(this.v=i,this):new se(i)}function $t(i,t,o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=o.apply(i,t||[]),r,f=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),g("next"),g("throw"),g("return",p),r[Symbol.asyncIterator]=function(){return this},r;function p(A){return function(I){return Promise.resolve(I).then(A,_)}}function g(A,I){a[A]&&(r[A]=function(H){return new Promise(function(U,P){f.push([A,H,U,P])>1||y(A,H)})},I&&(r[A]=I(r[A])))}function y(A,I){try{m(a[A](I))}catch(H){E(f[0][3],H)}}function m(A){A.value instanceof se?Promise.resolve(A.value.v).then(v,_):E(f[0][2],A)}function v(A){y("next",A)}function _(A){y("throw",A)}function E(A,I){A(I),f.shift(),f.length&&y(f[0][0],f[0][1])}}function Wt(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],o;return t?t.call(i):(i=typeof Xm=="function"?Xm(i):i[Symbol.iterator](),o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o);function a(f){o[f]=i[f]&&function(p){return new Promise(function(g,y){p=i[f](p),r(g,y,p.done,p.value)})}}function r(f,p,g,y){Promise.resolve(y).then(function(m){f({value:m,done:g})},p)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function yS(i){var t;if(i.candidates==null||i.candidates.length===0)return!1;const o=(t=i.candidates[0])===null||t===void 0?void 0:t.content;return o===void 0?!1:Lg(o)}function Lg(i){if(i.parts===void 0||i.parts.length===0)return!1;for(const t of i.parts)if(t===void 0||Object.keys(t).length===0)return!1;return!0}function vS(i){if(i.length!==0){for(const t of i)if(t.role!=="user"&&t.role!=="model")throw new Error(`Role must be user or model, but got ${t.role}.`)}}function Qm(i){if(i===void 0||i.length===0)return[];const t=[],o=i.length;let a=0;for(;a{var f,p,g;const y=await r,m=(p=(f=y.candidates)===null||f===void 0?void 0:f[0])===null||p===void 0?void 0:p.content,v=y.automaticFunctionCallingHistory,_=this.getHistory(!0).length;let E=[];v!=null&&(E=(g=v.slice(_))!==null&&g!==void 0?g:[]);const A=m?[m]:[];this.recordHistory(a,A,E)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),r}async sendMessageStream(t){var o;await this.sendPromise;const a=lt(t.message),r=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(a),config:(o=t.config)!==null&&o!==void 0?o:this.config});this.sendPromise=r.then(()=>{}).catch(()=>{});const f=await r;return this.processStreamResponse(f,a)}getHistory(t=!1){const o=t?Qm(this.history):this.history;return structuredClone(o)}processStreamResponse(t,o){return $t(this,arguments,function*(){var r,f,p,g,y,m;const v=[];try{for(var _=!0,E=Wt(t),A;A=yield se(E.next()),r=A.done,!r;_=!0){g=A.value,_=!1;const I=g;if(yS(I)){const H=(m=(y=I.candidates)===null||y===void 0?void 0:y[0])===null||m===void 0?void 0:m.content;H!==void 0&&v.push(H)}yield yield se(I)}}catch(I){f={error:I}}finally{try{!_&&!r&&(p=E.return)&&(yield se(p.call(E)))}finally{if(f)throw f.error}}this.recordHistory(o,v)})}recordHistory(t,o,a){let r=[];o.length>0&&o.every(f=>f.role!==void 0)?r=o:r.push({role:"model",parts:[]}),a&&a.length>0?this.history.push(...Qm(a)):this.history.push(t),this.history.push(...r)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class Tl extends Error{constructor(t){super(t.message),this.name="ApiError",this.status=t.status,Object.setPrototypeOf(this,Tl.prototype)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function ES(i){const t={},o=u(i,["file"]);return o!=null&&c(t,["file"],o),t}function SS(i){const t={},o=u(i,["sdkHttpResponse"]);return o!=null&&c(t,["sdkHttpResponse"],o),t}function CS(i){const t={},o=u(i,["name"]);return o!=null&&c(t,["_url","file"],Ng(o)),t}function AS(i){const t={},o=u(i,["sdkHttpResponse"]);return o!=null&&c(t,["sdkHttpResponse"],o),t}function xS(i){const t={},o=u(i,["name"]);return o!=null&&c(t,["_url","file"],Ng(o)),t}function RS(i){const t={},o=u(i,["uris"]);return o!=null&&c(t,["uris"],o),t}function NS(i,t){const o={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),o}function MS(i){const t={},o=u(i,["config"]);return o!=null&&NS(o,t),t}function IS(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["files"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>p)),c(t,["files"],f)}return t}function wS(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["files"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(t,["files"],r)}return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class bS extends xn{constructor(t){super(),this.apiClient=t,this.list=async(o={})=>new Ei(An.PAGED_ITEM_FILES,a=>this.listInternal(a),await this.listInternal(o),o)}async upload(t){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(t.file,t.config).then(o=>o)}async download(t){await this.apiClient.downloadFile(t)}async registerFiles(t){throw new Error("registerFiles is only supported in Node.js environments.")}async _registerFiles(t){return this.registerFilesInternal(t)}async listInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=MS(t);return f=Z("files",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(m=>{const v=m;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const m=IS(y),v=new b_;return Object.assign(v,m),v})}}async createInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=ES(t);return f=Z("upload/v1beta/files",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const m=SS(y),v=new D_;return Object.assign(v,m),v})}}async get(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=xS(t);return f=Z("files/{file}",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=CS(t);return f=Z("files/{file}",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(m=>{const v=m;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const m=AS(y),v=new U_;return Object.assign(v,m),v})}}async registerFilesInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=RS(t);return f=Z("files:register",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const m=wS(y),v=new L_;return Object.assign(v,m),v})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function ns(i){const t={},o=u(i,["data"]);if(o!=null&&c(t,["data"],o),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function DS(i){const t={},o=u(i,["parts"]);if(o!=null){let r=o;Array.isArray(r)&&(r=r.map(f=>XS(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function US(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const o=u(i,["fileUri"]);o!=null&&c(t,["fileUri"],o);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function LS(i){const t={},o=u(i,["id"]);o!=null&&c(t,["id"],o);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function GS(i){const t={},o=u(i,["description"]);o!=null&&c(t,["description"],o);const a=u(i,["name"]);a!=null&&c(t,["name"],a);const r=u(i,["parameters"]);r!=null&&c(t,["parameters"],r);const f=u(i,["parametersJsonSchema"]);f!=null&&c(t,["parametersJsonSchema"],f);const p=u(i,["response"]);p!=null&&c(t,["response"],p);const g=u(i,["responseJsonSchema"]);if(g!=null&&c(t,["responseJsonSchema"],g),u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");return t}function HS(i){const t={},o=u(i,["modelSelectionConfig"]);o!=null&&c(t,["modelConfig"],o);const a=u(i,["responseJsonSchema"]);a!=null&&c(t,["responseJsonSchema"],a);const r=u(i,["audioTimestamp"]);r!=null&&c(t,["audioTimestamp"],r);const f=u(i,["candidateCount"]);f!=null&&c(t,["candidateCount"],f);const p=u(i,["enableAffectiveDialog"]);p!=null&&c(t,["enableAffectiveDialog"],p);const g=u(i,["frequencyPenalty"]);g!=null&&c(t,["frequencyPenalty"],g);const y=u(i,["logprobs"]);y!=null&&c(t,["logprobs"],y);const m=u(i,["maxOutputTokens"]);m!=null&&c(t,["maxOutputTokens"],m);const v=u(i,["mediaResolution"]);v!=null&&c(t,["mediaResolution"],v);const _=u(i,["presencePenalty"]);_!=null&&c(t,["presencePenalty"],_);const E=u(i,["responseLogprobs"]);E!=null&&c(t,["responseLogprobs"],E);const A=u(i,["responseMimeType"]);A!=null&&c(t,["responseMimeType"],A);const I=u(i,["responseModalities"]);I!=null&&c(t,["responseModalities"],I);const H=u(i,["responseSchema"]);H!=null&&c(t,["responseSchema"],H);const U=u(i,["routingConfig"]);U!=null&&c(t,["routingConfig"],U);const P=u(i,["seed"]);P!=null&&c(t,["seed"],P);const Q=u(i,["speechConfig"]);Q!=null&&c(t,["speechConfig"],Q);const F=u(i,["stopSequences"]);F!=null&&c(t,["stopSequences"],F);const J=u(i,["temperature"]);J!=null&&c(t,["temperature"],J);const ee=u(i,["thinkingConfig"]);ee!=null&&c(t,["thinkingConfig"],ee);const B=u(i,["topK"]);B!=null&&c(t,["topK"],B);const X=u(i,["topP"]);if(X!=null&&c(t,["topP"],X),u(i,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return t}function zS(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const o=u(i,["enableWidget"]);return o!=null&&c(t,["enableWidget"],o),t}function kS(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const o=u(i,["timeRangeFilter"]);return o!=null&&c(t,["timeRangeFilter"],o),t}function VS(i,t){const o={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],a);const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const p=u(i,["topP"]);t!==void 0&&p!=null&&c(t,["setup","generationConfig","topP"],p);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const m=u(i,["mediaResolution"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","mediaResolution"],m);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const _=u(i,["speechConfig"]);t!==void 0&&_!=null&&c(t,["setup","generationConfig","speechConfig"],mc(_));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const A=u(i,["enableAffectiveDialog"]);t!==void 0&&A!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],A);const I=u(i,["systemInstruction"]);t!==void 0&&I!=null&&c(t,["setup","systemInstruction"],DS(lt(I)));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let B=go(H);Array.isArray(B)&&(B=B.map(X=>ZS(mo(X)))),c(t,["setup","tools"],B)}const U=u(i,["sessionResumption"]);t!==void 0&&U!=null&&c(t,["setup","sessionResumption"],QS(U));const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const Q=u(i,["outputAudioTranscription"]);t!==void 0&&Q!=null&&c(t,["setup","outputAudioTranscription"],Q);const F=u(i,["realtimeInputConfig"]);t!==void 0&&F!=null&&c(t,["setup","realtimeInputConfig"],F);const J=u(i,["contextWindowCompression"]);t!==void 0&&J!=null&&c(t,["setup","contextWindowCompression"],J);const ee=u(i,["proactivity"]);if(t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee),u(i,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return o}function qS(i,t){const o={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],HS(a));const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const p=u(i,["topP"]);t!==void 0&&p!=null&&c(t,["setup","generationConfig","topP"],p);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const m=u(i,["mediaResolution"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","mediaResolution"],m);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const _=u(i,["speechConfig"]);t!==void 0&&_!=null&&c(t,["setup","generationConfig","speechConfig"],mc(_));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const A=u(i,["enableAffectiveDialog"]);t!==void 0&&A!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],A);const I=u(i,["systemInstruction"]);t!==void 0&&I!=null&&c(t,["setup","systemInstruction"],lt(I));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let X=go(H);Array.isArray(X)&&(X=X.map(me=>$S(mo(me)))),c(t,["setup","tools"],X)}const U=u(i,["sessionResumption"]);t!==void 0&&U!=null&&c(t,["setup","sessionResumption"],U);const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const Q=u(i,["outputAudioTranscription"]);t!==void 0&&Q!=null&&c(t,["setup","outputAudioTranscription"],Q);const F=u(i,["realtimeInputConfig"]);t!==void 0&&F!=null&&c(t,["setup","realtimeInputConfig"],F);const J=u(i,["contextWindowCompression"]);t!==void 0&&J!=null&&c(t,["setup","contextWindowCompression"],J);const ee=u(i,["proactivity"]);t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee);const B=u(i,["explicitVadSignal"]);return t!==void 0&&B!=null&&c(t,["setup","explicitVadSignal"],B),o}function OS(i,t){const o={},a=u(t,["model"]);a!=null&&c(o,["setup","model"],Ie(i,a));const r=u(t,["config"]);return r!=null&&c(o,["config"],VS(r,o)),o}function BS(i,t){const o={},a=u(t,["model"]);a!=null&&c(o,["setup","model"],Ie(i,a));const r=u(t,["config"]);return r!=null&&c(o,["config"],qS(r,o)),o}function PS(i){const t={},o=u(i,["musicGenerationConfig"]);return o!=null&&c(t,["musicGenerationConfig"],o),t}function FS(i){const t={},o=u(i,["weightedPrompts"]);if(o!=null){let a=o;Array.isArray(a)&&(a=a.map(r=>r)),c(t,["weightedPrompts"],a)}return t}function YS(i){const t={},o=u(i,["media"]);if(o!=null){let m=Sg(o);Array.isArray(m)&&(m=m.map(v=>ns(v))),c(t,["mediaChunks"],m)}const a=u(i,["audio"]);a!=null&&c(t,["audio"],ns(Ag(a)));const r=u(i,["audioStreamEnd"]);r!=null&&c(t,["audioStreamEnd"],r);const f=u(i,["video"]);f!=null&&c(t,["video"],ns(Cg(f)));const p=u(i,["text"]);p!=null&&c(t,["text"],p);const g=u(i,["activityStart"]);g!=null&&c(t,["activityStart"],g);const y=u(i,["activityEnd"]);return y!=null&&c(t,["activityEnd"],y),t}function JS(i){const t={},o=u(i,["media"]);if(o!=null){let m=Sg(o);Array.isArray(m)&&(m=m.map(v=>v)),c(t,["mediaChunks"],m)}const a=u(i,["audio"]);a!=null&&c(t,["audio"],Ag(a));const r=u(i,["audioStreamEnd"]);r!=null&&c(t,["audioStreamEnd"],r);const f=u(i,["video"]);f!=null&&c(t,["video"],Cg(f));const p=u(i,["text"]);p!=null&&c(t,["text"],p);const g=u(i,["activityStart"]);g!=null&&c(t,["activityStart"],g);const y=u(i,["activityEnd"]);return y!=null&&c(t,["activityEnd"],y),t}function KS(i){const t={},o=u(i,["setupComplete"]);o!=null&&c(t,["setupComplete"],o);const a=u(i,["serverContent"]);a!=null&&c(t,["serverContent"],a);const r=u(i,["toolCall"]);r!=null&&c(t,["toolCall"],r);const f=u(i,["toolCallCancellation"]);f!=null&&c(t,["toolCallCancellation"],f);const p=u(i,["usageMetadata"]);p!=null&&c(t,["usageMetadata"],WS(p));const g=u(i,["goAway"]);g!=null&&c(t,["goAway"],g);const y=u(i,["sessionResumptionUpdate"]);y!=null&&c(t,["sessionResumptionUpdate"],y);const m=u(i,["voiceActivityDetectionSignal"]);m!=null&&c(t,["voiceActivityDetectionSignal"],m);const v=u(i,["voiceActivity"]);return v!=null&&c(t,["voiceActivity"],jS(v)),t}function XS(i){const t={},o=u(i,["mediaResolution"]);o!=null&&c(t,["mediaResolution"],o);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],US(f));const p=u(i,["functionCall"]);p!=null&&c(t,["functionCall"],LS(p));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],ns(y));const m=u(i,["text"]);m!=null&&c(t,["text"],m);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const _=u(i,["thoughtSignature"]);_!=null&&c(t,["thoughtSignature"],_);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function QS(i){const t={},o=u(i,["handle"]);if(o!=null&&c(t,["handle"],o),u(i,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function ZS(i){const t={};if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const o=u(i,["computerUse"]);o!=null&&c(t,["computerUse"],o);const a=u(i,["fileSearch"]);a!=null&&c(t,["fileSearch"],a);const r=u(i,["codeExecution"]);if(r!=null&&c(t,["codeExecution"],r),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const f=u(i,["functionDeclarations"]);if(f!=null){let v=f;Array.isArray(v)&&(v=v.map(_=>_)),c(t,["functionDeclarations"],v)}const p=u(i,["googleMaps"]);p!=null&&c(t,["googleMaps"],zS(p));const g=u(i,["googleSearch"]);g!=null&&c(t,["googleSearch"],kS(g));const y=u(i,["googleSearchRetrieval"]);y!=null&&c(t,["googleSearchRetrieval"],y);const m=u(i,["urlContext"]);return m!=null&&c(t,["urlContext"],m),t}function $S(i){const t={},o=u(i,["retrieval"]);o!=null&&c(t,["retrieval"],o);const a=u(i,["computerUse"]);if(a!=null&&c(t,["computerUse"],a),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const r=u(i,["codeExecution"]);r!=null&&c(t,["codeExecution"],r);const f=u(i,["enterpriseWebSearch"]);f!=null&&c(t,["enterpriseWebSearch"],f);const p=u(i,["functionDeclarations"]);if(p!=null){let _=p;Array.isArray(_)&&(_=_.map(E=>GS(E))),c(t,["functionDeclarations"],_)}const g=u(i,["googleMaps"]);g!=null&&c(t,["googleMaps"],g);const y=u(i,["googleSearch"]);y!=null&&c(t,["googleSearch"],y);const m=u(i,["googleSearchRetrieval"]);m!=null&&c(t,["googleSearchRetrieval"],m);const v=u(i,["urlContext"]);return v!=null&&c(t,["urlContext"],v),t}function WS(i){const t={},o=u(i,["promptTokenCount"]);o!=null&&c(t,["promptTokenCount"],o);const a=u(i,["cachedContentTokenCount"]);a!=null&&c(t,["cachedContentTokenCount"],a);const r=u(i,["candidatesTokenCount"]);r!=null&&c(t,["responseTokenCount"],r);const f=u(i,["toolUsePromptTokenCount"]);f!=null&&c(t,["toolUsePromptTokenCount"],f);const p=u(i,["thoughtsTokenCount"]);p!=null&&c(t,["thoughtsTokenCount"],p);const g=u(i,["totalTokenCount"]);g!=null&&c(t,["totalTokenCount"],g);const y=u(i,["promptTokensDetails"]);if(y!=null){let A=y;Array.isArray(A)&&(A=A.map(I=>I)),c(t,["promptTokensDetails"],A)}const m=u(i,["cacheTokensDetails"]);if(m!=null){let A=m;Array.isArray(A)&&(A=A.map(I=>I)),c(t,["cacheTokensDetails"],A)}const v=u(i,["candidatesTokensDetails"]);if(v!=null){let A=v;Array.isArray(A)&&(A=A.map(I=>I)),c(t,["responseTokensDetails"],A)}const _=u(i,["toolUsePromptTokensDetails"]);if(_!=null){let A=_;Array.isArray(A)&&(A=A.map(I=>I)),c(t,["toolUsePromptTokensDetails"],A)}const E=u(i,["trafficType"]);return E!=null&&c(t,["trafficType"],E),t}function jS(i){const t={},o=u(i,["type"]);return o!=null&&c(t,["voiceActivityType"],o),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function eC(i,t){const o={},a=u(i,["data"]);if(a!=null&&c(o,["data"],a),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const r=u(i,["mimeType"]);return r!=null&&c(o,["mimeType"],r),o}function tC(i,t){const o={},a=u(i,["content"]);a!=null&&c(o,["content"],a);const r=u(i,["citationMetadata"]);r!=null&&c(o,["citationMetadata"],nC(r));const f=u(i,["tokenCount"]);f!=null&&c(o,["tokenCount"],f);const p=u(i,["finishReason"]);p!=null&&c(o,["finishReason"],p);const g=u(i,["avgLogprobs"]);g!=null&&c(o,["avgLogprobs"],g);const y=u(i,["groundingMetadata"]);y!=null&&c(o,["groundingMetadata"],y);const m=u(i,["index"]);m!=null&&c(o,["index"],m);const v=u(i,["logprobsResult"]);v!=null&&c(o,["logprobsResult"],v);const _=u(i,["safetyRatings"]);if(_!=null){let A=_;Array.isArray(A)&&(A=A.map(I=>I)),c(o,["safetyRatings"],A)}const E=u(i,["urlContextMetadata"]);return E!=null&&c(o,["urlContextMetadata"],E),o}function nC(i,t){const o={},a=u(i,["citationSources"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(o,["citations"],r)}return o}function iC(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["contents"]);if(f!=null){let p=Gt(f);Array.isArray(p)&&(p=p.map(g=>g)),c(a,["contents"],p)}return a}function oC(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["tokensInfo"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>p)),c(o,["tokensInfo"],f)}return o}function lC(i,t){const o={},a=u(i,["values"]);a!=null&&c(o,["values"],a);const r=u(i,["statistics"]);return r!=null&&c(o,["statistics"],aC(r)),o}function aC(i,t){const o={},a=u(i,["truncated"]);a!=null&&c(o,["truncated"],a);const r=u(i,["token_count"]);return r!=null&&c(o,["tokenCount"],r),o}function _l(i,t){const o={},a=u(i,["parts"]);if(a!=null){let f=a;Array.isArray(f)&&(f=f.map(p=>mA(p))),c(o,["parts"],f)}const r=u(i,["role"]);return r!=null&&c(o,["role"],r),o}function sC(i,t){const o={},a=u(i,["controlType"]);a!=null&&c(o,["controlType"],a);const r=u(i,["enableControlImageComputation"]);return r!=null&&c(o,["computeControl"],r),o}function rC(i,t){const o={};if(u(i,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(u(i,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(u(i,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return o}function uC(i,t,o){const a={},r=u(i,["systemInstruction"]);t!==void 0&&r!=null&&c(t,["systemInstruction"],lt(r));const f=u(i,["tools"]);if(t!==void 0&&f!=null){let g=f;Array.isArray(g)&&(g=g.map(y=>kg(y))),c(t,["tools"],g)}const p=u(i,["generationConfig"]);return t!==void 0&&p!=null&&c(t,["generationConfig"],eA(p)),a}function cC(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["contents"]);if(f!=null){let g=Gt(f);Array.isArray(g)&&(g=g.map(y=>_l(y))),c(a,["contents"],g)}const p=u(t,["config"]);return p!=null&&rC(p),a}function fC(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["contents"]);if(f!=null){let g=Gt(f);Array.isArray(g)&&(g=g.map(y=>y)),c(a,["contents"],g)}const p=u(t,["config"]);return p!=null&&uC(p,a),a}function dC(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["totalTokens"]);r!=null&&c(o,["totalTokens"],r);const f=u(i,["cachedContentTokenCount"]);return f!=null&&c(o,["cachedContentTokenCount"],f),o}function pC(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["totalTokens"]);return r!=null&&c(o,["totalTokens"],r),o}function hC(i,t,o){const a={},r=u(t,["model"]);return r!=null&&c(a,["_url","name"],Ie(i,r)),a}function mC(i,t,o){const a={},r=u(t,["model"]);return r!=null&&c(a,["_url","name"],Ie(i,r)),a}function gC(i,t){const o={},a=u(i,["sdkHttpResponse"]);return a!=null&&c(o,["sdkHttpResponse"],a),o}function yC(i,t){const o={},a=u(i,["sdkHttpResponse"]);return a!=null&&c(o,["sdkHttpResponse"],a),o}function vC(i,t,o){const a={},r=u(i,["outputGcsUri"]);t!==void 0&&r!=null&&c(t,["parameters","storageUri"],r);const f=u(i,["negativePrompt"]);t!==void 0&&f!=null&&c(t,["parameters","negativePrompt"],f);const p=u(i,["numberOfImages"]);t!==void 0&&p!=null&&c(t,["parameters","sampleCount"],p);const g=u(i,["aspectRatio"]);t!==void 0&&g!=null&&c(t,["parameters","aspectRatio"],g);const y=u(i,["guidanceScale"]);t!==void 0&&y!=null&&c(t,["parameters","guidanceScale"],y);const m=u(i,["seed"]);t!==void 0&&m!=null&&c(t,["parameters","seed"],m);const v=u(i,["safetyFilterLevel"]);t!==void 0&&v!=null&&c(t,["parameters","safetySetting"],v);const _=u(i,["personGeneration"]);t!==void 0&&_!=null&&c(t,["parameters","personGeneration"],_);const E=u(i,["includeSafetyAttributes"]);t!==void 0&&E!=null&&c(t,["parameters","includeSafetyAttributes"],E);const A=u(i,["includeRaiReason"]);t!==void 0&&A!=null&&c(t,["parameters","includeRaiReason"],A);const I=u(i,["language"]);t!==void 0&&I!=null&&c(t,["parameters","language"],I);const H=u(i,["outputMimeType"]);t!==void 0&&H!=null&&c(t,["parameters","outputOptions","mimeType"],H);const U=u(i,["outputCompressionQuality"]);t!==void 0&&U!=null&&c(t,["parameters","outputOptions","compressionQuality"],U);const P=u(i,["addWatermark"]);t!==void 0&&P!=null&&c(t,["parameters","addWatermark"],P);const Q=u(i,["labels"]);t!==void 0&&Q!=null&&c(t,["labels"],Q);const F=u(i,["editMode"]);t!==void 0&&F!=null&&c(t,["parameters","editMode"],F);const J=u(i,["baseSteps"]);return t!==void 0&&J!=null&&c(t,["parameters","editConfig","baseSteps"],J),a}function TC(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["prompt"]);f!=null&&c(a,["instances[0]","prompt"],f);const p=u(t,["referenceImages"]);if(p!=null){let y=p;Array.isArray(y)&&(y=y.map(m=>EA(m))),c(a,["instances[0]","referenceImages"],y)}const g=u(t,["config"]);return g!=null&&vC(g,a),a}function _C(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["predictions"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>cs(p))),c(o,["generatedImages"],f)}return o}function EC(i,t,o){const a={},r=u(i,["taskType"]);t!==void 0&&r!=null&&c(t,["requests[]","taskType"],r);const f=u(i,["title"]);t!==void 0&&f!=null&&c(t,["requests[]","title"],f);const p=u(i,["outputDimensionality"]);if(t!==void 0&&p!=null&&c(t,["requests[]","outputDimensionality"],p),u(i,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(u(i,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return a}function SC(i,t,o){const a={};let r=u(o,["embeddingApiType"]);if(r===void 0&&(r="PREDICT"),r==="PREDICT"){const m=u(i,["taskType"]);t!==void 0&&m!=null&&c(t,["instances[]","task_type"],m)}else if(r==="EMBED_CONTENT"){const m=u(i,["taskType"]);t!==void 0&&m!=null&&c(t,["taskType"],m)}let f=u(o,["embeddingApiType"]);if(f===void 0&&(f="PREDICT"),f==="PREDICT"){const m=u(i,["title"]);t!==void 0&&m!=null&&c(t,["instances[]","title"],m)}else if(f==="EMBED_CONTENT"){const m=u(i,["title"]);t!==void 0&&m!=null&&c(t,["title"],m)}let p=u(o,["embeddingApiType"]);if(p===void 0&&(p="PREDICT"),p==="PREDICT"){const m=u(i,["outputDimensionality"]);t!==void 0&&m!=null&&c(t,["parameters","outputDimensionality"],m)}else if(p==="EMBED_CONTENT"){const m=u(i,["outputDimensionality"]);t!==void 0&&m!=null&&c(t,["outputDimensionality"],m)}let g=u(o,["embeddingApiType"]);if(g===void 0&&(g="PREDICT"),g==="PREDICT"){const m=u(i,["mimeType"]);t!==void 0&&m!=null&&c(t,["instances[]","mimeType"],m)}let y=u(o,["embeddingApiType"]);if(y===void 0&&(y="PREDICT"),y==="PREDICT"){const m=u(i,["autoTruncate"]);t!==void 0&&m!=null&&c(t,["parameters","autoTruncate"],m)}else if(y==="EMBED_CONTENT"){const m=u(i,["autoTruncate"]);t!==void 0&&m!=null&&c(t,["autoTruncate"],m)}return a}function CC(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["contents"]);if(f!=null){let m=dc(i,f);Array.isArray(m)&&(m=m.map(v=>v)),c(a,["requests[]","content"],m)}const p=u(t,["content"]);p!=null&&_l(lt(p));const g=u(t,["config"]);g!=null&&EC(g,a);const y=u(t,["model"]);return y!==void 0&&c(a,["requests[]","model"],Ie(i,y)),a}function AC(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));let f=u(o,["embeddingApiType"]);if(f===void 0&&(f="PREDICT"),f==="PREDICT"){const y=u(t,["contents"]);if(y!=null){let m=dc(i,y);Array.isArray(m)&&(m=m.map(v=>v)),c(a,["instances[]","content"],m)}}let p=u(o,["embeddingApiType"]);if(p===void 0&&(p="PREDICT"),p==="EMBED_CONTENT"){const y=u(t,["content"]);y!=null&&c(a,["content"],lt(y))}const g=u(t,["config"]);return g!=null&&SC(g,a,o),a}function xC(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["embeddings"]);if(r!=null){let p=r;Array.isArray(p)&&(p=p.map(g=>g)),c(o,["embeddings"],p)}const f=u(i,["metadata"]);return f!=null&&c(o,["metadata"],f),o}function RC(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["predictions[]","embeddings"]);if(r!=null){let p=r;Array.isArray(p)&&(p=p.map(g=>lC(g))),c(o,["embeddings"],p)}const f=u(i,["metadata"]);if(f!=null&&c(o,["metadata"],f),t&&u(t,["embeddingApiType"])==="EMBED_CONTENT"){const p=u(i,["embedding"]),g=u(i,["usageMetadata"]),y=u(i,["truncated"]);if(p){const m={};g&&g.promptTokenCount&&(m.tokenCount=g.promptTokenCount),y&&(m.truncated=y),p.statistics=m,c(o,["embeddings"],[p])}}return o}function NC(i,t){const o={},a=u(i,["endpoint"]);a!=null&&c(o,["name"],a);const r=u(i,["deployedModelId"]);return r!=null&&c(o,["deployedModelId"],r),o}function MC(i,t){const o={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["fileUri"]);a!=null&&c(o,["fileUri"],a);const r=u(i,["mimeType"]);return r!=null&&c(o,["mimeType"],r),o}function IC(i,t){const o={},a=u(i,["id"]);a!=null&&c(o,["id"],a);const r=u(i,["args"]);r!=null&&c(o,["args"],r);const f=u(i,["name"]);if(f!=null&&c(o,["name"],f),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return o}function wC(i,t){const o={},a=u(i,["allowedFunctionNames"]);a!=null&&c(o,["allowedFunctionNames"],a);const r=u(i,["mode"]);if(r!=null&&c(o,["mode"],r),u(i,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return o}function bC(i,t){const o={},a=u(i,["description"]);a!=null&&c(o,["description"],a);const r=u(i,["name"]);r!=null&&c(o,["name"],r);const f=u(i,["parameters"]);f!=null&&c(o,["parameters"],f);const p=u(i,["parametersJsonSchema"]);p!=null&&c(o,["parametersJsonSchema"],p);const g=u(i,["response"]);g!=null&&c(o,["response"],g);const y=u(i,["responseJsonSchema"]);if(y!=null&&c(o,["responseJsonSchema"],y),u(i,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");return o}function DC(i,t,o,a){const r={},f=u(t,["systemInstruction"]);o!==void 0&&f!=null&&c(o,["systemInstruction"],_l(lt(f)));const p=u(t,["temperature"]);p!=null&&c(r,["temperature"],p);const g=u(t,["topP"]);g!=null&&c(r,["topP"],g);const y=u(t,["topK"]);y!=null&&c(r,["topK"],y);const m=u(t,["candidateCount"]);m!=null&&c(r,["candidateCount"],m);const v=u(t,["maxOutputTokens"]);v!=null&&c(r,["maxOutputTokens"],v);const _=u(t,["stopSequences"]);_!=null&&c(r,["stopSequences"],_);const E=u(t,["responseLogprobs"]);E!=null&&c(r,["responseLogprobs"],E);const A=u(t,["logprobs"]);A!=null&&c(r,["logprobs"],A);const I=u(t,["presencePenalty"]);I!=null&&c(r,["presencePenalty"],I);const H=u(t,["frequencyPenalty"]);H!=null&&c(r,["frequencyPenalty"],H);const U=u(t,["seed"]);U!=null&&c(r,["seed"],U);const P=u(t,["responseMimeType"]);P!=null&&c(r,["responseMimeType"],P);const Q=u(t,["responseSchema"]);Q!=null&&c(r,["responseSchema"],pc(Q));const F=u(t,["responseJsonSchema"]);if(F!=null&&c(r,["responseJsonSchema"],F),u(t,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(u(t,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");const J=u(t,["safetySettings"]);if(o!==void 0&&J!=null){let we=J;Array.isArray(we)&&(we=we.map(Xe=>SA(Xe))),c(o,["safetySettings"],we)}const ee=u(t,["tools"]);if(o!==void 0&&ee!=null){let we=go(ee);Array.isArray(we)&&(we=we.map(Xe=>IA(mo(Xe)))),c(o,["tools"],we)}const B=u(t,["toolConfig"]);if(o!==void 0&&B!=null&&c(o,["toolConfig"],MA(B)),u(t,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const X=u(t,["cachedContent"]);o!==void 0&&X!=null&&c(o,["cachedContent"],Rn(i,X));const me=u(t,["responseModalities"]);me!=null&&c(r,["responseModalities"],me);const W=u(t,["mediaResolution"]);W!=null&&c(r,["mediaResolution"],W);const de=u(t,["speechConfig"]);if(de!=null&&c(r,["speechConfig"],hc(de)),u(t,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");const ce=u(t,["thinkingConfig"]);ce!=null&&c(r,["thinkingConfig"],ce);const Re=u(t,["imageConfig"]);Re!=null&&c(r,["imageConfig"],lA(Re));const qe=u(t,["enableEnhancedCivicAnswers"]);if(qe!=null&&c(r,["enableEnhancedCivicAnswers"],qe),u(t,["modelArmorConfig"])!==void 0)throw new Error("modelArmorConfig parameter is not supported in Gemini API.");return r}function UC(i,t,o,a){const r={},f=u(t,["systemInstruction"]);o!==void 0&&f!=null&&c(o,["systemInstruction"],lt(f));const p=u(t,["temperature"]);p!=null&&c(r,["temperature"],p);const g=u(t,["topP"]);g!=null&&c(r,["topP"],g);const y=u(t,["topK"]);y!=null&&c(r,["topK"],y);const m=u(t,["candidateCount"]);m!=null&&c(r,["candidateCount"],m);const v=u(t,["maxOutputTokens"]);v!=null&&c(r,["maxOutputTokens"],v);const _=u(t,["stopSequences"]);_!=null&&c(r,["stopSequences"],_);const E=u(t,["responseLogprobs"]);E!=null&&c(r,["responseLogprobs"],E);const A=u(t,["logprobs"]);A!=null&&c(r,["logprobs"],A);const I=u(t,["presencePenalty"]);I!=null&&c(r,["presencePenalty"],I);const H=u(t,["frequencyPenalty"]);H!=null&&c(r,["frequencyPenalty"],H);const U=u(t,["seed"]);U!=null&&c(r,["seed"],U);const P=u(t,["responseMimeType"]);P!=null&&c(r,["responseMimeType"],P);const Q=u(t,["responseSchema"]);Q!=null&&c(r,["responseSchema"],pc(Q));const F=u(t,["responseJsonSchema"]);F!=null&&c(r,["responseJsonSchema"],F);const J=u(t,["routingConfig"]);J!=null&&c(r,["routingConfig"],J);const ee=u(t,["modelSelectionConfig"]);ee!=null&&c(r,["modelConfig"],ee);const B=u(t,["safetySettings"]);if(o!==void 0&&B!=null){let ne=B;Array.isArray(ne)&&(ne=ne.map(ve=>ve)),c(o,["safetySettings"],ne)}const X=u(t,["tools"]);if(o!==void 0&&X!=null){let ne=go(X);Array.isArray(ne)&&(ne=ne.map(ve=>kg(mo(ve)))),c(o,["tools"],ne)}const me=u(t,["toolConfig"]);o!==void 0&&me!=null&&c(o,["toolConfig"],me);const W=u(t,["labels"]);o!==void 0&&W!=null&&c(o,["labels"],W);const de=u(t,["cachedContent"]);o!==void 0&&de!=null&&c(o,["cachedContent"],Rn(i,de));const ce=u(t,["responseModalities"]);ce!=null&&c(r,["responseModalities"],ce);const Re=u(t,["mediaResolution"]);Re!=null&&c(r,["mediaResolution"],Re);const qe=u(t,["speechConfig"]);qe!=null&&c(r,["speechConfig"],hc(qe));const we=u(t,["audioTimestamp"]);we!=null&&c(r,["audioTimestamp"],we);const Xe=u(t,["thinkingConfig"]);Xe!=null&&c(r,["thinkingConfig"],Xe);const z=u(t,["imageConfig"]);if(z!=null&&c(r,["imageConfig"],aA(z)),u(t,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");const Y=u(t,["modelArmorConfig"]);return o!==void 0&&Y!=null&&c(o,["modelArmorConfig"],Y),r}function Zm(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["contents"]);if(f!=null){let g=Gt(f);Array.isArray(g)&&(g=g.map(y=>_l(y))),c(a,["contents"],g)}const p=u(t,["config"]);return p!=null&&c(a,["generationConfig"],DC(i,p,a)),a}function $m(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["contents"]);if(f!=null){let g=Gt(f);Array.isArray(g)&&(g=g.map(y=>y)),c(a,["contents"],g)}const p=u(t,["config"]);return p!=null&&c(a,["generationConfig"],UC(i,p,a)),a}function Wm(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["candidates"]);if(r!=null){let m=r;Array.isArray(m)&&(m=m.map(v=>tC(v))),c(o,["candidates"],m)}const f=u(i,["modelVersion"]);f!=null&&c(o,["modelVersion"],f);const p=u(i,["promptFeedback"]);p!=null&&c(o,["promptFeedback"],p);const g=u(i,["responseId"]);g!=null&&c(o,["responseId"],g);const y=u(i,["usageMetadata"]);return y!=null&&c(o,["usageMetadata"],y),o}function jm(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["candidates"]);if(r!=null){let v=r;Array.isArray(v)&&(v=v.map(_=>_)),c(o,["candidates"],v)}const f=u(i,["createTime"]);f!=null&&c(o,["createTime"],f);const p=u(i,["modelVersion"]);p!=null&&c(o,["modelVersion"],p);const g=u(i,["promptFeedback"]);g!=null&&c(o,["promptFeedback"],g);const y=u(i,["responseId"]);y!=null&&c(o,["responseId"],y);const m=u(i,["usageMetadata"]);return m!=null&&c(o,["usageMetadata"],m),o}function LC(i,t,o){const a={};if(u(i,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(u(i,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");const r=u(i,["numberOfImages"]);t!==void 0&&r!=null&&c(t,["parameters","sampleCount"],r);const f=u(i,["aspectRatio"]);t!==void 0&&f!=null&&c(t,["parameters","aspectRatio"],f);const p=u(i,["guidanceScale"]);if(t!==void 0&&p!=null&&c(t,["parameters","guidanceScale"],p),u(i,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const g=u(i,["safetyFilterLevel"]);t!==void 0&&g!=null&&c(t,["parameters","safetySetting"],g);const y=u(i,["personGeneration"]);t!==void 0&&y!=null&&c(t,["parameters","personGeneration"],y);const m=u(i,["includeSafetyAttributes"]);t!==void 0&&m!=null&&c(t,["parameters","includeSafetyAttributes"],m);const v=u(i,["includeRaiReason"]);t!==void 0&&v!=null&&c(t,["parameters","includeRaiReason"],v);const _=u(i,["language"]);t!==void 0&&_!=null&&c(t,["parameters","language"],_);const E=u(i,["outputMimeType"]);t!==void 0&&E!=null&&c(t,["parameters","outputOptions","mimeType"],E);const A=u(i,["outputCompressionQuality"]);if(t!==void 0&&A!=null&&c(t,["parameters","outputOptions","compressionQuality"],A),u(i,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(u(i,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");const I=u(i,["imageSize"]);if(t!==void 0&&I!=null&&c(t,["parameters","sampleImageSize"],I),u(i,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return a}function GC(i,t,o){const a={},r=u(i,["outputGcsUri"]);t!==void 0&&r!=null&&c(t,["parameters","storageUri"],r);const f=u(i,["negativePrompt"]);t!==void 0&&f!=null&&c(t,["parameters","negativePrompt"],f);const p=u(i,["numberOfImages"]);t!==void 0&&p!=null&&c(t,["parameters","sampleCount"],p);const g=u(i,["aspectRatio"]);t!==void 0&&g!=null&&c(t,["parameters","aspectRatio"],g);const y=u(i,["guidanceScale"]);t!==void 0&&y!=null&&c(t,["parameters","guidanceScale"],y);const m=u(i,["seed"]);t!==void 0&&m!=null&&c(t,["parameters","seed"],m);const v=u(i,["safetyFilterLevel"]);t!==void 0&&v!=null&&c(t,["parameters","safetySetting"],v);const _=u(i,["personGeneration"]);t!==void 0&&_!=null&&c(t,["parameters","personGeneration"],_);const E=u(i,["includeSafetyAttributes"]);t!==void 0&&E!=null&&c(t,["parameters","includeSafetyAttributes"],E);const A=u(i,["includeRaiReason"]);t!==void 0&&A!=null&&c(t,["parameters","includeRaiReason"],A);const I=u(i,["language"]);t!==void 0&&I!=null&&c(t,["parameters","language"],I);const H=u(i,["outputMimeType"]);t!==void 0&&H!=null&&c(t,["parameters","outputOptions","mimeType"],H);const U=u(i,["outputCompressionQuality"]);t!==void 0&&U!=null&&c(t,["parameters","outputOptions","compressionQuality"],U);const P=u(i,["addWatermark"]);t!==void 0&&P!=null&&c(t,["parameters","addWatermark"],P);const Q=u(i,["labels"]);t!==void 0&&Q!=null&&c(t,["labels"],Q);const F=u(i,["imageSize"]);t!==void 0&&F!=null&&c(t,["parameters","sampleImageSize"],F);const J=u(i,["enhancePrompt"]);return t!==void 0&&J!=null&&c(t,["parameters","enhancePrompt"],J),a}function HC(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["prompt"]);f!=null&&c(a,["instances[0]","prompt"],f);const p=u(t,["config"]);return p!=null&&LC(p,a),a}function zC(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["prompt"]);f!=null&&c(a,["instances[0]","prompt"],f);const p=u(t,["config"]);return p!=null&&GC(p,a),a}function kC(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["predictions"]);if(r!=null){let p=r;Array.isArray(p)&&(p=p.map(g=>ZC(g))),c(o,["generatedImages"],p)}const f=u(i,["positivePromptSafetyAttributes"]);return f!=null&&c(o,["positivePromptSafetyAttributes"],Hg(f)),o}function VC(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["predictions"]);if(r!=null){let p=r;Array.isArray(p)&&(p=p.map(g=>cs(g))),c(o,["generatedImages"],p)}const f=u(i,["positivePromptSafetyAttributes"]);return f!=null&&c(o,["positivePromptSafetyAttributes"],zg(f)),o}function qC(i,t,o){const a={},r=u(i,["numberOfVideos"]);if(t!==void 0&&r!=null&&c(t,["parameters","sampleCount"],r),u(i,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(u(i,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");const f=u(i,["durationSeconds"]);if(t!==void 0&&f!=null&&c(t,["parameters","durationSeconds"],f),u(i,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");const p=u(i,["aspectRatio"]);t!==void 0&&p!=null&&c(t,["parameters","aspectRatio"],p);const g=u(i,["resolution"]);t!==void 0&&g!=null&&c(t,["parameters","resolution"],g);const y=u(i,["personGeneration"]);if(t!==void 0&&y!=null&&c(t,["parameters","personGeneration"],y),u(i,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");const m=u(i,["negativePrompt"]);t!==void 0&&m!=null&&c(t,["parameters","negativePrompt"],m);const v=u(i,["enhancePrompt"]);if(t!==void 0&&v!=null&&c(t,["parameters","enhancePrompt"],v),u(i,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");const _=u(i,["lastFrame"]);t!==void 0&&_!=null&&c(t,["instances[0]","lastFrame"],fs(_));const E=u(i,["referenceImages"]);if(t!==void 0&&E!=null){let A=E;Array.isArray(A)&&(A=A.map(I=>BA(I))),c(t,["instances[0]","referenceImages"],A)}if(u(i,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(u(i,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");return a}function OC(i,t,o){const a={},r=u(i,["numberOfVideos"]);t!==void 0&&r!=null&&c(t,["parameters","sampleCount"],r);const f=u(i,["outputGcsUri"]);t!==void 0&&f!=null&&c(t,["parameters","storageUri"],f);const p=u(i,["fps"]);t!==void 0&&p!=null&&c(t,["parameters","fps"],p);const g=u(i,["durationSeconds"]);t!==void 0&&g!=null&&c(t,["parameters","durationSeconds"],g);const y=u(i,["seed"]);t!==void 0&&y!=null&&c(t,["parameters","seed"],y);const m=u(i,["aspectRatio"]);t!==void 0&&m!=null&&c(t,["parameters","aspectRatio"],m);const v=u(i,["resolution"]);t!==void 0&&v!=null&&c(t,["parameters","resolution"],v);const _=u(i,["personGeneration"]);t!==void 0&&_!=null&&c(t,["parameters","personGeneration"],_);const E=u(i,["pubsubTopic"]);t!==void 0&&E!=null&&c(t,["parameters","pubsubTopic"],E);const A=u(i,["negativePrompt"]);t!==void 0&&A!=null&&c(t,["parameters","negativePrompt"],A);const I=u(i,["enhancePrompt"]);t!==void 0&&I!=null&&c(t,["parameters","enhancePrompt"],I);const H=u(i,["generateAudio"]);t!==void 0&&H!=null&&c(t,["parameters","generateAudio"],H);const U=u(i,["lastFrame"]);t!==void 0&&U!=null&&c(t,["instances[0]","lastFrame"],jt(U));const P=u(i,["referenceImages"]);if(t!==void 0&&P!=null){let J=P;Array.isArray(J)&&(J=J.map(ee=>PA(ee))),c(t,["instances[0]","referenceImages"],J)}const Q=u(i,["mask"]);t!==void 0&&Q!=null&&c(t,["instances[0]","mask"],OA(Q));const F=u(i,["compressionQuality"]);return t!==void 0&&F!=null&&c(t,["parameters","compressionQuality"],F),a}function BC(i,t){const o={},a=u(i,["name"]);a!=null&&c(o,["name"],a);const r=u(i,["metadata"]);r!=null&&c(o,["metadata"],r);const f=u(i,["done"]);f!=null&&c(o,["done"],f);const p=u(i,["error"]);p!=null&&c(o,["error"],p);const g=u(i,["response","generateVideoResponse"]);return g!=null&&c(o,["response"],JC(g)),o}function PC(i,t){const o={},a=u(i,["name"]);a!=null&&c(o,["name"],a);const r=u(i,["metadata"]);r!=null&&c(o,["metadata"],r);const f=u(i,["done"]);f!=null&&c(o,["done"],f);const p=u(i,["error"]);p!=null&&c(o,["error"],p);const g=u(i,["response"]);return g!=null&&c(o,["response"],KC(g)),o}function FC(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["prompt"]);f!=null&&c(a,["instances[0]","prompt"],f);const p=u(t,["image"]);p!=null&&c(a,["instances[0]","image"],fs(p));const g=u(t,["video"]);g!=null&&c(a,["instances[0]","video"],Vg(g));const y=u(t,["source"]);y!=null&&XC(y,a);const m=u(t,["config"]);return m!=null&&qC(m,a),a}function YC(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["prompt"]);f!=null&&c(a,["instances[0]","prompt"],f);const p=u(t,["image"]);p!=null&&c(a,["instances[0]","image"],jt(p));const g=u(t,["video"]);g!=null&&c(a,["instances[0]","video"],qg(g));const y=u(t,["source"]);y!=null&&QC(y,a);const m=u(t,["config"]);return m!=null&&OC(m,a),a}function JC(i,t){const o={},a=u(i,["generatedSamples"]);if(a!=null){let p=a;Array.isArray(p)&&(p=p.map(g=>WC(g))),c(o,["generatedVideos"],p)}const r=u(i,["raiMediaFilteredCount"]);r!=null&&c(o,["raiMediaFilteredCount"],r);const f=u(i,["raiMediaFilteredReasons"]);return f!=null&&c(o,["raiMediaFilteredReasons"],f),o}function KC(i,t){const o={},a=u(i,["videos"]);if(a!=null){let p=a;Array.isArray(p)&&(p=p.map(g=>jC(g))),c(o,["generatedVideos"],p)}const r=u(i,["raiMediaFilteredCount"]);r!=null&&c(o,["raiMediaFilteredCount"],r);const f=u(i,["raiMediaFilteredReasons"]);return f!=null&&c(o,["raiMediaFilteredReasons"],f),o}function XC(i,t,o){const a={},r=u(i,["prompt"]);t!==void 0&&r!=null&&c(t,["instances[0]","prompt"],r);const f=u(i,["image"]);t!==void 0&&f!=null&&c(t,["instances[0]","image"],fs(f));const p=u(i,["video"]);return t!==void 0&&p!=null&&c(t,["instances[0]","video"],Vg(p)),a}function QC(i,t,o){const a={},r=u(i,["prompt"]);t!==void 0&&r!=null&&c(t,["instances[0]","prompt"],r);const f=u(i,["image"]);t!==void 0&&f!=null&&c(t,["instances[0]","image"],jt(f));const p=u(i,["video"]);return t!==void 0&&p!=null&&c(t,["instances[0]","video"],qg(p)),a}function ZC(i,t){const o={},a=u(i,["_self"]);a!=null&&c(o,["image"],sA(a));const r=u(i,["raiFilteredReason"]);r!=null&&c(o,["raiFilteredReason"],r);const f=u(i,["_self"]);return f!=null&&c(o,["safetyAttributes"],Hg(f)),o}function cs(i,t){const o={},a=u(i,["_self"]);a!=null&&c(o,["image"],Gg(a));const r=u(i,["raiFilteredReason"]);r!=null&&c(o,["raiFilteredReason"],r);const f=u(i,["_self"]);f!=null&&c(o,["safetyAttributes"],zg(f));const p=u(i,["prompt"]);return p!=null&&c(o,["enhancedPrompt"],p),o}function $C(i,t){const o={},a=u(i,["_self"]);a!=null&&c(o,["mask"],Gg(a));const r=u(i,["labels"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>p)),c(o,["labels"],f)}return o}function WC(i,t){const o={},a=u(i,["video"]);return a!=null&&c(o,["video"],VA(a)),o}function jC(i,t){const o={},a=u(i,["_self"]);return a!=null&&c(o,["video"],qA(a)),o}function eA(i,t){const o={},a=u(i,["modelSelectionConfig"]);a!=null&&c(o,["modelConfig"],a);const r=u(i,["responseJsonSchema"]);r!=null&&c(o,["responseJsonSchema"],r);const f=u(i,["audioTimestamp"]);f!=null&&c(o,["audioTimestamp"],f);const p=u(i,["candidateCount"]);p!=null&&c(o,["candidateCount"],p);const g=u(i,["enableAffectiveDialog"]);g!=null&&c(o,["enableAffectiveDialog"],g);const y=u(i,["frequencyPenalty"]);y!=null&&c(o,["frequencyPenalty"],y);const m=u(i,["logprobs"]);m!=null&&c(o,["logprobs"],m);const v=u(i,["maxOutputTokens"]);v!=null&&c(o,["maxOutputTokens"],v);const _=u(i,["mediaResolution"]);_!=null&&c(o,["mediaResolution"],_);const E=u(i,["presencePenalty"]);E!=null&&c(o,["presencePenalty"],E);const A=u(i,["responseLogprobs"]);A!=null&&c(o,["responseLogprobs"],A);const I=u(i,["responseMimeType"]);I!=null&&c(o,["responseMimeType"],I);const H=u(i,["responseModalities"]);H!=null&&c(o,["responseModalities"],H);const U=u(i,["responseSchema"]);U!=null&&c(o,["responseSchema"],U);const P=u(i,["routingConfig"]);P!=null&&c(o,["routingConfig"],P);const Q=u(i,["seed"]);Q!=null&&c(o,["seed"],Q);const F=u(i,["speechConfig"]);F!=null&&c(o,["speechConfig"],F);const J=u(i,["stopSequences"]);J!=null&&c(o,["stopSequences"],J);const ee=u(i,["temperature"]);ee!=null&&c(o,["temperature"],ee);const B=u(i,["thinkingConfig"]);B!=null&&c(o,["thinkingConfig"],B);const X=u(i,["topK"]);X!=null&&c(o,["topK"],X);const me=u(i,["topP"]);if(me!=null&&c(o,["topP"],me),u(i,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return o}function tA(i,t,o){const a={},r=u(t,["model"]);return r!=null&&c(a,["_url","name"],Ie(i,r)),a}function nA(i,t,o){const a={},r=u(t,["model"]);return r!=null&&c(a,["_url","name"],Ie(i,r)),a}function iA(i,t){const o={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const a=u(i,["enableWidget"]);return a!=null&&c(o,["enableWidget"],a),o}function oA(i,t){const o={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const a=u(i,["timeRangeFilter"]);return a!=null&&c(o,["timeRangeFilter"],a),o}function lA(i,t){const o={},a=u(i,["aspectRatio"]);a!=null&&c(o,["aspectRatio"],a);const r=u(i,["imageSize"]);if(r!=null&&c(o,["imageSize"],r),u(i,["personGeneration"])!==void 0)throw new Error("personGeneration parameter is not supported in Gemini API.");if(u(i,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(u(i,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return o}function aA(i,t){const o={},a=u(i,["aspectRatio"]);a!=null&&c(o,["aspectRatio"],a);const r=u(i,["imageSize"]);r!=null&&c(o,["imageSize"],r);const f=u(i,["personGeneration"]);f!=null&&c(o,["personGeneration"],f);const p=u(i,["outputMimeType"]);p!=null&&c(o,["imageOutputOptions","mimeType"],p);const g=u(i,["outputCompressionQuality"]);return g!=null&&c(o,["imageOutputOptions","compressionQuality"],g),o}function sA(i,t){const o={},a=u(i,["bytesBase64Encoded"]);a!=null&&c(o,["imageBytes"],Wn(a));const r=u(i,["mimeType"]);return r!=null&&c(o,["mimeType"],r),o}function Gg(i,t){const o={},a=u(i,["gcsUri"]);a!=null&&c(o,["gcsUri"],a);const r=u(i,["bytesBase64Encoded"]);r!=null&&c(o,["imageBytes"],Wn(r));const f=u(i,["mimeType"]);return f!=null&&c(o,["mimeType"],f),o}function fs(i,t){const o={};if(u(i,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");const a=u(i,["imageBytes"]);a!=null&&c(o,["bytesBase64Encoded"],Wn(a));const r=u(i,["mimeType"]);return r!=null&&c(o,["mimeType"],r),o}function jt(i,t){const o={},a=u(i,["gcsUri"]);a!=null&&c(o,["gcsUri"],a);const r=u(i,["imageBytes"]);r!=null&&c(o,["bytesBase64Encoded"],Wn(r));const f=u(i,["mimeType"]);return f!=null&&c(o,["mimeType"],f),o}function rA(i,t,o,a){const r={},f=u(t,["pageSize"]);o!==void 0&&f!=null&&c(o,["_query","pageSize"],f);const p=u(t,["pageToken"]);o!==void 0&&p!=null&&c(o,["_query","pageToken"],p);const g=u(t,["filter"]);o!==void 0&&g!=null&&c(o,["_query","filter"],g);const y=u(t,["queryBase"]);return o!==void 0&&y!=null&&c(o,["_url","models_url"],Mg(i,y)),r}function uA(i,t,o,a){const r={},f=u(t,["pageSize"]);o!==void 0&&f!=null&&c(o,["_query","pageSize"],f);const p=u(t,["pageToken"]);o!==void 0&&p!=null&&c(o,["_query","pageToken"],p);const g=u(t,["filter"]);o!==void 0&&g!=null&&c(o,["_query","filter"],g);const y=u(t,["queryBase"]);return o!==void 0&&y!=null&&c(o,["_url","models_url"],Mg(i,y)),r}function cA(i,t,o){const a={},r=u(t,["config"]);return r!=null&&rA(i,r,a),a}function fA(i,t,o){const a={},r=u(t,["config"]);return r!=null&&uA(i,r,a),a}function dA(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["nextPageToken"]);r!=null&&c(o,["nextPageToken"],r);const f=u(i,["_self"]);if(f!=null){let p=Ig(f);Array.isArray(p)&&(p=p.map(g=>Wu(g))),c(o,["models"],p)}return o}function pA(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["nextPageToken"]);r!=null&&c(o,["nextPageToken"],r);const f=u(i,["_self"]);if(f!=null){let p=Ig(f);Array.isArray(p)&&(p=p.map(g=>ju(g))),c(o,["models"],p)}return o}function hA(i,t){const o={},a=u(i,["maskMode"]);a!=null&&c(o,["maskMode"],a);const r=u(i,["segmentationClasses"]);r!=null&&c(o,["maskClasses"],r);const f=u(i,["maskDilation"]);return f!=null&&c(o,["dilation"],f),o}function Wu(i,t){const o={},a=u(i,["name"]);a!=null&&c(o,["name"],a);const r=u(i,["displayName"]);r!=null&&c(o,["displayName"],r);const f=u(i,["description"]);f!=null&&c(o,["description"],f);const p=u(i,["version"]);p!=null&&c(o,["version"],p);const g=u(i,["_self"]);g!=null&&c(o,["tunedModelInfo"],wA(g));const y=u(i,["inputTokenLimit"]);y!=null&&c(o,["inputTokenLimit"],y);const m=u(i,["outputTokenLimit"]);m!=null&&c(o,["outputTokenLimit"],m);const v=u(i,["supportedGenerationMethods"]);v!=null&&c(o,["supportedActions"],v);const _=u(i,["temperature"]);_!=null&&c(o,["temperature"],_);const E=u(i,["maxTemperature"]);E!=null&&c(o,["maxTemperature"],E);const A=u(i,["topP"]);A!=null&&c(o,["topP"],A);const I=u(i,["topK"]);I!=null&&c(o,["topK"],I);const H=u(i,["thinking"]);return H!=null&&c(o,["thinking"],H),o}function ju(i,t){const o={},a=u(i,["name"]);a!=null&&c(o,["name"],a);const r=u(i,["displayName"]);r!=null&&c(o,["displayName"],r);const f=u(i,["description"]);f!=null&&c(o,["description"],f);const p=u(i,["versionId"]);p!=null&&c(o,["version"],p);const g=u(i,["deployedModels"]);if(g!=null){let E=g;Array.isArray(E)&&(E=E.map(A=>NC(A))),c(o,["endpoints"],E)}const y=u(i,["labels"]);y!=null&&c(o,["labels"],y);const m=u(i,["_self"]);m!=null&&c(o,["tunedModelInfo"],bA(m));const v=u(i,["defaultCheckpointId"]);v!=null&&c(o,["defaultCheckpointId"],v);const _=u(i,["checkpoints"]);if(_!=null){let E=_;Array.isArray(E)&&(E=E.map(A=>A)),c(o,["checkpoints"],E)}return o}function mA(i,t){const o={},a=u(i,["mediaResolution"]);a!=null&&c(o,["mediaResolution"],a);const r=u(i,["codeExecutionResult"]);r!=null&&c(o,["codeExecutionResult"],r);const f=u(i,["executableCode"]);f!=null&&c(o,["executableCode"],f);const p=u(i,["fileData"]);p!=null&&c(o,["fileData"],MC(p));const g=u(i,["functionCall"]);g!=null&&c(o,["functionCall"],IC(g));const y=u(i,["functionResponse"]);y!=null&&c(o,["functionResponse"],y);const m=u(i,["inlineData"]);m!=null&&c(o,["inlineData"],eC(m));const v=u(i,["text"]);v!=null&&c(o,["text"],v);const _=u(i,["thought"]);_!=null&&c(o,["thought"],_);const E=u(i,["thoughtSignature"]);E!=null&&c(o,["thoughtSignature"],E);const A=u(i,["videoMetadata"]);return A!=null&&c(o,["videoMetadata"],A),o}function gA(i,t){const o={},a=u(i,["productImage"]);return a!=null&&c(o,["image"],jt(a)),o}function yA(i,t,o){const a={},r=u(i,["numberOfImages"]);t!==void 0&&r!=null&&c(t,["parameters","sampleCount"],r);const f=u(i,["baseSteps"]);t!==void 0&&f!=null&&c(t,["parameters","baseSteps"],f);const p=u(i,["outputGcsUri"]);t!==void 0&&p!=null&&c(t,["parameters","storageUri"],p);const g=u(i,["seed"]);t!==void 0&&g!=null&&c(t,["parameters","seed"],g);const y=u(i,["safetyFilterLevel"]);t!==void 0&&y!=null&&c(t,["parameters","safetySetting"],y);const m=u(i,["personGeneration"]);t!==void 0&&m!=null&&c(t,["parameters","personGeneration"],m);const v=u(i,["addWatermark"]);t!==void 0&&v!=null&&c(t,["parameters","addWatermark"],v);const _=u(i,["outputMimeType"]);t!==void 0&&_!=null&&c(t,["parameters","outputOptions","mimeType"],_);const E=u(i,["outputCompressionQuality"]);t!==void 0&&E!=null&&c(t,["parameters","outputOptions","compressionQuality"],E);const A=u(i,["enhancePrompt"]);t!==void 0&&A!=null&&c(t,["parameters","enhancePrompt"],A);const I=u(i,["labels"]);return t!==void 0&&I!=null&&c(t,["labels"],I),a}function vA(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["source"]);f!=null&&_A(f,a);const p=u(t,["config"]);return p!=null&&yA(p,a),a}function TA(i,t){const o={},a=u(i,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>cs(f))),c(o,["generatedImages"],r)}return o}function _A(i,t,o){const a={},r=u(i,["prompt"]);t!==void 0&&r!=null&&c(t,["instances[0]","prompt"],r);const f=u(i,["personImage"]);t!==void 0&&f!=null&&c(t,["instances[0]","personImage","image"],jt(f));const p=u(i,["productImages"]);if(t!==void 0&&p!=null){let g=p;Array.isArray(g)&&(g=g.map(y=>gA(y))),c(t,["instances[0]","productImages"],g)}return a}function EA(i,t){const o={},a=u(i,["referenceImage"]);a!=null&&c(o,["referenceImage"],jt(a));const r=u(i,["referenceId"]);r!=null&&c(o,["referenceId"],r);const f=u(i,["referenceType"]);f!=null&&c(o,["referenceType"],f);const p=u(i,["maskImageConfig"]);p!=null&&c(o,["maskImageConfig"],hA(p));const g=u(i,["controlImageConfig"]);g!=null&&c(o,["controlImageConfig"],sC(g));const y=u(i,["styleImageConfig"]);y!=null&&c(o,["styleImageConfig"],y);const m=u(i,["subjectImageConfig"]);return m!=null&&c(o,["subjectImageConfig"],m),o}function Hg(i,t){const o={},a=u(i,["safetyAttributes","categories"]);a!=null&&c(o,["categories"],a);const r=u(i,["safetyAttributes","scores"]);r!=null&&c(o,["scores"],r);const f=u(i,["contentType"]);return f!=null&&c(o,["contentType"],f),o}function zg(i,t){const o={},a=u(i,["safetyAttributes","categories"]);a!=null&&c(o,["categories"],a);const r=u(i,["safetyAttributes","scores"]);r!=null&&c(o,["scores"],r);const f=u(i,["contentType"]);return f!=null&&c(o,["contentType"],f),o}function SA(i,t){const o={},a=u(i,["category"]);if(a!=null&&c(o,["category"],a),u(i,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");const r=u(i,["threshold"]);return r!=null&&c(o,["threshold"],r),o}function CA(i,t){const o={},a=u(i,["image"]);return a!=null&&c(o,["image"],jt(a)),o}function AA(i,t,o){const a={},r=u(i,["mode"]);t!==void 0&&r!=null&&c(t,["parameters","mode"],r);const f=u(i,["maxPredictions"]);t!==void 0&&f!=null&&c(t,["parameters","maxPredictions"],f);const p=u(i,["confidenceThreshold"]);t!==void 0&&p!=null&&c(t,["parameters","confidenceThreshold"],p);const g=u(i,["maskDilation"]);t!==void 0&&g!=null&&c(t,["parameters","maskDilation"],g);const y=u(i,["binaryColorThreshold"]);t!==void 0&&y!=null&&c(t,["parameters","binaryColorThreshold"],y);const m=u(i,["labels"]);return t!==void 0&&m!=null&&c(t,["labels"],m),a}function xA(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["source"]);f!=null&&NA(f,a);const p=u(t,["config"]);return p!=null&&AA(p,a),a}function RA(i,t){const o={},a=u(i,["predictions"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>$C(f))),c(o,["generatedMasks"],r)}return o}function NA(i,t,o){const a={},r=u(i,["prompt"]);t!==void 0&&r!=null&&c(t,["instances[0]","prompt"],r);const f=u(i,["image"]);t!==void 0&&f!=null&&c(t,["instances[0]","image"],jt(f));const p=u(i,["scribbleImage"]);return t!==void 0&&p!=null&&c(t,["instances[0]","scribble"],CA(p)),a}function MA(i,t){const o={},a=u(i,["retrievalConfig"]);a!=null&&c(o,["retrievalConfig"],a);const r=u(i,["functionCallingConfig"]);return r!=null&&c(o,["functionCallingConfig"],wC(r)),o}function IA(i,t){const o={};if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const a=u(i,["computerUse"]);a!=null&&c(o,["computerUse"],a);const r=u(i,["fileSearch"]);r!=null&&c(o,["fileSearch"],r);const f=u(i,["codeExecution"]);if(f!=null&&c(o,["codeExecution"],f),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const p=u(i,["functionDeclarations"]);if(p!=null){let _=p;Array.isArray(_)&&(_=_.map(E=>E)),c(o,["functionDeclarations"],_)}const g=u(i,["googleMaps"]);g!=null&&c(o,["googleMaps"],iA(g));const y=u(i,["googleSearch"]);y!=null&&c(o,["googleSearch"],oA(y));const m=u(i,["googleSearchRetrieval"]);m!=null&&c(o,["googleSearchRetrieval"],m);const v=u(i,["urlContext"]);return v!=null&&c(o,["urlContext"],v),o}function kg(i,t){const o={},a=u(i,["retrieval"]);a!=null&&c(o,["retrieval"],a);const r=u(i,["computerUse"]);if(r!=null&&c(o,["computerUse"],r),u(i,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");const f=u(i,["codeExecution"]);f!=null&&c(o,["codeExecution"],f);const p=u(i,["enterpriseWebSearch"]);p!=null&&c(o,["enterpriseWebSearch"],p);const g=u(i,["functionDeclarations"]);if(g!=null){let E=g;Array.isArray(E)&&(E=E.map(A=>bC(A))),c(o,["functionDeclarations"],E)}const y=u(i,["googleMaps"]);y!=null&&c(o,["googleMaps"],y);const m=u(i,["googleSearch"]);m!=null&&c(o,["googleSearch"],m);const v=u(i,["googleSearchRetrieval"]);v!=null&&c(o,["googleSearchRetrieval"],v);const _=u(i,["urlContext"]);return _!=null&&c(o,["urlContext"],_),o}function wA(i,t){const o={},a=u(i,["baseModel"]);a!=null&&c(o,["baseModel"],a);const r=u(i,["createTime"]);r!=null&&c(o,["createTime"],r);const f=u(i,["updateTime"]);return f!=null&&c(o,["updateTime"],f),o}function bA(i,t){const o={},a=u(i,["labels","google-vertex-llm-tuning-base-model-id"]);a!=null&&c(o,["baseModel"],a);const r=u(i,["createTime"]);r!=null&&c(o,["createTime"],r);const f=u(i,["updateTime"]);return f!=null&&c(o,["updateTime"],f),o}function DA(i,t,o){const a={},r=u(i,["displayName"]);t!==void 0&&r!=null&&c(t,["displayName"],r);const f=u(i,["description"]);t!==void 0&&f!=null&&c(t,["description"],f);const p=u(i,["defaultCheckpointId"]);return t!==void 0&&p!=null&&c(t,["defaultCheckpointId"],p),a}function UA(i,t,o){const a={},r=u(i,["displayName"]);t!==void 0&&r!=null&&c(t,["displayName"],r);const f=u(i,["description"]);t!==void 0&&f!=null&&c(t,["description"],f);const p=u(i,["defaultCheckpointId"]);return t!==void 0&&p!=null&&c(t,["defaultCheckpointId"],p),a}function LA(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","name"],Ie(i,r));const f=u(t,["config"]);return f!=null&&DA(f,a),a}function GA(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["config"]);return f!=null&&UA(f,a),a}function HA(i,t,o){const a={},r=u(i,["outputGcsUri"]);t!==void 0&&r!=null&&c(t,["parameters","storageUri"],r);const f=u(i,["safetyFilterLevel"]);t!==void 0&&f!=null&&c(t,["parameters","safetySetting"],f);const p=u(i,["personGeneration"]);t!==void 0&&p!=null&&c(t,["parameters","personGeneration"],p);const g=u(i,["includeRaiReason"]);t!==void 0&&g!=null&&c(t,["parameters","includeRaiReason"],g);const y=u(i,["outputMimeType"]);t!==void 0&&y!=null&&c(t,["parameters","outputOptions","mimeType"],y);const m=u(i,["outputCompressionQuality"]);t!==void 0&&m!=null&&c(t,["parameters","outputOptions","compressionQuality"],m);const v=u(i,["enhanceInputImage"]);t!==void 0&&v!=null&&c(t,["parameters","upscaleConfig","enhanceInputImage"],v);const _=u(i,["imagePreservationFactor"]);t!==void 0&&_!=null&&c(t,["parameters","upscaleConfig","imagePreservationFactor"],_);const E=u(i,["labels"]);t!==void 0&&E!=null&&c(t,["labels"],E);const A=u(i,["numberOfImages"]);t!==void 0&&A!=null&&c(t,["parameters","sampleCount"],A);const I=u(i,["mode"]);return t!==void 0&&I!=null&&c(t,["parameters","mode"],I),a}function zA(i,t,o){const a={},r=u(t,["model"]);r!=null&&c(a,["_url","model"],Ie(i,r));const f=u(t,["image"]);f!=null&&c(a,["instances[0]","image"],jt(f));const p=u(t,["upscaleFactor"]);p!=null&&c(a,["parameters","upscaleConfig","upscaleFactor"],p);const g=u(t,["config"]);return g!=null&&HA(g,a),a}function kA(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["predictions"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>cs(p))),c(o,["generatedImages"],f)}return o}function VA(i,t){const o={},a=u(i,["uri"]);a!=null&&c(o,["uri"],a);const r=u(i,["encodedVideo"]);r!=null&&c(o,["videoBytes"],Wn(r));const f=u(i,["encoding"]);return f!=null&&c(o,["mimeType"],f),o}function qA(i,t){const o={},a=u(i,["gcsUri"]);a!=null&&c(o,["uri"],a);const r=u(i,["bytesBase64Encoded"]);r!=null&&c(o,["videoBytes"],Wn(r));const f=u(i,["mimeType"]);return f!=null&&c(o,["mimeType"],f),o}function OA(i,t){const o={},a=u(i,["image"]);a!=null&&c(o,["_self"],jt(a));const r=u(i,["maskMode"]);return r!=null&&c(o,["maskMode"],r),o}function BA(i,t){const o={},a=u(i,["image"]);a!=null&&c(o,["image"],fs(a));const r=u(i,["referenceType"]);return r!=null&&c(o,["referenceType"],r),o}function PA(i,t){const o={},a=u(i,["image"]);a!=null&&c(o,["image"],jt(a));const r=u(i,["referenceType"]);return r!=null&&c(o,["referenceType"],r),o}function Vg(i,t){const o={},a=u(i,["uri"]);a!=null&&c(o,["uri"],a);const r=u(i,["videoBytes"]);r!=null&&c(o,["encodedVideo"],Wn(r));const f=u(i,["mimeType"]);return f!=null&&c(o,["encoding"],f),o}function qg(i,t){const o={},a=u(i,["uri"]);a!=null&&c(o,["gcsUri"],a);const r=u(i,["videoBytes"]);r!=null&&c(o,["bytesBase64Encoded"],Wn(r));const f=u(i,["mimeType"]);return f!=null&&c(o,["mimeType"],f),o}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function FA(i,t){const o={},a=u(i,["displayName"]);return t!==void 0&&a!=null&&c(t,["displayName"],a),o}function YA(i){const t={},o=u(i,["config"]);return o!=null&&FA(o,t),t}function JA(i,t){const o={},a=u(i,["force"]);return t!==void 0&&a!=null&&c(t,["_query","force"],a),o}function KA(i){const t={},o=u(i,["name"]);o!=null&&c(t,["_url","name"],o);const a=u(i,["config"]);return a!=null&&JA(a,t),t}function XA(i){const t={},o=u(i,["name"]);return o!=null&&c(t,["_url","name"],o),t}function QA(i,t){const o={},a=u(i,["customMetadata"]);if(t!==void 0&&a!=null){let f=a;Array.isArray(f)&&(f=f.map(p=>p)),c(t,["customMetadata"],f)}const r=u(i,["chunkingConfig"]);return t!==void 0&&r!=null&&c(t,["chunkingConfig"],r),o}function ZA(i){const t={},o=u(i,["name"]);o!=null&&c(t,["name"],o);const a=u(i,["metadata"]);a!=null&&c(t,["metadata"],a);const r=u(i,["done"]);r!=null&&c(t,["done"],r);const f=u(i,["error"]);f!=null&&c(t,["error"],f);const p=u(i,["response"]);return p!=null&&c(t,["response"],WA(p)),t}function $A(i){const t={},o=u(i,["fileSearchStoreName"]);o!=null&&c(t,["_url","file_search_store_name"],o);const a=u(i,["fileName"]);a!=null&&c(t,["fileName"],a);const r=u(i,["config"]);return r!=null&&QA(r,t),t}function WA(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["parent"]);a!=null&&c(t,["parent"],a);const r=u(i,["documentName"]);return r!=null&&c(t,["documentName"],r),t}function jA(i,t){const o={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),o}function e1(i){const t={},o=u(i,["config"]);return o!=null&&jA(o,t),t}function t1(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["fileSearchStores"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>p)),c(t,["fileSearchStores"],f)}return t}function Og(i,t){const o={},a=u(i,["mimeType"]);t!==void 0&&a!=null&&c(t,["mimeType"],a);const r=u(i,["displayName"]);t!==void 0&&r!=null&&c(t,["displayName"],r);const f=u(i,["customMetadata"]);if(t!==void 0&&f!=null){let g=f;Array.isArray(g)&&(g=g.map(y=>y)),c(t,["customMetadata"],g)}const p=u(i,["chunkingConfig"]);return t!==void 0&&p!=null&&c(t,["chunkingConfig"],p),o}function n1(i){const t={},o=u(i,["fileSearchStoreName"]);o!=null&&c(t,["_url","file_search_store_name"],o);const a=u(i,["config"]);return a!=null&&Og(a,t),t}function i1(i){const t={},o=u(i,["sdkHttpResponse"]);return o!=null&&c(t,["sdkHttpResponse"],o),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const o1="Content-Type",l1="X-Server-Timeout",a1="User-Agent",ec="x-goog-api-client",s1="1.42.0",r1=`google-genai-sdk/${s1}`,u1="v1beta1",c1="v1beta",f1=5,d1=[408,429,500,502,503,504];class p1{constructor(t){var o,a,r;this.clientOptions=Object.assign({},t),this.customBaseUrl=(o=t.httpOptions)===null||o===void 0?void 0:o.baseUrl,this.clientOptions.vertexai&&(this.clientOptions.project&&this.clientOptions.location?this.clientOptions.apiKey=void 0:this.clientOptions.apiKey&&(this.clientOptions.project=void 0,this.clientOptions.location=void 0));const f={};if(this.clientOptions.vertexai){if(!this.clientOptions.location&&!this.clientOptions.apiKey&&!this.customBaseUrl&&(this.clientOptions.location="global"),!(this.clientOptions.project&&this.clientOptions.location||this.clientOptions.apiKey)&&!this.customBaseUrl)throw new Error("Authentication is not set up. Please provide either a project and location, or an API key, or a custom base URL.");const g=t.project&&t.location||!!t.apiKey;this.customBaseUrl&&!g?(f.baseUrl=this.customBaseUrl,this.clientOptions.project=void 0,this.clientOptions.location=void 0):this.clientOptions.apiKey||this.clientOptions.location==="global"?f.baseUrl="https://aiplatform.googleapis.com/":this.clientOptions.project&&this.clientOptions.location&&(f.baseUrl=`https://${this.clientOptions.location}-aiplatform.googleapis.com/`),f.apiVersion=(a=this.clientOptions.apiVersion)!==null&&a!==void 0?a:u1}else{if(!this.clientOptions.apiKey)throw new Tl({message:"API key must be set when using the Gemini API.",status:403});f.apiVersion=(r=this.clientOptions.apiVersion)!==null&&r!==void 0?r:c1,f.baseUrl="https://generativelanguage.googleapis.com/"}f.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=f,t.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(f,t.httpOptions))}isVertexAI(){var t;return(t=this.clientOptions.vertexai)!==null&&t!==void 0?t:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getCustomBaseUrl(){return this.customBaseUrl}async getAuthHeaders(){const t=new Headers;return await this.clientOptions.auth.addAuthHeaders(t),t}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(t){if(!t||t.baseUrl===void 0||t.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");const a=[t.baseUrl.endsWith("/")?t.baseUrl.slice(0,-1):t.baseUrl];return t.apiVersion&&t.apiVersion!==""&&a.push(t.apiVersion),a.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){const t=this.getBaseUrl(),o=new URL(t);return o.protocol=o.protocol=="http:"?"ws":"wss",o.toString()}setBaseUrl(t){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=t;else throw new Error("HTTP options are not correctly set.")}constructUrl(t,o,a){const r=[this.getRequestUrlInternal(o)];return a&&r.push(this.getBaseResourcePath()),t!==""&&r.push(t),new URL(`${r.join("/")}`)}shouldPrependVertexProjectPath(t,o){return!(o.baseUrl&&o.baseUrlResourceScope===Xu.COLLECTION||this.clientOptions.apiKey||!this.clientOptions.vertexai||t.path.startsWith("projects/")||t.httpMethod==="GET"&&t.path.startsWith("publishers/google/models"))}async request(t){let o=this.clientOptions.httpOptions;t.httpOptions&&(o=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const a=this.shouldPrependVertexProjectPath(t,o),r=this.constructUrl(t.path,o,a);if(t.queryParams)for(const[p,g]of Object.entries(t.queryParams))r.searchParams.append(p,String(g));let f={};if(t.httpMethod==="GET"){if(t.body&&t.body!=="{}")throw new Error("Request body should be empty for GET request, but got non empty request body")}else f.body=t.body;return f=await this.includeExtraHttpOptionsToRequestInit(f,o,r.toString(),t.abortSignal),this.unaryApiCall(r,f,t.httpMethod)}patchHttpOptions(t,o){const a=JSON.parse(JSON.stringify(t));for(const[r,f]of Object.entries(o))typeof f=="object"?a[r]=Object.assign(Object.assign({},a[r]),f):f!==void 0&&(a[r]=f);return a}async requestStream(t){let o=this.clientOptions.httpOptions;t.httpOptions&&(o=this.patchHttpOptions(this.clientOptions.httpOptions,t.httpOptions));const a=this.shouldPrependVertexProjectPath(t,o),r=this.constructUrl(t.path,o,a);(!r.searchParams.has("alt")||r.searchParams.get("alt")!=="sse")&&r.searchParams.set("alt","sse");let f={};return f.body=t.body,f=await this.includeExtraHttpOptionsToRequestInit(f,o,r.toString(),t.abortSignal),this.streamApiCall(r,f,t.httpMethod)}async includeExtraHttpOptionsToRequestInit(t,o,a,r){if(o&&o.timeout||r){const f=new AbortController,p=f.signal;if(o.timeout&&(o==null?void 0:o.timeout)>0){const g=setTimeout(()=>f.abort(),o.timeout);g&&typeof g.unref=="function"&&g.unref()}r&&r.addEventListener("abort",()=>{f.abort()}),t.signal=p}return o&&o.extraBody!==null&&h1(t,o.extraBody),t.headers=await this.getHeadersInternal(o,a),t}async unaryApiCall(t,o,a){return this.apiCall(t.toString(),Object.assign(Object.assign({},o),{method:a})).then(async r=>(await eg(r),new Qu(r))).catch(r=>{throw r instanceof Error?r:new Error(JSON.stringify(r))})}async streamApiCall(t,o,a){return this.apiCall(t.toString(),Object.assign(Object.assign({},o),{method:a})).then(async r=>(await eg(r),this.processStreamResponse(r))).catch(r=>{throw r instanceof Error?r:new Error(JSON.stringify(r))})}processStreamResponse(t){return $t(this,arguments,function*(){var a;const r=(a=t==null?void 0:t.body)===null||a===void 0?void 0:a.getReader(),f=new TextDecoder("utf-8");if(!r)throw new Error("Response body is empty");try{let p="";const g="data:",y=[` `,"\r\r",`\r \r `];for(;;){const{done:m,value:v}=yield se(r.read());if(m){if(p.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}const _=f.decode(v,{stream:!0});try{const I=JSON.parse(_);if("error"in I){const H=JSON.parse(JSON.stringify(I.error)),U=H.status,P=H.code,Q=`got status: ${U}. ${JSON.stringify(I)}`;if(P>=400&&P<600)throw new Tl({message:Q,status:P})}}catch(I){if(I.name==="ApiError")throw I}p+=_;let E=-1,A=0;for(;;){E=-1,A=0;for(const U of y){const P=p.indexOf(U);P!==-1&&(E===-1||P{const p=await fetch(t,o);if(p.ok)return p;throw d1.includes(p.status)?new Error(`Retryable HTTP Error: ${p.statusText}`):new Tg.AbortError(`Non-retryable exception ${p.statusText} sending request`)},{retries:((a=r.attempts)!==null&&a!==void 0?a:f1)-1})}getDefaultHeaders(){const t={},o=r1+" "+this.clientOptions.userAgentExtra;return t[a1]=o,t[ec]=o,t[o1]="application/json",t}async getHeadersInternal(t,o){const a=new Headers;if(t&&t.headers){for(const[r,f]of Object.entries(t.headers))a.append(r,f);t.timeout&&t.timeout>0&&a.append(l1,String(Math.ceil(t.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(a,o),a}getFileName(t){var o;let a="";return typeof t=="string"&&(a=t.replace(/[/\\]+$/,""),a=(o=a.split(/[/\\]/).pop())!==null&&o!==void 0?o:""),a}async uploadFile(t,o){var a;const r={};o!=null&&(r.mimeType=o.mimeType,r.name=o.name,r.displayName=o.displayName),r.name&&!r.name.startsWith("files/")&&(r.name=`files/${r.name}`);const f=this.clientOptions.uploader,p=await f.stat(t);r.sizeBytes=String(p.size);const g=(a=o==null?void 0:o.mimeType)!==null&&a!==void 0?a:p.type;if(g===void 0||g==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");r.mimeType=g;const y={file:r},m=this.getFileName(t),v=Z("upload/v1beta/files",y._url),_=await this.fetchUploadUrl(v,r.sizeBytes,r.mimeType,m,y,o==null?void 0:o.httpOptions);return f.upload(t,_,this)}async uploadFileToFileSearchStore(t,o,a){var r;const f=this.clientOptions.uploader,p=await f.stat(o),g=String(p.size),y=(r=a==null?void 0:a.mimeType)!==null&&r!==void 0?r:p.type;if(y===void 0||y==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");const m=`upload/v1beta/${t}:uploadToFileSearchStore`,v=this.getFileName(o),_={};a!=null&&Og(a,_);const E=await this.fetchUploadUrl(m,g,y,v,_,a==null?void 0:a.httpOptions);return f.uploadToFileSearchStore(o,E,this)}async downloadFile(t){await this.clientOptions.downloader.download(t,this)}async fetchUploadUrl(t,o,a,r,f,p){var g;let y={};p?y=p:y={apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${o}`,"X-Goog-Upload-Header-Content-Type":`${a}`},r?{"X-Goog-Upload-File-Name":r}:{})};const m=await this.request({path:t,body:JSON.stringify(f),httpMethod:"POST",httpOptions:y});if(!m||!(m!=null&&m.headers))throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");const v=(g=m==null?void 0:m.headers)===null||g===void 0?void 0:g["x-goog-upload-url"];if(v===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return v}}async function eg(i){var t;if(i===void 0)throw new Error("response is undefined");if(!i.ok){const o=i.status;let a;!((t=i.headers.get("content-type"))===null||t===void 0)&&t.includes("application/json")?a=await i.json():a={error:{message:await i.text(),code:i.status,status:i.statusText}};const r=JSON.stringify(a);throw o>=400&&o<600?new Tl({message:r,status:o}):new Error(r)}}function h1(i,t){if(!t||Object.keys(t).length===0)return;if(i.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let o={};if(typeof i.body=="string"&&i.body.length>0)try{const f=JSON.parse(i.body);if(typeof f=="object"&&f!==null&&!Array.isArray(f))o=f;else{console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying extraBody to the request body.");return}}catch{console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function a(f,p){const g=Object.assign({},f);for(const y in p)if(Object.prototype.hasOwnProperty.call(p,y)){const m=p[y],v=g[y];m&&typeof m=="object"&&!Array.isArray(m)&&v&&typeof v=="object"&&!Array.isArray(v)?g[y]=a(v,m):(v&&m&&typeof v!=typeof m&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${y}". Original type: ${typeof v}, New type: ${typeof m}. Overwriting.`),g[y]=m)}return g}const r=a(o,t);i.body=JSON.stringify(r)}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const m1="mcp_used/unknown";let g1=!1;function Bg(i){for(const t of i)if(y1(t)||typeof t=="object"&&"inputSchema"in t)return!0;return g1}function Pg(i){var t;const o=(t=i[ec])!==null&&t!==void 0?t:"";i[ec]=(o+` ${m1}`).trimStart()}function y1(i){return i!==null&&typeof i=="object"&&i instanceof gc}function v1(i){return $t(this,arguments,function*(o,a=100){let r,f=0;for(;f0)return;const f={},p=[];for(const v of this.mcpClients)try{for(var g=!0,y=(o=void 0,Wt(v1(v))),m;m=await y.next(),t=m.done,!t;g=!0){r=m.value,g=!1;const _=r;p.push(_);const E=_.name;if(f[E])throw new Error(`Duplicate function name ${E} found in MCP tools. Please ensure function names are unique.`);f[E]=v}}catch(_){o={error:_}}finally{try{!g&&!t&&(a=y.return)&&await a.call(y)}finally{if(o)throw o.error}}this.mcpTools=p,this.functionNameToMcpClient=f}async tool(){return await this.initialize(),F_(this.mcpTools,this.config)}async callTool(t){await this.initialize();const o=[];for(const a of t)if(a.name in this.functionNameToMcpClient){const r=this.functionNameToMcpClient[a.name];let f;this.config.timeout&&(f={timeout:this.config.timeout});const p=await r.callTool({name:a.name,arguments:a.args},void 0,f);o.push({functionResponse:{name:a.name,response:p.isError?{error:p}:p}})}return o}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */async function T1(i,t,o){const a=new H_;let r;o.data instanceof Blob?r=JSON.parse(await o.data.text()):r=JSON.parse(o.data),Object.assign(a,r),t(a)}class _1{constructor(t,o,a){this.apiClient=t,this.auth=o,this.webSocketFactory=a}async connect(t){var o,a;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 r=this.apiClient.getWebsocketBaseUrl(),f=this.apiClient.getApiVersion(),p=C1(this.apiClient.getDefaultHeaders()),g=this.apiClient.getApiKey(),y=`${r}/ws/google.ai.generativelanguage.${f}.GenerativeService.BidiGenerateMusic?key=${g}`;let m=()=>{};const v=new Promise(F=>{m=F}),_=t.callbacks,E=function(){m({})},A=this.apiClient,I={onopen:E,onmessage:F=>{T1(A,_.onmessage,F)},onerror:(o=_==null?void 0:_.onerror)!==null&&o!==void 0?o:function(F){},onclose:(a=_==null?void 0:_.onclose)!==null&&a!==void 0?a:function(F){}},H=this.webSocketFactory.create(y,S1(p),I);H.connect(),await v;const Q={setup:{model:Ie(this.apiClient,t.model)}};return H.send(JSON.stringify(Q)),new E1(H,this.apiClient)}}class E1{constructor(t,o){this.conn=t,this.apiClient=o}async setWeightedPrompts(t){if(!t.weightedPrompts||Object.keys(t.weightedPrompts).length===0)throw new Error("Weighted prompts must be set and contain at least one entry.");const o=FS(t);this.conn.send(JSON.stringify({clientContent:o}))}async setMusicGenerationConfig(t){t.musicGenerationConfig||(t.musicGenerationConfig={});const o=PS(t);this.conn.send(JSON.stringify(o))}sendPlaybackControl(t){const o={playbackControl:t};this.conn.send(JSON.stringify(o))}play(){this.sendPlaybackControl(co.PLAY)}pause(){this.sendPlaybackControl(co.PAUSE)}stop(){this.sendPlaybackControl(co.STOP)}resetContext(){this.sendPlaybackControl(co.RESET_CONTEXT)}close(){this.conn.close()}}function S1(i){const t={};return i.forEach((o,a)=>{t[a]=o}),t}function C1(i){const t=new Headers;for(const[o,a]of Object.entries(i))t.append(o,a);return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const A1="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function x1(i,t,o){const a=new G_;let r;o.data instanceof Blob?r=await o.data.text():o.data instanceof ArrayBuffer?r=new TextDecoder().decode(o.data):r=o.data;const f=JSON.parse(r);if(i.isVertexAI()){const p=KS(f);Object.assign(a,p)}else Object.assign(a,f);t(a)}class R1{constructor(t,o,a){this.apiClient=t,this.auth=o,this.webSocketFactory=a,this.music=new _1(this.apiClient,this.auth,this.webSocketFactory)}async connect(t){var o,a,r,f,p,g;if(t.config&&t.config.httpOptions)throw new Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");const y=this.apiClient.getWebsocketBaseUrl(),m=this.apiClient.getApiVersion();let v;const _=this.apiClient.getHeaders();t.config&&t.config.tools&&Bg(t.config.tools)&&Pg(_);const E=w1(_);if(this.apiClient.isVertexAI()){const W=this.apiClient.getProject(),de=this.apiClient.getLocation(),ce=this.apiClient.getApiKey(),Re=!!W&&!!de||!!ce;this.apiClient.getCustomBaseUrl()&&!Re?v=y:(v=`${y}/ws/google.cloud.aiplatform.${m}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(E,v))}else{const W=this.apiClient.getApiKey();let de="BidiGenerateContent",ce="key";W!=null&&W.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),m!=="v1alpha"&&console.warn("Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection."),de="BidiGenerateContentConstrained",ce="access_token"),v=`${y}/ws/google.ai.generativelanguage.${m}.GenerativeService.${de}?${ce}=${W}`}let A=()=>{};const I=new Promise(W=>{A=W}),H=t.callbacks,U=function(){var W;(W=H==null?void 0:H.onopen)===null||W===void 0||W.call(H),A({})},P=this.apiClient,Q={onopen:U,onmessage:W=>{x1(P,H.onmessage,W)},onerror:(o=H==null?void 0:H.onerror)!==null&&o!==void 0?o:function(W){},onclose:(a=H==null?void 0:H.onclose)!==null&&a!==void 0?a:function(W){}},F=this.webSocketFactory.create(v,I1(E),Q);F.connect(),await I;let J=Ie(this.apiClient,t.model);if(this.apiClient.isVertexAI()&&J.startsWith("publishers/")){const W=this.apiClient.getProject(),de=this.apiClient.getLocation();W&&de&&(J=`projects/${W}/locations/${de}/`+J)}let ee={};this.apiClient.isVertexAI()&&((r=t.config)===null||r===void 0?void 0:r.responseModalities)===void 0&&(t.config===void 0?t.config={responseModalities:[is.AUDIO]}:t.config.responseModalities=[is.AUDIO]),!((f=t.config)===null||f===void 0)&&f.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 B=(g=(p=t.config)===null||p===void 0?void 0:p.tools)!==null&&g!==void 0?g:[],X=[];for(const W of B)if(this.isCallableTool(W)){const de=W;X.push(await de.tool())}else X.push(W);X.length>0&&(t.config.tools=X);const me={model:J,config:t.config,callbacks:t.callbacks};return this.apiClient.isVertexAI()?ee=BS(this.apiClient,me):ee=OS(this.apiClient,me),delete ee.config,F.send(JSON.stringify(ee)),new M1(F,this.apiClient)}isCallableTool(t){return"callTool"in t&&typeof t.callTool=="function"}}const N1={turnComplete:!0};class M1{constructor(t,o){this.conn=t,this.apiClient=o}tLiveClientContent(t,o){if(o.turns!==null&&o.turns!==void 0){let a=[];try{a=Gt(o.turns),t.isVertexAI()||(a=a.map(r=>_l(r)))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof o.turns}'`)}return{clientContent:{turns:a,turnComplete:o.turnComplete}}}return{clientContent:{turnComplete:o.turnComplete}}}tLiveClienttToolResponse(t,o){let a=[];if(o.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(o.functionResponses)?a=o.functionResponses:a=[o.functionResponses],a.length===0)throw new Error("functionResponses is required.");for(const f of a){if(typeof f!="object"||f===null||!("name"in f)||!("response"in f))throw new Error(`Could not parse function response, type '${typeof f}'.`);if(!t.isVertexAI()&&!("id"in f))throw new Error(A1)}return{toolResponse:{functionResponses:a}}}sendClientContent(t){t=Object.assign(Object.assign({},N1),t);const o=this.tLiveClientContent(this.apiClient,t);this.conn.send(JSON.stringify(o))}sendRealtimeInput(t){let o={};this.apiClient.isVertexAI()?o={realtimeInput:JS(t)}:o={realtimeInput:YS(t)},this.conn.send(JSON.stringify(o))}sendToolResponse(t){if(t.functionResponses==null)throw new Error("Tool response parameters are required.");const o=this.tLiveClienttToolResponse(this.apiClient,t);this.conn.send(JSON.stringify(o))}close(){this.conn.close()}}function I1(i){const t={};return i.forEach((o,a)=>{t[a]=o}),t}function w1(i){const t=new Headers;for(const[o,a]of Object.entries(i))t.append(o,a);return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const tg=10;function ng(i){var t,o,a;if(!((t=i==null?void 0:i.automaticFunctionCalling)===null||t===void 0)&&t.disable)return!0;let r=!1;for(const p of(o=i==null?void 0:i.tools)!==null&&o!==void 0?o:[])if(ho(p)){r=!0;break}if(!r)return!0;const f=(a=i==null?void 0:i.automaticFunctionCalling)===null||a===void 0?void 0:a.maximumRemoteCalls;return f&&(f<0||!Number.isInteger(f))||f==0?(console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a valid integer value greater than 0. maximumRemoteCalls provided:",f),!0):!1}function ho(i){return"callTool"in i&&typeof i.callTool=="function"}function b1(i){var t,o,a;return(a=(o=(t=i.config)===null||t===void 0?void 0:t.tools)===null||o===void 0?void 0:o.some(r=>ho(r)))!==null&&a!==void 0?a:!1}function ig(i){var t;const o=[];return!((t=i==null?void 0:i.config)===null||t===void 0)&&t.tools&&i.config.tools.forEach((a,r)=>{if(ho(a))return;const f=a;f.functionDeclarations&&f.functionDeclarations.length>0&&o.push(r)}),o}function og(i){var t;return!(!((t=i==null?void 0:i.automaticFunctionCalling)===null||t===void 0)&&t.ignoreCallHistory)}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class D1 extends xn{constructor(t){super(),this.apiClient=t,this.embedContent=async o=>{if(!this.apiClient.isVertexAI())return await this.embedContentInternal(o);if(o.model.includes("gemini")&&o.model!=="gemini-embedding-001"||o.model.includes("maas")){const r=Gt(o.contents);if(r.length>1)throw new Error("The embedContent API for this model only supports one content at a time.");const f=Object.assign(Object.assign({},o),{content:r[0],embeddingApiType:os.EMBED_CONTENT});return await this.embedContentInternal(f)}else{const r=Object.assign(Object.assign({},o),{embeddingApiType:os.PREDICT});return await this.embedContentInternal(r)}},this.generateContent=async o=>{var a,r,f,p,g;const y=await this.processParamsMaybeAddMcpUsage(o);if(this.maybeMoveToResponseJsonSchem(o),!b1(o)||ng(o.config))return await this.generateContentInternal(y);const m=ig(o);if(m.length>0){const H=m.map(U=>`tools[${U}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${H}.`)}let v,_;const E=Gt(y.contents),A=(f=(r=(a=y.config)===null||a===void 0?void 0:a.automaticFunctionCalling)===null||r===void 0?void 0:r.maximumRemoteCalls)!==null&&f!==void 0?f:tg;let I=0;for(;I{var a,r,f,p,g;if(this.maybeMoveToResponseJsonSchem(o),ng(o.config)){const _=await this.processParamsMaybeAddMcpUsage(o);return await this.generateContentStreamInternal(_)}const y=ig(o);if(y.length>0){const _=y.map(E=>`tools[${E}]`).join(", ");throw new Error(`Incompatible tools found at ${_}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}const m=(f=(r=(a=o==null?void 0:o.config)===null||a===void 0?void 0:a.toolConfig)===null||r===void 0?void 0:r.functionCallingConfig)===null||f===void 0?void 0:f.streamFunctionCallArguments,v=(g=(p=o==null?void 0:o.config)===null||p===void 0?void 0:p.automaticFunctionCalling)===null||g===void 0?void 0:g.disable;if(m&&!v)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(o)},this.generateImages=async o=>await this.generateImagesInternal(o).then(a=>{var r;let f;const p=[];if(a!=null&&a.generatedImages)for(const y of a.generatedImages)y&&(y!=null&&y.safetyAttributes)&&((r=y==null?void 0:y.safetyAttributes)===null||r===void 0?void 0:r.contentType)==="Positive Prompt"?f=y==null?void 0:y.safetyAttributes:p.push(y);let g;return f?g={generatedImages:p,positivePromptSafetyAttributes:f,sdkHttpResponse:a.sdkHttpResponse}:g={generatedImages:p,sdkHttpResponse:a.sdkHttpResponse},g}),this.list=async o=>{var a;const p={config:Object.assign(Object.assign({},{queryBase:!0}),o==null?void 0:o.config)};if(this.apiClient.isVertexAI()&&!p.config.queryBase){if(!((a=p.config)===null||a===void 0)&&a.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");p.config.filter="labels.tune-type:*"}return new Ei(An.PAGED_ITEM_MODELS,g=>this.listInternal(g),await this.listInternal(p),p)},this.editImage=async o=>{const a={model:o.model,prompt:o.prompt,referenceImages:[],config:o.config};return o.referenceImages&&o.referenceImages&&(a.referenceImages=o.referenceImages.map(r=>r.toReferenceImageAPI())),await this.editImageInternal(a)},this.upscaleImage=async o=>{let a={numberOfImages:1,mode:"upscale"};o.config&&(a=Object.assign(Object.assign({},a),o.config));const r={model:o.model,image:o.image,upscaleFactor:o.upscaleFactor,config:a};return await this.upscaleImageInternal(r)},this.generateVideos=async o=>{var a,r,f,p,g,y;if((o.prompt||o.image||o.video)&&o.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return this.apiClient.isVertexAI()||(!((a=o.video)===null||a===void 0)&&a.uri&&(!((r=o.video)===null||r===void 0)&&r.videoBytes)?o.video={uri:o.video.uri,mimeType:o.video.mimeType}:!((p=(f=o.source)===null||f===void 0?void 0:f.video)===null||p===void 0)&&p.uri&&(!((y=(g=o.source)===null||g===void 0?void 0:g.video)===null||y===void 0)&&y.videoBytes)&&(o.source.video={uri:o.source.video.uri,mimeType:o.source.video.mimeType})),await this.generateVideosInternal(o)}}maybeMoveToResponseJsonSchem(t){t.config&&t.config.responseSchema&&(t.config.responseJsonSchema||Object.keys(t.config.responseSchema).includes("$schema")&&(t.config.responseJsonSchema=t.config.responseSchema,delete t.config.responseSchema))}async processParamsMaybeAddMcpUsage(t){var o,a,r;const f=(o=t.config)===null||o===void 0?void 0:o.tools;if(!f)return t;const p=await Promise.all(f.map(async y=>ho(y)?await y.tool():y)),g={model:t.model,contents:t.contents,config:Object.assign(Object.assign({},t.config),{tools:p})};if(g.config.tools=p,t.config&&t.config.tools&&Bg(t.config.tools)){const y=(r=(a=t.config.httpOptions)===null||a===void 0?void 0:a.headers)!==null&&r!==void 0?r:{};let m=Object.assign({},y);Object.keys(m).length===0&&(m=this.apiClient.getDefaultHeaders()),Pg(m),g.config.httpOptions=Object.assign(Object.assign({},t.config.httpOptions),{headers:m})}return g}async initAfcToolsMap(t){var o,a,r;const f=new Map;for(const p of(a=(o=t.config)===null||o===void 0?void 0:o.tools)!==null&&a!==void 0?a:[])if(ho(p)){const g=p,y=await g.tool();for(const m of(r=y.functionDeclarations)!==null&&r!==void 0?r:[]){if(!m.name)throw new Error("Function declaration name is required.");if(f.has(m.name))throw new Error(`Duplicate tool declaration name: ${m.name}`);f.set(m.name,g)}}return f}async processAfcStream(t){var o,a,r;const f=(r=(a=(o=t.config)===null||o===void 0?void 0:o.automaticFunctionCalling)===null||a===void 0?void 0:a.maximumRemoteCalls)!==null&&r!==void 0?r:tg;let p=!1,g=0;const y=await this.initAfcToolsMap(t);return(function(m,v,_){return $t(this,arguments,function*(){for(var E,A,I,H,U,P;g0){p=!0;const W=new gl;W.candidates=[{content:{role:"user",parts:X}}],yield yield se(W);const de=[];de.push(...me),de.push({role:"user",parts:X});const ce=Gt(_.contents).concat(de);_.contents=ce}else break}})})(this,y,t)}async generateContentInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=$m(this.apiClient,t);return g=Z("{model}:generateContent",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=jm(v),E=new gl;return Object.assign(E,_),E})}else{const m=Zm(this.apiClient,t);return g=Z("{model}:generateContent",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=Wm(v),E=new gl;return Object.assign(E,_),E})}}async generateContentStreamInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=$m(this.apiClient,t);return g=Z("{model}:streamGenerateContent?alt=sse",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.requestStream({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}),p.then(function(_){return $t(this,arguments,function*(){var E,A,I,H;try{for(var U=!0,P=Wt(_),Q;Q=yield se(P.next()),E=Q.done,!E;U=!0){H=Q.value,U=!1;const F=H,J=jm(yield se(F.json()),t);J.sdkHttpResponse={headers:F.headers};const ee=new gl;Object.assign(ee,J),yield yield se(ee)}}catch(F){A={error:F}}finally{try{!U&&!E&&(I=P.return)&&(yield se(I.call(P)))}finally{if(A)throw A.error}}})})}else{const m=Zm(this.apiClient,t);return g=Z("{model}:streamGenerateContent?alt=sse",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.requestStream({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}),p.then(function(_){return $t(this,arguments,function*(){var E,A,I,H;try{for(var U=!0,P=Wt(_),Q;Q=yield se(P.next()),E=Q.done,!E;U=!0){H=Q.value,U=!1;const F=H,J=Wm(yield se(F.json()),t);J.sdkHttpResponse={headers:F.headers};const ee=new gl;Object.assign(ee,J),yield yield se(ee)}}catch(F){A={error:F}}finally{try{!U&&!E&&(I=P.return)&&(yield se(I.call(P)))}finally{if(A)throw A.error}}})})}}async embedContentInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=AC(this.apiClient,t,t),v=J_(t.model)?"{model}:embedContent":"{model}:predict";return g=Z(v,m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(_=>_.json().then(E=>{const A=E;return A.sdkHttpResponse={headers:_.headers},A})),p.then(_=>{const E=RC(_,t),A=new Um;return Object.assign(A,E),A})}else{const m=CC(this.apiClient,t);return g=Z("{model}:batchEmbedContents",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=xC(v),E=new Um;return Object.assign(E,_),E})}}async generateImagesInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=zC(this.apiClient,t);return g=Z("{model}:predict",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=VC(v),E=new Lm;return Object.assign(E,_),E})}else{const m=HC(this.apiClient,t);return g=Z("{model}:predict",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=kC(v),E=new Lm;return Object.assign(E,_),E})}}async editImageInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI()){const g=TC(this.apiClient,t);return f=Z("{model}:predict",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(m=>{const v=m;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const m=_C(y),v=new C_;return Object.assign(v,m),v})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI()){const g=zA(this.apiClient,t);return f=Z("{model}:predict",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(m=>{const v=m;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const m=kA(y),v=new A_;return Object.assign(v,m),v})}else throw new Error("This method is only supported by the Vertex AI.")}async recontextImage(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI()){const g=vA(this.apiClient,t);return f=Z("{model}:predict",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const m=TA(y),v=new x_;return Object.assign(v,m),v})}else throw new Error("This method is only supported by the Vertex AI.")}async segmentImage(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI()){const g=xA(this.apiClient,t);return f=Z("{model}:predict",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const m=RA(y),v=new R_;return Object.assign(v,m),v})}else throw new Error("This method is only supported by the Vertex AI.")}async get(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=nA(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),p.then(v=>ju(v))}else{const m=tA(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),p.then(v=>Wu(v))}}async listInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=fA(this.apiClient,t);return g=Z("{models_url}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=pA(v),E=new Gm;return Object.assign(E,_),E})}else{const m=cA(this.apiClient,t);return g=Z("{models_url}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=dA(v),E=new Gm;return Object.assign(E,_),E})}}async update(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=GA(this.apiClient,t);return g=Z("{model}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"PATCH",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),p.then(v=>ju(v))}else{const m=LA(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"PATCH",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),p.then(v=>Wu(v))}}async delete(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=mC(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=yC(v),E=new Hm;return Object.assign(E,_),E})}else{const m=hC(this.apiClient,t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"DELETE",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=gC(v),E=new Hm;return Object.assign(E,_),E})}}async countTokens(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=fC(this.apiClient,t);return g=Z("{model}:countTokens",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=pC(v),E=new zm;return Object.assign(E,_),E})}else{const m=cC(this.apiClient,t);return g=Z("{model}:countTokens",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=dC(v),E=new zm;return Object.assign(E,_),E})}}async computeTokens(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI()){const g=iC(this.apiClient,t);return f=Z("{model}:computeTokens",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(m=>{const v=m;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>{const m=oC(y),v=new N_;return Object.assign(v,m),v})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideosInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=YC(this.apiClient,t);return g=Z("{model}:predictLongRunning",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),p.then(v=>{const _=PC(v),E=new ls;return Object.assign(E,_),E})}else{const m=FC(this.apiClient,t);return g=Z("{model}:predictLongRunning",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),p.then(v=>{const _=BC(v),E=new ls;return Object.assign(E,_),E})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class U1 extends xn{constructor(t){super(),this.apiClient=t}async getVideosOperation(t){const o=t.operation,a=t.config;if(o.name===void 0||o.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const r=o.name.split("/operations/")[0];let f;a&&"httpOptions"in a&&(f=a.httpOptions);const p=await this.fetchPredictVideosOperationInternal({operationName:o.name,resourceName:r,config:{httpOptions:f}});return o._fromAPIResponse({apiResponse:p,_isVertexAI:!0})}else{const r=await this.getVideosOperationInternal({operationName:o.name,config:a});return o._fromAPIResponse({apiResponse:r,_isVertexAI:!1})}}async get(t){const o=t.operation,a=t.config;if(o.name===void 0||o.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){const r=o.name.split("/operations/")[0];let f;a&&"httpOptions"in a&&(f=a.httpOptions);const p=await this.fetchPredictVideosOperationInternal({operationName:o.name,resourceName:r,config:{httpOptions:f}});return o._fromAPIResponse({apiResponse:p,_isVertexAI:!0})}else{const r=await this.getVideosOperationInternal({operationName:o.name,config:a});return o._fromAPIResponse({apiResponse:r,_isVertexAI:!1})}}async getVideosOperationInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=y_(t);return g=Z("{operationName}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json()),p}else{const m=g_(t);return g=Z("{operationName}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json()),p}}async fetchPredictVideosOperationInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI()){const g=u_(t);return f=Z("{resourceName}:fetchPredictOperation",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r}else throw new Error("This method is only supported by the Vertex AI.")}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function L1(i){const t={},o=u(i,["data"]);if(o!=null&&c(t,["data"],o),u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function G1(i){const t={},o=u(i,["parts"]);if(o!=null){let r=o;Array.isArray(r)&&(r=r.map(f=>F1(f))),c(t,["parts"],r)}const a=u(i,["role"]);return a!=null&&c(t,["role"],a),t}function H1(i,t,o){const a={},r=u(t,["expireTime"]);o!==void 0&&r!=null&&c(o,["expireTime"],r);const f=u(t,["newSessionExpireTime"]);o!==void 0&&f!=null&&c(o,["newSessionExpireTime"],f);const p=u(t,["uses"]);o!==void 0&&p!=null&&c(o,["uses"],p);const g=u(t,["liveConnectConstraints"]);o!==void 0&&g!=null&&c(o,["bidiGenerateContentSetup"],P1(i,g));const y=u(t,["lockAdditionalFields"]);return o!==void 0&&y!=null&&c(o,["fieldMask"],y),a}function z1(i,t){const o={},a=u(t,["config"]);return a!=null&&c(o,["config"],H1(i,a,o)),o}function k1(i){const t={};if(u(i,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");const o=u(i,["fileUri"]);o!=null&&c(t,["fileUri"],o);const a=u(i,["mimeType"]);return a!=null&&c(t,["mimeType"],a),t}function V1(i){const t={},o=u(i,["id"]);o!=null&&c(t,["id"],o);const a=u(i,["args"]);a!=null&&c(t,["args"],a);const r=u(i,["name"]);if(r!=null&&c(t,["name"],r),u(i,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(u(i,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return t}function q1(i){const t={};if(u(i,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");const o=u(i,["enableWidget"]);return o!=null&&c(t,["enableWidget"],o),t}function O1(i){const t={};if(u(i,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(u(i,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");const o=u(i,["timeRangeFilter"]);return o!=null&&c(t,["timeRangeFilter"],o),t}function B1(i,t){const o={},a=u(i,["generationConfig"]);t!==void 0&&a!=null&&c(t,["setup","generationConfig"],a);const r=u(i,["responseModalities"]);t!==void 0&&r!=null&&c(t,["setup","generationConfig","responseModalities"],r);const f=u(i,["temperature"]);t!==void 0&&f!=null&&c(t,["setup","generationConfig","temperature"],f);const p=u(i,["topP"]);t!==void 0&&p!=null&&c(t,["setup","generationConfig","topP"],p);const g=u(i,["topK"]);t!==void 0&&g!=null&&c(t,["setup","generationConfig","topK"],g);const y=u(i,["maxOutputTokens"]);t!==void 0&&y!=null&&c(t,["setup","generationConfig","maxOutputTokens"],y);const m=u(i,["mediaResolution"]);t!==void 0&&m!=null&&c(t,["setup","generationConfig","mediaResolution"],m);const v=u(i,["seed"]);t!==void 0&&v!=null&&c(t,["setup","generationConfig","seed"],v);const _=u(i,["speechConfig"]);t!==void 0&&_!=null&&c(t,["setup","generationConfig","speechConfig"],mc(_));const E=u(i,["thinkingConfig"]);t!==void 0&&E!=null&&c(t,["setup","generationConfig","thinkingConfig"],E);const A=u(i,["enableAffectiveDialog"]);t!==void 0&&A!=null&&c(t,["setup","generationConfig","enableAffectiveDialog"],A);const I=u(i,["systemInstruction"]);t!==void 0&&I!=null&&c(t,["setup","systemInstruction"],G1(lt(I)));const H=u(i,["tools"]);if(t!==void 0&&H!=null){let B=go(H);Array.isArray(B)&&(B=B.map(X=>J1(mo(X)))),c(t,["setup","tools"],B)}const U=u(i,["sessionResumption"]);t!==void 0&&U!=null&&c(t,["setup","sessionResumption"],Y1(U));const P=u(i,["inputAudioTranscription"]);t!==void 0&&P!=null&&c(t,["setup","inputAudioTranscription"],P);const Q=u(i,["outputAudioTranscription"]);t!==void 0&&Q!=null&&c(t,["setup","outputAudioTranscription"],Q);const F=u(i,["realtimeInputConfig"]);t!==void 0&&F!=null&&c(t,["setup","realtimeInputConfig"],F);const J=u(i,["contextWindowCompression"]);t!==void 0&&J!=null&&c(t,["setup","contextWindowCompression"],J);const ee=u(i,["proactivity"]);if(t!==void 0&&ee!=null&&c(t,["setup","proactivity"],ee),u(i,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return o}function P1(i,t){const o={},a=u(t,["model"]);a!=null&&c(o,["setup","model"],Ie(i,a));const r=u(t,["config"]);return r!=null&&c(o,["config"],B1(r,o)),o}function F1(i){const t={},o=u(i,["mediaResolution"]);o!=null&&c(t,["mediaResolution"],o);const a=u(i,["codeExecutionResult"]);a!=null&&c(t,["codeExecutionResult"],a);const r=u(i,["executableCode"]);r!=null&&c(t,["executableCode"],r);const f=u(i,["fileData"]);f!=null&&c(t,["fileData"],k1(f));const p=u(i,["functionCall"]);p!=null&&c(t,["functionCall"],V1(p));const g=u(i,["functionResponse"]);g!=null&&c(t,["functionResponse"],g);const y=u(i,["inlineData"]);y!=null&&c(t,["inlineData"],L1(y));const m=u(i,["text"]);m!=null&&c(t,["text"],m);const v=u(i,["thought"]);v!=null&&c(t,["thought"],v);const _=u(i,["thoughtSignature"]);_!=null&&c(t,["thoughtSignature"],_);const E=u(i,["videoMetadata"]);return E!=null&&c(t,["videoMetadata"],E),t}function Y1(i){const t={},o=u(i,["handle"]);if(o!=null&&c(t,["handle"],o),u(i,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return t}function J1(i){const t={};if(u(i,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");const o=u(i,["computerUse"]);o!=null&&c(t,["computerUse"],o);const a=u(i,["fileSearch"]);a!=null&&c(t,["fileSearch"],a);const r=u(i,["codeExecution"]);if(r!=null&&c(t,["codeExecution"],r),u(i,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");const f=u(i,["functionDeclarations"]);if(f!=null){let v=f;Array.isArray(v)&&(v=v.map(_=>_)),c(t,["functionDeclarations"],v)}const p=u(i,["googleMaps"]);p!=null&&c(t,["googleMaps"],q1(p));const g=u(i,["googleSearch"]);g!=null&&c(t,["googleSearch"],O1(g));const y=u(i,["googleSearchRetrieval"]);y!=null&&c(t,["googleSearchRetrieval"],y);const m=u(i,["urlContext"]);return m!=null&&c(t,["urlContext"],m),t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function K1(i){const t=[];for(const o in i)if(Object.prototype.hasOwnProperty.call(i,o)){const a=i[o];if(typeof a=="object"&&a!=null&&Object.keys(a).length>0){const r=Object.keys(a).map(f=>`${o}.${f}`);t.push(...r)}else t.push(o)}return t.join(",")}function X1(i,t){let o=null;const a=i.bidiGenerateContentSetup;if(typeof a=="object"&&a!==null&&"setup"in a){const f=a.setup;typeof f=="object"&&f!==null?(i.bidiGenerateContentSetup=f,o=f):delete i.bidiGenerateContentSetup}else a!==void 0&&delete i.bidiGenerateContentSetup;const r=i.fieldMask;if(o){const f=K1(o);if(Array.isArray(t==null?void 0:t.lockAdditionalFields)&&(t==null?void 0:t.lockAdditionalFields.length)===0)f?i.fieldMask=f:delete i.fieldMask;else if(t!=null&&t.lockAdditionalFields&&t.lockAdditionalFields.length>0&&r!==null&&Array.isArray(r)&&r.length>0){const p=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"];let g=[];r.length>0&&(g=r.map(m=>p.includes(m)?`generationConfig.${m}`:m));const y=[];f&&y.push(f),g.length>0&&y.push(...g),y.length>0?i.fieldMask=y.join(","):delete i.fieldMask}else delete i.fieldMask}else r!==null&&Array.isArray(r)&&r.length>0?i.fieldMask=r.join(","):delete i.fieldMask;return i}class Q1 extends xn{constructor(t){super(),this.apiClient=t}async create(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{const g=z1(this.apiClient,t);f=Z("auth_tokens",g._url),p=g._query,delete g.config,delete g._url,delete g._query;const y=X1(g,t.config);return r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(y),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(m=>m.json()),r.then(m=>m)}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function Z1(i,t){const o={},a=u(i,["force"]);return t!==void 0&&a!=null&&c(t,["_query","force"],a),o}function $1(i){const t={},o=u(i,["name"]);o!=null&&c(t,["_url","name"],o);const a=u(i,["config"]);return a!=null&&Z1(a,t),t}function W1(i){const t={},o=u(i,["name"]);return o!=null&&c(t,["_url","name"],o),t}function j1(i,t){const o={},a=u(i,["pageSize"]);t!==void 0&&a!=null&&c(t,["_query","pageSize"],a);const r=u(i,["pageToken"]);return t!==void 0&&r!=null&&c(t,["_query","pageToken"],r),o}function ex(i){const t={},o=u(i,["parent"]);o!=null&&c(t,["_url","parent"],o);const a=u(i,["config"]);return a!=null&&j1(a,t),t}function tx(i){const t={},o=u(i,["sdkHttpResponse"]);o!=null&&c(t,["sdkHttpResponse"],o);const a=u(i,["nextPageToken"]);a!=null&&c(t,["nextPageToken"],a);const r=u(i,["documents"]);if(r!=null){let f=r;Array.isArray(f)&&(f=f.map(p=>p)),c(t,["documents"],f)}return t}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class nx extends xn{constructor(t){super(),this.apiClient=t,this.list=async o=>new Ei(An.PAGED_ITEM_DOCUMENTS,a=>this.listInternal({parent:o.parent,config:a.config}),await this.listInternal(o),o)}async get(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=W1(t);return f=Z("{name}",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var o,a;let r="",f={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const p=$1(t);r=Z("{name}",p._url),f=p._query,delete p._url,delete p._query,await this.apiClient.request({path:r,queryParams:f,body:JSON.stringify(p),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}}async listInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=ex(t);return f=Z("{parent}/documents",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const m=tx(y),v=new M_;return Object.assign(v,m),v})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class ix extends xn{constructor(t,o=new nx(t)){super(),this.apiClient=t,this.documents=o,this.list=async(a={})=>new Ei(An.PAGED_ITEM_FILE_SEARCH_STORES,r=>this.listInternal(r),await this.listInternal(a),a)}async uploadToFileSearchStore(t){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(t.fileSearchStoreName,t.file,t.config)}async create(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=YA(t);return f=Z("fileSearchStores",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async get(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=XA(t);return f=Z("{name}",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>y)}}async delete(t){var o,a;let r="",f={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const p=KA(t);r=Z("{name}",p._url),f=p._query,delete p._url,delete p._query,await this.apiClient.request({path:r,queryParams:f,body:JSON.stringify(p),httpMethod:"DELETE",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal})}}async listInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=e1(t);return f=Z("fileSearchStores",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const m=t1(y),v=new I_;return Object.assign(v,m),v})}}async uploadToFileSearchStoreInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=n1(t);return f=Z("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const m=i1(y),v=new w_;return Object.assign(v,m),v})}}async importFile(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=$A(t);return f=Z("{file_search_store_name}:importFile",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json()),r.then(y=>{const m=ZA(y),v=new cc;return Object.assign(v,m),v})}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */let Fg=function(){const{crypto:i}=globalThis;if(i!=null&&i.randomUUID)return Fg=i.randomUUID.bind(i),i.randomUUID();const t=new Uint8Array(1),o=i?()=>i.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(+a^o()&15>>+a/4).toString(16))};const ox=()=>Fg();/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function tc(i){return typeof i=="object"&&i!==null&&("name"in i&&i.name==="AbortError"||"message"in i&&String(i.message).includes("FetchRequestCanceledException"))}const nc=i=>{if(i instanceof Error)return i;if(typeof i=="object"&&i!==null){try{if(Object.prototype.toString.call(i)==="[object Error]"){const t=new Error(i.message,i.cause?{cause:i.cause}:{});return i.stack&&(t.stack=i.stack),i.cause&&!t.cause&&(t.cause=i.cause),i.name&&(t.name=i.name),t}}catch{}try{return new Error(JSON.stringify(i))}catch{}}return new Error(i)};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class Jt extends Error{}class yt extends Jt{constructor(t,o,a,r){super(`${yt.makeMessage(t,o,a)}`),this.status=t,this.headers=r,this.error=o}static makeMessage(t,o,a){const r=o!=null&&o.message?typeof o.message=="string"?o.message:JSON.stringify(o.message):o?JSON.stringify(o):a;return t&&r?`${t} ${r}`:t?`${t} status code (no body)`:r||"(no status code or body)"}static generate(t,o,a,r){if(!t||!r)return new ds({message:a,cause:nc(o)});const f=o;return t===400?new Jg(t,f,a,r):t===401?new Kg(t,f,a,r):t===403?new Xg(t,f,a,r):t===404?new Qg(t,f,a,r):t===409?new Zg(t,f,a,r):t===422?new $g(t,f,a,r):t===429?new Wg(t,f,a,r):t>=500?new jg(t,f,a,r):new yt(t,f,a,r)}}class ic extends yt{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}}class ds extends yt{constructor({message:t,cause:o}){super(void 0,void 0,t||"Connection error.",void 0),o&&(this.cause=o)}}class Yg extends ds{constructor({message:t}={}){super({message:t??"Request timed out."})}}class Jg extends yt{}class Kg extends yt{}class Xg extends yt{}class Qg extends yt{}class Zg extends yt{}class $g extends yt{}class Wg extends yt{}class jg extends yt{}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const lx=/^[a-z][a-z0-9+.-]*:/i,ax=i=>lx.test(i);let oc=i=>(oc=Array.isArray,oc(i));const sx=oc;let rx=sx;const lg=rx;function ux(i){if(!i)return!0;for(const t in i)return!1;return!0}function cx(i,t){return Object.prototype.hasOwnProperty.call(i,t)}const fx=(i,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new Jt(`${i} must be an integer`);if(t<0)throw new Jt(`${i} must be a positive integer`);return t},dx=i=>{try{return JSON.parse(i)}catch{return}};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const px=i=>new Promise(t=>setTimeout(t,i));/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const uo="0.0.1";/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function hx(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}const mx=()=>{var i,t,o,a,r;const f=hx();if(f==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uo,"X-Stainless-OS":sg(Deno.build.os),"X-Stainless-Arch":ag(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:(t=(i=Deno.version)===null||i===void 0?void 0:i.deno)!==null&&t!==void 0?t:"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(f==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uo,"X-Stainless-OS":sg((o=globalThis.process.platform)!==null&&o!==void 0?o:"unknown"),"X-Stainless-Arch":ag((a=globalThis.process.arch)!==null&&a!==void 0?a:"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":(r=globalThis.process.version)!==null&&r!==void 0?r:"unknown"};const p=gx();return p?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${p.browser}`,"X-Stainless-Runtime-Version":p.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uo,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function gx(){if(typeof navigator>"u"||!navigator)return null;const i=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:t,pattern:o}of i){const a=o.exec(navigator.userAgent);if(a){const r=a[1]||0,f=a[2]||0,p=a[3]||0;return{browser:t,version:`${r}.${f}.${p}`}}}return null}const ag=i=>i==="x32"?"x32":i==="x86_64"||i==="x64"?"x64":i==="arm"?"arm":i==="aarch64"||i==="arm64"?"arm64":i?`other:${i}`:"unknown",sg=i=>(i=i.toLowerCase(),i.includes("ios")?"iOS":i==="android"?"Android":i==="darwin"?"MacOS":i==="win32"?"Windows":i==="freebsd"?"FreeBSD":i==="openbsd"?"OpenBSD":i==="linux"?"Linux":i?`Other:${i}`:"Unknown");let Ka;const yx=()=>Ka??(Ka=mx());/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function vx(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new GeminiNextGenAPIClient({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function ey(...i){const t=globalThis.ReadableStream;if(typeof t>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...i)}function Tx(i){let t=Symbol.asyncIterator in i?i[Symbol.asyncIterator]():i[Symbol.iterator]();return ey({start(){},async pull(o){const{done:a,value:r}=await t.next();a?o.close():o.enqueue(r)},async cancel(){var o;await((o=t.return)===null||o===void 0?void 0:o.call(t))}})}function ty(i){if(i[Symbol.asyncIterator])return i;const t=i.getReader();return{async next(){try{const o=await t.read();return o!=null&&o.done&&t.releaseLock(),o}catch(o){throw t.releaseLock(),o}},async return(){const o=t.cancel();return t.releaseLock(),await o,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function _x(i){var t,o;if(i===null||typeof i!="object")return;if(i[Symbol.asyncIterator]){await((o=(t=i[Symbol.asyncIterator]()).return)===null||o===void 0?void 0:o.call(t));return}const a=i.getReader(),r=a.cancel();a.releaseLock(),await r}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const Ex=({headers:i,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const ny=()=>{var i;if(typeof File>"u"){const{process:t}=globalThis,o=typeof((i=t==null?void 0:t.versions)===null||i===void 0?void 0:i.node)=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(o?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Pu(i,t,o){return ny(),new File(i,t??"unknown_file",o)}function Sx(i){return(typeof i=="object"&&i!==null&&("name"in i&&i.name&&String(i.name)||"url"in i&&i.url&&String(i.url)||"filename"in i&&i.filename&&String(i.filename)||"path"in i&&i.path&&String(i.path))||"").split(/[\\/]/).pop()||void 0}const Cx=i=>i!=null&&typeof i=="object"&&typeof i[Symbol.asyncIterator]=="function";/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const iy=i=>i!=null&&typeof i=="object"&&typeof i.size=="number"&&typeof i.type=="string"&&typeof i.text=="function"&&typeof i.slice=="function"&&typeof i.arrayBuffer=="function",Ax=i=>i!=null&&typeof i=="object"&&typeof i.name=="string"&&typeof i.lastModified=="number"&&iy(i),xx=i=>i!=null&&typeof i=="object"&&typeof i.url=="string"&&typeof i.blob=="function";async function Rx(i,t,o){if(ny(),i=await i,Ax(i))return i instanceof File?i:Pu([await i.arrayBuffer()],i.name);if(xx(i)){const r=await i.blob();return t||(t=new URL(i.url).pathname.split(/[\\/]/).pop()),Pu(await lc(r),t,o)}const a=await lc(i);if(t||(t=Sx(i)),!(o!=null&&o.type)){const r=a.find(f=>typeof f=="object"&&"type"in f&&f.type);typeof r=="string"&&(o=Object.assign(Object.assign({},o),{type:r}))}return Pu(a,t,o)}async function lc(i){var t,o,a,r,f;let p=[];if(typeof i=="string"||ArrayBuffer.isView(i)||i instanceof ArrayBuffer)p.push(i);else if(iy(i))p.push(i instanceof Blob?i:await i.arrayBuffer());else if(Cx(i))try{for(var g=!0,y=Wt(i),m;m=await y.next(),t=m.done,!t;g=!0){r=m.value,g=!1;const v=r;p.push(...await lc(v))}}catch(v){o={error:v}}finally{try{!g&&!t&&(a=y.return)&&await a.call(y)}finally{if(o)throw o.error}}else{const v=(f=i==null?void 0:i.constructor)===null||f===void 0?void 0:f.name;throw new Error(`Unexpected data type: ${typeof i}${v?`; constructor: ${v}`:""}${Nx(i)}`)}return p}function Nx(i){return typeof i!="object"||i===null?"":`; props: [${Object.getOwnPropertyNames(i).map(o=>`"${o}"`).join(", ")}]`}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class oy{constructor(t){this._client=t}}oy._key=[];/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function ly(i){return i.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const rg=Object.freeze(Object.create(null)),Mx=(i=ly)=>(function(o,...a){if(o.length===1)return o[0];let r=!1;const f=[],p=o.reduce((v,_,E)=>{var A,I,H;/[?#]/.test(_)&&(r=!0);const U=a[E];let P=(r?encodeURIComponent:i)(""+U);return E!==a.length&&(U==null||typeof U=="object"&&U.toString===((H=Object.getPrototypeOf((I=Object.getPrototypeOf((A=U.hasOwnProperty)!==null&&A!==void 0?A:rg))!==null&&I!==void 0?I:rg))===null||H===void 0?void 0:H.toString))&&(P=U+"",f.push({start:v.length+_.length,length:P.length,error:`Value of type ${Object.prototype.toString.call(U).slice(8,-1)} is not a valid path parameter`})),v+_+(E===a.length?"":P)},""),g=p.split(/[?#]/,1)[0],y=new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)","gi");let m;for(;(m=y.exec(g))!==null;)f.push({start:m.index,length:m[0].length,error:`Value "${m[0]}" can't be safely passed as a path parameter`});if(f.sort((v,_)=>v.start-_.start),f.length>0){let v=0;const _=f.reduce((E,A)=>{const I=" ".repeat(A.start-v),H="^".repeat(A.length);return v=A.start+A.length,E+I+H},"");throw new Jt(`Path parameters result in path with invalid segments: ${f.map(E=>E.error).join(` `)} ${p} ${_}`)}return p}),Xa=Mx(ly);/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class ay extends oy{create(t,o){var a;const{api_version:r=this._client.apiVersion}=t,f=ss(t,["api_version"]);if("model"in f&&"agent_config"in f)throw new Jt("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");if("agent"in f&&"generation_config"in f)throw new Jt("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");return this._client.post(Xa`/${r}/interactions`,Object.assign(Object.assign({body:f},o),{stream:(a=t.stream)!==null&&a!==void 0?a:!1}))}delete(t,o={},a){const{api_version:r=this._client.apiVersion}=o??{};return this._client.delete(Xa`/${r}/interactions/${t}`,a)}cancel(t,o={},a){const{api_version:r=this._client.apiVersion}=o??{};return this._client.post(Xa`/${r}/interactions/${t}/cancel`,a)}get(t,o={},a){var r;const f=o??{},{api_version:p=this._client.apiVersion}=f,g=ss(f,["api_version"]);return this._client.get(Xa`/${p}/interactions/${t}`,Object.assign(Object.assign({query:g},a),{stream:(r=o==null?void 0:o.stream)!==null&&r!==void 0?r:!1}))}}ay._key=Object.freeze(["interactions"]);class sy extends ay{}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function Ix(i){let t=0;for(const r of i)t+=r.length;const o=new Uint8Array(t);let a=0;for(const r of i)o.set(r,a),a+=r.length;return o}let Qa;function yc(i){let t;return(Qa??(t=new globalThis.TextEncoder,Qa=t.encode.bind(t)))(i)}let Za;function ug(i){let t;return(Za??(t=new globalThis.TextDecoder,Za=t.decode.bind(t)))(i)}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class ps{constructor(){this.buffer=new Uint8Array,this.carriageReturnIndex=null}decode(t){if(t==null)return[];const o=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?yc(t):t;this.buffer=Ix([this.buffer,o]);const a=[];let r;for(;(r=wx(this.buffer,this.carriageReturnIndex))!=null;){if(r.carriage&&this.carriageReturnIndex==null){this.carriageReturnIndex=r.index;continue}if(this.carriageReturnIndex!=null&&(r.index!==this.carriageReturnIndex+1||r.carriage)){a.push(ug(this.buffer.subarray(0,this.carriageReturnIndex-1))),this.buffer=this.buffer.subarray(this.carriageReturnIndex),this.carriageReturnIndex=null;continue}const f=this.carriageReturnIndex!==null?r.preceding-1:r.preceding,p=ug(this.buffer.subarray(0,f));a.push(p),this.buffer=this.buffer.subarray(r.index),this.carriageReturnIndex=null}return a}flush(){return this.buffer.length?this.decode(` `):[]}}ps.NEWLINE_CHARS=new Set([` `,"\r"]);ps.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function wx(i,t){for(let r=t??0;r{if(i){if(cx(rs,i))return i;gt(o).warn(`${t} was set to ${JSON.stringify(i)}, expected one of ${JSON.stringify(Object.keys(rs))}`)}};function vl(){}function $a(i,t,o){return!t||rs[i]>rs[o]?vl:t[i].bind(t)}const Dx={error:vl,warn:vl,info:vl,debug:vl};let fg=new WeakMap;function gt(i){var t;const o=i.logger,a=(t=i.logLevel)!==null&&t!==void 0?t:"off";if(!o)return Dx;const r=fg.get(o);if(r&&r[0]===a)return r[1];const f={error:$a("error",o,a),warn:$a("warn",o,a),info:$a("info",o,a),debug:$a("debug",o,a)};return fg.set(o,[a,f]),f}const _i=i=>(i.options&&(i.options=Object.assign({},i.options),delete i.options.headers),i.headers&&(i.headers=Object.fromEntries((i.headers instanceof Headers?[...i.headers]:Object.entries(i.headers)).map(([t,o])=>[t,t.toLowerCase()==="x-goog-api-key"||t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":o]))),"retryOfRequestLogID"in i&&(i.retryOfRequestLogID&&(i.retryOf=i.retryOfRequestLogID),delete i.retryOfRequestLogID),i);/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class fo{constructor(t,o,a){this.iterator=t,this.controller=o,this.client=a}static fromSSEResponse(t,o,a){let r=!1;const f=a?gt(a):console;function p(){return $t(this,arguments,function*(){var y,m,v,_;if(r)throw new Jt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let E=!1;try{try{for(var A=!0,I=Wt(Ux(t,o)),H;H=yield se(I.next()),y=H.done,!y;A=!0){_=H.value,A=!1;const U=_;if(!E)if(U.data.startsWith("[DONE]")){E=!0;continue}else try{yield yield se(JSON.parse(U.data))}catch(P){throw f.error("Could not parse message into JSON:",U.data),f.error("From chunk:",U.raw),P}}}catch(U){m={error:U}}finally{try{!A&&!y&&(v=I.return)&&(yield se(v.call(I)))}finally{if(m)throw m.error}}E=!0}catch(U){if(tc(U))return yield se(void 0);throw U}finally{E||o.abort()}})}return new fo(p,o,a)}static fromReadableStream(t,o,a){let r=!1;function f(){return $t(this,arguments,function*(){var y,m,v,_;const E=new ps,A=ty(t);try{for(var I=!0,H=Wt(A),U;U=yield se(H.next()),y=U.done,!y;I=!0){_=U.value,I=!1;const P=_;for(const Q of E.decode(P))yield yield se(Q)}}catch(P){m={error:P}}finally{try{!I&&!y&&(v=H.return)&&(yield se(v.call(H)))}finally{if(m)throw m.error}}for(const P of E.flush())yield yield se(P)})}function p(){return $t(this,arguments,function*(){var y,m,v,_;if(r)throw new Jt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let E=!1;try{try{for(var A=!0,I=Wt(f()),H;H=yield se(I.next()),y=H.done,!y;A=!0){_=H.value,A=!1;const U=_;E||U&&(yield yield se(JSON.parse(U)))}}catch(U){m={error:U}}finally{try{!A&&!y&&(v=I.return)&&(yield se(v.call(I)))}finally{if(m)throw m.error}}E=!0}catch(U){if(tc(U))return yield se(void 0);throw U}finally{E||o.abort()}})}return new fo(p,o,a)}[Symbol.asyncIterator](){return this.iterator()}tee(){const t=[],o=[],a=this.iterator(),r=f=>({next:()=>{if(f.length===0){const p=a.next();t.push(p),o.push(p)}return f.shift()}});return[new fo(()=>r(t),this.controller,this.client),new fo(()=>r(o),this.controller,this.client)]}toReadableStream(){const t=this;let o;return ey({async start(){o=t[Symbol.asyncIterator]()},async pull(a){try{const{value:r,done:f}=await o.next();if(f)return a.close();const p=yc(JSON.stringify(r)+` `);a.enqueue(p)}catch(r){a.error(r)}},async cancel(){var a;await((a=o.return)===null||a===void 0?void 0:a.call(o))}})}}function Ux(i,t){return $t(this,arguments,function*(){var a,r,f,p;if(!i.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new Jt("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new Jt("Attempted to iterate over a response with no body");const g=new Gx,y=new ps,m=ty(i.body);try{for(var v=!0,_=Wt(Lx(m)),E;E=yield se(_.next()),a=E.done,!a;v=!0){p=E.value,v=!1;const A=p;for(const I of y.decode(A)){const H=g.decode(I);H&&(yield yield se(H))}}}catch(A){r={error:A}}finally{try{!v&&!a&&(f=_.return)&&(yield se(f.call(_)))}finally{if(r)throw r.error}}for(const A of y.flush()){const I=g.decode(A);I&&(yield yield se(I))}})}function Lx(i){return $t(this,arguments,function*(){var o,a,r,f;let p=new Uint8Array;try{for(var g=!0,y=Wt(i),m;m=yield se(y.next()),o=m.done,!o;g=!0){f=m.value,g=!1;const v=f;if(v==null)continue;const _=v instanceof ArrayBuffer?new Uint8Array(v):typeof v=="string"?yc(v):v;let E=new Uint8Array(p.length+_.length);E.set(p),E.set(_,p.length),p=E;let A;for(;(A=bx(p))!==-1;)yield yield se(p.slice(0,A)),p=p.slice(A)}}catch(v){a={error:v}}finally{try{!g&&!o&&(r=y.return)&&(yield se(r.call(y)))}finally{if(a)throw a.error}}p.length>0&&(yield yield se(p))})}class Gx{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;const f={event:this.event,data:this.data.join(` `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],f}if(this.chunks.push(t),t.startsWith(":"))return null;let[o,a,r]=Hx(t,":");return r.startsWith(" ")&&(r=r.substring(1)),o==="event"?this.event=r:o==="data"&&this.data.push(r),null}}function Hx(i,t){const o=i.indexOf(t);return o!==-1?[i.substring(0,o),t,i.substring(o+t.length)]:[i,"",""]}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */async function zx(i,t){const{response:o,requestLogID:a,retryOfRequestLogID:r,startTime:f}=t,p=await(async()=>{var g;if(t.options.stream)return gt(i).debug("response",o.status,o.url,o.headers,o.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(o,t.controller,i):fo.fromSSEResponse(o,t.controller,i);if(o.status===204)return null;if(t.options.__binaryResponse)return o;const y=o.headers.get("content-type"),m=(g=y==null?void 0:y.split(";")[0])===null||g===void 0?void 0:g.trim();return(m==null?void 0:m.includes("application/json"))||(m==null?void 0:m.endsWith("+json"))?o.headers.get("content-length")==="0"?void 0:await o.json():await o.text()})();return gt(i).debug(`[${a}] response parsed`,_i({retryOfRequestLogID:r,url:o.url,status:o.status,body:p,durationMs:Date.now()-f})),p}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class vc extends Promise{constructor(t,o,a=zx){super(r=>{r(null)}),this.responsePromise=o,this.parseResponse=a,this.client=t}_thenUnwrap(t){return new vc(this.client,this.responsePromise,async(o,a)=>t(await this.parseResponse(o,a),a))}asResponse(){return this.responsePromise.then(t=>t.response)}async withResponse(){const[t,o]=await Promise.all([this.parse(),this.asResponse()]);return{data:t,response:o}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(t=>this.parseResponse(this.client,t))),this.parsedPromise}then(t,o){return this.parse().then(t,o)}catch(t){return this.parse().catch(t)}finally(t){return this.parse().finally(t)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const ry=Symbol("brand.privateNullableHeaders");function*kx(i){if(!i)return;if(ry in i){const{values:a,nulls:r}=i;yield*a.entries();for(const f of r)yield[f,null];return}let t=!1,o;i instanceof Headers?o=i.entries():lg(i)?o=i:(t=!0,o=Object.entries(i??{}));for(let a of o){const r=a[0];if(typeof r!="string")throw new TypeError("expected header name to be a string");const f=lg(a[1])?a[1]:[a[1]];let p=!1;for(const g of f)g!==void 0&&(t&&!p&&(p=!0,yield[r,null]),yield[r,g])}}const yl=i=>{const t=new Headers,o=new Set;for(const a of i){const r=new Set;for(const[f,p]of kx(a)){const g=f.toLowerCase();r.has(g)||(t.delete(f),r.add(g)),p===null?(t.delete(f),o.add(g)):(t.append(f,p),o.delete(g))}}return{[ry]:!0,values:t,nulls:o}};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const Fu=i=>{var t,o,a,r,f,p;if(typeof globalThis.process<"u")return(a=(o=(t=i_)===null||t===void 0?void 0:t[i])===null||o===void 0?void 0:o.trim())!==null&&a!==void 0?a:void 0;if(typeof globalThis.Deno<"u")return(p=(f=(r=globalThis.Deno.env)===null||r===void 0?void 0:r.get)===null||f===void 0?void 0:f.call(r,i))===null||p===void 0?void 0:p.trim()};/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */var uy;class hs{constructor(t){var o,a,r,f,p,g,y,{baseURL:m=Fu("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:v=(o=Fu("GEMINI_API_KEY"))!==null&&o!==void 0?o:null,apiVersion:_="v1beta"}=t,E=ss(t,["baseURL","apiKey","apiVersion"]);const A=Object.assign(Object.assign({apiKey:v,apiVersion:_},E),{baseURL:m||"https://generativelanguage.googleapis.com"});this.baseURL=A.baseURL,this.timeout=(a=A.timeout)!==null&&a!==void 0?a:hs.DEFAULT_TIMEOUT,this.logger=(r=A.logger)!==null&&r!==void 0?r:console;const I="warn";this.logLevel=I,this.logLevel=(p=(f=cg(A.logLevel,"ClientOptions.logLevel",this))!==null&&f!==void 0?f:cg(Fu("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&p!==void 0?p:I,this.fetchOptions=A.fetchOptions,this.maxRetries=(g=A.maxRetries)!==null&&g!==void 0?g:2,this.fetch=(y=A.fetch)!==null&&y!==void 0?y:vx(),this.encoder=Ex,this._options=A,this.apiKey=v,this.apiVersion=_,this.clientAdapter=A.clientAdapter}withOptions(t){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),t))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:t,nulls:o}){if(!(t.has("authorization")||t.has("x-goog-api-key"))&&!(this.apiKey&&t.get("x-goog-api-key"))&&!o.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(t){const o=yl([t.headers]);if(!(o.values.has("authorization")||o.values.has("x-goog-api-key"))){if(this.apiKey)return yl([{"x-goog-api-key":this.apiKey}]);if(this.clientAdapter.isVertexAI())return yl([await this.clientAdapter.getAuthHeaders()])}}stringifyQuery(t){return Object.entries(t).filter(([o,a])=>typeof a<"u").map(([o,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(o)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(o)}=`;throw new Jt(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${uo}`}defaultIdempotencyKey(){return`stainless-node-retry-${ox()}`}makeStatusError(t,o,a,r){return yt.generate(t,o,a,r)}buildURL(t,o,a){const r=!this.baseURLOverridden()&&a||this.baseURL,f=ax(t)?new URL(t):new URL(r+(r.endsWith("/")&&t.startsWith("/")?t.slice(1):t)),p=this.defaultQuery();return ux(p)||(o=Object.assign(Object.assign({},p),o)),typeof o=="object"&&o&&!Array.isArray(o)&&(f.search=this.stringifyQuery(o)),f.toString()}async prepareOptions(t){if(this.clientAdapter&&this.clientAdapter.isVertexAI()&&!t.path.startsWith(`/${this.apiVersion}/projects/`)){const o=t.path.slice(this.apiVersion.length+1);t.path=`/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${o}`}}async prepareRequest(t,{url:o,options:a}){}get(t,o){return this.methodRequest("get",t,o)}post(t,o){return this.methodRequest("post",t,o)}patch(t,o){return this.methodRequest("patch",t,o)}put(t,o){return this.methodRequest("put",t,o)}delete(t,o){return this.methodRequest("delete",t,o)}methodRequest(t,o,a){return this.request(Promise.resolve(a).then(r=>Object.assign({method:t,path:o},r)))}request(t,o=null){return new vc(this,this.makeRequest(t,o,void 0))}async makeRequest(t,o,a){var r,f,p;const g=await t,y=(r=g.maxRetries)!==null&&r!==void 0?r:this.maxRetries;o==null&&(o=y),await this.prepareOptions(g);const{req:m,url:v,timeout:_}=await this.buildRequest(g,{retryCount:y-o});await this.prepareRequest(m,{url:v,options:g});const E="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),A=a===void 0?"":`, retryOf: ${a}`,I=Date.now();if(gt(this).debug(`[${E}] sending request`,_i({retryOfRequestLogID:a,method:g.method,url:v,options:g,headers:m.headers})),!((f=g.signal)===null||f===void 0)&&f.aborted)throw new ic;const H=new AbortController,U=await this.fetchWithTimeout(v,m,_,H).catch(nc),P=Date.now();if(U instanceof globalThis.Error){const F=`retrying, ${o} attempts remaining`;if(!((p=g.signal)===null||p===void 0)&&p.aborted)throw new ic;const J=tc(U)||/timed? ?out/i.test(String(U)+("cause"in U?String(U.cause):""));if(o)return gt(this).info(`[${E}] connection ${J?"timed out":"failed"} - ${F}`),gt(this).debug(`[${E}] connection ${J?"timed out":"failed"} (${F})`,_i({retryOfRequestLogID:a,url:v,durationMs:P-I,message:U.message})),this.retryRequest(g,o,a??E);throw gt(this).info(`[${E}] connection ${J?"timed out":"failed"} - error; no more retries left`),gt(this).debug(`[${E}] connection ${J?"timed out":"failed"} (error; no more retries left)`,_i({retryOfRequestLogID:a,url:v,durationMs:P-I,message:U.message})),J?new Yg:new ds({cause:U})}const Q=`[${E}${A}] ${m.method} ${v} ${U.ok?"succeeded":"failed"} with status ${U.status} in ${P-I}ms`;if(!U.ok){const F=await this.shouldRetry(U);if(o&&F){const W=`retrying, ${o} attempts remaining`;return await _x(U.body),gt(this).info(`${Q} - ${W}`),gt(this).debug(`[${E}] response error (${W})`,_i({retryOfRequestLogID:a,url:U.url,status:U.status,headers:U.headers,durationMs:P-I})),this.retryRequest(g,o,a??E,U.headers)}const J=F?"error; no more retries left":"error; not retryable";gt(this).info(`${Q} - ${J}`);const ee=await U.text().catch(W=>nc(W).message),B=dx(ee),X=B?void 0:ee;throw gt(this).debug(`[${E}] response error (${J})`,_i({retryOfRequestLogID:a,url:U.url,status:U.status,headers:U.headers,message:X,durationMs:Date.now()-I})),this.makeStatusError(U.status,B,X,U.headers)}return gt(this).info(Q),gt(this).debug(`[${E}] response start`,_i({retryOfRequestLogID:a,url:U.url,status:U.status,headers:U.headers,durationMs:P-I})),{response:U,options:g,controller:H,requestLogID:E,retryOfRequestLogID:a,startTime:I}}async fetchWithTimeout(t,o,a,r){const f=o||{},{signal:p,method:g}=f,y=ss(f,["signal","method"]),m=this._makeAbort(r);p&&p.addEventListener("abort",m,{once:!0});const v=setTimeout(m,a),_=globalThis.ReadableStream&&y.body instanceof globalThis.ReadableStream||typeof y.body=="object"&&y.body!==null&&Symbol.asyncIterator in y.body,E=Object.assign(Object.assign(Object.assign({signal:r.signal},_?{duplex:"half"}:{}),{method:"GET"}),y);g&&(E.method=g.toUpperCase());try{return await this.fetch.call(void 0,t,E)}finally{clearTimeout(v)}}async shouldRetry(t){const o=t.headers.get("x-should-retry");return o==="true"?!0:o==="false"?!1:t.status===408||t.status===409||t.status===429||t.status>=500}async retryRequest(t,o,a,r){var f;let p;const g=r==null?void 0:r.get("retry-after-ms");if(g){const m=parseFloat(g);Number.isNaN(m)||(p=m)}const y=r==null?void 0:r.get("retry-after");if(y&&!p){const m=parseFloat(y);Number.isNaN(m)?p=Date.parse(y)-Date.now():p=m*1e3}if(!(p&&0<=p&&p<60*1e3)){const m=(f=t.maxRetries)!==null&&f!==void 0?f:this.maxRetries;p=this.calculateDefaultRetryTimeoutMillis(o,m)}return await px(p),this.makeRequest(t,o-1,a)}calculateDefaultRetryTimeoutMillis(t,o){const f=o-t,p=Math.min(.5*Math.pow(2,f),8),g=1-Math.random()*.25;return p*g*1e3}async buildRequest(t,{retryCount:o=0}={}){var a,r,f;const p=Object.assign({},t),{method:g,path:y,query:m,defaultBaseURL:v}=p,_=this.buildURL(y,m,v);"timeout"in p&&fx("timeout",p.timeout),p.timeout=(a=p.timeout)!==null&&a!==void 0?a:this.timeout;const{bodyHeaders:E,body:A}=this.buildBody({options:p}),I=await this.buildHeaders({options:t,method:g,bodyHeaders:E,retryCount:o});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:g,headers:I},p.signal&&{signal:p.signal}),globalThis.ReadableStream&&A instanceof globalThis.ReadableStream&&{duplex:"half"}),A&&{body:A}),(r=this.fetchOptions)!==null&&r!==void 0?r:{}),(f=p.fetchOptions)!==null&&f!==void 0?f:{}),url:_,timeout:p.timeout}}async buildHeaders({options:t,method:o,bodyHeaders:a,retryCount:r}){let f={};this.idempotencyHeader&&o!=="get"&&(t.idempotencyKey||(t.idempotencyKey=this.defaultIdempotencyKey()),f[this.idempotencyHeader]=t.idempotencyKey);const p=await this.authHeaders(t);let g=yl([f,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r)},t.timeout?{"X-Stainless-Timeout":String(Math.trunc(t.timeout/1e3))}:{}),yx()),this._options.defaultHeaders,a,t.headers,p]);return this.validateHeaders(g),g.values}_makeAbort(t){return()=>t.abort()}buildBody({options:{body:t,headers:o}}){if(!t)return{bodyHeaders:void 0,body:void 0};const a=yl([o]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||typeof t=="string"&&a.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:typeof t=="object"&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&typeof t.next=="function")?{bodyHeaders:void 0,body:Tx(t)}:typeof t=="object"&&a.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(t)}:this.encoder({body:t,headers:a})}}hs.DEFAULT_TIMEOUT=6e4;class at extends hs{constructor(){super(...arguments),this.interactions=new sy(this)}}uy=at;at.GeminiNextGenAPIClient=uy;at.GeminiNextGenAPIClientError=Jt;at.APIError=yt;at.APIConnectionError=ds;at.APIConnectionTimeoutError=Yg;at.APIUserAbortError=ic;at.NotFoundError=Qg;at.ConflictError=Zg;at.RateLimitError=Wg;at.BadRequestError=Jg;at.AuthenticationError=Kg;at.InternalServerError=jg;at.PermissionDeniedError=Xg;at.UnprocessableEntityError=$g;at.toFile=Rx;at.Interactions=sy;/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */function Vx(i,t){const o={},a=u(i,["name"]);return a!=null&&c(o,["_url","name"],a),o}function qx(i,t){const o={},a=u(i,["name"]);return a!=null&&c(o,["_url","name"],a),o}function Ox(i,t){const o={},a=u(i,["sdkHttpResponse"]);return a!=null&&c(o,["sdkHttpResponse"],a),o}function Bx(i,t){const o={},a=u(i,["sdkHttpResponse"]);return a!=null&&c(o,["sdkHttpResponse"],a),o}function Px(i,t,o){const a={};if(u(i,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");const r=u(i,["tunedModelDisplayName"]);if(t!==void 0&&r!=null&&c(t,["displayName"],r),u(i,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");const f=u(i,["epochCount"]);t!==void 0&&f!=null&&c(t,["tuningTask","hyperparameters","epochCount"],f);const p=u(i,["learningRateMultiplier"]);if(p!=null&&c(a,["tuningTask","hyperparameters","learningRateMultiplier"],p),u(i,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(u(i,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(u(i,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");if(u(i,["tuningMode"])!==void 0)throw new Error("tuningMode parameter is not supported in Gemini API.");if(u(i,["customBaseModel"])!==void 0)throw new Error("customBaseModel parameter is not supported in Gemini API.");const g=u(i,["batchSize"]);t!==void 0&&g!=null&&c(t,["tuningTask","hyperparameters","batchSize"],g);const y=u(i,["learningRate"]);if(t!==void 0&&y!=null&&c(t,["tuningTask","hyperparameters","learningRate"],y),u(i,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(u(i,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");if(u(i,["baseTeacherModel"])!==void 0)throw new Error("baseTeacherModel parameter is not supported in Gemini API.");if(u(i,["tunedTeacherModelSource"])!==void 0)throw new Error("tunedTeacherModelSource parameter is not supported in Gemini API.");if(u(i,["sftLossWeightMultiplier"])!==void 0)throw new Error("sftLossWeightMultiplier parameter is not supported in Gemini API.");if(u(i,["outputUri"])!==void 0)throw new Error("outputUri parameter is not supported in Gemini API.");if(u(i,["encryptionSpec"])!==void 0)throw new Error("encryptionSpec parameter is not supported in Gemini API.");return a}function Fx(i,t,o){const a={};let r=u(o,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const B=u(i,["validationDataset"]);t!==void 0&&B!=null&&c(t,["supervisedTuningSpec"],Yu(B))}else if(r==="PREFERENCE_TUNING"){const B=u(i,["validationDataset"]);t!==void 0&&B!=null&&c(t,["preferenceOptimizationSpec"],Yu(B))}else if(r==="DISTILLATION"){const B=u(i,["validationDataset"]);t!==void 0&&B!=null&&c(t,["distillationSpec"],Yu(B))}const f=u(i,["tunedModelDisplayName"]);t!==void 0&&f!=null&&c(t,["tunedModelDisplayName"],f);const p=u(i,["description"]);t!==void 0&&p!=null&&c(t,["description"],p);let g=u(o,["config","method"]);if(g===void 0&&(g="SUPERVISED_FINE_TUNING"),g==="SUPERVISED_FINE_TUNING"){const B=u(i,["epochCount"]);t!==void 0&&B!=null&&c(t,["supervisedTuningSpec","hyperParameters","epochCount"],B)}else if(g==="PREFERENCE_TUNING"){const B=u(i,["epochCount"]);t!==void 0&&B!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","epochCount"],B)}else if(g==="DISTILLATION"){const B=u(i,["epochCount"]);t!==void 0&&B!=null&&c(t,["distillationSpec","hyperParameters","epochCount"],B)}let y=u(o,["config","method"]);if(y===void 0&&(y="SUPERVISED_FINE_TUNING"),y==="SUPERVISED_FINE_TUNING"){const B=u(i,["learningRateMultiplier"]);t!==void 0&&B!=null&&c(t,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],B)}else if(y==="PREFERENCE_TUNING"){const B=u(i,["learningRateMultiplier"]);t!==void 0&&B!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],B)}else if(y==="DISTILLATION"){const B=u(i,["learningRateMultiplier"]);t!==void 0&&B!=null&&c(t,["distillationSpec","hyperParameters","learningRateMultiplier"],B)}let m=u(o,["config","method"]);if(m===void 0&&(m="SUPERVISED_FINE_TUNING"),m==="SUPERVISED_FINE_TUNING"){const B=u(i,["exportLastCheckpointOnly"]);t!==void 0&&B!=null&&c(t,["supervisedTuningSpec","exportLastCheckpointOnly"],B)}else if(m==="PREFERENCE_TUNING"){const B=u(i,["exportLastCheckpointOnly"]);t!==void 0&&B!=null&&c(t,["preferenceOptimizationSpec","exportLastCheckpointOnly"],B)}else if(m==="DISTILLATION"){const B=u(i,["exportLastCheckpointOnly"]);t!==void 0&&B!=null&&c(t,["distillationSpec","exportLastCheckpointOnly"],B)}let v=u(o,["config","method"]);if(v===void 0&&(v="SUPERVISED_FINE_TUNING"),v==="SUPERVISED_FINE_TUNING"){const B=u(i,["adapterSize"]);t!==void 0&&B!=null&&c(t,["supervisedTuningSpec","hyperParameters","adapterSize"],B)}else if(v==="PREFERENCE_TUNING"){const B=u(i,["adapterSize"]);t!==void 0&&B!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","adapterSize"],B)}else if(v==="DISTILLATION"){const B=u(i,["adapterSize"]);t!==void 0&&B!=null&&c(t,["distillationSpec","hyperParameters","adapterSize"],B)}let _=u(o,["config","method"]);if(_===void 0&&(_="SUPERVISED_FINE_TUNING"),_==="SUPERVISED_FINE_TUNING"){const B=u(i,["tuningMode"]);t!==void 0&&B!=null&&c(t,["supervisedTuningSpec","tuningMode"],B)}const E=u(i,["customBaseModel"]);t!==void 0&&E!=null&&c(t,["customBaseModel"],E);let A=u(o,["config","method"]);if(A===void 0&&(A="SUPERVISED_FINE_TUNING"),A==="SUPERVISED_FINE_TUNING"){const B=u(i,["batchSize"]);t!==void 0&&B!=null&&c(t,["supervisedTuningSpec","hyperParameters","batchSize"],B)}let I=u(o,["config","method"]);if(I===void 0&&(I="SUPERVISED_FINE_TUNING"),I==="SUPERVISED_FINE_TUNING"){const B=u(i,["learningRate"]);t!==void 0&&B!=null&&c(t,["supervisedTuningSpec","hyperParameters","learningRate"],B)}const H=u(i,["labels"]);t!==void 0&&H!=null&&c(t,["labels"],H);const U=u(i,["beta"]);t!==void 0&&U!=null&&c(t,["preferenceOptimizationSpec","hyperParameters","beta"],U);const P=u(i,["baseTeacherModel"]);t!==void 0&&P!=null&&c(t,["distillationSpec","baseTeacherModel"],P);const Q=u(i,["tunedTeacherModelSource"]);t!==void 0&&Q!=null&&c(t,["distillationSpec","tunedTeacherModelSource"],Q);const F=u(i,["sftLossWeightMultiplier"]);t!==void 0&&F!=null&&c(t,["distillationSpec","hyperParameters","sftLossWeightMultiplier"],F);const J=u(i,["outputUri"]);t!==void 0&&J!=null&&c(t,["outputUri"],J);const ee=u(i,["encryptionSpec"]);return t!==void 0&&ee!=null&&c(t,["encryptionSpec"],ee),a}function Yx(i,t){const o={},a=u(i,["baseModel"]);a!=null&&c(o,["baseModel"],a);const r=u(i,["preTunedModel"]);r!=null&&c(o,["preTunedModel"],r);const f=u(i,["trainingDataset"]);f!=null&&nR(f);const p=u(i,["config"]);return p!=null&&Px(p,o),o}function Jx(i,t){const o={},a=u(i,["baseModel"]);a!=null&&c(o,["baseModel"],a);const r=u(i,["preTunedModel"]);r!=null&&c(o,["preTunedModel"],r);const f=u(i,["trainingDataset"]);f!=null&&iR(f,o,t);const p=u(i,["config"]);return p!=null&&Fx(p,o,t),o}function Kx(i,t){const o={},a=u(i,["name"]);return a!=null&&c(o,["_url","name"],a),o}function Xx(i,t){const o={},a=u(i,["name"]);return a!=null&&c(o,["_url","name"],a),o}function Qx(i,t,o){const a={},r=u(i,["pageSize"]);t!==void 0&&r!=null&&c(t,["_query","pageSize"],r);const f=u(i,["pageToken"]);t!==void 0&&f!=null&&c(t,["_query","pageToken"],f);const p=u(i,["filter"]);return t!==void 0&&p!=null&&c(t,["_query","filter"],p),a}function Zx(i,t,o){const a={},r=u(i,["pageSize"]);t!==void 0&&r!=null&&c(t,["_query","pageSize"],r);const f=u(i,["pageToken"]);t!==void 0&&f!=null&&c(t,["_query","pageToken"],f);const p=u(i,["filter"]);return t!==void 0&&p!=null&&c(t,["_query","filter"],p),a}function $x(i,t){const o={},a=u(i,["config"]);return a!=null&&Qx(a,o),o}function Wx(i,t){const o={},a=u(i,["config"]);return a!=null&&Zx(a,o),o}function jx(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["nextPageToken"]);r!=null&&c(o,["nextPageToken"],r);const f=u(i,["tunedModels"]);if(f!=null){let p=f;Array.isArray(p)&&(p=p.map(g=>cy(g))),c(o,["tuningJobs"],p)}return o}function eR(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["nextPageToken"]);r!=null&&c(o,["nextPageToken"],r);const f=u(i,["tuningJobs"]);if(f!=null){let p=f;Array.isArray(p)&&(p=p.map(g=>ac(g))),c(o,["tuningJobs"],p)}return o}function tR(i,t){const o={},a=u(i,["name"]);a!=null&&c(o,["model"],a);const r=u(i,["name"]);return r!=null&&c(o,["endpoint"],r),o}function nR(i,t){const o={};if(u(i,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(u(i,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");const a=u(i,["examples"]);if(a!=null){let r=a;Array.isArray(r)&&(r=r.map(f=>f)),c(o,["examples","examples"],r)}return o}function iR(i,t,o){const a={};let r=u(o,["config","method"]);if(r===void 0&&(r="SUPERVISED_FINE_TUNING"),r==="SUPERVISED_FINE_TUNING"){const p=u(i,["gcsUri"]);t!==void 0&&p!=null&&c(t,["supervisedTuningSpec","trainingDatasetUri"],p)}else if(r==="PREFERENCE_TUNING"){const p=u(i,["gcsUri"]);t!==void 0&&p!=null&&c(t,["preferenceOptimizationSpec","trainingDatasetUri"],p)}else if(r==="DISTILLATION"){const p=u(i,["gcsUri"]);t!==void 0&&p!=null&&c(t,["distillationSpec","promptDatasetUri"],p)}let f=u(o,["config","method"]);if(f===void 0&&(f="SUPERVISED_FINE_TUNING"),f==="SUPERVISED_FINE_TUNING"){const p=u(i,["vertexDatasetResource"]);t!==void 0&&p!=null&&c(t,["supervisedTuningSpec","trainingDatasetUri"],p)}else if(f==="PREFERENCE_TUNING"){const p=u(i,["vertexDatasetResource"]);t!==void 0&&p!=null&&c(t,["preferenceOptimizationSpec","trainingDatasetUri"],p)}else if(f==="DISTILLATION"){const p=u(i,["vertexDatasetResource"]);t!==void 0&&p!=null&&c(t,["distillationSpec","promptDatasetUri"],p)}if(u(i,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return a}function cy(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(o,["name"],r);const f=u(i,["state"]);f!=null&&c(o,["state"],Rg(f));const p=u(i,["createTime"]);p!=null&&c(o,["createTime"],p);const g=u(i,["tuningTask","startTime"]);g!=null&&c(o,["startTime"],g);const y=u(i,["tuningTask","completeTime"]);y!=null&&c(o,["endTime"],y);const m=u(i,["updateTime"]);m!=null&&c(o,["updateTime"],m);const v=u(i,["description"]);v!=null&&c(o,["description"],v);const _=u(i,["baseModel"]);_!=null&&c(o,["baseModel"],_);const E=u(i,["_self"]);return E!=null&&c(o,["tunedModel"],tR(E)),o}function ac(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(o,["name"],r);const f=u(i,["state"]);f!=null&&c(o,["state"],Rg(f));const p=u(i,["createTime"]);p!=null&&c(o,["createTime"],p);const g=u(i,["startTime"]);g!=null&&c(o,["startTime"],g);const y=u(i,["endTime"]);y!=null&&c(o,["endTime"],y);const m=u(i,["updateTime"]);m!=null&&c(o,["updateTime"],m);const v=u(i,["error"]);v!=null&&c(o,["error"],v);const _=u(i,["description"]);_!=null&&c(o,["description"],_);const E=u(i,["baseModel"]);E!=null&&c(o,["baseModel"],E);const A=u(i,["tunedModel"]);A!=null&&c(o,["tunedModel"],A);const I=u(i,["preTunedModel"]);I!=null&&c(o,["preTunedModel"],I);const H=u(i,["supervisedTuningSpec"]);H!=null&&c(o,["supervisedTuningSpec"],H);const U=u(i,["preferenceOptimizationSpec"]);U!=null&&c(o,["preferenceOptimizationSpec"],U);const P=u(i,["distillationSpec"]);P!=null&&c(o,["distillationSpec"],P);const Q=u(i,["tuningDataStats"]);Q!=null&&c(o,["tuningDataStats"],Q);const F=u(i,["encryptionSpec"]);F!=null&&c(o,["encryptionSpec"],F);const J=u(i,["partnerModelTuningSpec"]);J!=null&&c(o,["partnerModelTuningSpec"],J);const ee=u(i,["customBaseModel"]);ee!=null&&c(o,["customBaseModel"],ee);const B=u(i,["experiment"]);B!=null&&c(o,["experiment"],B);const X=u(i,["labels"]);X!=null&&c(o,["labels"],X);const me=u(i,["outputUri"]);me!=null&&c(o,["outputUri"],me);const W=u(i,["pipelineJob"]);W!=null&&c(o,["pipelineJob"],W);const de=u(i,["serviceAccount"]);de!=null&&c(o,["serviceAccount"],de);const ce=u(i,["tunedModelDisplayName"]);ce!=null&&c(o,["tunedModelDisplayName"],ce);const Re=u(i,["veoTuningSpec"]);return Re!=null&&c(o,["veoTuningSpec"],Re),o}function oR(i,t){const o={},a=u(i,["sdkHttpResponse"]);a!=null&&c(o,["sdkHttpResponse"],a);const r=u(i,["name"]);r!=null&&c(o,["name"],r);const f=u(i,["metadata"]);f!=null&&c(o,["metadata"],f);const p=u(i,["done"]);p!=null&&c(o,["done"],p);const g=u(i,["error"]);return g!=null&&c(o,["error"],g),o}function Yu(i,t){const o={},a=u(i,["gcsUri"]);a!=null&&c(o,["validationDatasetUri"],a);const r=u(i,["vertexDatasetResource"]);return r!=null&&c(o,["validationDatasetUri"],r),o}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class lR extends xn{constructor(t){super(),this.apiClient=t,this.list=async(o={})=>new Ei(An.PAGED_ITEM_TUNING_JOBS,a=>this.listInternal(a),await this.listInternal(o),o),this.get=async o=>await this.getInternal(o),this.tune=async o=>{var a;if(this.apiClient.isVertexAI())if(o.baseModel.startsWith("projects/")){const r={tunedModelName:o.baseModel};!((a=o.config)===null||a===void 0)&&a.preTunedModelCheckpointId&&(r.checkpointId=o.config.preTunedModelCheckpointId);const f=Object.assign(Object.assign({},o),{preTunedModel:r});return f.baseModel=void 0,await this.tuneInternal(f)}else{const r=Object.assign({},o);return await this.tuneInternal(r)}else{const r=Object.assign({},o),f=await this.tuneMldevInternal(r);let p="";return f.metadata!==void 0&&f.metadata.tunedModel!==void 0?p=f.metadata.tunedModel:f.name!==void 0&&f.name.includes("/operations/")&&(p=f.name.split("/operations/")[0]),{name:p,state:Ku.JOB_STATE_QUEUED}}}}async getInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=Xx(t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>ac(v))}else{const m=Kx(t);return g=Z("{name}",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>cy(v))}}async listInternal(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=Wx(t);return g=Z("tuningJobs",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=eR(v),E=new km;return Object.assign(E,_),E})}else{const m=$x(t);return g=Z("tunedModels",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"GET",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=jx(v),E=new km;return Object.assign(E,_),E})}}async cancel(t){var o,a,r,f;let p,g="",y={};if(this.apiClient.isVertexAI()){const m=qx(t);return g=Z("{name}:cancel",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=Bx(v),E=new Vm;return Object.assign(E,_),E})}else{const m=Vx(t);return g=Z("{name}:cancel",m._url),y=m._query,delete m._url,delete m._query,p=this.apiClient.request({path:g,queryParams:y,body:JSON.stringify(m),httpMethod:"POST",httpOptions:(r=t.config)===null||r===void 0?void 0:r.httpOptions,abortSignal:(f=t.config)===null||f===void 0?void 0:f.abortSignal}).then(v=>v.json().then(_=>{const E=_;return E.sdkHttpResponse={headers:v.headers},E})),p.then(v=>{const _=Ox(v),E=new Vm;return Object.assign(E,_),E})}}async tuneInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI()){const g=Jx(t,t);return f=Z("tuningJobs",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(m=>{const v=m;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>ac(y))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(t){var o,a;let r,f="",p={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{const g=Yx(t);return f=Z("tunedModels",g._url),p=g._query,delete g._url,delete g._query,r=this.apiClient.request({path:f,queryParams:p,body:JSON.stringify(g),httpMethod:"POST",httpOptions:(o=t.config)===null||o===void 0?void 0:o.httpOptions,abortSignal:(a=t.config)===null||a===void 0?void 0:a.abortSignal}).then(y=>y.json().then(m=>{const v=m;return v.sdkHttpResponse={headers:y.headers},v})),r.then(y=>oR(y))}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class aR{async download(t,o){throw new Error("Download to file is not supported in the browser, please use a browser compliant download like an tag.")}}const sR=1024*1024*8,rR=3,uR=1e3,cR=2,us="x-goog-upload-status";async function fR(i,t,o){var a;const r=await fy(i,t,o),f=await(r==null?void 0:r.json());if(((a=r==null?void 0:r.headers)===null||a===void 0?void 0:a[us])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return f.file}async function dR(i,t,o){var a;const r=await fy(i,t,o),f=await(r==null?void 0:r.json());if(((a=r==null?void 0:r.headers)===null||a===void 0?void 0:a[us])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");const p=_g(f),g=new fc;return Object.assign(g,p),g}async function fy(i,t,o){var a,r;let f=0,p=0,g=new Qu(new Response),y="upload";for(f=i.size;p=f&&(y+=", finalize");let _=0,E=uR;for(;_setTimeout(t,i))}class mR{async upload(t,o,a){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await fR(t,o,a)}async uploadToFileSearchStore(t,o,a){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await dR(t,o,a)}async stat(t){if(typeof t=="string")throw new Error("File path is not supported in browser uploader.");return await pR(t)}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */class gR{create(t,o,a){return new yR(t,o,a)}}class yR{constructor(t,o,a){this.url=t,this.headers=o,this.callbacks=a}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(t){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.send(t)}close(){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.close()}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const dg="x-goog-api-key";class vR{constructor(t){this.apiKey=t}async addAuthHeaders(t,o){if(t.get(dg)===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.");t.append(dg,this.apiKey)}}}/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */const TR="gl-node/";class _R{get interactions(){var t;if(this._interactions!==void 0)return this._interactions;console.warn("GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.");const o=this.httpOptions;o!=null&&o.extraBody&&console.warn("GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.");const a=new at({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,apiVersion:this.apiClient.getApiVersion(),clientAdapter:this.apiClient,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:o==null?void 0:o.timeout,maxRetries:(t=o==null?void 0:o.retryOptions)===null||t===void 0?void 0:t.attempts});return this._interactions=a.interactions,this._interactions}constructor(t){var o;if(t.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(t.project||t.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=(o=t.vertexai)!==null&&o!==void 0?o:!1,this.apiKey=t.apiKey;const a=s_(t.httpOptions,t.vertexai,void 0,void 0);a&&(t.httpOptions?t.httpOptions.baseUrl=a:t.httpOptions={baseUrl:a}),this.apiVersion=t.apiVersion,this.httpOptions=t.httpOptions;const r=new vR(this.apiKey);this.apiClient=new p1({auth:r,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:TR+"web",uploader:new mR,downloader:new aR}),this.models=new D1(this.apiClient),this.live=new R1(this.apiClient,r,new gR),this.batches=new kE(this.apiClient),this.chats=new TS(this.models,this.apiClient),this.caches=new gS(this.apiClient),this.files=new bS(this.apiClient),this.operations=new U1(this.apiClient),this.authTokens=new Q1(this.apiClient),this.tunings=new lR(this.apiClient),this.fileSearchStores=new ix(this.apiClient)}}const ms=new _R({apiKey:"AIzaSyBq0f2mUZ9hgrd3xz1m6zW_vnbD6BJGl6g"});async function ER(i){try{const t=await ms.models.generateContent({model:"gemini-2.5-flash-image",contents:[{parts:[{text:i}]}],config:{imageConfig:{aspectRatio:"1:1"}}});let o="",a="";for(const r of t.candidates[0].content.parts)r.inlineData?o=`data:image/png;base64,${r.inlineData.data}`:r.text&&(a=r.text);if(!o)throw new Error("No image data received");return{dataUrl:o,caption:a}}catch(t){throw console.error("Image generation error:",t),t}}async function pg(i){try{const t=[];if(i.content&&i.mimeType){const r=i.mimeType.startsWith("image/"),f=i.mimeType==="application/pdf";if(r||f){const p=i.content.includes("base64,")?i.content.split("base64,")[1]:i.content;t.push({inlineData:{data:p,mimeType:i.mimeType}})}}const o=`Analyze this ${i.source} file. Name: ${i.name} Type: ${i.type} Return JSON: {"summary": "1-2 sentence description", "keywords": ["tag1", "tag2", "tag3", "tag4", "tag5"]}`;t.push({text:o});const a=await ms.models.generateContent({model:"gemini-3-flash-preview",contents:{parts:t},config:{responseMimeType:"application/json",responseSchema:{type:xt.OBJECT,properties:{summary:{type:xt.STRING},keywords:{type:xt.ARRAY,items:{type:xt.STRING}}}}}});return JSON.parse(a.text||'{"summary": "No summary available", "keywords": []}')}catch{return{summary:"Error indexing file",keywords:[]}}}async function SR(i,t){const o=t.filter(r=>r.aiSummary).map(r=>`[File: ${r.name} (Source: ${r.source})] Summary: ${r.aiSummary}`).join(` `);return(await ms.models.generateContent({model:"gemini-3-pro-preview",contents:`You are the Brain of a integrated workspace. Context: ${o||"No files available."} Question: ${i}`})).text||"No response."}async function CR(i,t){try{const o=t.map(r=>({id:r.id,name:r.name,summary:r.aiSummary})),a=await ms.models.generateContent({model:"gemini-3-flash-preview",contents:`Search: "${i}". Return IDs for relevant matches: ${JSON.stringify(o)}`,config:{responseMimeType:"application/json",responseSchema:{type:xt.ARRAY,items:{type:xt.STRING}}}});return JSON.parse(a.text||"[]")}catch{return t.filter(a=>a.name.toLowerCase().includes(i.toLowerCase())).map(a=>a.id)}}const dy="https://api.github.com";async function AR(i){try{const t=await fetch(`${dy}/users/${i}/repos?sort=updated&per_page=30`);if(!t.ok)throw new Error("User not found");return await t.json()}catch(t){return console.error("GitHub fetch error:",t),[]}}async function xR(i,t,o=""){try{const a=await fetch(`${dy}/repos/${i}/${t}/contents/${o}`);return a.ok?await a.json():[]}catch(a){return console.error("GitHub contents fetch error:",a),[]}}async function RR(i){try{const t=await fetch(i);return t.ok?await t.text():"Error fetching content."}catch{return"Failed to load file content."}}function hg(i,t,o,a){return i.map(r=>{const f=!!r.full_name,p=f||r.type==="dir"?Pe.FOLDER:Pe.DOCUMENT;return{id:f?`repo-${r.id}`:`gh-${r.sha||Math.random().toString(36).substr(2,9)}`,name:r.name,type:p,size:r.size||null,lastModified:r.updated_at?new Date(r.updated_at).toLocaleDateString():new Date().toLocaleDateString(),parentId:t,source:"github",githubOwner:o,githubRepo:f?r.name:a,githubUrl:r.html_url,content:r.download_url,extension:r.name.split(".").pop(),mimeType:f||r.type==="dir"?void 0:"text/plain"}})}const py="https://www.googleapis.com/drive/v3";async function mg(i,t="root"){var o;if(i==="demo-token")return MR(t);try{const a=`'${t}' in parents and trashed = false`,r=await fetch(`${py}/files?q=${encodeURIComponent(a)}&fields=files(id, name, mimeType, size, modifiedTime, thumbnailLink)&pageSize=100`,{headers:{Authorization:`Bearer ${i}`}});if(!r.ok){const p=await r.json();throw new Error(((o=p.error)==null?void 0:o.message)||"Drive fetch failed")}return(await r.json()).files||[]}catch(a){throw console.error("Google Drive API Error:",a),a}}async function NR(i,t){if(i==="demo-token")return`Content for mock file ${t}. This is a demonstration of the OMNI Workspace unified viewer. In a real environment with a valid OAuth token, this would be the actual binary or text data from your Google Drive. The OMNI Brain would then analyze this text to provide deep semantic insights.`;try{const o=await fetch(`${py}/files/${t}?alt=media`,{headers:{Authorization:`Bearer ${i}`}});return o.ok?await o.text():"Cannot preview this file type directly (Google Drive API restriction for some file types)."}catch{return"Error loading Drive content."}}function gg(i,t){return i.map(o=>{const a=o.mimeType==="application/vnd.google-apps.folder";let r=Pe.DOCUMENT;return a?r=Pe.FOLDER:o.mimeType.startsWith("image/")?r=Pe.IMAGE:o.mimeType.startsWith("video/")?r=Pe.VIDEO:o.mimeType.startsWith("audio/")&&(r=Pe.AUDIO),{id:`drive-${o.id}`,driveFileId:o.id,name:o.name,type:r,size:o.size?parseInt(o.size):null,lastModified:new Date(o.modifiedTime||Date.now()).toLocaleDateString(),parentId:t,source:"google-drive",mimeType:o.mimeType,isCloudFolder:a,content:o.thumbnailLink}})}function MR(i){return i==="root"?[{id:"mock-1",name:"Project Roadmap.gdoc",mimeType:"application/vnd.google-apps.document",size:"1024",modifiedTime:new Date().toISOString()},{id:"mock-2",name:"Design Assets",mimeType:"application/vnd.google-apps.folder",modifiedTime:new Date().toISOString()},{id:"mock-3",name:"Budget_2024.xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",size:"542000",modifiedTime:new Date().toISOString()},{id:"mock-4",name:"Presentation.pptx",mimeType:"application/vnd.openxmlformats-officedocument.presentationml.presentation",size:"2500000",modifiedTime:new Date().toISOString()}]:i==="mock-2"?[{id:"mock-2-1",name:"Logo_Primary.png",mimeType:"image/png",size:"150000",modifiedTime:new Date().toISOString()},{id:"mock-2-2",name:"Icon_Set.zip",mimeType:"application/zip",size:"8900000",modifiedTime:new Date().toISOString()}]:[]}function IR(){var Rl;const[i,t]=Ae.useState([]),[o,a]=Ae.useState("root"),[r,f]=Ae.useState([]),[p,g]=Ae.useState([]),[y,m]=Ae.useState("grid"),[v,_]=Ae.useState(""),[E,A]=Ae.useState(!1),[I,H]=Ae.useState(null),[U,P]=Ae.useState(!1),[Q,F]=Ae.useState(""),[J,ee]=Ae.useState(""),[B,X]=Ae.useState(!1),[me,W]=Ae.useState(null),[de,ce]=Ae.useState(!1),[Re,qe]=Ae.useState(["jocall3"]),[we,Xe]=Ae.useState(null),[z,Y]=Ae.useState(!1),[ne,ve]=Ae.useState(!1),[Se,N]=Ae.useState(null),[O,K]=Ae.useState(null),[j,le]=Ae.useState([]),[pe,xe]=Ae.useState(""),[st,Fe]=Ae.useState(!1),[Kt,jn]=Ae.useState(""),[ei,vo]=Ae.useState(!1),en=Ae.useRef(null),ti=r.length>0?r[r.length-1]:o,Rt=Ae.useMemo(()=>p.length!==1?null:i.find(G=>G.id===p[0])||null,[p,i]);Ae.useEffect(()=>{U&&Re.forEach(G=>Si(G))},[U]);const El=Ae.useMemo(()=>{let G=i;return I?G=i.filter(ae=>I.includes(ae.id)):v&&!E?G=i.filter(ae=>ae.name.toLowerCase().includes(v.toLowerCase())):G=i.filter(ae=>ae.parentId===ti),o==="starred"&&(G=i.filter(ae=>{var re;return(re=ae.aiKeywords)==null?void 0:re.includes("starred")})),y==="gallery"&&(G=G.filter(ae=>ae.type===Pe.IMAGE)),G},[i,ti,v,I,E,y,o]),Sl=async G=>{if(G.preventDefault(),W(null),!Q||!J)return;X(!0),await new Promise(re=>setTimeout(re,2e3));const ae="demo-token";Xe(ae),P(!0);try{await _o(ae),a("drive"),f([])}catch(re){console.error("Cloud initial sync error",re)}finally{X(!1)}},To=()=>{Xe(null),P(!1),t([]),a("root"),f([]),F(""),ee("")},_o=async G=>{ce(!0);try{const ae=await mg(G),re=gg(ae,"drive");t(ze=>[...ze.filter(Nt=>Nt.source!=="google-drive"),...re])}finally{ce(!1)}},Si=async G=>{ce(!0);const ae=await AR(G),re=hg(ae,`gh-${G}`,G,"Repositories"),ze={id:`gh-${G}`,name:`${G} (GitHub)`,type:Pe.FOLDER,size:null,lastModified:new Date().toLocaleDateString(),parentId:"root",source:"github",githubOwner:G};t(Ve=>[...Ve.filter($e=>!($e.source==="github"&&$e.githubOwner===G)),ze,...re]),ce(!1)},gs=async G=>{if(G.type===Pe.FOLDER){if(G.source==="github"&&G.githubOwner&&G.githubRepo&&!i.some(re=>re.parentId===G.id)){ce(!0);const re=await xR(G.githubOwner,G.githubRepo,G.name===G.githubRepo?"":G.name),ze=hg(re,G.id,G.githubOwner,G.githubRepo);t(Ve=>[...Ve,...ze]),ce(!1)}if(G.source==="google-drive"&&we&&G.driveFileId&&!i.some(re=>re.parentId===G.id)){ce(!0);try{const re=await mg(we,G.driveFileId),ze=gg(re,G.id);t(Ve=>[...Ve,...ze])}finally{ce(!1)}}f([...r,G.id]),g([])}},Cl=async G=>{if(N(G),K(null),ce(!0),G.type===Pe.IMAGE&&G.source!=="google-drive")K(G.content||"");else if(G.source==="github"&&G.content){const ae=await RR(G.content);K(ae),G.aiSummary||pt(G,ae)}else if(G.source==="google-drive"&&we&&G.driveFileId){const ae=await NR(we,G.driveFileId);K(ae),G.aiSummary||pt(G,ae)}else G.source==="local"&&G.content?K(G.content):K("Content unavailable for direct preview. Source: "+G.source);ce(!1)},pt=async(G,ae)=>{const re=await pg({...G,content:ae});t(ze=>ze.map(Ve=>Ve.id===G.id?{...Ve,aiSummary:re.summary,aiKeywords:re.keywords}:Ve))},ys=async()=>{if(!v.trim()){H(null);return}A(!0);try{const G=await CR(v,i);H(G)}finally{A(!1)}},Al=async G=>{if(G.preventDefault(),!pe.trim())return;const ae=pe;xe(""),le(re=>[...re,{role:"user",text:ae}]),Fe(!0);try{const re=await SR(ae,i);le(ze=>[...ze,{role:"ai",text:re}])}finally{Fe(!1)}},xl=async G=>{if(G.preventDefault(),!!Kt.trim()){vo(!0);try{const ae=await ER(Kt),re={id:`ai-${Date.now()}`,name:`Studio_${Math.floor(Math.random()*1e3)}.png`,type:Pe.IMAGE,size:ae.dataUrl.length,lastModified:new Date().toLocaleDateString(),parentId:"ai-gallery",source:"ai",content:ae.dataUrl,mimeType:"image/png",aiSummary:Kt};t(ze=>[...ze,re]),jn(""),ve(!1),a("ai-gallery"),f([])}finally{vo(!1)}}},Ci=G=>{const ae=G.target.files;ae&&Array.from(ae).forEach(re=>{const ze=new FileReader;ze.onload=async Ve=>{var Ml;const Nt=(Ml=Ve.target)==null?void 0:Ml.result,$e={id:Math.random().toString(36).substring(2,11),name:re.name,type:re.type.startsWith("image/")?Pe.IMAGE:Pe.DOCUMENT,size:re.size,lastModified:new Date().toLocaleDateString(),parentId:ti,source:"local",content:Nt,mimeType:re.type};t(Eo=>[...Eo,$e]);const Nl=await pg($e);t(Eo=>Eo.map(Nn=>Nn.id===$e.id?{...Nn,aiSummary:Nl.summary,aiKeywords:Nl.keywords}:Nn))},re.type.startsWith("text/")?ze.readAsText(re):ze.readAsDataURL(re)})};return U?C.jsxs("div",{className:"flex h-screen w-full bg-[#f8f9fa] select-none overflow-hidden relative font-sans text-[#3c4043]",children:[C.jsx("input",{type:"file",multiple:!0,ref:en,className:"hidden",onChange:Ci}),C.jsxs("aside",{className:"w-72 border-r border-gray-200 flex flex-col bg-white z-10 shrink-0",children:[C.jsx("div",{className:"p-8 pb-4",children:C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("div",{className:"w-12 h-12 bg-indigo-600 rounded-2xl flex items-center justify-center text-white shadow-lg rotate-3",children:C.jsx(es,{size:24})}),C.jsxs("div",{children:[C.jsx("div",{className:"font-black text-2xl tracking-tighter text-gray-900 leading-none",children:"OMNI"}),C.jsx("div",{className:"text-[10px] font-bold text-indigo-500 uppercase tracking-widest mt-1",children:"Next-Gen Manager"})]})]})}),C.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-8",children:[C.jsxs("div",{className:"space-y-1",children:[C.jsx("div",{className:"px-4 text-[10px] font-black text-gray-400 uppercase tracking-widest mb-3",children:"Workspace"}),wh.filter(G=>["root","recent","starred"].includes(G.id)).map(G=>C.jsxs("button",{onClick:()=>{a(G.id),f([]),H(null)},className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl text-sm font-bold transition-all ${o===G.id&&r.length===0?"bg-indigo-50 text-indigo-600":"hover:bg-gray-50 text-gray-500"}`,children:[G.icon," ",G.label]},G.id)),C.jsxs("button",{onClick:()=>{a("drive"),f([]),H(null)},className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl text-sm font-bold transition-all ${o==="drive"?"bg-blue-50 text-blue-600":"hover:bg-gray-50 text-gray-500"}`,children:[C.jsx(ja,{size:18})," My Google Drive",C.jsx("div",{className:"ml-auto w-2 h-2 bg-emerald-500 rounded-full shadow-sm"})]}),C.jsxs("button",{onClick:()=>{a("ai-gallery"),f([]),H(null)},className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl text-sm font-bold transition-all ${o==="ai-gallery"?"bg-purple-50 text-purple-600":"hover:bg-gray-50 text-gray-500"}`,children:[C.jsx(zu,{size:18})," AI Studio Art"]})]}),C.jsxs("div",{className:"space-y-1",children:[C.jsxs("div",{className:"px-4 text-[10px] font-black text-gray-400 uppercase tracking-widest mb-3 flex justify-between items-center",children:[C.jsx("span",{children:"GitHub Hub"}),C.jsx("button",{onClick:()=>{const G=prompt("Sync external repository (User):");G&&(qe([...Re,G]),Si(G))},className:"p-1 hover:bg-indigo-50 rounded-lg text-indigo-600",children:C.jsx(YT,{size:14})})]}),Re.map(G=>C.jsxs("button",{onClick:()=>{a(`gh-${G}`),f([]),H(null)},className:`w-full flex items-center gap-3 px-4 py-3 rounded-2xl text-sm font-bold transition-all ${o===`gh-${G}`?"bg-slate-900 text-white shadow-lg":"hover:bg-gray-50 text-gray-500"}`,children:[C.jsx(Hu,{size:18})," ",G]},G))]})]}),C.jsx("div",{className:"p-8 pt-4 border-t border-gray-100 bg-gray-50/30",children:C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center bg-indigo-600 text-white shadow-lg shadow-indigo-100",children:C.jsx(KT,{size:18})}),C.jsxs("div",{className:"flex-1 min-w-0",children:[C.jsx("div",{className:"text-[10px] font-black uppercase tracking-widest text-gray-900 truncate",children:Q.split("@")[0]||"Cloud User"}),C.jsxs("div",{className:"text-[9px] font-bold text-emerald-500 flex items-center gap-1",children:[C.jsx(Mh,{size:8})," Verified Session"]})]}),C.jsx("button",{onClick:To,className:"p-2 text-gray-300 hover:text-red-500 transition-colors",title:"Logout",children:C.jsx(eT,{size:14})})]})})]}),C.jsxs("main",{className:"flex-1 flex flex-col min-w-0 bg-white shadow-2xl relative z-0",children:[C.jsxs("header",{className:"h-24 flex items-center justify-between px-10 border-b border-gray-100 bg-white/90 backdrop-blur-xl sticky top-0 z-20",children:[C.jsxs("div",{className:"flex items-center gap-6 min-w-0",children:[r.length>0&&C.jsx("button",{onClick:()=>f(r.slice(0,-1)),className:"p-3 bg-gray-50 hover:bg-gray-100 rounded-2xl transition-colors text-gray-400",children:C.jsx(Nh,{size:20})}),C.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[C.jsx("span",{className:"font-black text-2xl text-gray-900 tracking-tight",children:((Rl=wh.find(G=>G.id===o))==null?void 0:Rl.label)||o.replace("gh-","")}),r.map(G=>{var re;const ae=((re=i.find(ze=>ze.id===G))==null?void 0:re.name)||"Folder";return C.jsxs(Wa.Fragment,{children:[C.jsx(Qv,{size:20,className:"text-gray-200 shrink-0"}),C.jsx("span",{className:"font-bold text-gray-400 text-lg whitespace-nowrap truncate max-w-[150px]",children:ae})]},G)})]})]}),C.jsxs("div",{className:"flex items-center gap-4",children:[C.jsxs("div",{className:"flex items-center bg-gray-100 rounded-[28px] px-7 py-3.5 w-[450px] focus-within:bg-white focus-within:ring-[10px] focus-within:ring-indigo-50/50 transition-all border border-transparent focus-within:border-indigo-100 group shadow-inner",children:[C.jsx(LT,{size:18,className:"text-gray-400 mr-4 group-focus-within:text-indigo-600 transition-colors"}),C.jsx("input",{type:"text",placeholder:"Ask OMNI about your cloud documents...",className:"bg-transparent border-none outline-none text-sm w-full font-bold text-gray-700 placeholder:text-gray-400",value:v,onChange:G=>_(G.target.value),onKeyDown:G=>G.key==="Enter"&&ys()}),C.jsx(Ya,{size:16,className:`ml-3 transition-all ${E?"text-indigo-500 animate-spin-slow":"text-gray-300"}`})]}),C.jsxs("button",{onClick:()=>m(y==="list"?"grid":y==="grid"?"gallery":"list"),className:"p-3.5 bg-gray-50 text-gray-400 rounded-2xl hover:text-gray-900 transition-all font-black text-[10px] uppercase tracking-[0.2em] flex items-center gap-2 border border-transparent hover:border-gray-200",children:[y==="list"?C.jsx(ST,{size:18}):y==="grid"?C.jsx(_T,{size:18}):C.jsx(vg,{size:18}),C.jsx("span",{className:"hidden lg:inline",children:y})]})]})]}),Rt&&C.jsxs("div",{className:"mx-10 mt-6 p-6 rounded-[36px] bg-gradient-to-br from-indigo-500 via-indigo-600 to-purple-700 text-white flex items-center gap-10 animate-in slide-in-from-top-6 duration-700 shadow-2xl relative overflow-hidden group",children:[C.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2 blur-3xl group-hover:scale-150 transition-transform duration-1000"}),C.jsx("div",{className:"w-20 h-20 bg-white/20 backdrop-blur-xl rounded-[28px] flex items-center justify-center text-white shrink-0 shadow-lg border border-white/20",children:Wa.cloneElement(ku(Rt.type,!1),{size:40})}),C.jsxs("div",{className:"flex-1 min-w-0",children:[C.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[C.jsxs("span",{className:"text-[10px] font-black uppercase text-indigo-100 tracking-widest px-3 py-1 bg-white/20 rounded-full border border-white/10 flex items-center gap-2",children:[Rt.source==="google-drive"?C.jsx(ja,{size:10}):Rt.source==="github"?C.jsx(Hu,{size:10}):C.jsx(es,{size:10}),Rt.source," Content"]}),C.jsx("span",{className:"text-[10px] font-black text-white/50 uppercase tracking-widest",children:Vu(Rt.size)})]}),C.jsx("h3",{className:"font-black text-2xl text-white truncate drop-shadow-sm",children:Rt.name}),C.jsx("p",{className:"text-sm text-indigo-100/80 mt-2 line-clamp-1 italic font-medium",children:Rt.aiSummary||"OMNI Brain is distilling the essence of this file..."})]}),C.jsxs("div",{className:"flex gap-4 relative z-10",children:[C.jsxs("button",{onClick:()=>Cl(Rt),className:"px-8 py-4 bg-white text-indigo-600 rounded-3xl font-black text-xs uppercase tracking-[0.1em] shadow-xl hover:scale-105 transition-all active:scale-95 flex items-center gap-3",children:[C.jsx(lT,{size:18})," Insight Preview"]}),C.jsx("button",{onClick:()=>g([]),className:"p-4 bg-white/10 text-white/60 hover:text-white border border-white/10 rounded-full transition-colors hover:bg-white/20",children:C.jsx(Ja,{size:20})})]})]}),C.jsx("div",{className:"flex-1 overflow-auto p-10 scroll-smooth",children:El.length===0?C.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center",children:[C.jsx("div",{className:"w-48 h-48 bg-gray-50 rounded-[60px] flex items-center justify-center mb-10 border border-gray-100/50 shadow-inner",children:C.jsx(gT,{size:80,className:"text-gray-200"})}),C.jsx("h2",{className:"text-3xl font-black text-gray-800 tracking-tight",children:"Cloud region empty"}),C.jsx("p",{className:"text-base text-gray-400 mt-4 max-w-sm font-medium leading-relaxed italic",children:"Upload local work or sync your cloud hubs to manifest data here."})]}):C.jsx("div",{className:`grid gap-10 ${y==="list"?"grid-cols-1":y==="gallery"?"grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5":"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8"}`,children:El.map(G=>C.jsxs("div",{onClick:ae=>{ae.stopPropagation(),ae.ctrlKey||ae.metaKey?g(re=>re.includes(G.id)?re.filter(ze=>ze!==G.id):[...re,G.id]):g([G.id])},onDoubleClick:()=>G.type===Pe.FOLDER?gs(G):Cl(G),className:`group relative flex flex-col p-6 rounded-[40px] border-2 transition-all cursor-pointer ${p.includes(G.id)?"bg-white border-indigo-600 ring-[12px] ring-indigo-50/50 scale-105 shadow-2xl z-10":"bg-white border-transparent hover:border-gray-100 hover:shadow-xl"}`,children:[C.jsxs("div",{className:"absolute top-5 right-5 flex gap-2",children:[G.source==="google-drive"&&C.jsx(ja,{size:14,className:"text-blue-400 drop-shadow-sm"}),G.source==="github"&&C.jsx(Hu,{size:14,className:"text-gray-900 opacity-0 group-hover:opacity-100 transition-opacity"}),G.source==="ai"&&C.jsx(Ya,{size:14,className:"text-purple-500 animate-pulse"})]}),C.jsx("div",{className:"flex-1 mb-6 rounded-[30px] flex items-center justify-center transition-transform group-hover:scale-110 overflow-hidden bg-gray-50 aspect-square shadow-inner",children:G.type===Pe.IMAGE&&G.content?C.jsx("img",{src:G.content,className:"w-full h-full object-cover",loading:"lazy"}):Wa.cloneElement(ku(G.type),{size:56})}),C.jsxs("div",{className:"px-1",children:[C.jsx("span",{className:"text-sm font-black text-gray-900 truncate block text-center leading-tight",children:G.name}),C.jsx("div",{className:"flex items-center justify-center gap-2 mt-2",children:C.jsx("span",{className:"text-[9px] font-black text-gray-300 uppercase tracking-widest",children:G.type===Pe.FOLDER?"Folder":Vu(G.size)})})]})]},G.id))})}),C.jsxs("footer",{className:"h-32 px-12 border-t border-gray-100 bg-white/90 backdrop-blur-2xl flex items-center justify-between z-30",children:[C.jsxs("div",{className:"flex gap-5",children:[C.jsxs("button",{onClick:()=>{var G;return(G=en.current)==null?void 0:G.click()},className:"flex items-center gap-4 px-10 py-5 bg-gray-900 text-white rounded-[32px] font-black text-sm uppercase tracking-widest shadow-2xl hover:scale-105 active:scale-95 transition-all",children:[C.jsx(uT,{size:22})," Local Files"]}),C.jsxs("button",{onClick:()=>ve(!0),className:"px-10 py-5 bg-gradient-to-r from-purple-600 to-indigo-600 text-white rounded-[32px] font-black text-sm uppercase tracking-widest shadow-xl hover:scale-105 active:scale-95 transition-all flex items-center gap-4",children:[C.jsx(zu,{size:22})," Creative Studio"]})]}),C.jsxs("div",{className:"flex items-center gap-5",children:[C.jsx("button",{onClick:()=>Y(!0),className:"p-5 bg-white border border-gray-100 text-indigo-600 rounded-full shadow-lg hover:bg-indigo-50 hover:border-indigo-200 transition-all active:scale-90",children:C.jsx(Fa,{size:28,className:"animate-pulse"})}),C.jsx("button",{className:`px-16 py-5 rounded-[32px] font-black text-sm uppercase tracking-[0.2em] transition-all duration-500 ${p.length>0?"bg-indigo-600 text-white shadow-2xl shadow-indigo-200 scale-110 active:scale-100":"bg-gray-100 text-gray-300 cursor-not-allowed"}`,disabled:p.length===0,children:"Analyze Hub"})]})]})]}),Se&&C.jsx("div",{className:"fixed inset-0 bg-slate-950/95 backdrop-blur-3xl z-[300] flex items-stretch p-12 animate-in fade-in duration-500",children:C.jsxs("div",{className:"bg-white rounded-[60px] shadow-2xl w-full flex overflow-hidden border border-white/10",children:[C.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[C.jsxs("div",{className:"h-28 px-12 border-b border-gray-100 flex items-center justify-between bg-white relative",children:[C.jsxs("div",{className:"flex items-center gap-6",children:[C.jsx("div",{className:"p-4 bg-gray-50 rounded-3xl shadow-inner",children:ku(Se.type)}),C.jsxs("div",{children:[C.jsx("h2",{className:"font-black text-3xl text-gray-900 leading-tight tracking-tight",children:Se.name}),C.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[C.jsxs("span",{className:"px-3 py-1 bg-indigo-50 text-indigo-600 rounded-full text-[10px] font-black uppercase tracking-widest",children:[Se.source," Connection"]}),C.jsx("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-widest",children:Vu(Se.size)})]})]})]}),C.jsx("button",{onClick:()=>N(null),className:"p-5 bg-red-500 text-white rounded-3xl hover:bg-red-600 transition-all shadow-xl shadow-red-100 active:scale-90 ml-6",children:C.jsx(Ja,{size:28})})]}),C.jsx("div",{className:"flex-1 overflow-auto bg-gray-50 p-16 relative",children:de?C.jsxs("div",{className:"h-full flex items-center justify-center flex-col gap-8",children:[C.jsxs("div",{className:"relative",children:[C.jsx("div",{className:"w-24 h-24 border-8 border-indigo-100 border-t-indigo-600 rounded-full animate-spin"}),C.jsx(Fa,{size:32,className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-indigo-600 animate-pulse"})]}),C.jsx("span",{className:"text-sm font-black uppercase text-indigo-600 tracking-[0.3em] animate-pulse",children:"Retrieving Data..."})]}):Se.type===Pe.IMAGE?C.jsx("div",{className:"h-full flex items-center justify-center",children:C.jsx("img",{src:O||"",className:"max-w-full max-h-[70vh] object-contain rounded-[40px] shadow-2xl border-[16px] border-white"})}):C.jsxs("div",{className:"max-w-5xl mx-auto bg-white rounded-[48px] shadow-2xl overflow-hidden border border-gray-100 h-full flex flex-col",children:[C.jsx("div",{className:"h-16 px-10 bg-[#1e1e2e] flex items-center justify-between",children:C.jsxs("div",{className:"flex items-center gap-3",children:[C.jsx("div",{className:"w-3 h-3 rounded-full bg-[#ff5f56]"}),C.jsx("div",{className:"w-3 h-3 rounded-full bg-[#ffbd2e]"}),C.jsx("div",{className:"w-3 h-3 rounded-full bg-[#27c93f]"}),C.jsx("span",{className:"text-[11px] font-black text-[#6272a4] uppercase tracking-[0.2em] ml-6 font-mono",children:"Stream.log"})]})}),C.jsx("div",{className:"flex-1 overflow-auto bg-[#282a36] p-12 text-gray-300 font-mono text-sm leading-relaxed whitespace-pre-wrap",children:O||"// Content stream initiated. Analyzing..."})]})})]}),C.jsxs("div",{className:"w-[480px] border-l border-gray-100 bg-white flex flex-col shrink-0",children:[C.jsxs("div",{className:"p-12 border-b border-gray-100 bg-gray-50/50",children:[C.jsxs("div",{className:"flex items-center gap-4 text-indigo-600 mb-10",children:[C.jsx("div",{className:"w-14 h-14 bg-white rounded-2xl flex items-center justify-center shadow-lg border border-indigo-50",children:C.jsx(Fa,{size:32})}),C.jsx("span",{className:"font-black text-xl uppercase tracking-tighter text-gray-900",children:"Semantic Insight"})]}),C.jsxs("div",{className:"bg-white p-8 rounded-[40px] shadow-sm border border-gray-100",children:[C.jsxs("h4",{className:"font-black text-xs text-indigo-600 uppercase tracking-widest mb-4 flex items-center gap-2",children:[C.jsx(Ya,{size:14})," Gemini Summary"]}),C.jsx("p",{className:"text-sm text-gray-700 leading-relaxed font-medium",children:Se.aiSummary||"OMNI is analyzing this document context. Semantic data will appear shortly..."})]})]}),C.jsx("div",{className:"flex-1 p-12 overflow-y-auto",children:C.jsxs("div",{className:"text-center py-10 space-y-8",children:[C.jsx("div",{className:"w-20 h-20 bg-indigo-50 rounded-full flex items-center justify-center mx-auto text-indigo-200",children:C.jsx(IT,{size:32})}),C.jsx("p",{className:"text-xs font-bold text-gray-400 uppercase tracking-widest max-w-xs mx-auto leading-relaxed",children:"Ask specific questions about this document in the OMNI Brain."}),C.jsx("button",{onClick:()=>Y(!0),className:"px-8 py-4 bg-indigo-50 text-indigo-600 rounded-3xl font-black text-xs uppercase tracking-widest border border-indigo-100",children:"Launch Brain"})]})}),C.jsx("div",{className:"p-12 border-t border-gray-100",children:C.jsx("button",{className:"w-full py-5 bg-slate-900 text-white rounded-3xl font-black text-xs uppercase tracking-widest",children:"Share Cloud Link"})})]})]})}),ne&&C.jsx("div",{className:"fixed inset-0 bg-gray-950/80 backdrop-blur-2xl z-[500] flex items-center justify-center p-8 animate-in fade-in",children:C.jsxs("div",{className:"bg-white rounded-[64px] shadow-2xl w-full max-w-3xl overflow-hidden",children:[C.jsxs("div",{className:"p-14 bg-gradient-to-br from-indigo-700 via-purple-700 to-indigo-900 text-white relative",children:[C.jsxs("div",{className:"flex items-center gap-8",children:[C.jsx("div",{className:"p-6 bg-white/10 rounded-[36px] backdrop-blur-3xl border border-white/20 shadow-2xl",children:C.jsx(zu,{size:56})}),C.jsxs("div",{children:[C.jsx("h2",{className:"text-5xl font-black tracking-tighter",children:"AI Studio"}),C.jsx("p",{className:"text-xs text-white/50 font-black uppercase tracking-[0.4em] mt-3",children:"Synthesizing Imagery"})]})]}),C.jsx("button",{onClick:()=>ve(!1),className:"absolute top-10 right-10 p-4 hover:bg-white/10 rounded-full transition-all active:scale-90",children:C.jsx(Ja,{size:36})})]}),C.jsx("div",{className:"p-16",children:C.jsxs("form",{onSubmit:xl,className:"space-y-12",children:[C.jsx("textarea",{value:Kt,onChange:G=>jn(G.target.value),placeholder:"Describe your creative vision...",className:"w-full h-56 p-10 bg-gray-50 rounded-[48px] border-none outline-none text-gray-800 placeholder:text-gray-300 font-black text-2xl resize-none shadow-inner focus:ring-[20px] focus:ring-indigo-50 transition-all leading-tight"}),C.jsxs("button",{disabled:ei||!Kt.trim(),className:"w-full py-8 bg-indigo-600 text-white rounded-[40px] font-black text-xl uppercase tracking-[0.2em] shadow-2xl hover:bg-indigo-700 active:scale-95 transition-all flex items-center justify-center gap-6",children:[ei?C.jsx(Ih,{className:"animate-spin",size:32}):C.jsx(Ya,{size:32}),ei?"Manifesting...":"Generate Masterpiece"]})]})})]})}),C.jsxs("div",{className:`fixed right-0 top-0 h-full w-[550px] bg-white border-l border-gray-100 shadow-[0_0_120px_rgba(0,0,0,0.15)] transition-transform duration-700 z-[400] flex flex-col ${z?"translate-x-0":"translate-x-full"}`,children:[C.jsxs("div",{className:"p-12 border-b border-gray-100 bg-[#fbfbfb] flex items-center justify-between",children:[C.jsxs("div",{className:"flex items-center gap-6 text-indigo-600",children:[C.jsx("div",{className:"w-16 h-16 bg-white rounded-3xl flex items-center justify-center shadow-xl border border-indigo-50",children:C.jsx(Fa,{size:36})}),C.jsxs("div",{children:[C.jsx("h2",{className:"text-2xl font-black tracking-tight text-gray-900 leading-none",children:"OMNI BRAIN"}),C.jsx("p",{className:"text-[10px] text-indigo-500 uppercase font-black tracking-widest mt-2",children:"Unified Neural IQ"})]})]}),C.jsx("button",{onClick:()=>Y(!1),className:"p-5 hover:bg-gray-200 rounded-full text-gray-400 transition-all",children:C.jsx(Ja,{size:32})})]}),C.jsxs("div",{className:"flex-1 overflow-y-auto p-12 space-y-10 bg-white",children:[j.map((G,ae)=>C.jsx("div",{className:`flex ${G.role==="user"?"justify-end":"justify-start"} animate-in slide-in-from-bottom-4 duration-500`,children:C.jsx("div",{className:`max-w-[90%] px-10 py-6 rounded-[40px] text-sm leading-relaxed shadow-sm border font-medium ${G.role==="user"?"bg-indigo-600 text-white rounded-tr-none border-transparent":"bg-gray-50 text-gray-800 rounded-tl-none border-gray-100"}`,children:G.text})},ae)),st&&C.jsx("div",{className:"flex justify-start",children:C.jsxs("div",{className:"bg-gray-50 px-10 py-6 rounded-[40px] rounded-tl-none border border-gray-100 flex gap-4",children:[C.jsx("div",{className:"w-3 h-3 bg-indigo-200 rounded-full animate-bounce"}),C.jsx("div",{className:"w-3 h-3 bg-indigo-400 rounded-full animate-bounce [animation-delay:0.2s]"}),C.jsx("div",{className:"w-3 h-3 bg-indigo-600 rounded-full animate-bounce [animation-delay:0.4s]"})]})})]}),C.jsx("form",{onSubmit:Al,className:"p-12 bg-white border-t border-gray-100",children:C.jsxs("div",{className:"relative",children:[C.jsx("input",{type:"text",placeholder:"Inquire about your unified workspace...",className:"w-full bg-gray-50 border-none outline-none py-7 px-10 rounded-[36px] text-base font-bold text-gray-800 focus:bg-white focus:ring-[14px] focus:ring-indigo-50/50 transition-all pr-24 shadow-inner",value:pe,onChange:G=>xe(G.target.value)}),C.jsx("button",{type:"submit",className:"absolute right-5 top-1/2 -translate-y-1/2 p-5 bg-indigo-600 text-white rounded-full shadow-2xl hover:bg-indigo-700 transition-all active:scale-90",children:C.jsx(Nh,{className:"rotate-180",size:28})})]})})]})]}):C.jsxs("div",{className:"h-screen w-full bg-[#f1f3f4] flex flex-col items-center justify-center font-sans overflow-hidden",children:[C.jsxs("div",{className:"absolute inset-0 z-0 opacity-40",children:[C.jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[50vw] h-[50vw] bg-blue-200/50 rounded-full blur-[120px] animate-pulse"}),C.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[50vw] h-[50vw] bg-purple-200/50 rounded-full blur-[120px] animate-pulse",style:{animationDelay:"1s"}})]}),C.jsxs("div",{className:"bg-white w-[480px] rounded-[32px] shadow-[0_24px_80px_rgba(0,0,0,0.1)] border border-gray-100 p-12 z-10 flex flex-col items-center transition-all animate-in zoom-in-95 fade-in duration-700",children:[C.jsxs("div",{className:"mb-10 text-center",children:[C.jsx("div",{className:"w-20 h-20 bg-indigo-600 rounded-[28px] flex items-center justify-center text-white shadow-xl rotate-3 mb-8 mx-auto hover:rotate-0 transition-transform",children:C.jsx(es,{size:40})}),C.jsx("h1",{className:"text-4xl font-black tracking-tighter text-gray-900 mb-2",children:"Google Login"}),C.jsx("p",{className:"text-gray-400 font-medium text-sm",children:"Sync your Drive workspace with OMNI Intelligence."})]}),C.jsxs("form",{onSubmit:Sl,className:"w-full space-y-6",children:[C.jsxs("div",{className:"space-y-4",children:[C.jsxs("div",{className:"relative group",children:[C.jsx(NT,{className:"absolute left-5 top-1/2 -translate-y-1/2 text-gray-300 group-focus-within:text-indigo-600 transition-colors",size:20}),C.jsx("input",{type:"email",required:!0,value:Q,onChange:G=>F(G.target.value),placeholder:"Email or phone",className:"w-full h-16 bg-gray-50 border-2 border-transparent rounded-2xl pl-14 pr-6 font-bold text-gray-700 placeholder:text-gray-400 focus:bg-white focus:border-indigo-600 focus:ring-4 focus:ring-indigo-50 outline-none transition-all shadow-inner"})]}),C.jsxs("div",{className:"relative group",children:[C.jsx(xT,{className:"absolute left-5 top-1/2 -translate-y-1/2 text-gray-300 group-focus-within:text-indigo-600 transition-colors",size:20}),C.jsx("input",{type:"password",required:!0,value:J,onChange:G=>ee(G.target.value),placeholder:"Enter your password",className:"w-full h-16 bg-gray-50 border-2 border-transparent rounded-2xl pl-14 pr-6 font-bold text-gray-700 placeholder:text-gray-400 focus:bg-white focus:border-indigo-600 focus:ring-4 focus:ring-indigo-50 outline-none transition-all shadow-inner"})]})]}),C.jsxs("div",{className:"flex justify-between items-center px-1",children:[C.jsx("button",{type:"button",className:"text-indigo-600 text-xs font-black uppercase tracking-widest hover:underline",children:"Forgot email?"}),C.jsx("button",{type:"button",className:"text-indigo-600 text-xs font-black uppercase tracking-widest hover:underline",children:"Create account"})]}),C.jsx("button",{type:"submit",disabled:B,className:"w-full h-20 bg-indigo-600 text-white rounded-[24px] font-black text-lg uppercase tracking-widest shadow-2xl shadow-indigo-100 hover:bg-indigo-700 transition-all active:scale-95 flex items-center justify-center gap-4 disabled:opacity-70 disabled:cursor-not-allowed mt-4",children:B?C.jsxs(C.Fragment,{children:[C.jsx(Ih,{className:"animate-spin",size:28})," Synchronizing..."]}):C.jsxs(C.Fragment,{children:[C.jsx(Mh,{size:24})," Next"]})})]}),C.jsxs("div",{className:"mt-12 flex items-center gap-3 text-[10px] font-black text-gray-300 uppercase tracking-[0.2em]",children:[C.jsx(HT,{size:12})," Secure Identity Exchange v4.2"]})]}),C.jsxs("div",{className:"fixed bottom-10 flex gap-10 text-[11px] font-black text-gray-400 uppercase tracking-widest",children:[C.jsx("a",{href:"#",className:"hover:text-gray-900 transition-colors",children:"Privacy"}),C.jsx("a",{href:"#",className:"hover:text-gray-900 transition-colors",children:"Terms"}),C.jsx("a",{href:"#",className:"hover:text-gray-900 transition-colors",children:"Help"})]})]})}const hy=document.getElementById("root");if(!hy)throw new Error("Could not find root element");const wR=kv.createRoot(hy);wR.render(C.jsx(Wa.StrictMode,{children:C.jsx(IR,{})}));