notes/.obsidian/plugins/copilot/main.js

1478 lines
No EOL
3.2 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var pVt=Object.create;var gq=Object.defineProperty;var mVt=Object.getOwnPropertyDescriptor;var hVt=Object.getOwnPropertyNames;var gVt=Object.getPrototypeOf,yVt=Object.prototype.hasOwnProperty;var xDe=t=>{throw TypeError(t)};var bVt=(t,e,r)=>e in t?gq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var O=(t,e)=>()=>(t&&(e=t(t=0)),e);var b=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ff=(t,e)=>{for(var r in e)gq(t,r,{get:e[r],enumerable:!0})},CDe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of hVt(e))!yVt.call(t,o)&&o!==r&&gq(t,o,{get:()=>e[o],enumerable:!(n=mVt(e,o))||n.enumerable});return t};var B=(t,e,r)=>(r=t!=null?pVt(gVt(t)):{},CDe(e||!t||!t.__esModule?gq(r,"default",{value:t,enumerable:!0}):r,t)),gl=t=>CDe(gq({},"__esModule",{value:!0}),t);var Wl=(t,e,r)=>bVt(t,typeof e!="symbol"?e+"":e,r),_Vt=(t,e,r)=>e.has(t)||xDe("Cannot "+r);var ODe=(t,e,r)=>e.has(t)?xDe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var EDe=(t,e,r)=>(_Vt(t,e,"access private method"),r);function Vse(){if(!v6&&(v6=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!v6))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return v6(vVt)}var v6,vVt,PDe=O(()=>{vVt=new Uint8Array(16)});function TDe(t,e=0){return Kl[t[e+0]]+Kl[t[e+1]]+Kl[t[e+2]]+Kl[t[e+3]]+"-"+Kl[t[e+4]]+Kl[t[e+5]]+"-"+Kl[t[e+6]]+Kl[t[e+7]]+"-"+Kl[t[e+8]]+Kl[t[e+9]]+"-"+Kl[t[e+10]]+Kl[t[e+11]]+Kl[t[e+12]]+Kl[t[e+13]]+Kl[t[e+14]]+Kl[t[e+15]]}var Kl,ADe=O(()=>{Kl=[];for(let t=0;t<256;++t)Kl.push((t+256).toString(16).slice(1))});var wVt,Wse,IDe=O(()=>{wVt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Wse={randomUUID:wVt}});function SVt(t,e,r){if(Wse.randomUUID&&!e&&!t)return Wse.randomUUID();t=t||{};let n=t.random||(t.rng||Vse)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let o=0;o<16;++o)e[r+o]=n[o];return e}return TDe(n)}var tI,MDe=O(()=>{IDe();PDe();ADe();tI=SVt});var w6=O(()=>{MDe()});function CVt(t){NDe=t}function S6(){return NDe}function Qe(t,e){let r=S6(),n=x6({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===lD?void 0:lD].filter(o=>!!o)});t.common.issues.push(n)}function C6(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function LDe(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function Or(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{var u,l;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}},description:o}}function kDe(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function UVt(t){return new RegExp(`^${kDe(t)}$`)}function BDe(t){let e=`${FDe}T${kDe(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function zVt(t,e){return!!((e==="v4"||!e)&&NVt.test(t)||(e==="v6"||!e)&&FVt.test(t))}function HVt(t,e){if(!MVt.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function VVt(t,e){return!!((e==="v4"||!e)&&LVt.test(t)||(e==="v6"||!e)&&kVt.test(t))}function WVt(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(t.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}function sD(t){if(t instanceof mf){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=pf.create(sD(n))}return new mf({...t._def,shape:()=>e})}else return t instanceof zS?new zS({...t._def,type:sD(t.element)}):t instanceof pf?pf.create(sD(t.unwrap())):t instanceof Sy?Sy.create(sD(t.unwrap())):t instanceof wy?wy.create(t.items.map(e=>sD(e))):t}function Zse(t,e){let r=qS(t),n=qS(e);if(t===e)return{valid:!0,data:t};if(r===at.object&&n===at.object){let o=Mn.objectKeys(e),i=Mn.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=Zse(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===at.array&&n===at.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],u=Zse(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===at.date&&n===at.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function $De(t,e){return new pI({values:t,typeName:ne.ZodEnum,...Or(e)})}function jDe(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function qDe(t,e={},r){return t?$O.create().superRefine((n,o)=>{var i,a;let s=t(n);if(s instanceof Promise)return s.then(u=>{var l,c;if(!u){let d=jDe(e,n),f=(c=(l=d.fatal)!==null&&l!==void 0?l:r)!==null&&c!==void 0?c:!0;o.addIssue({code:"custom",...d,fatal:f})}});if(!s){let u=jDe(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0;o.addIssue({code:"custom",...u,fatal:l})}}):$O.create()}var Mn,Jse,at,qS,Pe,xVt,yp,lD,NDe,x6,OVt,qc,Zt,uD,Ad,Gse,Yse,rI,_q,Et,yq,bq,bm,RDe,Er,EVt,PVt,TVt,AVt,IVt,MVt,RVt,jVt,DVt,Kse,NVt,LVt,FVt,kVt,BVt,$Vt,FDe,qVt,BO,nI,oI,iI,aI,cD,sI,uI,$O,US,Qh,dD,zS,mf,lI,$S,O6,cI,wy,E6,fD,pD,P6,dI,fI,pI,mI,qO,bp,pf,Sy,hI,gI,mD,KVt,vq,wq,yI,JVt,ne,GVt,UDe,zDe,YVt,ZVt,HDe,XVt,QVt,e6t,t6t,r6t,n6t,o6t,i6t,a6t,s6t,u6t,l6t,c6t,d6t,f6t,p6t,m6t,h6t,g6t,y6t,b6t,_6t,v6t,w6t,DDe,S6t,x6t,C6t,O6t,E6t,P6t,T6t,A6t,I6t,Pr,Uc=O(()=>{(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Mn||(Mn={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Jse||(Jse={}));at=Mn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qS=t=>{switch(typeof t){case"undefined":return at.undefined;case"string":return at.string;case"number":return isNaN(t)?at.nan:at.number;case"boolean":return at.boolean;case"function":return at.function;case"bigint":return at.bigint;case"symbol":return at.symbol;case"object":return Array.isArray(t)?at.array:t===null?at.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?at.promise:typeof Map<"u"&&t instanceof Map?at.map:typeof Set<"u"&&t instanceof Set?at.set:typeof Date<"u"&&t instanceof Date?at.date:at.object;default:return at.unknown}},Pe=Mn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),xVt=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),yp=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Mn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};yp.create=t=>new yp(t);lD=(t,e)=>{let r;switch(t.code){case Pe.invalid_type:t.received===at.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Pe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Mn.jsonStringifyReplacer)}`;break;case Pe.unrecognized_keys:r=`Unrecognized key(s) in object: ${Mn.joinValues(t.keys,", ")}`;break;case Pe.invalid_union:r="Invalid input";break;case Pe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Mn.joinValues(t.options)}`;break;case Pe.invalid_enum_value:r=`Invalid enum value. Expected ${Mn.joinValues(t.options)}, received '${t.received}'`;break;case Pe.invalid_arguments:r="Invalid function arguments";break;case Pe.invalid_return_type:r="Invalid function return type";break;case Pe.invalid_date:r="Invalid date";break;case Pe.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Mn.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Pe.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Pe.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Pe.custom:r="Invalid input";break;case Pe.invalid_intersection_types:r="Intersection results could not be merged";break;case Pe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Pe.not_finite:r="Number must be finite";break;default:r=e.defaultError,Mn.assertNever(t)}return{message:r}},NDe=lD;x6=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}},OVt=[];qc=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return Zt;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return Zt;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},Zt=Object.freeze({status:"aborted"}),uD=t=>({status:"dirty",value:t}),Ad=t=>({status:"valid",value:t}),Gse=t=>t.status==="aborted",Yse=t=>t.status==="dirty",rI=t=>t.status==="valid",_q=t=>typeof Promise<"u"&&t instanceof Promise;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Et||(Et={}));bm=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},RDe=(t,e)=>{if(rI(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new yp(t.common.issues);return this._error=r,this._error}}};Er=class{get description(){return this._def.description}_getType(e){return qS(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:qS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qc,ctx:{common:e.parent.common,data:e.data,parsedType:qS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(_q(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qS(e)},i=this._parseSync({data:e,path:o.path,parent:o});return RDe(o,i)}"~validate"(e){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qS(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return rI(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>rI(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qS(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(_q(o)?o:Promise.resolve(o));return RDe(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:Pe.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new bp({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return pf.create(this,this._def)}nullable(){return Sy.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return zS.create(this)}promise(){return qO.create(this,this._def)}or(e){return lI.create([this,e],this._def)}and(e){return cI.create(this,e,this._def)}transform(e){return new bp({...Or(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new hI({...Or(this._def),innerType:this,defaultValue:r,typeName:ne.ZodDefault})}brand(){return new vq({typeName:ne.ZodBranded,type:this,...Or(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new gI({...Or(this._def),innerType:this,catchValue:r,typeName:ne.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return wq.create(this,e)}readonly(){return yI.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},EVt=/^c[^\s-]{8,}$/i,PVt=/^[0-9a-z]+$/,TVt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,AVt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,IVt=/^[a-z0-9_-]{21}$/i,MVt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,RVt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,jVt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,DVt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",NVt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,LVt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,FVt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,kVt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,BVt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$Vt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,FDe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",qVt=new RegExp(`^${FDe}$`);BO=class t extends Er{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==at.string){let i=this._getOrReturnCtx(e);return Qe(i,{code:Pe.invalid_type,expected:at.string,received:i.parsedType}),Zt}let n=new qc,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),Qe(o,{code:Pe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),Qe(o,{code:Pe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?Qe(o,{code:Pe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&Qe(o,{code:Pe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")jVt.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"email",code:Pe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Kse||(Kse=new RegExp(DVt,"u")),Kse.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"emoji",code:Pe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")AVt.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"uuid",code:Pe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")IVt.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"nanoid",code:Pe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")EVt.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"cuid",code:Pe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")PVt.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"cuid2",code:Pe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")TVt.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"ulid",code:Pe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),Qe(o,{validation:"url",code:Pe.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"regex",code:Pe.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),Qe(o,{code:Pe.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),Qe(o,{code:Pe.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),Qe(o,{code:Pe.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?BDe(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{code:Pe.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?qVt.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{code:Pe.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?UVt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{code:Pe.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?RVt.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"duration",code:Pe.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?zVt(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"ip",code:Pe.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?HVt(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"jwt",code:Pe.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?VVt(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"cidr",code:Pe.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?BVt.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"base64",code:Pe.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?$Vt.test(e.data)||(o=this._getOrReturnCtx(e,o),Qe(o,{validation:"base64url",code:Pe.invalid_string,message:i.message}),n.dirty()):Mn.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Pe.invalid_string,...Et.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Et.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Et.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Et.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Et.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Et.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Et.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Et.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Et.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Et.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Et.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Et.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Et.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Et.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...Et.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Et.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Et.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Et.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Et.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Et.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Et.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Et.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Et.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Et.errToObj(r)})}nonempty(e){return this.min(1,Et.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};BO.create=t=>{var e;return new BO({checks:[],typeName:ne.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Or(t)})};nI=class t extends Er{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==at.number){let i=this._getOrReturnCtx(e);return Qe(i,{code:Pe.invalid_type,expected:at.number,received:i.parsedType}),Zt}let n,o=new qc;for(let i of this._def.checks)i.kind==="int"?Mn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Pe.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Pe.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Pe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?WVt(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Pe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Pe.not_finite,message:i.message}),o.dirty()):Mn.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Et.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Et.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Et.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Et.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Et.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Et.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Et.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Et.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Et.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Et.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Et.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Mn.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};nI.create=t=>new nI({checks:[],typeName:ne.ZodNumber,coerce:t?.coerce||!1,...Or(t)});oI=class t extends Er{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==at.bigint)return this._getInvalidInput(e);let n,o=new qc;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Pe.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Pe.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Pe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Mn.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Qe(r,{code:Pe.invalid_type,expected:at.bigint,received:r.parsedType}),Zt}gte(e,r){return this.setLimit("min",e,!0,Et.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Et.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Et.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Et.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Et.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Et.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Et.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};oI.create=t=>{var e;return new oI({checks:[],typeName:ne.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Or(t)})};iI=class extends Er{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==at.boolean){let n=this._getOrReturnCtx(e);return Qe(n,{code:Pe.invalid_type,expected:at.boolean,received:n.parsedType}),Zt}return Ad(e.data)}};iI.create=t=>new iI({typeName:ne.ZodBoolean,coerce:t?.coerce||!1,...Or(t)});aI=class t extends Er{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==at.date){let i=this._getOrReturnCtx(e);return Qe(i,{code:Pe.invalid_type,expected:at.date,received:i.parsedType}),Zt}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return Qe(i,{code:Pe.invalid_date}),Zt}let n=new qc,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),Qe(o,{code:Pe.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),Qe(o,{code:Pe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Mn.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Et.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Et.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};aI.create=t=>new aI({checks:[],coerce:t?.coerce||!1,typeName:ne.ZodDate,...Or(t)});cD=class extends Er{_parse(e){if(this._getType(e)!==at.symbol){let n=this._getOrReturnCtx(e);return Qe(n,{code:Pe.invalid_type,expected:at.symbol,received:n.parsedType}),Zt}return Ad(e.data)}};cD.create=t=>new cD({typeName:ne.ZodSymbol,...Or(t)});sI=class extends Er{_parse(e){if(this._getType(e)!==at.undefined){let n=this._getOrReturnCtx(e);return Qe(n,{code:Pe.invalid_type,expected:at.undefined,received:n.parsedType}),Zt}return Ad(e.data)}};sI.create=t=>new sI({typeName:ne.ZodUndefined,...Or(t)});uI=class extends Er{_parse(e){if(this._getType(e)!==at.null){let n=this._getOrReturnCtx(e);return Qe(n,{code:Pe.invalid_type,expected:at.null,received:n.parsedType}),Zt}return Ad(e.data)}};uI.create=t=>new uI({typeName:ne.ZodNull,...Or(t)});$O=class extends Er{constructor(){super(...arguments),this._any=!0}_parse(e){return Ad(e.data)}};$O.create=t=>new $O({typeName:ne.ZodAny,...Or(t)});US=class extends Er{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ad(e.data)}};US.create=t=>new US({typeName:ne.ZodUnknown,...Or(t)});Qh=class extends Er{_parse(e){let r=this._getOrReturnCtx(e);return Qe(r,{code:Pe.invalid_type,expected:at.never,received:r.parsedType}),Zt}};Qh.create=t=>new Qh({typeName:ne.ZodNever,...Or(t)});dD=class extends Er{_parse(e){if(this._getType(e)!==at.undefined){let n=this._getOrReturnCtx(e);return Qe(n,{code:Pe.invalid_type,expected:at.void,received:n.parsedType}),Zt}return Ad(e.data)}};dD.create=t=>new dD({typeName:ne.ZodVoid,...Or(t)});zS=class t extends Er{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==at.array)return Qe(r,{code:Pe.invalid_type,expected:at.array,received:r.parsedType}),Zt;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(Qe(r,{code:a?Pe.too_big:Pe.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(Qe(r,{code:Pe.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(Qe(r,{code:Pe.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new bm(r,a,r.path,s)))).then(a=>qc.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new bm(r,a,r.path,s)));return qc.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Et.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Et.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Et.toString(r)}})}nonempty(e){return this.min(1,e)}};zS.create=(t,e)=>new zS({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...Or(e)});mf=class t extends Er{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Mn.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==at.object){let l=this._getOrReturnCtx(e);return Qe(l,{code:Pe.invalid_type,expected:at.object,received:l.parsedType}),Zt}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Qh&&this._def.unknownKeys==="strip"))for(let l in o.data)a.includes(l)||s.push(l);let u=[];for(let l of a){let c=i[l],d=o.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new bm(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Qh){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of s)u.push({key:{status:"valid",value:c},value:{status:"valid",value:o.data[c]}});else if(l==="strict")s.length>0&&(Qe(o,{code:Pe.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let c of s){let d=o.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new bm(o,d,o.path,c)),alwaysSet:c in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let c of u){let d=await c.key,f=await c.value;l.push({key:d,value:f,alwaysSet:c.alwaysSet})}return l}).then(l=>qc.mergeObjectSync(n,l)):qc.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Et.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=Et.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ne.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Mn.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Mn.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return sD(this)}partial(e){let r={};return Mn.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return Mn.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof pf;)i=i._def.innerType;r[n]=i}}),new t({...this._def,shape:()=>r})}keyof(){return $De(Mn.objectKeys(this.shape))}};mf.create=(t,e)=>new mf({shape:()=>t,unknownKeys:"strip",catchall:Qh.create(),typeName:ne.ZodObject,...Or(e)});mf.strictCreate=(t,e)=>new mf({shape:()=>t,unknownKeys:"strict",catchall:Qh.create(),typeName:ne.ZodObject,...Or(e)});mf.lazycreate=(t,e)=>new mf({shape:t,unknownKeys:"strip",catchall:Qh.create(),typeName:ne.ZodObject,...Or(e)});lI=class extends Er{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new yp(s.ctx.common.issues));return Qe(r,{code:Pe.invalid_union,unionErrors:a}),Zt}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},c=u._parseSync({data:r.data,path:r.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new yp(u));return Qe(r,{code:Pe.invalid_union,unionErrors:s}),Zt}}get options(){return this._def.options}};lI.create=(t,e)=>new lI({options:t,typeName:ne.ZodUnion,...Or(e)});$S=t=>t instanceof dI?$S(t.schema):t instanceof bp?$S(t.innerType()):t instanceof fI?[t.value]:t instanceof pI?t.options:t instanceof mI?Mn.objectValues(t.enum):t instanceof hI?$S(t._def.innerType):t instanceof sI?[void 0]:t instanceof uI?[null]:t instanceof pf?[void 0,...$S(t.unwrap())]:t instanceof Sy?[null,...$S(t.unwrap())]:t instanceof vq||t instanceof yI?$S(t.unwrap()):t instanceof gI?$S(t._def.innerType):[],O6=class t extends Er{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==at.object)return Qe(r,{code:Pe.invalid_type,expected:at.object,received:r.parsedType}),Zt;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(Qe(r,{code:Pe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Zt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=$S(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Or(n)})}};cI=class extends Er{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(Gse(i)||Gse(a))return Zt;let s=Zse(i.value,a.value);return s.valid?((Yse(i)||Yse(a))&&r.dirty(),{status:r.value,value:s.data}):(Qe(n,{code:Pe.invalid_intersection_types}),Zt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};cI.create=(t,e,r)=>new cI({left:t,right:e,typeName:ne.ZodIntersection,...Or(r)});wy=class t extends Er{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==at.array)return Qe(n,{code:Pe.invalid_type,expected:at.array,received:n.parsedType}),Zt;if(n.data.length<this._def.items.length)return Qe(n,{code:Pe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Zt;!this._def.rest&&n.data.length>this._def.items.length&&(Qe(n,{code:Pe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new bm(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>qc.mergeArray(r,a)):qc.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wy.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wy({items:t,typeName:ne.ZodTuple,rest:null,...Or(e)})};E6=class t extends Er{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==at.object)return Qe(n,{code:Pe.invalid_type,expected:at.object,received:n.parsedType}),Zt;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new bm(n,s,n.path,s)),value:a._parse(new bm(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?qc.mergeObjectAsync(r,o):qc.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Er?new t({keyType:e,valueType:r,typeName:ne.ZodRecord,...Or(n)}):new t({keyType:BO.create(),valueType:e,typeName:ne.ZodRecord,...Or(r)})}},fD=class extends Er{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==at.map)return Qe(n,{code:Pe.invalid_type,expected:at.map,received:n.parsedType}),Zt;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new bm(n,s,n.path,[l,"key"])),value:i._parse(new bm(n,u,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,c=await u.value;if(l.status==="aborted"||c.status==="aborted")return Zt;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let u of a){let l=u.key,c=u.value;if(l.status==="aborted"||c.status==="aborted")return Zt;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};fD.create=(t,e,r)=>new fD({valueType:e,keyType:t,typeName:ne.ZodMap,...Or(r)});pD=class t extends Er{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==at.set)return Qe(n,{code:Pe.invalid_type,expected:at.set,received:n.parsedType}),Zt;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Qe(n,{code:Pe.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(Qe(n,{code:Pe.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let l=new Set;for(let c of u){if(c.status==="aborted")return Zt;c.status==="dirty"&&r.dirty(),l.add(c.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((u,l)=>i._parse(new bm(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Et.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Et.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};pD.create=(t,e)=>new pD({valueType:t,minSize:null,maxSize:null,typeName:ne.ZodSet,...Or(e)});P6=class t extends Er{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==at.function)return Qe(r,{code:Pe.invalid_type,expected:at.function,received:r.parsedType}),Zt;function n(s,u){return x6({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,S6(),lD].filter(l=>!!l),issueData:{code:Pe.invalid_arguments,argumentsError:u}})}function o(s,u){return x6({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,S6(),lD].filter(l=>!!l),issueData:{code:Pe.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof qO){let s=this;return Ad(async function(...u){let l=new yp([]),c=await s._def.args.parseAsync(u,i).catch(p=>{throw l.addIssue(n(u,p)),l}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw l.addIssue(o(d,p)),l})})}else{let s=this;return Ad(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new yp([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new yp([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wy.create(e).rest(US.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||wy.create([]).rest(US.create()),returns:r||US.create(),typeName:ne.ZodFunction,...Or(n)})}},dI=class extends Er{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};dI.create=(t,e)=>new dI({getter:t,typeName:ne.ZodLazy,...Or(e)});fI=class extends Er{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Qe(r,{received:r.data,code:Pe.invalid_literal,expected:this._def.value}),Zt}return{status:"valid",value:e.data}}get value(){return this._def.value}};fI.create=(t,e)=>new fI({value:t,typeName:ne.ZodLiteral,...Or(e)});pI=class t extends Er{constructor(){super(...arguments),yq.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Qe(r,{expected:Mn.joinValues(n),received:r.parsedType,code:Pe.invalid_type}),Zt}if(C6(this,yq,"f")||LDe(this,yq,new Set(this._def.values),"f"),!C6(this,yq,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return Qe(r,{received:r.data,code:Pe.invalid_enum_value,options:n}),Zt}return Ad(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};yq=new WeakMap;pI.create=$De;mI=class extends Er{constructor(){super(...arguments),bq.set(this,void 0)}_parse(e){let r=Mn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==at.string&&n.parsedType!==at.number){let o=Mn.objectValues(r);return Qe(n,{expected:Mn.joinValues(o),received:n.parsedType,code:Pe.invalid_type}),Zt}if(C6(this,bq,"f")||LDe(this,bq,new Set(Mn.getValidEnumValues(this._def.values)),"f"),!C6(this,bq,"f").has(e.data)){let o=Mn.objectValues(r);return Qe(n,{received:n.data,code:Pe.invalid_enum_value,options:o}),Zt}return Ad(e.data)}get enum(){return this._def.values}};bq=new WeakMap;mI.create=(t,e)=>new mI({values:t,typeName:ne.ZodNativeEnum,...Or(e)});qO=class extends Er{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==at.promise&&r.common.async===!1)return Qe(r,{code:Pe.invalid_type,expected:at.promise,received:r.parsedType}),Zt;let n=r.parsedType===at.promise?r.data:Promise.resolve(r.data);return Ad(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};qO.create=(t,e)=>new qO({type:t,typeName:ne.ZodPromise,...Or(e)});bp=class extends Er{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{Qe(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return Zt;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?Zt:u.status==="dirty"||r.value==="dirty"?uD(u.value):u});{if(r.value==="aborted")return Zt;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Zt:s.status==="dirty"||r.value==="dirty"?uD(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Zt:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Zt:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!rI(a))return a;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>rI(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);Mn.assertNever(o)}};bp.create=(t,e,r)=>new bp({schema:t,typeName:ne.ZodEffects,effect:e,...Or(r)});bp.createWithPreprocess=(t,e,r)=>new bp({schema:e,effect:{type:"preprocess",transform:t},typeName:ne.ZodEffects,...Or(r)});pf=class extends Er{_parse(e){return this._getType(e)===at.undefined?Ad(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pf.create=(t,e)=>new pf({innerType:t,typeName:ne.ZodOptional,...Or(e)});Sy=class extends Er{_parse(e){return this._getType(e)===at.null?Ad(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Sy.create=(t,e)=>new Sy({innerType:t,typeName:ne.ZodNullable,...Or(e)});hI=class extends Er{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===at.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};hI.create=(t,e)=>new hI({innerType:t,typeName:ne.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Or(e)});gI=class extends Er{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return _q(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new yp(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new yp(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};gI.create=(t,e)=>new gI({innerType:t,typeName:ne.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Or(e)});mD=class extends Er{_parse(e){if(this._getType(e)!==at.nan){let n=this._getOrReturnCtx(e);return Qe(n,{code:Pe.invalid_type,expected:at.nan,received:n.parsedType}),Zt}return{status:"valid",value:e.data}}};mD.create=t=>new mD({typeName:ne.ZodNaN,...Or(t)});KVt=Symbol("zod_brand"),vq=class extends Er{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},wq=class t extends Er{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Zt:i.status==="dirty"?(r.dirty(),uD(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Zt:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ne.ZodPipeline})}},yI=class extends Er{_parse(e){let r=this._def.innerType._parse(e),n=o=>(rI(o)&&(o.value=Object.freeze(o.value)),o);return _q(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};yI.create=(t,e)=>new yI({innerType:t,typeName:ne.ZodReadonly,...Or(e)});JVt={object:mf.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ne||(ne={}));GVt=(t,e={message:`Input not instance of ${t.name}`})=>qDe(r=>r instanceof t,e),UDe=BO.create,zDe=nI.create,YVt=mD.create,ZVt=oI.create,HDe=iI.create,XVt=aI.create,QVt=cD.create,e6t=sI.create,t6t=uI.create,r6t=$O.create,n6t=US.create,o6t=Qh.create,i6t=dD.create,a6t=zS.create,s6t=mf.create,u6t=mf.strictCreate,l6t=lI.create,c6t=O6.create,d6t=cI.create,f6t=wy.create,p6t=E6.create,m6t=fD.create,h6t=pD.create,g6t=P6.create,y6t=dI.create,b6t=fI.create,_6t=pI.create,v6t=mI.create,w6t=qO.create,DDe=bp.create,S6t=pf.create,x6t=Sy.create,C6t=bp.createWithPreprocess,O6t=wq.create,E6t=()=>UDe().optional(),P6t=()=>zDe().optional(),T6t=()=>HDe().optional(),A6t={string:t=>BO.create({...t,coerce:!0}),number:t=>nI.create({...t,coerce:!0}),boolean:t=>iI.create({...t,coerce:!0}),bigint:t=>oI.create({...t,coerce:!0}),date:t=>aI.create({...t,coerce:!0})},I6t=Zt,Pr=Object.freeze({__proto__:null,defaultErrorMap:lD,setErrorMap:CVt,getErrorMap:S6,makeIssue:x6,EMPTY_PATH:OVt,addIssueToContext:Qe,ParseStatus:qc,INVALID:Zt,DIRTY:uD,OK:Ad,isAborted:Gse,isDirty:Yse,isValid:rI,isAsync:_q,get util(){return Mn},get objectUtil(){return Jse},ZodParsedType:at,getParsedType:qS,ZodType:Er,datetimeRegex:BDe,ZodString:BO,ZodNumber:nI,ZodBigInt:oI,ZodBoolean:iI,ZodDate:aI,ZodSymbol:cD,ZodUndefined:sI,ZodNull:uI,ZodAny:$O,ZodUnknown:US,ZodNever:Qh,ZodVoid:dD,ZodArray:zS,ZodObject:mf,ZodUnion:lI,ZodDiscriminatedUnion:O6,ZodIntersection:cI,ZodTuple:wy,ZodRecord:E6,ZodMap:fD,ZodSet:pD,ZodFunction:P6,ZodLazy:dI,ZodLiteral:fI,ZodEnum:pI,ZodNativeEnum:mI,ZodPromise:qO,ZodEffects:bp,ZodTransformer:bp,ZodOptional:pf,ZodNullable:Sy,ZodDefault:hI,ZodCatch:gI,ZodNaN:mD,BRAND:KVt,ZodBranded:vq,ZodPipeline:wq,ZodReadonly:yI,custom:qDe,Schema:Er,ZodSchema:Er,late:JVt,get ZodFirstPartyTypeKind(){return ne},coerce:A6t,any:r6t,array:a6t,bigint:ZVt,boolean:HDe,date:XVt,discriminatedUnion:c6t,effect:DDe,enum:_6t,function:g6t,instanceof:GVt,intersection:d6t,lazy:y6t,literal:b6t,map:m6t,nan:YVt,nativeEnum:v6t,never:o6t,null:t6t,nullable:x6t,number:zDe,object:s6t,oboolean:T6t,onumber:P6t,optional:S6t,ostring:E6t,pipeline:O6t,preprocess:C6t,promise:w6t,record:p6t,set:h6t,strictObject:u6t,string:UDe,symbol:QVt,transformer:DDe,tuple:f6t,undefined:e6t,union:l6t,unknown:n6t,void:i6t,NEVER:I6t,ZodIssueCode:Pe,quotelessJson:xVt,ZodError:yp})});var WDe=b((Mbn,VDe)=>{function _m(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.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))}VDe.exports=_m;_m.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};_m.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};_m.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0};_m.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};_m.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};_m.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};_m.prototype.start=_m.prototype.try;_m.prototype.errors=function(){return this._errors};_m.prototype.attempts=function(){return this._attempts};_m.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var KDe=b(bI=>{var M6t=WDe();bI.operation=function(t){var e=bI.timeouts(t);return new M6t(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};bI.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(i,a){return i-a}),n};bI.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};bI.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var i=r[o],a=t[i];t[i]=function(u){var l=bI.operation(e),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(f){l.retry(f)||(f&&(arguments[0]=l.mainError()),d.apply(this,arguments))}),l.attempt(function(){u.apply(t,c)})}.bind(t,a),t[i].options=e}}});var GDe=b((jbn,JDe)=>{JDe.exports=KDe()});var I6=b((Dbn,A6)=>{"use strict";var R6t=GDe(),j6t=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],T6=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},D6t=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},N6t=t=>j6t.includes(t),YDe=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=R6t.operation(e);o.attempt(async i=>{try{r(await t(i))}catch(a){if(!(a instanceof Error)){n(new TypeError(`Non-error was thrown: "${a}". You should only throw errors.`));return}if(a instanceof T6)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!N6t(a.message))o.stop(),n(a);else{D6t(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});A6.exports=YDe;A6.exports.default=YDe;A6.exports.AbortError=T6});var ZDe,XDe=O(()=>{ZDe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});function L6t(t){return typeof t=="string"&&ZDe.test(t)}var UO,QDe=O(()=>{XDe();UO=L6t});function eNe(t,e=0){return(Jl[t[e+0]]+Jl[t[e+1]]+Jl[t[e+2]]+Jl[t[e+3]]+"-"+Jl[t[e+4]]+Jl[t[e+5]]+"-"+Jl[t[e+6]]+Jl[t[e+7]]+"-"+Jl[t[e+8]]+Jl[t[e+9]]+"-"+Jl[t[e+10]]+Jl[t[e+11]]+Jl[t[e+12]]+Jl[t[e+13]]+Jl[t[e+14]]+Jl[t[e+15]]).toLowerCase()}var Jl,M6,tNe=O(()=>{Jl=[];for(M6=0;M6<256;++M6)Jl.push((M6+256).toString(16).slice(1))});function Xse(){if(!R6&&(R6=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!R6))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return R6(F6t)}var R6,F6t,rNe=O(()=>{F6t=new Uint8Array(16)});var k6t,Qse,nNe=O(()=>{k6t=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Qse={randomUUID:k6t}});function B6t(t,e,r){if(Qse.randomUUID&&!e&&!t)return Qse.randomUUID();t=t||{};var n=t.random||(t.rng||Xse)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return eNe(n)}var Ra,oNe=O(()=>{nNe();rNe();tNe();Ra=B6t});var zO=O(()=>{oNe();QDe()});var aNe=b((Kbn,eue)=>{"use strict";var $6t=Object.prototype.hasOwnProperty,Id="~";function Sq(){}Object.create&&(Sq.prototype=Object.create(null),new Sq().__proto__||(Id=!1));function q6t(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function iNe(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new q6t(r,n||t,o),a=Id?Id+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],i]:t._events[a].push(i):(t._events[a]=i,t._eventsCount++),t}function D6(t,e){--t._eventsCount===0?t._events=new Sq:delete t._events[e]}function zc(){this._events=new Sq,this._eventsCount=0}zc.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)$6t.call(r,n)&&e.push(Id?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};zc.prototype.listeners=function(e){var r=Id?Id+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,a=new Array(i);o<i;o++)a[o]=n[o].fn;return a};zc.prototype.listenerCount=function(e){var r=Id?Id+e:e,n=this._events[r];return n?n.fn?1:n.length:0};zc.prototype.emit=function(e,r,n,o,i,a){var s=Id?Id+e:e;if(!this._events[s])return!1;var u=this._events[s],l=arguments.length,c,d;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),l){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,r),!0;case 3:return u.fn.call(u.context,r,n),!0;case 4:return u.fn.call(u.context,r,n,o),!0;case 5:return u.fn.call(u.context,r,n,o,i),!0;case 6:return u.fn.call(u.context,r,n,o,i,a),!0}for(d=1,c=new Array(l-1);d<l;d++)c[d-1]=arguments[d];u.fn.apply(u.context,c)}else{var f=u.length,p;for(d=0;d<f;d++)switch(u[d].once&&this.removeListener(e,u[d].fn,void 0,!0),l){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,r);break;case 3:u[d].fn.call(u[d].context,r,n);break;case 4:u[d].fn.call(u[d].context,r,n,o);break;default:if(!c)for(p=1,c=new Array(l-1);p<l;p++)c[p-1]=arguments[p];u[d].fn.apply(u[d].context,c)}}return!0};zc.prototype.on=function(e,r,n){return iNe(this,e,r,n,!1)};zc.prototype.once=function(e,r,n){return iNe(this,e,r,n,!0)};zc.prototype.removeListener=function(e,r,n,o){var i=Id?Id+e:e;if(!this._events[i])return this;if(!r)return D6(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&D6(this,i);else{for(var s=0,u=[],l=a.length;s<l;s++)(a[s].fn!==r||o&&!a[s].once||n&&a[s].context!==n)&&u.push(a[s]);u.length?this._events[i]=u.length===1?u[0]:u:D6(this,i)}return this};zc.prototype.removeAllListeners=function(e){var r;return e?(r=Id?Id+e:e,this._events[r]&&D6(this,r)):(this._events=new Sq,this._eventsCount=0),this};zc.prototype.off=zc.prototype.removeListener;zc.prototype.addListener=zc.prototype.on;zc.prefixed=Id;zc.EventEmitter=zc;typeof eue<"u"&&(eue.exports=zc)});var uNe=b((Jbn,sNe)=>{"use strict";sNe.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var cNe=b((Gbn,L6)=>{"use strict";var U6t=uNe(),N6=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},lNe=(t,e,r)=>new Promise((n,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let i=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(u){o(u)}return}let a=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,s=r instanceof Error?r:new N6(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);U6t(t.then(n,o),()=>{clearTimeout(i)})});L6.exports=lNe;L6.exports.default=lNe;L6.exports.TimeoutError=N6});var dNe=b(tue=>{"use strict";Object.defineProperty(tue,"__esModule",{value:!0});function z6t(t,e,r){let n=0,o=t.length;for(;o>0;){let i=o/2|0,a=n+i;r(t[a],e)<=0?(n=++a,o-=i+1):o=i}return n}tue.default=z6t});var fNe=b(nue=>{"use strict";Object.defineProperty(nue,"__esModule",{value:!0});var H6t=dNe(),rue=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let o=H6t.default(this._queue,n,(i,a)=>a.priority-i.priority);this._queue.splice(o,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};nue.default=rue});var k6=b(iue=>{"use strict";Object.defineProperty(iue,"__esModule",{value:!0});var V6t=aNe(),pNe=cNe(),W6t=fNe(),F6=()=>{},K6t=new pNe.TimeoutError,oue=class extends V6t{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=F6,this._resolveIdle=F6,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:W6t.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(i=(o=e.interval)===null||o===void 0?void 0:o.toString())!==null&&i!==void 0?i:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=F6,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=F6,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let e=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-e;if(r<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let a=this._timeout===void 0&&r.timeout===void 0?e():pNe.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(K6t)});n(await a)}catch(a){o(a)}this._next()};this._queue.enqueue(i,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};iue.default=oue});var J6t,G6t,Rt,B6=O(()=>{xq();J6t=(...t)=>fetch(...t),G6t=Symbol.for("ls:fetch_implementation"),Rt=t=>async(...e)=>{if(t||hf("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[G6t]??J6t)(...e);return(t||hf("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var mNe,$6,Y6t,Z6t,Cq,hNe=O(()=>{mNe=B(I6(),1),$6=B(k6(),1);B6();Y6t=[400,401,403,404,405,406,407,408],Z6t=[409],Cq=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.debug=e.debug,"default"in $6.default?this.queue=new $6.default.default({concurrency:this.maxConcurrency}):this.queue=new $6.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,mNe.default)(()=>e(...r).catch(o=>{throw o instanceof Error?o:new Error(o)}),{async onFailedAttempt(o){if(o.message.startsWith("Cancel")||o.message.startsWith("TimeoutError")||o.message.startsWith("AbortError")||o?.code==="ECONNABORTED")throw o;let i=o?.response,a=i?.status;if(a){if(Y6t.includes(+a))throw o;if(Z6t.includes(+a))return;n&&await n(i)}},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,r,...n){return e.signal?Promise.race([this.call(r,...n),new Promise((o,i)=>{e.signal?.addEventListener("abort",()=>{i(new Error("AbortError"))})})]):this.call(r,...n)}fetch(...e){return this.call(()=>Rt(this.debug)(...e).then(r=>r.ok?r:Promise.reject(r)))}}});function aue(t){return typeof t?._getType=="function"}function sue(t){let e={type:t._getType(),data:{content:t.content}};return t?.additional_kwargs&&Object.keys(t.additional_kwargs).length>0&&(e.data.additional_kwargs={...t.additional_kwargs}),e}var gNe=O(()=>{});function Tr(t,e){if(!UO(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}var yNe=O(()=>{zO()});function q6(t){bNe[t]||(console.warn(t),bNe[t]=!0)}var bNe,uue=O(()=>{bNe={}});var Oq=b((a_n,_Ne)=>{var X6t="2.0.0",Q6t=Number.MAX_SAFE_INTEGER||9007199254740991,e5t=16,t5t=250,r5t=["major","premajor","minor","preminor","patch","prepatch","prerelease"];_Ne.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:e5t,MAX_SAFE_BUILD_LENGTH:t5t,MAX_SAFE_INTEGER:Q6t,RELEASE_TYPES:r5t,SEMVER_SPEC_VERSION:X6t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Eq=b((s_n,vNe)=>{var n5t=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};vNe.exports=n5t});var hD=b((HS,wNe)=>{var{MAX_SAFE_COMPONENT_LENGTH:lue,MAX_SAFE_BUILD_LENGTH:o5t,MAX_LENGTH:i5t}=Oq(),a5t=Eq();HS=wNe.exports={};var s5t=HS.re=[],u5t=HS.safeRe=[],ct=HS.src=[],dt=HS.t={},l5t=0,cue="[a-zA-Z0-9-]",c5t=[["\\s",1],["\\d",i5t],[cue,o5t]],d5t=t=>{for(let[e,r]of c5t)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},wr=(t,e,r)=>{let n=d5t(e),o=l5t++;a5t(t,o,e),dt[t]=o,ct[o]=e,s5t[o]=new RegExp(e,r?"g":void 0),u5t[o]=new RegExp(n,r?"g":void 0)};wr("NUMERICIDENTIFIER","0|[1-9]\\d*");wr("NUMERICIDENTIFIERLOOSE","\\d+");wr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${cue}*`);wr("MAINVERSION",`(${ct[dt.NUMERICIDENTIFIER]})\\.(${ct[dt.NUMERICIDENTIFIER]})\\.(${ct[dt.NUMERICIDENTIFIER]})`);wr("MAINVERSIONLOOSE",`(${ct[dt.NUMERICIDENTIFIERLOOSE]})\\.(${ct[dt.NUMERICIDENTIFIERLOOSE]})\\.(${ct[dt.NUMERICIDENTIFIERLOOSE]})`);wr("PRERELEASEIDENTIFIER",`(?:${ct[dt.NUMERICIDENTIFIER]}|${ct[dt.NONNUMERICIDENTIFIER]})`);wr("PRERELEASEIDENTIFIERLOOSE",`(?:${ct[dt.NUMERICIDENTIFIERLOOSE]}|${ct[dt.NONNUMERICIDENTIFIER]})`);wr("PRERELEASE",`(?:-(${ct[dt.PRERELEASEIDENTIFIER]}(?:\\.${ct[dt.PRERELEASEIDENTIFIER]})*))`);wr("PRERELEASELOOSE",`(?:-?(${ct[dt.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${ct[dt.PRERELEASEIDENTIFIERLOOSE]})*))`);wr("BUILDIDENTIFIER",`${cue}+`);wr("BUILD",`(?:\\+(${ct[dt.BUILDIDENTIFIER]}(?:\\.${ct[dt.BUILDIDENTIFIER]})*))`);wr("FULLPLAIN",`v?${ct[dt.MAINVERSION]}${ct[dt.PRERELEASE]}?${ct[dt.BUILD]}?`);wr("FULL",`^${ct[dt.FULLPLAIN]}$`);wr("LOOSEPLAIN",`[v=\\s]*${ct[dt.MAINVERSIONLOOSE]}${ct[dt.PRERELEASELOOSE]}?${ct[dt.BUILD]}?`);wr("LOOSE",`^${ct[dt.LOOSEPLAIN]}$`);wr("GTLT","((?:<|>)?=?)");wr("XRANGEIDENTIFIERLOOSE",`${ct[dt.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);wr("XRANGEIDENTIFIER",`${ct[dt.NUMERICIDENTIFIER]}|x|X|\\*`);wr("XRANGEPLAIN",`[v=\\s]*(${ct[dt.XRANGEIDENTIFIER]})(?:\\.(${ct[dt.XRANGEIDENTIFIER]})(?:\\.(${ct[dt.XRANGEIDENTIFIER]})(?:${ct[dt.PRERELEASE]})?${ct[dt.BUILD]}?)?)?`);wr("XRANGEPLAINLOOSE",`[v=\\s]*(${ct[dt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${ct[dt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${ct[dt.XRANGEIDENTIFIERLOOSE]})(?:${ct[dt.PRERELEASELOOSE]})?${ct[dt.BUILD]}?)?)?`);wr("XRANGE",`^${ct[dt.GTLT]}\\s*${ct[dt.XRANGEPLAIN]}$`);wr("XRANGELOOSE",`^${ct[dt.GTLT]}\\s*${ct[dt.XRANGEPLAINLOOSE]}$`);wr("COERCEPLAIN",`(^|[^\\d])(\\d{1,${lue}})(?:\\.(\\d{1,${lue}}))?(?:\\.(\\d{1,${lue}}))?`);wr("COERCE",`${ct[dt.COERCEPLAIN]}(?:$|[^\\d])`);wr("COERCEFULL",ct[dt.COERCEPLAIN]+`(?:${ct[dt.PRERELEASE]})?(?:${ct[dt.BUILD]})?(?:$|[^\\d])`);wr("COERCERTL",ct[dt.COERCE],!0);wr("COERCERTLFULL",ct[dt.COERCEFULL],!0);wr("LONETILDE","(?:~>?)");wr("TILDETRIM",`(\\s*)${ct[dt.LONETILDE]}\\s+`,!0);HS.tildeTrimReplace="$1~";wr("TILDE",`^${ct[dt.LONETILDE]}${ct[dt.XRANGEPLAIN]}$`);wr("TILDELOOSE",`^${ct[dt.LONETILDE]}${ct[dt.XRANGEPLAINLOOSE]}$`);wr("LONECARET","(?:\\^)");wr("CARETTRIM",`(\\s*)${ct[dt.LONECARET]}\\s+`,!0);HS.caretTrimReplace="$1^";wr("CARET",`^${ct[dt.LONECARET]}${ct[dt.XRANGEPLAIN]}$`);wr("CARETLOOSE",`^${ct[dt.LONECARET]}${ct[dt.XRANGEPLAINLOOSE]}$`);wr("COMPARATORLOOSE",`^${ct[dt.GTLT]}\\s*(${ct[dt.LOOSEPLAIN]})$|^$`);wr("COMPARATOR",`^${ct[dt.GTLT]}\\s*(${ct[dt.FULLPLAIN]})$|^$`);wr("COMPARATORTRIM",`(\\s*)${ct[dt.GTLT]}\\s*(${ct[dt.LOOSEPLAIN]}|${ct[dt.XRANGEPLAIN]})`,!0);HS.comparatorTrimReplace="$1$2$3";wr("HYPHENRANGE",`^\\s*(${ct[dt.XRANGEPLAIN]})\\s+-\\s+(${ct[dt.XRANGEPLAIN]})\\s*$`);wr("HYPHENRANGELOOSE",`^\\s*(${ct[dt.XRANGEPLAINLOOSE]})\\s+-\\s+(${ct[dt.XRANGEPLAINLOOSE]})\\s*$`);wr("STAR","(<|>)?=?\\s*\\*");wr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");wr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var U6=b((u_n,SNe)=>{var f5t=Object.freeze({loose:!0}),p5t=Object.freeze({}),m5t=t=>t?typeof t!="object"?f5t:t:p5t;SNe.exports=m5t});var due=b((l_n,ONe)=>{var xNe=/^[0-9]+$/,CNe=(t,e)=>{let r=xNe.test(t),n=xNe.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},h5t=(t,e)=>CNe(e,t);ONe.exports={compareIdentifiers:CNe,rcompareIdentifiers:h5t}});var Hc=b((c_n,ANe)=>{var z6=Eq(),{MAX_LENGTH:ENe,MAX_SAFE_INTEGER:H6}=Oq(),{safeRe:PNe,t:TNe}=hD(),g5t=U6(),{compareIdentifiers:gD}=due(),fue=class t{constructor(e,r){if(r=g5t(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>ENe)throw new TypeError(`version is longer than ${ENe} characters`);z6("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?PNe[TNe.LOOSE]:PNe[TNe.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>H6||this.major<0)throw new TypeError("Invalid major version");if(this.minor>H6||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>H6||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let i=+o;if(i>=0&&i<H6)return i}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(z6("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),gD(this.major,e.major)||gD(this.minor,e.minor)||gD(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(z6("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return gD(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(z6("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return gD(n,o)}while(++r)}inc(e,r,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),gD(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};ANe.exports=fue});var _I=b((d_n,MNe)=>{var INe=Hc(),y5t=(t,e,r=!1)=>{if(t instanceof INe)return t;try{return new INe(t,e)}catch(n){if(!r)return null;throw n}};MNe.exports=y5t});var jNe=b((f_n,RNe)=>{var b5t=_I(),_5t=(t,e)=>{let r=b5t(t,e);return r?r.version:null};RNe.exports=_5t});var NNe=b((p_n,DNe)=>{var v5t=_I(),w5t=(t,e)=>{let r=v5t(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};DNe.exports=w5t});var kNe=b((m_n,FNe)=>{var LNe=Hc(),S5t=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new LNe(t instanceof LNe?t.version:t,r).inc(e,n,o).version}catch{return null}};FNe.exports=S5t});var qNe=b((h_n,$Ne)=>{var BNe=_I(),x5t=(t,e)=>{let r=BNe(t,null,!0),n=BNe(e,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,a=i?r:n,s=i?n:r,u=!!a.prerelease.length;if(!!s.prerelease.length&&!u)return!s.patch&&!s.minor?"major":a.patch?"patch":a.minor?"minor":"major";let c=u?"pre":"";return r.major!==n.major?c+"major":r.minor!==n.minor?c+"minor":r.patch!==n.patch?c+"patch":"prerelease"};$Ne.exports=x5t});var zNe=b((g_n,UNe)=>{var C5t=Hc(),O5t=(t,e)=>new C5t(t,e).major;UNe.exports=O5t});var VNe=b((y_n,HNe)=>{var E5t=Hc(),P5t=(t,e)=>new E5t(t,e).minor;HNe.exports=P5t});var KNe=b((b_n,WNe)=>{var T5t=Hc(),A5t=(t,e)=>new T5t(t,e).patch;WNe.exports=A5t});var GNe=b((__n,JNe)=>{var I5t=_I(),M5t=(t,e)=>{let r=I5t(t,e);return r&&r.prerelease.length?r.prerelease:null};JNe.exports=M5t});var vm=b((v_n,ZNe)=>{var YNe=Hc(),R5t=(t,e,r)=>new YNe(t,r).compare(new YNe(e,r));ZNe.exports=R5t});var QNe=b((w_n,XNe)=>{var j5t=vm(),D5t=(t,e,r)=>j5t(e,t,r);XNe.exports=D5t});var tLe=b((S_n,eLe)=>{var N5t=vm(),L5t=(t,e)=>N5t(t,e,!0);eLe.exports=L5t});var V6=b((x_n,nLe)=>{var rLe=Hc(),F5t=(t,e,r)=>{let n=new rLe(t,r),o=new rLe(e,r);return n.compare(o)||n.compareBuild(o)};nLe.exports=F5t});var iLe=b((C_n,oLe)=>{var k5t=V6(),B5t=(t,e)=>t.sort((r,n)=>k5t(r,n,e));oLe.exports=B5t});var sLe=b((O_n,aLe)=>{var $5t=V6(),q5t=(t,e)=>t.sort((r,n)=>$5t(n,r,e));aLe.exports=q5t});var Pq=b((E_n,uLe)=>{var U5t=vm(),z5t=(t,e,r)=>U5t(t,e,r)>0;uLe.exports=z5t});var W6=b((P_n,lLe)=>{var H5t=vm(),V5t=(t,e,r)=>H5t(t,e,r)<0;lLe.exports=V5t});var pue=b((T_n,cLe)=>{var W5t=vm(),K5t=(t,e,r)=>W5t(t,e,r)===0;cLe.exports=K5t});var mue=b((A_n,dLe)=>{var J5t=vm(),G5t=(t,e,r)=>J5t(t,e,r)!==0;dLe.exports=G5t});var K6=b((I_n,fLe)=>{var Y5t=vm(),Z5t=(t,e,r)=>Y5t(t,e,r)>=0;fLe.exports=Z5t});var J6=b((M_n,pLe)=>{var X5t=vm(),Q5t=(t,e,r)=>X5t(t,e,r)<=0;pLe.exports=Q5t});var hue=b((R_n,mLe)=>{var e9t=pue(),t9t=mue(),r9t=Pq(),n9t=K6(),o9t=W6(),i9t=J6(),a9t=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return e9t(t,r,n);case"!=":return t9t(t,r,n);case">":return r9t(t,r,n);case">=":return n9t(t,r,n);case"<":return o9t(t,r,n);case"<=":return i9t(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};mLe.exports=a9t});var gLe=b((j_n,hLe)=>{var s9t=Hc(),u9t=_I(),{safeRe:G6,t:Y6}=hD(),l9t=(t,e)=>{if(t instanceof s9t)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?G6[Y6.COERCEFULL]:G6[Y6.COERCE]);else{let u=e.includePrerelease?G6[Y6.COERCERTLFULL]:G6[Y6.COERCERTL],l;for(;(l=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),u.lastIndex=l.index+l[1].length+l[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",a=e.includePrerelease&&r[5]?`-${r[5]}`:"",s=e.includePrerelease&&r[6]?`+${r[6]}`:"";return u9t(`${n}.${o}.${i}${a}${s}`,e)};hLe.exports=l9t});var bLe=b((D_n,yLe)=>{var gue=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};yLe.exports=gue});var wm=b((N_n,SLe)=>{var c9t=/\s+/g,yue=class t{constructor(e,r){if(r=f9t(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof bue)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(c9t," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!vLe(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&_9t(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&y9t)|(this.options.loose&&b9t))+":"+e,o=_Le.get(n);if(o)return o;let i=this.options.loose,a=i?gf[Md.HYPHENRANGELOOSE]:gf[Md.HYPHENRANGE];e=e.replace(a,A9t(this.options.includePrerelease)),Oi("hyphen replace",e),e=e.replace(gf[Md.COMPARATORTRIM],m9t),Oi("comparator trim",e),e=e.replace(gf[Md.TILDETRIM],h9t),Oi("tilde trim",e),e=e.replace(gf[Md.CARETTRIM],g9t),Oi("caret trim",e);let s=e.split(" ").map(d=>v9t(d,this.options)).join(" ").split(/\s+/).map(d=>T9t(d,this.options));i&&(s=s.filter(d=>(Oi("loose invalid filter",d,this.options),!!d.match(gf[Md.COMPARATORLOOSE])))),Oi("range list",s);let u=new Map,l=s.map(d=>new bue(d,this.options));for(let d of l){if(vLe(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return _Le.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>wLe(n,r)&&e.set.some(o=>wLe(o,r)&&n.every(i=>o.every(a=>i.intersects(a,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new p9t(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(I9t(this.set[r],e,this.options))return!0;return!1}};SLe.exports=yue;var d9t=bLe(),_Le=new d9t,f9t=U6(),bue=Tq(),Oi=Eq(),p9t=Hc(),{safeRe:gf,t:Md,comparatorTrimReplace:m9t,tildeTrimReplace:h9t,caretTrimReplace:g9t}=hD(),{FLAG_INCLUDE_PRERELEASE:y9t,FLAG_LOOSE:b9t}=Oq(),vLe=t=>t.value==="<0.0.0-0",_9t=t=>t.value==="",wLe=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,e)),o=n.pop();return r},v9t=(t,e)=>(Oi("comp",t,e),t=x9t(t,e),Oi("caret",t),t=w9t(t,e),Oi("tildes",t),t=O9t(t,e),Oi("xrange",t),t=P9t(t,e),Oi("stars",t),t),Rd=t=>!t||t.toLowerCase()==="x"||t==="*",w9t=(t,e)=>t.trim().split(/\s+/).map(r=>S9t(r,e)).join(" "),S9t=(t,e)=>{let r=e.loose?gf[Md.TILDELOOSE]:gf[Md.TILDE];return t.replace(r,(n,o,i,a,s)=>{Oi("tilde",t,n,o,i,a,s);let u;return Rd(o)?u="":Rd(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Rd(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(Oi("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,Oi("tilde return",u),u})},x9t=(t,e)=>t.trim().split(/\s+/).map(r=>C9t(r,e)).join(" "),C9t=(t,e)=>{Oi("caret",t,e);let r=e.loose?gf[Md.CARETLOOSE]:gf[Md.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{Oi("caret",t,o,i,a,s,u);let l;return Rd(i)?l="":Rd(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Rd(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(Oi("replaceCaret pr",u),i==="0"?a==="0"?l=`>=${i}.${a}.${s}-${u} <${i}.${a}.${+s+1}-0`:l=`>=${i}.${a}.${s}-${u} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.${s}-${u} <${+i+1}.0.0-0`):(Oi("no pr"),i==="0"?a==="0"?l=`>=${i}.${a}.${s}${n} <${i}.${a}.${+s+1}-0`:l=`>=${i}.${a}.${s}${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.${s} <${+i+1}.0.0-0`),Oi("caret return",l),l})},O9t=(t,e)=>(Oi("replaceXRanges",t,e),t.split(/\s+/).map(r=>E9t(r,e)).join(" ")),E9t=(t,e)=>{t=t.trim();let r=e.loose?gf[Md.XRANGELOOSE]:gf[Md.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{Oi("xRange",t,n,o,i,a,s,u);let l=Rd(i),c=l||Rd(a),d=c||Rd(s),f=d;return o==="="&&f&&(o=""),u=e.includePrerelease?"-0":"",l?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&f?(c&&(a=0),s=0,o===">"?(o=">=",c?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):o==="<="&&(o="<",c?i=+i+1:a=+a+1),o==="<"&&(u="-0"),n=`${o+i}.${a}.${s}${u}`):c?n=`>=${i}.0.0${u} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${u} <${i}.${+a+1}.0-0`),Oi("xRange return",n),n})},P9t=(t,e)=>(Oi("replaceStars",t,e),t.trim().replace(gf[Md.STAR],"")),T9t=(t,e)=>(Oi("replaceGTE0",t,e),t.trim().replace(gf[e.includePrerelease?Md.GTE0PRE:Md.GTE0],"")),A9t=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Rd(n)?r="":Rd(o)?r=`>=${n}.0.0${t?"-0":""}`:Rd(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Rd(l)?u="":Rd(c)?u=`<${+l+1}.0.0-0`:Rd(d)?u=`<${l}.${+c+1}.0-0`:f?u=`<=${l}.${c}.${d}-${f}`:t?u=`<${l}.${c}.${+d+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),I9t=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(Oi(t[n].semver),t[n].semver!==bue.ANY&&t[n].semver.prerelease.length>0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var Tq=b((L_n,TLe)=>{var Aq=Symbol("SemVer ANY"),wue=class t{static get ANY(){return Aq}constructor(e,r){if(r=xLe(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),vue("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Aq?this.value="":this.value=this.operator+this.semver.version,vue("comp",this)}parse(e){let r=this.options.loose?CLe[OLe.COMPARATORLOOSE]:CLe[OLe.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new ELe(n[2],this.options.loose):this.semver=Aq}toString(){return this.value}test(e){if(vue("Comparator.test",e,this.options.loose),this.semver===Aq||e===Aq)return!0;if(typeof e=="string")try{e=new ELe(e,this.options)}catch{return!1}return _ue(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new PLe(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new PLe(this.value,r).test(e.semver):(r=xLe(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||_ue(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||_ue(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};TLe.exports=wue;var xLe=U6(),{safeRe:CLe,t:OLe}=hD(),_ue=hue(),vue=Eq(),ELe=Hc(),PLe=wm()});var Iq=b((F_n,ALe)=>{var M9t=wm(),R9t=(t,e,r)=>{try{e=new M9t(e,r)}catch{return!1}return e.test(t)};ALe.exports=R9t});var MLe=b((k_n,ILe)=>{var j9t=wm(),D9t=(t,e)=>new j9t(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));ILe.exports=D9t});var jLe=b((B_n,RLe)=>{var N9t=Hc(),L9t=wm(),F9t=(t,e,r)=>{let n=null,o=null,i=null;try{i=new L9t(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new N9t(n,r))}),n};RLe.exports=F9t});var NLe=b(($_n,DLe)=>{var k9t=Hc(),B9t=wm(),$9t=(t,e,r)=>{let n=null,o=null,i=null;try{i=new B9t(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new k9t(n,r))}),n};DLe.exports=$9t});var kLe=b((q_n,FLe)=>{var Sue=Hc(),q9t=wm(),LLe=Pq(),U9t=(t,e)=>{t=new q9t(t,e);let r=new Sue("0.0.0");if(t.test(r)||(r=new Sue("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let o=t.set[n],i=null;o.forEach(a=>{let s=new Sue(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||LLe(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||LLe(r,i))&&(r=i)}return r&&t.test(r)?r:null};FLe.exports=U9t});var $Le=b((U_n,BLe)=>{var z9t=wm(),H9t=(t,e)=>{try{return new z9t(t,e).range||"*"}catch{return null}};BLe.exports=H9t});var Z6=b((z_n,HLe)=>{var V9t=Hc(),zLe=Tq(),{ANY:W9t}=zLe,K9t=wm(),J9t=Iq(),qLe=Pq(),ULe=W6(),G9t=J6(),Y9t=K6(),Z9t=(t,e,r,n)=>{t=new V9t(t,n),e=new K9t(e,n);let o,i,a,s,u;switch(r){case">":o=qLe,i=G9t,a=ULe,s=">",u=">=";break;case"<":o=ULe,i=Y9t,a=qLe,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(J9t(t,e,n))return!1;for(let l=0;l<e.set.length;++l){let c=e.set[l],d=null,f=null;if(c.forEach(p=>{p.semver===W9t&&(p=new zLe(">=0.0.0")),d=d||p,f=f||p,o(p.semver,d.semver,n)?d=p:a(p.semver,f.semver,n)&&(f=p)}),d.operator===s||d.operator===u||(!f.operator||f.operator===s)&&i(t,f.semver))return!1;if(f.operator===u&&a(t,f.semver))return!1}return!0};HLe.exports=Z9t});var WLe=b((H_n,VLe)=>{var X9t=Z6(),Q9t=(t,e,r)=>X9t(t,e,">",r);VLe.exports=Q9t});var JLe=b((V_n,KLe)=>{var eWt=Z6(),tWt=(t,e,r)=>eWt(t,e,"<",r);KLe.exports=tWt});var ZLe=b((W_n,YLe)=>{var GLe=wm(),rWt=(t,e,r)=>(t=new GLe(t,r),e=new GLe(e,r),t.intersects(e,r));YLe.exports=rWt});var QLe=b((K_n,XLe)=>{var nWt=Iq(),oWt=vm();XLe.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>oWt(c,d,r));for(let c of a)nWt(c,e,r)?(i=c,o||(o=c)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);let s=[];for(let[c,d]of n)c===d?s.push(c):!d&&c===a[0]?s.push("*"):d?c===a[0]?s.push(`<=${d}`):s.push(`${c} - ${d}`):s.push(`>=${c}`);let u=s.join(" || "),l=typeof e.raw=="string"?e.raw:String(e);return u.length<l.length?u:e}});var iFe=b((J_n,oFe)=>{var eFe=wm(),Cue=Tq(),{ANY:xue}=Cue,Mq=Iq(),Oue=vm(),iWt=(t,e,r={})=>{if(t===e)return!0;t=new eFe(t,r),e=new eFe(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=sWt(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},aWt=[new Cue(">=0.0.0-0")],tFe=[new Cue(">=0.0.0")],sWt=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===xue){if(e.length===1&&e[0].semver===xue)return!0;r.includePrerelease?t=aWt:t=tFe}if(e.length===1&&e[0].semver===xue){if(r.includePrerelease)return!0;e=tFe}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=rFe(o,p,r):p.operator==="<"||p.operator==="<="?i=nFe(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=Oue(o.semver,i.semver,r),a>0)return null;if(a===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let p of n){if(o&&!Mq(p,String(o),r)||i&&!Mq(p,String(i),r))return null;for(let m of e)if(!Mq(p,String(m),r))return!1;return!0}let s,u,l,c,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let p of e){if(c=c||p.operator===">"||p.operator===">=",l=l||p.operator==="<"||p.operator==="<=",o){if(f&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===f.major&&p.semver.minor===f.minor&&p.semver.patch===f.patch&&(f=!1),p.operator===">"||p.operator===">="){if(s=rFe(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!Mq(o.semver,String(p),r))return!1}if(i){if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),p.operator==="<"||p.operator==="<="){if(u=nFe(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!Mq(i.semver,String(p),r))return!1}if(!p.operator&&(i||o)&&a!==0)return!1}return!(o&&l&&!i&&a!==0||i&&c&&!o&&a!==0||f||d)},rFe=(t,e,r)=>{if(!t)return e;let n=Oue(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},nFe=(t,e,r)=>{if(!t)return e;let n=Oue(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};oFe.exports=iWt});var lFe=b((G_n,uFe)=>{var Eue=hD(),aFe=Oq(),uWt=Hc(),sFe=due(),lWt=_I(),cWt=jNe(),dWt=NNe(),fWt=kNe(),pWt=qNe(),mWt=zNe(),hWt=VNe(),gWt=KNe(),yWt=GNe(),bWt=vm(),_Wt=QNe(),vWt=tLe(),wWt=V6(),SWt=iLe(),xWt=sLe(),CWt=Pq(),OWt=W6(),EWt=pue(),PWt=mue(),TWt=K6(),AWt=J6(),IWt=hue(),MWt=gLe(),RWt=Tq(),jWt=wm(),DWt=Iq(),NWt=MLe(),LWt=jLe(),FWt=NLe(),kWt=kLe(),BWt=$Le(),$Wt=Z6(),qWt=WLe(),UWt=JLe(),zWt=ZLe(),HWt=QLe(),VWt=iFe();uFe.exports={parse:lWt,valid:cWt,clean:dWt,inc:fWt,diff:pWt,major:mWt,minor:hWt,patch:gWt,prerelease:yWt,compare:bWt,rcompare:_Wt,compareLoose:vWt,compareBuild:wWt,sort:SWt,rsort:xWt,gt:CWt,lt:OWt,eq:EWt,neq:PWt,gte:TWt,lte:AWt,cmp:IWt,coerce:MWt,Comparator:RWt,Range:jWt,satisfies:DWt,toComparators:NWt,maxSatisfying:LWt,minSatisfying:FWt,minVersion:kWt,validRange:BWt,outside:$Wt,gtr:qWt,ltr:UWt,intersects:zWt,simplifyRange:HWt,subset:VWt,SemVer:uWt,re:Eue.re,src:Eue.src,tokens:Eue.t,SEMVER_SPEC_VERSION:aFe.SEMVER_SPEC_VERSION,RELEASE_TYPES:aFe.RELEASE_TYPES,compareIdentifiers:sFe.compareIdentifiers,rcompareIdentifiers:sFe.rcompareIdentifiers}});function VS(t){if(!t||t.split("/").length>2||t.startsWith("/")||t.endsWith("/")||t.split(":").length>2)throw new Error(`Invalid identifier format: ${t}`);let[e,r]=t.split(":"),n=r||"latest";if(e.includes("/")){let[o,i]=e.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${t}`);return[o,i,n]}else{if(!e)throw new Error(`Invalid identifier format: ${t}`);return["-",e,n]}}var WWt,cFe=O(()=>{WWt=B(lFe(),1)});async function Vr(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}n=await t.text();let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Server response: ${n}`;throw t.status===409?new Pue(o):new Error(o)}var Pue,dFe=O(()=>{Pue=class extends Error{constructor(e){super(e),this.name="LangSmithConflictError"}}});function GWt(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function X6(t){return JWt.encode(t)}function yf(t,e,r,n){try{let o=JSON.stringify(t,e,r);return X6(o)}catch(o){if(!o.message?.includes("Converting circular structure to JSON"))return console.warn("[WARNING]: LangSmith received unserializable value."),X6("[Unserializable]");console.warn("[WARNING]: LangSmith received circular JSON. This will decrease tracer performance."),typeof n>"u"&&(n=GWt()),Aue(t,"",0,[],void 0,0,n);let i;try{yD.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,YWt(e),r)}catch{return X6("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Q6.length!==0;){let a=Q6.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return X6(i)}}function Tue(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Q6.push([n,r,e,o])):yD.push([e,r,t]):(n[r]=t,Q6.push([n,r,e]))}function Aue(t,e,r,n,o,i,a){i+=1;var s;if(typeof t=="object"&&t!==null){for(s=0;s<n.length;s++)if(n[s]===t){Tue(KWt,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){Tue(fFe,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Tue(fFe,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Aue(t[s],s,s,n,t,i,a);else{var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];Aue(t[l],l,s,n,t,i,a)}}n.pop()}}function YWt(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(yD.length>0)for(var n=0;n<yD.length;n++){var o=yD[n];if(o[1]===e&&o[0]===r){r=o[2],yD.splice(n,1);break}}return t.call(this,e,r)}}var fFe,KWt,Q6,yD,JWt,pFe=O(()=>{fFe="[...]",KWt={result:"[Circular]"},Q6=[],yD=[],JWt=new TextEncoder});function mFe(t){let e=r5(),r=yFe(),n=t.extra??{},o=n.metadata;return t.extra={...n,runtime:{...e,...n?.runtime},metadata:{...r,...r.revision_id||t.revision_id?{revision_id:t.revision_id??r.revision_id}:{},...o}},t}async function QWt(t){let e=[];for await(let r of t)e.push(r);return e}function Iue(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function hFe(t){return typeof t=="number"?Number(t.toFixed(4)):t}function gFe(t){return"dataset_id"in t||"dataset_name"in t}var ZWt,XWt,eKt,Mue,tKt,rKt,vI,Rue=O(()=>{zO();hNe();gNe();xq();t5();yNe();uue();cFe();dFe();B6();pFe();ZWt=t=>{let e=t?.toString()??hf("TRACING_SAMPLING_RATE");if(e===void 0)return;let r=parseFloat(e);if(r<0||r>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${r}`);return r},XWt=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};eKt=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"30",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1};Mue=class{constructor(){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0})}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=yf(e.item).length;return this.items.push({action:e.action,payload:e.item,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n}pop(e){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let r=[],n=0;for(;n+(this.peek()?.size??0)<e&&this.items.length>0;){let o=this.items.shift();o&&(r.push(o),n+=o.size,this.sizeBytes-=o.size)}if(r.length===0&&this.items.length>0){let o=this.items.shift();r.push(o),n+=o.size,this.sizeBytes-=o.size}return[r.map(o=>({action:o.action,item:o.payload})),()=>r.forEach(o=>o.itemPromiseResolve())]}},tKt=20971520,rKt=2500,vI=class t{constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:new Mue}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:xy("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:xy("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=ZWt(e.tracingSamplingRate),this.apiUrl=Iue(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Iue(e.apiKey??r.apiKey),this.webUrl=Iue(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=e.timeout_ms??9e4,this.caller=new Cq({...e.callerOptions??{},debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.batchIngestCaller=new Cq({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:eKt,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode}static getDefaultClientConfig(){let e=hf("API_KEY"),r=hf("ENDPOINT")??"https://api.smith.langchain.com",n=hf("HIDE_INPUTS")==="true",o=hf("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:XWt(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get headers(){let e={"User-Agent":`langsmith-js/${e5}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),e}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`,i=await this.caller.call(Rt(this.debug),o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(i,`Failed to fetch ${e}`),i}async _get(e,r){return(await this._getResponse(e,r)).json()}async*_getPaginated(e,r=new URLSearchParams,n){let o=Number(r.get("offset"))||0,i=Number(r.get("limit"))||100;for(;;){r.set("offset",String(o)),r.set("limit",String(i));let a=`${this.apiUrl}${e}?${r}`,s=await this.caller.call(Rt(this.debug),a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(s,`Failed to fetch ${e}`);let u=n?n(await s.json()):await s.json();if(u.length===0||(yield u,u.length<i))break;o+=u.length}}async*_getCursorPaginatedList(e,r=null,n="POST",o="runs"){let i=r?{...r}:{};for(;;){let s=await(await this.caller.call(Rt(this.debug),`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)})).json();if(!s||!s[o])break;yield s[o];let u=s.cursors;if(!u||!u.next)break;i.cursor=u.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()<this.tracingSampleRate}_filterForSampling(e,r=!1){if(this.tracingSampleRate===void 0)return e;if(r){let n=[];for(let o of e)this.filteredPostUuids.has(o.id)?this.filteredPostUuids.delete(o.id):n.push(o);return n}else{let n=[];for(let o of e){let i=o.trace_id??o.id;this.filteredPostUuids.has(i)||(o.id===i?this._shouldSample()?n.push(o):this.filteredPostUuids.add(i):n.push(o))}return n}}async _getBatchSizeLimitBytes(){let e=await this._ensureServerInfo();return this.batchSizeBytesLimit??e.batch_ingest_config?.size_limit_bytes??tKt}async _getMultiPartSupport(){return(await this._ensureServerInfo()).instance_flags?.dataset_examples_multipart_enabled??!1}drainAutoBatchQueue(e){let r=[];for(;this.autoBatchQueue.items.length>0;){let[n,o]=this.autoBatchQueue.pop(e);if(!n.length){o();break}let i=this._processBatch(n,o).catch(console.error);r.push(i)}return Promise.all(r)}async _processBatch(e,r){if(!e.length){r();return}try{let n={runCreates:e.filter(i=>i.action==="create").map(i=>i.item),runUpdates:e.filter(i=>i.action==="update").map(i=>i.item)};(await this._ensureServerInfo())?.batch_ingest_config?.use_multipart_endpoint?await this.multipartIngestRuns(n):await this.batchIngestRuns(n)}finally{r()}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.action==="create"&&(e.item=mFe(e.item));let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes();return this.autoBatchQueue.sizeBytes>n&&this.drainAutoBatchQueue(n),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue(n)},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let e=await Rt(this.debug)(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(rKt),...this.fetchOptions});await Vr(e,"get server info");let r=await e.json();return this.debug&&console.log(`
=== LangSmith Server Configuration ===
`+JSON.stringify(r,null,2)+`
`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch{console.warn("[WARNING]: LangSmith failed to fetch info on supported operations. Falling back to batch operations and default limits.")}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(this._serverInfo===void 0&&(this._getServerInfoPromise=void 0),e))}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){let e=await this._getBatchSizeLimitBytes();await this.drainAutoBatchQueue(e)}async createRun(e){if(!this._filterForSampling([e]).length)return;let r={...this.headers,"Content-Type":"application/json"},n=e.project_name;delete e.project_name;let o=await this.prepareRunCreateOrUpdateInputs({session_name:n,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){this.processRunOperation({action:"create",item:o}).catch(console.error);return}let i=mFe(o),a=await this.caller.call(Rt(this.debug),`${this.apiUrl}/runs`,{method:"POST",headers:r,body:yf(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(a,"create run",!0)}async batchIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n=await Promise.all(e?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[]),o=await Promise.all(r?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[]);if(n.length>0&&o.length>0){let s=n.reduce((l,c)=>(c.id&&(l[c.id]=c),l),{}),u=[];for(let l of o)l.id!==void 0&&s[l.id]?s[l.id]={...s[l.id],...l}:u.push(l);n=Object.values(s),o=u}let i={post:n,patch:o};if(!i.post.length&&!i.patch.length)return;let a={post:[],patch:[]};for(let s of["post","patch"]){let u=s,l=i[u].reverse(),c=l.pop();for(;c!==void 0;)a[u].push(c),c=l.pop()}(a.post.length>0||a.patch.length>0)&&await this._postBatchIngestRuns(yf(a))}async _postBatchIngestRuns(e){let r={...this.headers,"Content-Type":"application/json",Accept:"application/json"},n=await this.batchIngestCaller.call(Rt(this.debug),`${this.apiUrl}/runs/batch`,{method:"POST",headers:r,body:e,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(n,"batch create run",!0)}async multipartIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n={},o=[];for(let c of e??[]){let d=await this.prepareRunCreateOrUpdateInputs(c);d.id!==void 0&&d.attachments!==void 0&&(n[d.id]=d.attachments),delete d.attachments,o.push(d)}let i=[];for(let c of r??[])i.push(await this.prepareRunCreateOrUpdateInputs(c));if(o.find(c=>c.trace_id===void 0||c.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(i.find(c=>c.trace_id===void 0||c.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(o.length>0&&i.length>0){let c=o.reduce((f,p)=>(p.id&&(f[p.id]=p),f),{}),d=[];for(let f of i)f.id!==void 0&&c[f.id]?c[f.id]={...c[f.id],...f}:d.push(f);o=Object.values(c),i=d}if(o.length===0&&i.length===0)return;let u=[],l=[];for(let[c,d]of[["post",o],["patch",i]])for(let f of d){let{inputs:p,outputs:m,events:h,attachments:v,...g}=f,_={inputs:p,outputs:m,events:h},w=yf(g);l.push({name:`${c}.${g.id}`,payload:new Blob([w],{type:`application/json; length=${w.length}`})});for(let[x,C]of Object.entries(_)){if(C===void 0)continue;let P=yf(C);l.push({name:`${c}.${g.id}.${x}`,payload:new Blob([P],{type:`application/json; length=${P.length}`})})}if(g.id!==void 0){let x=n[g.id];if(x){delete n[g.id];for(let[C,P]of Object.entries(x)){let E,A;if(Array.isArray(P)?[E,A]=P:(E=P.mimeType,A=P.data),C.includes(".")){console.warn(`Skipping attachment '${C}' for run ${g.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${g.id}.${C}`,payload:new Blob([A],{type:`${E}; length=${A.byteLength}`})})}}}u.push(`trace=${g.trace_id},id=${g.id}`)}await this._sendMultipartRequest(l,u.join("; "))}async _sendMultipartRequest(e,r){try{let n="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),o=[];for(let u of e)o.push(new Blob([`--${n}\r
`])),o.push(new Blob([`Content-Disposition: form-data; name="${u.name}"\r
`,`Content-Type: ${u.payload.type}\r
\r
`])),o.push(u.payload),o.push(new Blob([`\r
`]));o.push(new Blob([`--${n}--\r
`]));let a=await new Blob(o).arrayBuffer(),s=await this.batchIngestCaller.call(Rt(this.debug),`${this.apiUrl}/runs/multipart`,{method:"POST",headers:{...this.headers,"Content-Type":`multipart/form-data; boundary=${n}`},body:a,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(s,"ingest multipart runs",!0)}catch(n){console.warn(`${n.message.trim()}
Context: ${r}`)}}async updateRun(e,r){Tr(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let n={...r,id:e};if(!this._filterForSampling([n],!0).length)return;if(this.autoBatchTracing&&n.trace_id!==void 0&&n.dotted_order!==void 0){if(r.end_time!==void 0&&n.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:n}).catch(console.error);return}else this.processRunOperation({action:"update",item:n}).catch(console.error);return}let o={...this.headers,"Content-Type":"application/json"},i=await this.caller.call(Rt(this.debug),`${this.apiUrl}/runs/${e}`,{method:"PATCH",headers:o,body:yf(r),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(i,"update run",!0)}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){Tr(e);let n=await this._get(`/runs/${e}`);return r&&n.child_run_ids&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:hf("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${r.id}?poll=true`}else if(e!==void 0){let o=await this.readRun(e);if(!o.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${o.app_path}`}else throw new Error("Must provide either runId or run")}async _loadChildRuns(e){let r=await QWt(this.listRuns({id:e.child_run_ids})),n={},o={};r.sort((i,a)=>(i?.dotted_order??"").localeCompare(a?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:a,startTime:s,executionOrder:u,isRoot:l,runType:c,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:v,limit:g,select:_}=e,w=[];if(r&&(w=Array.isArray(r)?r:[r]),n){let E=Array.isArray(n)?n:[n],A=await Promise.all(E.map(M=>this.readProject({projectName:M}).then(R=>R.id)));w.push(...A)}let x=["app_path","child_run_ids","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],C={session:w.length?w:null,run_type:c,reference_example:a,query:p,filter:m,trace_filter:h,tree_filter:v,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:g,trace:i,select:_||x,is_root:l},P=0;for await(let E of this._getCursorPaginatedList("/runs/query",C))if(g){if(P>=g)break;if(E.length+P>g){yield*E.slice(0,g-P);break}P+=E.length,yield*E}else yield*E}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:a,referenceExampleIds:s,startTime:u,endTime:l,error:c,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:v}){let g=a||[];i&&(g=[...a||[],...await Promise.all(i.map(P=>this.readProject({projectName:P}).then(E=>E.id)))]);let w=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:g,reference_example:s,start_time:u,end_time:l,error:c,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:v}).filter(([P,E])=>E!==void 0));return await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/runs/stats`,{method:"POST",headers:this.headers,body:JSON.stringify(w),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||Ra()};Tr(e);let i=await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,body:JSON.stringify(n),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();if(i===null||!("share_token"in i))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${i.share_token}/r`}async unshareRun(e){Tr(e);let r=await this.caller.call(Rt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(r,"unshare run",!0)}async readRunSharedLink(e){Tr(e);let n=await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();if(!(n===null||!("share_token"in n)))return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:r}={}){let n=new URLSearchParams({share_token:e});if(r!==void 0)for(let a of r)n.append("id",a);return Tr(e),await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async readDatasetSharedSchema(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id),Tr(e);let o=await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,r){if(!e&&!r)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:r})).id);let n={dataset_id:e};Tr(e);let i=await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,body:JSON.stringify(n),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json();return i.url=`${this.getHostUrl()}/public/${i.share_token}/d`,i}async unshareDataset(e){Tr(e);let r=await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(r,"unshare dataset",!0)}async readSharedDataset(e){return Tr(e),await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async listSharedExamples(e,r){let n={};r?.exampleIds&&(n.id=r.exampleIds);let o=new URLSearchParams;Object.entries(n).forEach(([s,u])=>{Array.isArray(u)?u.forEach(l=>o.append(s,l)):o.append(s,u)});let i=await this.caller.call(Rt(this.debug),`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions}),a=await i.json();if(!i.ok)throw"detail"in a?new Error(`Failed to list shared examples.
Status: ${i.status}
Message: ${a.detail.join(`
`)}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return a.map(s=>({...s,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:a=null}){let s=o?"?upsert=true":"",u=`${this.apiUrl}/sessions${s}`,l=i||{};n&&(l.metadata=n);let c={name:e,extra:l,description:r};a!==null&&(c.reference_dataset_id=a);let d=await this.caller.call(Rt(this.debug),u,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(c),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(d,"create project"),await d.json()}async updateProject(e,{name:r=null,description:n=null,metadata:o=null,projectExtra:i=null,endTime:a=null}){let s=`${this.apiUrl}/sessions/${e}`,u=i;o&&(u={...u||{},metadata:o});let l={name:r,extra:u,description:n,end_time:a?new Date(a).toISOString():null},c=await this.caller.call(Rt(this.debug),s,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(l),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(c,"update project"),await c.json()}async hasProject({projectId:e,projectName:r}){let n="/sessions",o=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)Tr(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(Rt(this.debug),`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});try{let a=await i.json();return i.ok?Array.isArray(a)?a.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:r,includeStats:n}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)Tr(e),o+=`/${e}`;else if(r!==void 0)i.append("name",r);else throw new Error("Must provide projectName or projectId");n!==void 0&&i.append("include_stats",n.toString());let a=await this._get(o,i),s;if(Array.isArray(a)){if(a.length===0)throw new Error(`Project[id=${e}, name=${r}] not found`);s=a[0]}else s=a;return s}async getProjectUrl({projectId:e,projectName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either projectName or projectId");let n=await this.readProject({projectId:e,projectName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:r}){if(e===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");let n=await this.readDataset({datasetId:e,datasetName:r}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${n.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let e=new URLSearchParams({limit:"1"});for await(let r of this._getPaginated("/sessions",e))return this._tenantId=r[0].tenant_id,r[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:r,nameContains:n,referenceDatasetId:o,referenceDatasetName:i,referenceFree:a,metadata:s}={}){let u=new URLSearchParams;if(e!==void 0)for(let l of e)u.append("id",l);if(r!==void 0&&u.append("name",r),n!==void 0&&u.append("name_contains",n),o!==void 0)u.append("reference_dataset",o);else if(i!==void 0){let l=await this.readDataset({datasetName:i});u.append("reference_dataset",l.id)}a!==void 0&&u.append("reference_free",a.toString()),s!==void 0&&u.append("metadata",JSON.stringify(s));for await(let l of this._getPaginated("/sessions",u))yield*l}async deleteProject({projectId:e,projectName:r}){let n;if(e===void 0&&r===void 0)throw new Error("Must provide projectName or projectId");if(e!==void 0&&r!==void 0)throw new Error("Must provide either projectName or projectId, not both");e===void 0?n=(await this.readProject({projectName:r})).id:n=e,Tr(n);let o=await this.caller.call(Rt(this.debug),`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(o,`delete session ${n} (${r})`,!0)}async uploadCsv({csvFile:e,fileName:r,inputKeys:n,outputKeys:o,description:i,dataType:a,name:s}){let u=`${this.apiUrl}/datasets/upload`,l=new FormData;l.append("file",e,r),n.forEach(f=>{l.append("input_keys",f)}),o.forEach(f=>{l.append("output_keys",f)}),i&&l.append("description",i),a&&l.append("data_type",a),s&&l.append("name",s);let c=await this.caller.call(Rt(this.debug),u,{method:"POST",headers:this.headers,body:l,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(c,"upload CSV"),await c.json()}async createDataset(e,{description:r,dataType:n,inputsSchema:o,outputsSchema:i,metadata:a}={}){let s={name:e,description:r,extra:a?{metadata:a}:void 0};n&&(s.data_type=n),o&&(s.inputs_schema_definition=o),i&&(s.outputs_schema_definition=i);let u=await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(s),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(u,"create dataset"),await u.json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)Tr(e),n+=`/${e}`;else if(r!==void 0)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),a;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);a=i[0]}else a=i;return a}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let a=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,a)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(`
`).map(s=>JSON.parse(s))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:a}={}){let s="/datasets",u=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let l of n)u.append("id",l);o!==void 0&&u.append("name",o),i!==void 0&&u.append("name_contains",i),a!==void 0&&u.append("metadata",JSON.stringify(a));for await(let l of this._getPaginated(s,u))yield*l}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;Tr(i);let a=await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(o),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(a,"update dataset"),await a.json()}async updateDatasetTag(e){let{datasetId:r,datasetName:n,asOf:o,tag:i}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let a=r??(await this.readDataset({datasetName:n})).id;Tr(a);let s=await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets/${a}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(s,"update dataset tags")}async deleteDataset({datasetId:e,datasetName:r}){let n="/datasets",o=e;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(r!==void 0&&(o=(await this.readDataset({datasetName:r})).id),o!==void 0)Tr(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");let i=await this.caller.call(Rt(this.debug),this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(i,`delete ${n}`),await i.json()}async indexDataset({datasetId:e,datasetName:r,tag:n}){let o=e;if(!o&&!r)throw new Error("Must provide either datasetName or datasetId");if(o&&r)throw new Error("Must provide either datasetName or datasetId, not both");o||(o=(await this.readDataset({datasetName:r})).id),Tr(o);let i={tag:n},a=await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(a,"index dataset"),await a.json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),Tr(r);let a=await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets/${r}/search`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(a,"fetch similar examples"),(await a.json()).examples}async createExample(e,r,n){if(gFe(e)&&(r!==void 0||n!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let o=r?n?.datasetId:e.dataset_id,i=r?n?.datasetName:e.dataset_name;if(o===void 0&&i===void 0)throw new Error("Must provide either datasetName or datasetId");if(o!==void 0&&i!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");o===void 0&&(o=(await this.readDataset({datasetName:i})).id);let a=(r?n?.createdAt:e.created_at)||new Date,s;gFe(e)?s=e:s={inputs:e,outputs:r,created_at:a?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};let u=await this._uploadExamplesMultipart(o,[s]);return await this.readExample(u.example_ids?.[0]??Ra())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let _=e,w=_[0].dataset_id,x=_[0].dataset_name;if(w===void 0&&x===void 0)throw new Error("Must provide either datasetName or datasetId");if(w!==void 0&&x!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");w===void 0&&(w=(await this.readDataset({datasetName:x})).id);let C=await this._uploadExamplesMultipart(w,_);return await Promise.all(C.example_ids.map(E=>this.readExample(E)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:a,useSourceRunIOs:s,useSourceRunAttachments:u,attachments:l,exampleIds:c,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((_,w)=>({dataset_id:p,inputs:_,outputs:n?.[w],metadata:o?.[w],split:i?.[w],id:c?.[w],attachments:l?.[w],source_run_id:a?.[w],use_source_run_io:s?.[w],use_source_run_attachments:u?.[w]})),v=await this._uploadExamplesMultipart(p,h);return await Promise.all(v.example_ids.map(_=>this.readExample(_)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(a=>aue(a)?sue(a):a),i=aue(r)?sue(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){Tr(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,a=i;return o&&(a.attachments=Object.entries(o).reduce((s,[u,l])=>(s[u.slice(11)]={presigned_url:l.presigned_url,mime_type:l.mime_type},s),{})),a}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:a,metadata:s,limit:u,offset:l,filter:c,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=a??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let g of n)p.append("id",g);if(i!==void 0)for(let g of i)p.append("splits",g);if(s!==void 0){let g=JSON.stringify(s);p.append("metadata",g)}u!==void 0&&p.append("limit",u.toString()),l!==void 0&&p.append("offset",l.toString()),c!==void 0&&p.append("filter",c),d===!0&&["attachment_urls","outputs","metadata"].forEach(g=>p.append("select",g));let v=0;for await(let g of this._getPaginated("/examples",p)){for(let _ of g){let{attachment_urls:w,...x}=_,C=x;w&&(C.attachments=Object.entries(w).reduce((P,[E,A])=>(P[E.slice(11)]={presigned_url:A.presigned_url,mime_type:A.mime_type||void 0},P),{})),yield C,v++}if(u!==void 0&&v>=u)break}}async deleteExample(e){Tr(e);let r=`/examples/${e}`,n=await this.caller.call(Rt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(n,`delete ${r}`),await n.json()}async updateExample(e,r){let n;r?n=e:n=e.id,Tr(n);let o;r?o={id:n,...r}:o=e;let i;return o.dataset_id!==void 0?i=o.dataset_id:i=(await this.readExample(n)).dataset_id,this._updateExamplesMultipart(i,[o])}async updateExamples(e){let r;return e[0].dataset_id===void 0?r=(await this.readExample(e[0].id)).dataset_id:r=e[0].dataset_id,this._updateExamplesMultipart(r,e)}async readDatasetVersion({datasetId:e,datasetName:r,asOf:n,tag:o}){let i;if(e?i=e:i=(await this.readDataset({datasetName:r})).id,Tr(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let a=new URLSearchParams;n!==void 0&&a.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&a.append("tag",o);let s=await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(s,"read dataset version"),await s.json()}async listDatasetSplits({datasetId:e,datasetName:r,asOf:n}){let o;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:r})).id:o=e,Tr(o);let i=new URLSearchParams,a=n?typeof n=="string"?n:n?.toISOString():void 0;return a&&i.append("as_of",a),await this._get(`/datasets/${o}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:r,splitName:n,exampleIds:o,remove:i=!1}){let a;if(e===void 0&&r===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?a=(await this.readDataset({datasetName:r})).id:a=e,Tr(a);let s={split_name:n,examples:o.map(l=>(Tr(l),l)),remove:i},u=await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets/${a}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(s),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(u,"update dataset splits",!0)}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){q6("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let a;if(typeof e=="string")a=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)a=e;else throw new Error(`Invalid run type: ${typeof e}`);a.reference_example_id!==null&&a.reference_example_id!==void 0&&(i=await this.readExample(a.reference_example_id));let s=await r.evaluateRun(a,i),[u,l]=await this._logEvaluationFeedback(s,a,n);return l[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:a,sourceInfo:s,feedbackSourceType:u="api",sourceRunId:l,feedbackId:c,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:u??"api",metadata:s??{}};l!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:l}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&Tr(m.metadata.__run.run_id);let h={id:c??Ra(),run_id:e,key:r,score:hFe(n),value:o,correction:i,comment:a,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},v=`${this.apiUrl}/feedback`,g=await this.caller.call(Rt(this.debug),v,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(h),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(g,"create feedback",!0),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=hFe(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),Tr(e);let s=await this.caller.call(Rt(this.debug),`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(a),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(s,"update feedback",!0)}async readFeedback(e){Tr(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){Tr(e);let r=`/feedback/${e}`,n=await this.caller.call(Rt(this.debug),this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(n,`delete ${r}`),await n.json()}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e&&o.append("run",e.join(",")),r)for(let i of r)o.append("key",i);if(n)for(let i of n)o.append("source",i);for await(let i of this._getPaginated("/feedback",o))yield*i}async createPresignedFeedbackToken(e,r,{expiration:n,feedbackConfig:o}={}){let i={run_id:e,feedback_key:r,feedback_config:o};return n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3},await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async createComparativeExperiment({name:e,experimentIds:r,referenceDatasetId:n,createdAt:o,description:i,metadata:a,id:s}){if(r.length===0)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:r[0]})).reference_dataset_id),!n==null)throw new Error("A reference dataset is required");let u={id:s,name:e,experiment_ids:r,reference_dataset_id:n,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};return a&&(u.extra.metadata=a),await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(u),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async*listPresignedFeedbackTokens(e){Tr(e);let r=new URLSearchParams({run_id:e});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(e){let r;return"results"in e?r=e.results:Array.isArray(e)?r=e:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let a of o){let s=n||{};a.evaluatorInfo&&(s={...a.evaluatorInfo,...s});let u=null;a.targetRunId?u=a.targetRunId:r&&(u=r.id),i.push(await this.createFeedback(u,a.key,{score:a.score,value:a.value,comment:a.comment,correction:a.correction,sourceInfo:s,sourceRunId:a.sourceRunId,feedbackConfig:a.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,a=new URLSearchParams;r&&r.forEach((u,l)=>{Tr(u,`queueIds[${l}]`),a.append("ids",u)}),n&&a.append("name",n),o&&a.append("name_contains",o),a.append("limit",(i!==void 0?Math.min(i,100):100).toString());let s=0;for await(let u of this._getPaginated("/annotation-queues",a))if(yield*u,s++,i!==void 0&&s>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o}=e,i={name:r,description:n,id:o||Ra()},a=await this.caller.call(Rt(this.debug),`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(Object.fromEntries(Object.entries(i).filter(([u,l])=>l!==void 0))),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(a,"create annotation queue"),await a.json()}async readAnnotationQueue(e){let r=await this.listAnnotationQueues({queueIds:[e]}).next();if(r.done)throw new Error(`Annotation queue with ID ${e} not found`);return r.value}async updateAnnotationQueue(e,r){let{name:n,description:o}=r,i=await this.caller.call(Rt(this.debug),`${this.apiUrl}/annotation-queues/${Tr(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({name:n,description:o}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(i,"update annotation queue")}async deleteAnnotationQueue(e){let r=await this.caller.call(Rt(this.debug),`${this.apiUrl}/annotation-queues/${Tr(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(r,"delete annotation queue")}async addRunsToAnnotationQueue(e,r){let n=await this.caller.call(Rt(this.debug),`${this.apiUrl}/annotation-queues/${Tr(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r.map((o,i)=>Tr(o,`runIds[${i}]`).toString())),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${Tr(e,"queueId")}/run`,o=await this.caller.call(Rt(this.debug),`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(o,"get run from annotation queue"),await o.json()}async deleteRunFromAnnotationQueue(e,r){let n=await this.caller.call(Rt(this.debug),`${this.apiUrl}/annotation-queues/${Tr(e,"queueId")}/runs/${Tr(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(n,"delete run from annotation queue")}async getSizeFromAnnotationQueue(e){let r=await this.caller.call(Rt(this.debug),`${this.apiUrl}/annotation-queues/${Tr(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(r,"get size from annotation queue"),await r.json()}async _currentTenantIsOwner(e){let r=await this._getSettings();return e=="-"||r.tenant_handle===e}async _ownerConflictError(e,r){let n=await this._getSettings();return new Error(`Cannot ${e} for another tenant.
Current tenant: ${n.tenant_handle}
Requested tenant: ${r}`)}async _getLatestCommitHash(e){let r=await this.caller.call(Rt(this.debug),`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions}),n=await r.json();if(!r.ok){let o=typeof n.detail=="string"?n.detail:JSON.stringify(n.detail),i=new Error(`Error ${r.status}: ${r.statusText}
${o}`);throw i.statusCode=r.status,i}if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=VS(e),a=await this.caller.call(Rt(this.debug),`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",body:JSON.stringify({like:r}),headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(e){let[r,n,o]=VS(e);if(await this._currentTenantIsOwner(r)){let i=await this._getSettings();return o!=="latest"?`${this.getHostUrl()}/prompts/${n}/${o.substring(0,8)}?organizationId=${i.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${i.id}`}else return o!=="latest"?`${this.getHostUrl()}/hub/${r}/${n}/${o.substring(0,8)}`:`${this.getHostUrl()}/hub/${r}/${n}`}async promptExists(e){return!!await this.getPrompt(e)}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){for await(let r of this._getPaginated(`/commits/${e}/`,new URLSearchParams,n=>n.commits))yield*r}async*listPrompts(e){let r=new URLSearchParams;r.append("sort_field",e?.sortField??"updated_at"),r.append("sort_direction","desc"),r.append("is_archived",(!!e?.isArchived).toString()),e?.isPublic!==void 0&&r.append("is_public",e.isPublic.toString()),e?.query&&r.append("query",e.query);for await(let n of this._getPaginated("/repos",r,o=>o.repos))yield*n}async getPrompt(e){let[r,n,o]=VS(e),i=await this.caller.call(Rt(this.debug),`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});if(i.status===404)return null;await Vr(i,"get prompt");let a=await i.json();return a.repo?a.repo:null}async createPrompt(e,r){let n=await this._getSettings();if(r?.isPublic&&!n.tenant_handle)throw new Error(`Cannot create a public prompt without first
creating a LangChain Hub handle.
You can add a handle by creating a public prompt at:
https://smith.langchain.com/prompts`);let[o,i,a]=VS(e);if(!await this._currentTenantIsOwner(o))throw await this._ownerConflictError("create a prompt",o);let s={repo_handle:i,...r?.description&&{description:r.description},...r?.readme&&{readme:r.readme},...r?.tags&&{tags:r.tags},is_public:!!r?.isPublic},u=await this.caller.call(Rt(this.debug),`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(s),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(u,"create prompt");let{repo:l}=await u.json();return l}async createCommit(e,r,n){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[o,i,a]=VS(e),s=n?.parentCommitHash==="latest"||!n?.parentCommitHash?await this._getLatestCommitHash(`${o}/${i}`):n?.parentCommitHash,u={manifest:JSON.parse(JSON.stringify(r)),parent_commit:s},l=await this.caller.call(Rt(this.debug),`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(u),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(l,"create commit");let c=await l.json();return this._getPromptUrl(`${o}/${i}${c.commit_hash?`:${c.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let s of r){let u=s.id,l={...s.metadata&&{metadata:s.metadata},...s.split&&{split:s.split}},c=yf(l),d=new Blob([c],{type:"application/json"});if(n.append(u,d),s.inputs){let f=yf(s.inputs),p=new Blob([f],{type:"application/json"});n.append(`${u}.inputs`,p)}if(s.outputs){let f=yf(s.outputs),p=new Blob([f],{type:"application/json"});n.append(`${u}.outputs`,p)}if(s.attachments)for(let[f,p]of Object.entries(s.attachments)){let m,h;Array.isArray(p)?[m,h]=p:(m=p.mimeType,h=p.data);let v=new Blob([h],{type:`${m}; length=${h.byteLength}`});n.append(`${u}.attachment.${f}`,v)}if(s.attachments_operations){let f=yf(s.attachments_operations),p=new Blob([f],{type:"application/json"});n.append(`${u}.attachments_operations`,p)}}let o=e??r[0]?.dataset_id;return await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/v1/platform/datasets/${o}/examples`,{method:"PATCH",headers:this.headers,body:n})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getMultiPartSupport())throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");let n=new FormData;for(let a of r){let s=(a.id??Ra()).toString(),u={created_at:a.created_at,...a.metadata&&{metadata:a.metadata},...a.split&&{split:a.split},...a.source_run_id&&{source_run_id:a.source_run_id},...a.use_source_run_io&&{use_source_run_io:a.use_source_run_io},...a.use_source_run_attachments&&{use_source_run_attachments:a.use_source_run_attachments}},l=yf(u),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=yf(a.inputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=yf(a.outputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.outputs`,f)}if(a.attachments)for(let[d,f]of Object.entries(a.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${s}.attachment.${d}`,h)}}let o=await this.caller.call(Rt(this.debug),`${this.apiUrl}/v1/platform/datasets/${e}/examples`,{method:"POST",headers:this.headers,body:n});return await Vr(o,"upload examples"),await o.json()}async updatePrompt(e,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,o]=VS(e);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("update a prompt",n);let i={};if(r?.description!==void 0&&(i.description=r.description),r?.readme!==void 0&&(i.readme=r.readme),r?.tags!==void 0&&(i.tags=r.tags),r?.isPublic!==void 0&&(i.is_public=r.isPublic),r?.isArchived!==void 0&&(i.is_archived=r.isArchived),Object.keys(i).length===0)throw new Error("No valid update options provided");let a=await this.caller.call(Rt(this.debug),`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",body:JSON.stringify(i),headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Vr(a,"update prompt"),a.json()}async deletePrompt(e){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[r,n,o]=VS(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return await(await this.caller.call(Rt(this.debug),`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async pullPromptCommit(e,r){let[n,o,i]=VS(e),a=await this.caller.call(Rt(this.debug),`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await Vr(a,"pull prompt commit");let s=await a.json();return{owner:n,repo:o,commit_hash:s.commit_hash,manifest:s.manifest,examples:s.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,a]=this.parseTokenOrUrl(e,n),s=new t({apiUrl:i,apiKey:"placeholder"}),u=await s.readSharedDataset(a),l=o||u.name;try{if(await this.hasDataset({datasetId:l})){console.log(`Dataset ${l} already exists in your tenant. Skipping.`);return}}catch{}let c=await s.listSharedExamples(a),d=await this.createDataset(l,{description:u.description,dataType:u.data_type||"kv",inputsSchema:u.inputs_schema_definition??void 0,outputsSchema:u.outputs_schema_definition??void 0});try{await this.createExamples({inputs:c.map(f=>f.inputs),outputs:c.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${l}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return Tr(e),[r,e]}catch{}try{let a=new URL(e).pathname.split("/").filter(s=>s!=="");if(a.length>=n){let s=a[a.length-n];return[r,s]}else throw new Error(`Invalid public ${o} URL: ${e}`)}catch{throw new Error(`Invalid public ${o} URL or token: ${e}`)}}awaitPendingTraceBatches(){return this.manualFlushMode?(console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve()):Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()])}}});var e5,t5=O(()=>{Rue();n5();B6();e5="0.3.20"});function r5(){if(jue===void 0){let t=sKt(),e=lKt();jue={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:e5,...e}}return jue}function yFe(){let t=uKt()||{},e={},r=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(let[n,o]of Object.entries(t))(n.startsWith("LANGCHAIN_")||n.startsWith("LANGSMITH_"))&&typeof o=="string"&&!r.includes(n)&&!n.toLowerCase().includes("key")&&!n.toLowerCase().includes("secret")&&!n.toLowerCase().includes("token")&&(n==="LANGCHAIN_REVISION_ID"?e.revision_id=o:e[n]=o);return e}function uKt(){try{return typeof process<"u"&&process.env?Object.entries(process.env).reduce((t,[e,r])=>(t[e]=String(r),t),{}):void 0}catch{return}}function xy(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function hf(t){return xy(`LANGSMITH_${t}`)||xy(`LANGCHAIN_${t}`)}function lKt(){if(Due!==void 0)return Due;let t=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],e={};for(let r of t){let n=xy(r);n!==void 0&&(e[r]=n)}return Due=e,e}var KS,nKt,oKt,iKt,bFe,aKt,sKt,jue,Due,xq=O(()=>{t5();nKt=()=>typeof window<"u"&&typeof window.document<"u",oKt=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",iKt=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),bFe=()=>typeof Deno<"u",aKt=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!bFe(),sKt=()=>KS||(nKt()?KS="browser":aKt()?KS="node":oKt()?KS="webworker":iKt()?KS="jsdom":bFe()?KS="deno":KS="other",KS)});var _Fe,vFe=O(()=>{xq();_Fe=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>hf(r)==="true")});var o5,wFe=O(()=>{o5=Symbol.for("lc:context_variables")});function cKt(t){return t.replace(/[-:.]/g,"")}function dKt(t,e,r=1){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return cKt(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function a5(t){return t!==void 0&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function xFe(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function SFe(t){return Array.isArray(t)&&t.some(e=>xFe(e))}function fKt(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function pKt(t){return t!==void 0&&typeof t.callbacks=="object"&&(SFe(t.callbacks?.handlers)||SFe(t.callbacks))}var i5,WS,n5=O(()=>{zO();xq();Rue();vFe();uue();wFe();i5=class t{constructor(e,r,n){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n}static fromHeader(e){let r=e.split(","),n={},o=[],i;for(let a of r){let[s,u]=a.split("="),l=decodeURIComponent(u);s==="langsmith-metadata"?n=JSON.parse(l):s==="langsmith-tags"?o=l.split(","):s==="langsmith-project"&&(i=l)}return new t(n,o,i)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},WS=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a5(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),a={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:a},Object.assign(this,{...r,...o,client:i}),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.execution_order??(this.execution_order=1),this.child_execution_order??(this.child_execution_order=1),!this.dotted_order){let s=dKt(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+s:this.dotted_order=s}}static getDefaultConfig(){return{id:Ra(),run_type:"chain",project_name:hf("PROJECT")??xy("LANGCHAIN_SESSION")??"default",child_runs:[],api_url:xy("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:xy("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new vI),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=new t({...e,parent_run:this,project_name:this.project_name,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});o5 in this&&(n[o5]=this[o5]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(pKt(i)){let u={...i},l=fKt(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(xFe)?.updateFromRunTree?.(n),u.callbacks=l),n.extra[o]=u}let a=new Set,s=this;for(;s!=null&&!a.has(s.id);)a.add(s.id),s.child_execution_order=Math.max(s.child_execution_order,r),s=s.parent_run;return this.child_runs.push(n),n}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o.runtime||(o.runtime={}),r)for(let[u,l]of Object.entries(r))o.runtime[u]||(o.runtime[u]=l);let i,a;return n?(a=e.parent_run?.id,i=[]):(i=e.child_runs.map(u=>this._convertToCreate(u,r,n)),a=void 0),{id:e.id,name:e.name,start_time:e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:a,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments}}async postRun(e=!0){try{let r=r5(),n=await this._convertToCreate(this,r,!0);if(await this.client.createRun(n),!e){q6("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let o of this.child_runs)await o.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(){try{let e={end_time:this.end_time,error:this.error,inputs:this.inputs,outputs:this.outputs,parent_run_id:this.parent_run?.id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};await this.client.updateRun(this.id,e)}catch(e){console.error(`Error in patchRun for run ${this.id}`,e)}}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),typeof e=="string"?this.events.push({name:"event",time:new Date().toISOString(),message:e}):this.events.push({...e,time:e.time??new Date().toISOString()})}static fromRunnableConfig(e,r){let n=e?.callbacks,o,i,a,s=_Fe();if(n){let l=n?.getParentRunId?.()??"",c=n?.handlers?.find(d=>d?.name=="langchain_tracer");o=c?.getRun?.(l),i=c?.projectName,a=c?.client,s=s||!!c}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:a,tracingEnabled:s,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new t({...r,client:a,tracingEnabled:s,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),a=i.split(".").map(l=>{let[c,d]=l.split("Z");return{strTime:c,time:Date.parse(c+"Z"),uuid:d}}),s=a[0].uuid,u={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:a.at(-1)?.uuid,trace_id:s,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=i5.fromHeader(n.baggage);u.metadata=l.metadata,u.tags=l.tags,u.project_name=l.project_name}return new t(u)}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new i5(this.extra?.metadata,this.tags,this.project_name).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(WS,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});function s5(t){return typeof t=="function"&&"langsmith:traceable"in t}var Lue,Nue,mKt,Fue,hKt,CFe,Pvn,OFe=O(()=>{n5();Lue=class{getStore(){}run(e,r){return r()}},Nue=Symbol.for("ls:tracing_async_local_storage"),mKt=new Lue,Fue=class{getInstance(){return globalThis[Nue]??mKt}initializeGlobalInstance(e){globalThis[Nue]===void 0&&(globalThis[Nue]=e)}},hKt=new Fue,CFe=()=>{let t=hKt.getInstance().getStore();if(!a5(t))throw new Error(["Could not get the current run tree.","","Please make sure you are calling this method within a traceable function and that tracing is enabled."].join(`
`));return t},Pvn=Symbol.for("langsmith:traceable:root")});var kue=O(()=>{OFe()});function l5(t,e){return gKt.call(t,e)}function c5(t){if(Array.isArray(t)){let r=new Array(t.length);for(let n=0;n<r.length;n++)r[n]=""+n;return r}if(Object.keys)return Object.keys(t);let e=[];for(let r in t)l5(t,r)&&e.push(r);return e}function Vc(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function d5(t){let e=0,r=t.length,n;for(;e<r;){if(n=t.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}function Cy(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function Rq(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function u5(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(u5(t[r]))return!0}else if(typeof t=="object"){let r=c5(t),n=r.length;for(var e=0;e<n;e++)if(u5(t[r[e]]))return!0}}return!1}function EFe(t,e){let r=[t];for(let n in e){let o=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof o<"u"&&r.push(`${n}: ${o}`)}return r.join(`
`)}var gKt,wI,jq=O(()=>{gKt=Object.prototype.hasOwnProperty;wI=class extends Error{constructor(e,r,n,o,i){super(EFe(e,{name:r,index:n,operation:o,tree:i})),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"operation",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"tree",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.setPrototypeOf(this,new.target.prototype),this.message=EFe(e,{name:r,index:n,operation:o,tree:i})}}});var Bue={};ff(Bue,{JsonPatchError:()=>ja,_areEquals:()=>Dq,applyOperation:()=>SI,applyPatch:()=>HO,applyReducer:()=>_Kt,deepClone:()=>yKt,getValueByPointer:()=>f5,validate:()=>PFe,validator:()=>p5});function f5(t,e){if(e=="")return t;var r={op:"_get",path:e};return SI(t,r),r.value}function SI(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):p5(e,0)),e.path===""){let a={newDocument:t};if(e.op==="add")return a.newDocument=e.value,a;if(e.op==="replace")return a.newDocument=e.value,a.removed=t,a;if(e.op==="move"||e.op==="copy")return a.newDocument=f5(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=Dq(t,e.value),a.test===!1)throw new ja("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return a.newDocument=t,a}else{if(e.op==="remove")return a.removed=t,a.newDocument=null,a;if(e.op==="_get")return e.value=t,a;if(r)throw new ja("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=Vc(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=p5;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=Rq(f)),o&&(f=="__proto__"||f=="prototype"&&l>0&&s[l-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&d===void 0&&(u[f]===void 0?d=s.slice(0,l).join("/"):l==c-1&&(d=e.path),d!==void 0&&p(e,0,t,d)),l++,Array.isArray(u)){if(f==="-")f=u.length;else{if(r&&!d5(f))throw new ja("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,e,t);d5(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new ja("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=bKt[e.op].call(e,u,f,t);if(m.test===!1)throw new ja("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(l>=c){let m=bD[e.op].call(e,u,f,t);if(m.test===!1)throw new ja("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new ja("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function HO(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new ja("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=Vc(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=SI(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function _Kt(t,e,r){let n=SI(t,e);if(n.test===!1)throw new ja("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function p5(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new ja("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(bD[t.op]){if(typeof t.path!="string")throw new ja("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new ja('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new ja("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new ja("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&u5(t.value))throw new ja("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var o=t.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new ja("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new ja("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var a={op:"_get",path:t.from,value:void 0},s=PFe([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new ja("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new ja("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function PFe(t,e,r){try{if(!Array.isArray(t))throw new ja("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)HO(Vc(e),Vc(t),r||!0);else{r=r||p5;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof ja)return o;throw o}}function Dq(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){var r=Array.isArray(t),n=Array.isArray(e),o,i,a;if(r&&n){if(i=t.length,i!=e.length)return!1;for(o=i;o--!==0;)if(!Dq(t[o],e[o]))return!1;return!0}if(r!=n)return!1;var s=Object.keys(t);if(i=s.length,i!==Object.keys(e).length)return!1;for(o=i;o--!==0;)if(!e.hasOwnProperty(s[o]))return!1;for(o=i;o--!==0;)if(a=s[o],!Dq(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var ja,yKt,bD,bKt,m5=O(()=>{jq();ja=wI,yKt=Vc,bD={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=f5(r,this.path);n&&(n=Vc(n));let o=SI(r,{op:"remove",path:this.from}).removed;return SI(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=f5(r,this.from);return SI(r,{op:"add",path:this.path,value:Vc(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:Dq(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},bKt={add:function(t,e,r){return d5(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:bD.move,copy:bD.copy,test:bD.test,_get:bD._get}});function TFe(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=c5(e),a=c5(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(l5(e,c)&&!(e[c]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var f=e[c];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?TFe(d,f,r,n+"/"+Cy(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+Cy(c),value:Vc(d)}),r.push({op:"replace",path:n+"/"+Cy(c),value:Vc(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+Cy(c),value:Vc(d)}),r.push({op:"remove",path:n+"/"+Cy(c)}),u=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),s=!0)}if(!(!u&&i.length==a.length))for(var l=0;l<i.length;l++){var c=i[l];!l5(t,c)&&e[c]!==void 0&&r.push({op:"add",path:n+"/"+Cy(c),value:Vc(e[c])})}}}function h5(t,e,r=!1){var n=[];return TFe(t,e,n,"",r),n}var AFe=O(()=>{jq();m5();});var Fvn,$ue=O(()=>{m5();AFe();jq();m5();jq();Fvn={...Bue,JsonPatchError:wI,deepClone:Vc,escapePathComponent:Cy,unescapePathComponent:Rq}});var MFe=b((Uvn,IFe)=>{"use strict";IFe.exports=function(t,e){if(typeof t!="string")throw new TypeError("Expected a string");return e=typeof e>"u"?"_":e,t.replace(/([a-z\d])([A-Z])/g,"$1"+e+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+e+"$2").toLowerCase()}});var kFe=b((zvn,que)=>{"use strict";var vKt=/[\p{Lu}]/u,wKt=/[\p{Ll}]/u,RFe=/^[\p{Lu}](?![\p{Lu}])/gu,NFe=/([\p{Alpha}\p{N}_]|$)/u,LFe=/[_.\- ]+/,SKt=new RegExp("^"+LFe.source),jFe=new RegExp(LFe.source+NFe.source,"gu"),DFe=new RegExp("\\d+"+NFe.source,"gu"),xKt=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&vKt.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&wKt.test(s)?(t=t.slice(0,a-1)+"-"+t.slice(a-1),i=o,o=!1,n=!0):(n=e(s)===s&&r(s)!==s,i=o,o=r(s)===s&&e(s)!==s)}return t},CKt=(t,e)=>(RFe.lastIndex=0,t.replace(RFe,r=>e(r))),OKt=(t,e)=>(jFe.lastIndex=0,DFe.lastIndex=0,t.replace(jFe,(r,n)=>e(n)).replace(DFe,r=>e(r))),FFe=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(t)?t=t.map(i=>i.trim()).filter(i=>i.length).join("-"):t=t.trim(),t.length===0)return"";let r=e.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(e.locale),n=e.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(e.locale);return t.length===1?e.pascalCase?n(t):r(t):(t!==r(t)&&(t=xKt(t,r,n)),t=t.replace(SKt,""),e.preserveConsecutiveUppercase?t=CKt(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),OKt(t,n))};que.exports=FFe;que.exports.default=FFe});function $Fe(t,e){return e?.[t]||(0,BFe.default)(t)}function qFe(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var BFe,EKt,UFe=O(()=>{BFe=B(MFe(),1),EKt=B(kFe(),1)});function zFe(t){return Array.isArray(t)?[...t]:{...t}}function PKt(t,e){let r=zFe(t);for(let[n,o]of Object.entries(e)){let[i,...a]=n.split(".").reverse(),s=r;for(let u of a.reverse()){if(s[u]===void 0)break;s[u]=zFe(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function Uue(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var bf,xI=O(()=>{UFe();bf=class t{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Uue(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof t||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,a=n,[s,...u]=o.split(".").reverse();for(let l of u.reverse()){if(!(l in i)||i[l]===void 0)return;(!(l in a)||a[l]===void 0)&&(typeof i[l]=="object"&&i[l]!=null?a[l]={}:Array.isArray(i[l])&&(a[l]=[])),i=i[l],a=a[l]}s in i&&i[s]!==void 0&&(a[s]=a[s]||i[s])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:qFe(Object.keys(r).length?PKt(n,r):n,$Fe,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});async function HFe(){return zue===void 0&&(zue={library:"langchain-js",runtime:g5()}),zue}function Ye(t){try{return typeof process<"u"?process.env?.[t]:Hue()?Deno?.env.get(t):void 0}catch{return}}var TKt,AKt,IKt,Hue,MKt,g5,zue,CI=O(()=>{TKt=()=>typeof window<"u"&&typeof window.document<"u",AKt=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",IKt=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),Hue=()=>typeof Deno<"u",MKt=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!Hue(),g5=()=>{let t;return TKt()?t="browser":MKt()?t="node":AKt()?t="webworker":IKt()?t="jsdom":Hue()?t="deno":t="other",t}});function Wue(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var Vue,OI,VFe,Nq=O(()=>{zO();xI();CI();Vue=class{};OI=class t extends Vue{get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Uue(this.constructor)]}constructor(e){super(),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ignoreLLM",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreChain",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreAgent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreRetriever",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreCustomEvent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"raiseError",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"awaitHandlers",{enumerable:!0,configurable:!0,writable:!0,value:Ye("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"}),this.lc_kwargs=e||{},e&&(this.ignoreLLM=e.ignoreLLM??this.ignoreLLM,this.ignoreChain=e.ignoreChain??this.ignoreChain,this.ignoreAgent=e.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=e.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=e.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=e.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(e._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return bf.prototype.toJSON.call(this)}toJSONNotImplemented(){return bf.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends t{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:Ra()}),Object.assign(this,e)}}return new r}},VFe=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});function Kue(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function RKt(t){return t.replace(/[-:.]/g,"")}function jKt(t,e,r){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return RKt(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function _D(t){return typeof t._addRunToRunMap=="function"}var Sm,EI=O(()=>{Nq();Sm=class extends OI{constructor(e){super(...arguments),Object.defineProperty(this,"runMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}copy(){return this}stringifyError(e){return e instanceof Error?e.message+(e?.stack?`
${e.stack}`:""):typeof e=="string"?e:`${e}`}_addChildRun(e,r){e.child_runs.push(r)}_addRunToRunMap(e){let r=jKt(e.start_time,e.id,e.execution_order),n={...e};if(n.parent_run_id!==void 0){let o=this.runMap.get(n.parent_run_id);o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,r].join(".")))}else n.trace_id=n.id,n.dotted_order=r;return this.runMap.set(n.id,n),n}async _endTrace(e){let r=e.parent_run_id!==void 0&&this.runMap.get(e.parent_run_id);r?r.child_execution_order=Math.max(r.child_execution_order,e.child_execution_order):await this.persistRun(e),this.runMap.delete(e.id),await this.onRunUpdate?.(e)}_getExecutionOrder(e){let r=e!==void 0&&this.runMap.get(e);return r?r.child_execution_order+1:1}_createRunForLLMStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{prompts:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleLLMStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForLLMStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}_createRunForChatModelStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{messages:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleChatModelStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForChatModelStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}async handleLLMEnd(e,r,n,o,i){let a=this.runMap.get(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.outputs=e,a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMEnd?.(a),await this._endTrace(a),a}async handleLLMError(e,r,n,o,i){let a=this.runMap.get(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMError?.(a),await this._endTrace(a),a}_createRunForChainStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:r,execution_order:l,child_execution_order:l,run_type:s??"chain",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(d)}async handleChainStart(e,r,n,o,i,a,s,u){let l=this.runMap.get(n)??this._createRunForChainStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onChainStart?.(l),l}async handleChainEnd(e,r,n,o,i){let a=this.runMap.get(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=Kue(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=Kue(i.inputs,"input")),await this.onChainEnd?.(a),await this._endTrace(a),a}async handleChainError(e,r,n,o,i){let a=this.runMap.get(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=Kue(i.inputs,"input")),await this.onChainError?.(a),await this._endTrace(a),a}_createRunForToolStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{input:r},execution_order:u,child_execution_order:u,run_type:"tool",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleToolStart(e,r,n,o,i,a,s){let u=this.runMap.get(n)??this._createRunForToolStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onToolStart?.(u),u}async handleToolEnd(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.outputs={output:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onToolEnd?.(n),await this._endTrace(n),n}async handleToolError(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onToolError?.(n),await this._endTrace(n),n}async handleAgentAction(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="chain")return;let o=n;o.actions=o.actions||[],o.actions.push(e),o.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentAction?.(n)}async handleAgentEnd(e,r){let n=this.runMap.get(r);!n||n?.run_type!=="chain"||(n.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentEnd?.(n))}_createRunForRetrieverStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{query:r},execution_order:u,child_execution_order:u,run_type:"retriever",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleRetrieverStart(e,r,n,o,i,a,s){let u=this.runMap.get(n)??this._createRunForRetrieverStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onRetrieverStart?.(u),u}async handleRetrieverEnd(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.outputs={documents:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onRetrieverEnd?.(n),await this._endTrace(n),n}async handleRetrieverError(e,r){let n=this.runMap.get(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onRetrieverError?.(n),await this._endTrace(n),n}async handleText(e,r){let n=this.runMap.get(r);!n||n?.run_type!=="chain"||(n.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:e}}),await this.onText?.(n))}async handleLLMNewToken(e,r,n,o,i,a){let s=this.runMap.get(n);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:e,idx:r,chunk:a?.chunk}}),await this.onLLMNewToken?.(s,e,{chunk:a?.chunk}),s}}});var GFe=b((Qvn,JFe)=>{"use strict";var WFe=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,KFe=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function DKt(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi256=WFe(),e.color.ansi16m=KFe(),e.bgColor.ansi256=WFe(10),e.bgColor.ansi16m=KFe(10),Object.defineProperties(e,{rgbToAnsi256:{value:(r,n,o)=>r===n&&n===o?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:o}=n.groups;o.length===3&&(o=o.split("").map(a=>a+a).join(""));let i=Number.parseInt(o,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:r=>e.rgbToAnsi256(...e.hexToRgb(r)),enumerable:!1}}),e}Object.defineProperty(JFe,"exports",{enumerable:!0,get:DKt})});function jd(t,e){return`${t.open}${e}${t.close}`}function xm(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function YFe(t){return typeof t=="string"?t.trim():t==null?t:xm(t,t.toString())}function VO(t){if(!t.end_time)return"";let e=t.end_time-t.start_time;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}var Jue,_f,Lq,ZFe=O(()=>{Jue=B(GFe(),1);EI();({color:_f}=Jue.default),Lq=class extends Sm{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"console_callback_handler"})}persistRun(e){return Promise.resolve()}getParents(e){let r=[],n=e;for(;n.parent_run_id;){let o=this.runMap.get(n.parent_run_id);if(o)r.push(o),n=o;else break}return r}getBreadcrumbs(e){let n=[...this.getParents(e).reverse(),e].map((o,i,a)=>{let s=`${o.execution_order}:${o.run_type}:${o.name}`;return i===a.length-1?jd(Jue.default.bold,s):s}).join(" > ");return jd(_f.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.green,"[chain/start]")} [${r}] Entering Chain run with input: ${xm(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.cyan,"[chain/end]")} [${r}] [${VO(e)}] Exiting Chain run with output: ${xm(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.red,"[chain/error]")} [${r}] [${VO(e)}] Chain run errored with error: ${xm(e.error,"[error]")}`)}onLLMStart(e){let r=this.getBreadcrumbs(e),n="prompts"in e.inputs?{prompts:e.inputs.prompts.map(o=>o.trim())}:e.inputs;console.log(`${jd(_f.green,"[llm/start]")} [${r}] Entering LLM run with input: ${xm(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.cyan,"[llm/end]")} [${r}] [${VO(e)}] Exiting LLM run with output: ${xm(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.red,"[llm/error]")} [${r}] [${VO(e)}] LLM run errored with error: ${xm(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.green,"[tool/start]")} [${r}] Entering Tool run with input: "${YFe(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.cyan,"[tool/end]")} [${r}] [${VO(e)}] Exiting Tool run with output: "${YFe(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.red,"[tool/error]")} [${r}] [${VO(e)}] Tool run errored with error: ${xm(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${xm(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.cyan,"[retriever/end]")} [${r}] [${VO(e)}] Exiting Retriever run with output: ${xm(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${jd(_f.red,"[retriever/error]")} [${r}] [${VO(e)}] Retriever run errored with error: ${xm(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${jd(_f.blue,"[agent/action]")} [${n}] Agent selected action: ${xm(r.actions[r.actions.length-1],"[action]")}`)}}});function WO(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var Fq=O(()=>{});function vD(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}var PI,y5=O(()=>{PI=class extends Error{constructor(e,r){super(e),Object.defineProperty(this,"output",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.output=r}}});function Gue(t,e=wD){t=t.trim();let r=/```(json)?(.*)```/s.exec(t);return e(r?r[2]:t)}function wD(t){if(typeof t>"u")return null;try{return JSON.parse(t)}catch{}let e="",r=[],n=!1,o=!1;for(let i of t){if(n)i==='"'&&!o?n=!1:i===`
`&&!o?i="\\n":i==="\\"?o=!o:o=!1;else if(i==='"')n=!0,o=!1;else if(i==="{")r.push("}");else if(i==="[")r.push("]");else if(i==="}"||i==="]")if(r&&r[r.length-1]===i)r.pop();else return null;e+=i}n&&(e+='"');for(let i=r.length-1;i>=0;i-=1)e+=r[i];try{return JSON.parse(e)}catch{return null}}var Yue=O(()=>{});function Cm(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:[{type:"text",text:t},...e]:Array.isArray(e)?kq(t,e)??[...t,...e]:e===""?t:[...t,{type:"text",text:e}]}function XFe(t,e){return t==="error"||e==="error"?"error":"success"}function NKt(t,e){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(a=>r(a,o+1));let i={};for(let a of Object.keys(n))i[a]=r(n[a],o+1);return i}return JSON.stringify(r(t,0),null,2)}function Ka(t,e){let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=Ka(r[n],o);else if(Array.isArray(r[n]))r[n]=kq(r[n],o);else{if(r[n]===o)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function kq(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>i.index===n.index);o!==-1?r[o]=Ka(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function QFe(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types.
Left ${typeof t}
Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return kq(t,e);if(typeof t=="object"&&typeof e=="object")return Ka(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
Left ${t}
Right ${e}`)}function eke(t){return typeof t.role=="string"}function Om(t){return typeof t?._getType=="function"}function Zue(t){return Om(t)&&typeof t.concat=="function"}var Ku,vf,Em=O(()=>{xI();Ku=class extends bf{get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(e=>typeof e=="string"?e:e.type==="text"?e.text:"").join(""):""}getType(){return this._getType()}constructor(e,r){typeof e=="string"&&(e={content:e,additional_kwargs:r,response_metadata:{}}),e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","messages"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"additional_kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.content=e.content,this.additional_kwargs=e.additional_kwargs,this.response_metadata=e.response_metadata,this.id=e.id}toDict(){return{type:this._getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let r=NKt(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};vf=class extends Ku{}});function tke(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function rke(t){let e=[],r=[];for(let n of t)if(n.function){let o=n.function.name;try{let i=JSON.parse(n.function.arguments),a={name:o||"",args:i||{},id:n.id};e.push(a)}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}var JS,Pm,SD=O(()=>{Em();JS=class extends Ku{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}constructor(e,r,n){typeof e=="string"&&(e={content:e,name:n,tool_call_id:r}),super(e),Object.defineProperty(this,"lc_direct_tool_output",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tool_call_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"artifact",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}_getType(){return"tool"}static isInstance(e){return e._getType()==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},Pm=class t extends vf{constructor(e){super(e),Object.defineProperty(this,"tool_call_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"artifact",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}_getType(){return"tool"}concat(e){return new t({content:Cm(this.content,e.content),additional_kwargs:Ka(this.additional_kwargs,e.additional_kwargs),response_metadata:Ka(this.response_metadata,e.response_metadata),artifact:QFe(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:XFe(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function ei(t){return t._getType()==="ai"}function Xue(t){return t._getType()==="ai"}var en,or,TI=O(()=>{Yue();Em();SD();en=class extends Ku{get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls"}}constructor(e,r){let n;if(typeof e=="string")n={content:e,tool_calls:[],invalid_tool_calls:[],additional_kwargs:r??{}};else{n=e;let o=n.additional_kwargs?.tool_calls,i=n.tool_calls;o!=null&&o.length>0&&(i===void 0||i.length===0)&&console.warn(["New LangChain packages are available that more efficiently handle",`tool calling.
Please upgrade your packages to versions that set`,"message tool calls. e.g., `yarn add @langchain/anthropic`,","yarn add @langchain/openai`, etc."].join(" "));try{if(o!=null&&i===void 0){let[a,s]=rke(o);n.tool_calls=a??[],n.invalid_tool_calls=s??[]}else n.tool_calls=n.tool_calls??[],n.invalid_tool_calls=n.invalid_tool_calls??[]}catch{n.tool_calls=[],n.invalid_tool_calls=[]}}super(n),Object.defineProperty(this,"tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"invalid_tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"usage_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof n!="string"&&(this.tool_calls=n.tool_calls??this.tool_calls,this.invalid_tool_calls=n.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=n.usage_metadata}static lc_name(){return"AIMessage"}_getType(){return"ai"}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}};or=class t extends vf{constructor(e){let r;if(typeof e=="string")r={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(e.tool_call_chunks===void 0)r={...e,tool_calls:e.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0};else{let n=[],o=[];for(let i of e.tool_call_chunks){let a={};try{if(a=wD(i.args||"{}"),a===null||typeof a!="object"||Array.isArray(a))throw new Error("Malformed tool call chunk args.");n.push({name:i.name??"",args:a,id:i.id,type:"tool_call"})}catch{o.push({name:i.name,args:i.args,id:i.id,error:"Malformed args.",type:"invalid_tool_call"})}}r={...e,tool_calls:n,invalid_tool_calls:o,usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0}}super(r),Object.defineProperty(this,"tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"invalid_tool_calls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"tool_call_chunks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"usage_metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.tool_call_chunks=r.tool_call_chunks??this.tool_call_chunks,this.tool_calls=r.tool_calls??this.tool_calls,this.invalid_tool_calls=r.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=r.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks"}}static lc_name(){return"AIMessageChunk"}_getType(){return"ai"}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(e){let r={content:Cm(this.content,e.content),additional_kwargs:Ka(this.additional_kwargs,e.additional_kwargs),response_metadata:Ka(this.response_metadata,e.response_metadata),tool_call_chunks:[],id:this.id??e.id};if(this.tool_call_chunks!==void 0||e.tool_call_chunks!==void 0){let n=kq(this.tool_call_chunks,e.tool_call_chunks);n!==void 0&&n.length>0&&(r.tool_call_chunks=n)}if(this.usage_metadata!==void 0||e.usage_metadata!==void 0){let n={...(this.usage_metadata?.input_token_details?.audio!==void 0||e.usage_metadata?.input_token_details?.audio!==void 0)&&{audio:(this.usage_metadata?.input_token_details?.audio??0)+(e.usage_metadata?.input_token_details?.audio??0)},...(this.usage_metadata?.input_token_details?.cache_read!==void 0||e.usage_metadata?.input_token_details?.cache_read!==void 0)&&{cache_read:(this.usage_metadata?.input_token_details?.cache_read??0)+(e.usage_metadata?.input_token_details?.cache_read??0)},...(this.usage_metadata?.input_token_details?.cache_creation!==void 0||e.usage_metadata?.input_token_details?.cache_creation!==void 0)&&{cache_creation:(this.usage_metadata?.input_token_details?.cache_creation??0)+(e.usage_metadata?.input_token_details?.cache_creation??0)}},o={...(this.usage_metadata?.output_token_details?.audio!==void 0||e.usage_metadata?.output_token_details?.audio!==void 0)&&{audio:(this.usage_metadata?.output_token_details?.audio??0)+(e.usage_metadata?.output_token_details?.audio??0)},...(this.usage_metadata?.output_token_details?.reasoning!==void 0||e.usage_metadata?.output_token_details?.reasoning!==void 0)&&{reasoning:(this.usage_metadata?.output_token_details?.reasoning??0)+(e.usage_metadata?.output_token_details?.reasoning??0)}},i=this.usage_metadata??{input_tokens:0,output_tokens:0,total_tokens:0},a=e.usage_metadata??{input_tokens:0,output_tokens:0,total_tokens:0},s={input_tokens:i.input_tokens+a.input_tokens,output_tokens:i.output_tokens+a.output_tokens,total_tokens:i.total_tokens+a.total_tokens,...Object.keys(n).length>0&&{input_token_details:n},...Object.keys(o).length>0&&{output_token_details:o}};r.usage_metadata=s}return new t(r)}}});var Ja,Dd,b5=O(()=>{Em();Ja=class t extends Ku{static lc_name(){return"ChatMessage"}static _chatMessageClass(){return t}constructor(e,r){typeof e=="string"&&(e={content:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}_getType(){return"generic"}static isInstance(e){return e._getType()==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},Dd=class t extends vf{static lc_name(){return"ChatMessageChunk"}constructor(e,r){typeof e=="string"&&(e={content:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}_getType(){return"generic"}concat(e){return new t({content:Cm(this.content,e.content),additional_kwargs:Ka(this.additional_kwargs,e.additional_kwargs),response_metadata:Ka(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var _p,_5=O(()=>{Em();_p=class t extends vf{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(e){return new t({content:Cm(this.content,e.content),additional_kwargs:Ka(this.additional_kwargs,e.additional_kwargs),response_metadata:Ka(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var Ga,Nd,Bq=O(()=>{Em();Ga=class extends Ku{static lc_name(){return"HumanMessage"}_getType(){return"human"}},Nd=class t extends vf{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}concat(e){return new t({content:Cm(this.content,e.content),additional_kwargs:Ka(this.additional_kwargs,e.additional_kwargs),response_metadata:Ka(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});var GS,Wc,v5=O(()=>{Em();GS=class extends Ku{static lc_name(){return"SystemMessage"}_getType(){return"system"}},Wc=class t extends vf{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}concat(e){return new t({content:Cm(this.content,e.content),additional_kwargs:Ka(this.additional_kwargs,e.additional_kwargs),response_metadata:Ka(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});function FKt(t){return vD(t)?t:typeof t.id=="string"&&t.type==="function"&&typeof t.function=="object"&&t.function!==null&&"arguments"in t.function&&typeof t.function.arguments=="string"&&"name"in t.function&&typeof t.function.name=="string"?{id:t.id,args:JSON.parse(t.function.arguments),name:t.function.name,type:"tool_call"}:t}function kKt(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function Que(t){let e,r;if(kKt(t)){let n=t.id.at(-1);n==="HumanMessage"||n==="HumanMessageChunk"?e="user":n==="AIMessage"||n==="AIMessageChunk"?e="assistant":n==="SystemMessage"||n==="SystemMessageChunk"?e="system":n==="FunctionMessage"||n==="FunctionMessageChunk"?e="function":n==="ToolMessage"||n==="ToolMessageChunk"?e="tool":e="unknown",r=t.kwargs}else{let{type:n,...o}=t;e=n,r=o}if(e==="human"||e==="user")return new Ga(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new en(r);let i=n.map(FKt);return new en({...o,tool_calls:i})}else{if(e==="system")return new GS(r);if(e==="developer")return new GS({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new JS({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw WO(new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported.
Received: ${JSON.stringify(t,null,2)}`),"MESSAGE_COERCION_FAILURE")}}function eg(t){if(typeof t=="string")return new Ga(t);if(Om(t))return t;if(Array.isArray(t)){let[e,r]=t;return Que({type:e,content:r})}else if(eke(t)){let{role:e,...r}=t;return Que({...r,type:e})}else return Que(t)}function Ld(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o._getType()==="human")i=e;else if(o._getType()==="ai")i=r;else if(o._getType()==="system")i="System";else if(o._getType()==="function")i="Function";else if(o._getType()==="tool")i="Tool";else if(o._getType()==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o._getType()}`);let a=o.name?`${o.name}, `:"",s=typeof o.content=="string"?o.content:JSON.stringify(o.content,null,2);n.push(`${i}: ${a}${s}`)}return n.join(`
`)}function ele(t){let e=t._getType();if(e==="human")return new Nd({...t});if(e==="ai"){let r={...t};return"tool_calls"in r&&(r={...r,tool_call_chunks:r.tool_calls?.map(n=>({...n,type:"tool_call_chunk",index:void 0,args:JSON.stringify(n.args)}))}),new or({...r})}else{if(e==="system")return new Wc({...t});if(e==="function")return new _p({...t});if(Ja.isInstance(t))return new Dd({...t});throw new Error("Unknown message type.")}}var KO=O(()=>{Fq();y5();TI();Em();b5();_5();Bq();v5();SD()});var tle=O(()=>{n5()});var rle=O(()=>{t5()});var nle,nke,oke=O(()=>{rle();CI();nke=()=>{if(nle===void 0){let t=Ye("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};nle=new vI(t)}return nle}});var xD,ike=O(()=>{tle();kue();CI();EI();oke();xD=class t extends Sm{constructor(e={}){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"langchain_tracer"}),Object.defineProperty(this,"projectName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let{exampleId:r,projectName:n,client:o}=e;this.projectName=n??Ye("LANGCHAIN_PROJECT")??Ye("LANGCHAIN_SESSION"),this.exampleId=r,this.client=o??nke();let i=t.getTraceableRunTree();i&&this.updateFromRunTree(i)}async _convertToCreate(e,r=void 0){return{...e,extra:{...e.extra,runtime:await HFe()},child_runs:void 0,session_name:this.projectName,reference_example_id:e.parent_run_id?void 0:r}}async persistRun(e){}async onRunCreate(e){let r=await this._convertToCreate(e,this.exampleId);await this.client.createRun(r)}async onRunUpdate(e){let r={end_time:e.end_time,error:e.error,outputs:e.outputs,events:e.events,inputs:e.inputs,trace_id:e.trace_id,dotted_order:e.dotted_order,parent_run_id:e.parent_run_id,extra:e.extra,session_name:this.projectName};await this.client.updateRun(e.id,r)}getRun(e){return this.runMap.get(e)}updateFromRunTree(e){let r=e,n=new Set;for(;r.parent_run&&!(n.has(r.id)||(n.add(r.id),!r.parent_run));)r=r.parent_run;n.clear();let o=[r];for(;o.length>0;){let i=o.shift();!i||n.has(i.id)||(n.add(i.id),this.runMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}convertToRunTree(e){let r={},n=[];for(let[o,i]of this.runMap){let a=new WS({...i,child_runs:[],parent_run:void 0,client:this.client,project_name:this.projectName,reference_example_id:this.exampleId,tracingEnabled:!0});r[o]=a,n.push([o,i.dotted_order])}n.sort((o,i)=>!o[1]||!i[1]?0:o[1].localeCompare(i[1]));for(let[o]of n){let i=this.runMap.get(o),a=r[o];if(!(!i||!a)&&i.parent_run_id){let s=r[i.parent_run_id];s&&(s.child_runs.push(a),a.parent_run=s)}}return r[e]}static getTraceableRunTree(){try{return CFe()}catch{return}}}});var ake,AI,ske,JO,$q=O(()=>{ake=Symbol.for("ls:tracing_async_local_storage"),AI=Symbol.for("lc:context_variables"),ske=t=>{globalThis[ake]=t},JO=()=>globalThis[ake]});function BKt(){let t="default"in w5.default?w5.default.default:w5.default;return new t({autoStart:!0,concurrency:1})}function $Kt(){return typeof qq>"u"&&(qq=BKt()),qq}async function Ya(t,e){if(e===!0){let r=JO();r!==void 0?await r.run(void 0,async()=>t()):await t()}else qq=$Kt(),qq.add(async()=>{let r=JO();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var w5,qq,uke=O(()=>{w5=B(k6(),1);$q()});var lke=O(()=>{uke()});var cke,dke=O(()=>{CI();cke=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>Ye(r)==="true")});function ole(t){let e=JO();return e===void 0?void 0:e.getStore()?.[AI]?.[t]}var qKt,fke,pke=O(()=>{tle();$q();qKt=Symbol("lc:configure_hooks"),fke=()=>ole(qKt)||[]});function II(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function Uq(t){return"name"in t?t:OI.fromMethods(t)}var ile,CD,ale,S5,sle,ule,ls,GO=O(()=>{zO();Nq();ZFe();KO();CI();ike();lke();dke();EI();pke();ile=class{setHandler(e){return this.setHandlers([e])}},CD=class{constructor(e,r,n,o,i,a,s,u){Object.defineProperty(this,"runId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"inheritableHandlers",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"inheritableTags",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"inheritableMetadata",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_parentRunId",{enumerable:!0,configurable:!0,writable:!0,value:u})}get parentRunId(){return this._parentRunId}async handleText(e){await Promise.all(this.handlers.map(r=>Ya(async()=>{try{await r.handleText?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleText: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(a=>Ya(async()=>{try{await a.handleCustomEvent?.(e,r,this.runId,this.tags,this.metadata)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleCustomEvent: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}},ale=class extends CD{getChild(e){let r=new ls(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),e&&r.addTags([e],!1),r}async handleRetrieverEnd(e){await Promise.all(this.handlers.map(r=>Ya(async()=>{if(!r.ignoreRetriever)try{await r.handleRetrieverEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleRetriever`),r.raiseError)throw n}},r.awaitHandlers)))}async handleRetrieverError(e){await Promise.all(this.handlers.map(r=>Ya(async()=>{if(!r.ignoreRetriever)try{await r.handleRetrieverError?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleRetrieverError: ${n}`),r.raiseError)throw e}},r.awaitHandlers)))}},S5=class extends CD{async handleLLMNewToken(e,r,n,o,i,a){await Promise.all(this.handlers.map(s=>Ya(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(e,r??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,a)}catch(u){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleLLMNewToken: ${u}`),s.raiseError)throw u}},s.awaitHandlers)))}async handleLLMError(e,r,n,o,i){await Promise.all(this.handlers.map(a=>Ya(async()=>{if(!a.ignoreLLM)try{await a.handleLLMError?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleLLMError: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleLLMEnd(e,r,n,o,i){await Promise.all(this.handlers.map(a=>Ya(async()=>{if(!a.ignoreLLM)try{await a.handleLLMEnd?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleLLMEnd: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}},sle=class extends CD{getChild(e){let r=new ls(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),e&&r.addTags([e],!1),r}async handleChainError(e,r,n,o,i){await Promise.all(this.handlers.map(a=>Ya(async()=>{if(!a.ignoreChain)try{await a.handleChainError?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleChainError: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleChainEnd(e,r,n,o,i){await Promise.all(this.handlers.map(a=>Ya(async()=>{if(!a.ignoreChain)try{await a.handleChainEnd?.(e,this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleChainEnd: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleAgentAction(e){await Promise.all(this.handlers.map(r=>Ya(async()=>{if(!r.ignoreAgent)try{await r.handleAgentAction?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleAgentAction: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}async handleAgentEnd(e){await Promise.all(this.handlers.map(r=>Ya(async()=>{if(!r.ignoreAgent)try{await r.handleAgentEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleAgentEnd: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}},ule=class extends CD{getChild(e){let r=new ls(this.runId);return r.setHandlers(this.inheritableHandlers),r.addTags(this.inheritableTags),r.addMetadata(this.inheritableMetadata),e&&r.addTags([e],!1),r}async handleToolError(e){await Promise.all(this.handlers.map(r=>Ya(async()=>{if(!r.ignoreAgent)try{await r.handleToolError?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleToolError: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}async handleToolEnd(e){await Promise.all(this.handlers.map(r=>Ya(async()=>{if(!r.ignoreAgent)try{await r.handleToolEnd?.(e,this.runId,this._parentRunId,this.tags)}catch(n){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleToolEnd: ${n}`),r.raiseError)throw n}},r.awaitHandlers)))}},ls=class t extends ile{constructor(e,r){super(),Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"inheritableHandlers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"inheritableTags",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"inheritableMetadata",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"callback_manager"}),Object.defineProperty(this,"_parentRunId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,r,n=void 0,o=void 0,i=void 0,a=void 0,s=void 0,u=void 0){return Promise.all(r.map(async(l,c)=>{let d=c===0&&n?n:Ra();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return _D(f)&&f._createRunForLLMStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Ya(async()=>{try{await f.handleLLMStart?.(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u)}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new S5(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,r,n=void 0,o=void 0,i=void 0,a=void 0,s=void 0,u=void 0){return Promise.all(r.map(async(l,c)=>{let d=c===0&&n?n:Ra();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return _D(f)&&f._createRunForChatModelStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Ya(async()=>{try{if(f.handleChatModelStart)await f.handleChatModelStart?.(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u);else if(f.handleLLMStart){let p=Ld(l);await f.handleLLMStart?.(e,[p],d,this._parentRunId,i,this.tags,this.metadata,u)}}catch(p){if((f.raiseError?console.error:console.warn)(`Error in handler ${f.constructor.name}, handleLLMStart: ${p}`),f.raiseError)throw p}},f.awaitHandlers)})),new S5(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=Ra(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreChain)return _D(u)&&u._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,s),Ya(async()=>{try{await u.handleChainStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,o,s)}catch(l){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleChainStart: ${l}`),u.raiseError)throw l}},u.awaitHandlers)})),new sle(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=Ra(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreAgent)return _D(u)&&u._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Ya(async()=>{try{await u.handleToolStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,s)}catch(l){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleToolStart: ${l}`),u.raiseError)throw l}},u.awaitHandlers)})),new ule(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=Ra(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreRetriever)return _D(u)&&u._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Ya(async()=>{try{await u.handleRetrieverStart?.(e,r,n,this._parentRunId,this.tags,this.metadata,s)}catch(l){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleRetrieverStart: ${l}`),u.raiseError)throw l}},u.awaitHandlers)})),new ale(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,r,n,o,i){await Promise.all(this.handlers.map(a=>Ya(async()=>{if(!a.ignoreCustomEvent)try{await a.handleCustomEvent?.(e,r,n,this.tags,this.metadata)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleCustomEvent: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}addHandler(e,r=!0){this.handlers.push(e),r&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(r=>r!==e),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==e)}setHandlers(e,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let n of e)this.addHandler(n,r)}addTags(e,r=!0){this.removeTags(e),this.tags.push(...e),r&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(r=>!e.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!e.includes(r))}addMetadata(e,r=!0){this.metadata={...this.metadata,...e},r&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(let r of Object.keys(e))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(e=[],r=!0){let n=new t(this._parentRunId);for(let o of this.handlers){let i=this.inheritableHandlers.includes(o);n.addHandler(o,i)}for(let o of this.tags){let i=this.inheritableTags.includes(o);n.addTags([o],i)}for(let o of Object.keys(this.metadata)){let i=Object.keys(this.inheritableMetadata).includes(o);n.addMetadata({[o]:this.metadata[o]},i)}for(let o of e)n.handlers.filter(i=>i.name==="console_callback_handler").some(i=>i.name===o.name)||n.addHandler(o,r);return n}static fromHandlers(e){class r extends OI{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:Ra()}),Object.assign(this,e)}}let n=new this;return n.addHandler(new r),n}static configure(e,r,n,o,i,a,s){return this._configureSync(e,r,n,o,i,a,s)}static _configureSync(e,r,n,o,i,a,s){let u;(e||r)&&(Array.isArray(e)||!e?(u=new t,u.setHandlers(e?.map(Uq)??[],!0)):u=e,u=u.copy(Array.isArray(r)?r.map(Uq):r?.handlers,!1));let l=Ye("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=xD.getTraceableRunTree()?.tracingEnabled||cke(),d=c||(Ye("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new t),l&&!u.handlers.some(f=>f.name===Lq.prototype.name)){let f=new Lq;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new xD;u.addHandler(f,!0),u._parentRunId=xD.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of fke()){let v=h&&Ye(h)==="true"&&m,g,_=f!==void 0?ole(f):void 0;_&&VFe(_)?g=_:v&&(g=new m({})),g!==void 0&&(u||(u=new t),u.handlers.some(w=>w.name===g.name)||u.addHandler(g,p))}return(n||o)&&u&&(u.addTags(n??[]),u.addTags(o??[],!1)),(i||a)&&u&&(u.addMetadata(i??{}),u.addMetadata(a??{},!1)),u}}});var x5,UKt,mke,lle,Kc,hke=O(()=>{rle();$q();GO();x5=class{getStore(){}run(e,r){return r()}enterWith(e){}},UKt=new x5,mke=Symbol.for("lc:child_config"),lle=class{getInstance(){return JO()??UKt}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[mke]}runWithConfig(e,r,n){let o=ls._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata),i=this.getInstance(),a=i.getStore(),s=o?.getParentRunId(),u=o?.handlers?.find(c=>c?.name==="langchain_tracer"),l;return u&&s?l=u.convertToRunTree(s):n||(l=new WS({name:"<runnable_lambda>",tracingEnabled:!1})),l&&(l.extra={...l.extra,[mke]:e}),a!==void 0&&a[AI]!==void 0&&(l===void 0&&(l={}),l[AI]=a[AI]),i.run(l,r)}initializeGlobalInstance(e){JO()===void 0&&ske(e)}},Kc=new lle});var OD=O(()=>{hke();$q()});async function wf(t){return ls._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function O5(...t){let e={};for(let r of t.filter(n=>!!n))for(let n of Object.keys(r))if(n==="metadata")e[n]={...e[n],...r[n]};else if(n==="tags"){let o=e[n]??[];e[n]=[...new Set(o.concat(r[n]??[]))]}else if(n==="configurable")e[n]={...e[n],...r[n]};else if(n==="timeout")e.timeout===void 0?e.timeout=r.timeout:r.timeout!==void 0&&(e.timeout=Math.min(e.timeout,r.timeout));else if(n==="signal")e.signal===void 0?e.signal=r.signal:r.signal!==void 0&&("any"in AbortSignal?e.signal=AbortSignal.any([e.signal,r.signal]):e.signal=r.signal);else if(n==="callbacks"){let o=e.callbacks,i=r.callbacks;if(Array.isArray(i))if(!o)e.callbacks=i;else if(Array.isArray(o))e.callbacks=o.concat(i);else{let a=o.copy();for(let s of i)a.addHandler(Uq(s),!0);e.callbacks=a}else if(i)if(!o)e.callbacks=i;else if(Array.isArray(o)){let a=i.copy();for(let s of o)a.addHandler(Uq(s),!0);e.callbacks=a}else e.callbacks=new ls(i._parentRunId,{handlers:o.handlers.concat(i.handlers),inheritableHandlers:o.inheritableHandlers.concat(i.inheritableHandlers),tags:Array.from(new Set(o.tags.concat(i.tags))),inheritableTags:Array.from(new Set(o.inheritableTags.concat(i.inheritableTags))),metadata:{...o.metadata,...i.metadata}})}else{let o=n;e[o]=r[o]??e[o]}return e}function Wr(t){let e=Kc.getRunnableConfig(),r={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(e){let{runId:n,runName:o,...i}=e;r=Object.entries(i).reduce((a,[s,u])=>(u!==void 0&&(a[s]=u),a),r)}if(t&&(r=Object.entries(t).reduce((n,[o,i])=>(i!==void 0&&(n[o]=i),n),r)),r?.configurable)for(let n of Object.keys(r.configurable))zKt.has(typeof r.configurable[n])&&!r.metadata?.[n]&&(r.metadata||(r.metadata={}),r.metadata[n]=r.configurable[n]);if(r.timeout!==void 0){if(r.timeout<=0)throw new Error("Timeout must be a positive number");let n=AbortSignal.timeout(r.timeout);r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,n])):r.signal=n,delete r.timeout}return r}function Da(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=Wr(t);return e!==void 0&&(delete s.runName,s.callbacks=e),n!==void 0&&(s.recursionLimit=n),r!==void 0&&(s.maxConcurrency=r),o!==void 0&&(s.runName=o),i!==void 0&&(s.configurable={...s.configurable,...i}),a!==void 0&&delete s.runId,s}function vp(t){return t?{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal}:void 0}var C5,zKt,Oy=O(()=>{GO();OD();C5=25;zKt=new Set(["string","number","boolean"])});async function Ey(t,e){if(e===void 0)return t;let r;return Promise.race([t.catch(n=>{if(!e?.aborted)throw n}),new Promise((n,o)=>{r=()=>{o(new Error("Aborted"))},e.addEventListener("abort",r),e.aborted&&o(new Error("Aborted"))})]).finally(()=>e.removeEventListener("abort",r))}var cle=O(()=>{});function dle(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let a of r)a.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function yl(t,e){if(Array.isArray(t)&&Array.isArray(e))return t.concat(e);if(typeof t=="string"&&typeof e=="string")return t+e;if(typeof t=="number"&&typeof e=="number")return t+e;if("concat"in t&&typeof t.concat=="function")return t.concat(e);if(typeof t=="object"&&typeof e=="object"){let r={...t};for(let[n,o]of Object.entries(e))n in r&&!Array.isArray(r[n])?r[n]=yl(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function gke(t,e,r,n,...o){let i=new YS({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var Jc,YS,Py=O(()=>{Oy();OD();cle();Jc=class t extends ReadableStream{constructor(){super(...arguments),Object.defineProperty(this,"reader",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){let e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(e){let r=e.getReader();return new t({start(n){return o();function o(){return r.read().then(({done:i,value:a})=>{if(i){n.close();return}return n.enqueue(a),o()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(e){return new t({async pull(r){let{value:n,done:o}=await e.next();o&&r.close(),r.enqueue(n)},async cancel(r){await e.return(r)}})}};YS=class{constructor(e){Object.defineProperty(this,"generator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"setup",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signal",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"firstResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"firstResultUsed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.generator=e.generator,this.config=e.config,this.signal=e.signal??this.config?.signal,this.setup=new Promise((r,n)=>{Kc.runWithConfig(vp(e.config),async()=>{this.firstResult=e.generator.next(),e.startSetup?this.firstResult.then(e.startSetup).then(r,n):this.firstResult.then(o=>r(void 0),n)},!0)})}async next(...e){return this.signal?.throwIfAborted(),this.firstResultUsed?Kc.runWithConfig(vp(this.config),this.signal?async()=>Ey(this.generator.next(...e),this.signal):async()=>this.generator.next(...e),!0):(this.firstResultUsed=!0,this.firstResult)}async return(e){return this.generator.return(e)}async throw(e){return this.generator.throw(e)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}}});async function yke(t,e){if(e==="original")throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");let{inputs:r}=t;if(["retriever","llm","prompt"].includes(t.run_type))return r;if(!(Object.keys(r).length===1&&r?.input===""))return r.input}async function bke(t,e){let{outputs:r}=t;return e==="original"||["retriever","llm","prompt"].includes(t.run_type)?r:r!==void 0&&Object.keys(r).length===1&&r?.output!==void 0?r.output:r}function HKt(t){return t!==void 0&&t.message!==void 0}var tg,zq,_ke,Hq,vke=O(()=>{$ue();EI();Py();TI();tg=class{constructor(e){Object.defineProperty(this,"ops",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.ops=e.ops??[]}concat(e){let r=this.ops.concat(e.ops),n=HO({},r);return new zq({ops:r,state:n[n.length-1].newDocument})}},zq=class t extends tg{constructor(e){super(e),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.state=e.state}concat(e){let r=this.ops.concat(e.ops),n=HO(this.state,e.ops);return new t({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=HO({},e.ops);return new t({ops:e.ops,state:r[r.length-1].newDocument})}},_ke=t=>t.name==="log_stream_tracer";Hq=class extends Sm{constructor(e){super({_awaitHandler:!0,...e}),Object.defineProperty(this,"autoClose",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_schemaFormat",{enumerable:!0,configurable:!0,writable:!0,value:"original"}),Object.defineProperty(this,"rootId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keyMapByRunId",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"counterMapByRunName",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"transformStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"receiveStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"log_stream_tracer"}),Object.defineProperty(this,"lc_prefer_streaming",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this._schemaFormat=e?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=Jc.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){if(e.id===this.rootId)return!1;let r=e.tags??[],n=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(e.run_type)),this.includeTags!==void 0&&(n=n||r.find(o=>this.includeTags?.includes(o))!==void 0),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(e.run_type)),this.excludeTags!==void 0&&(n=n&&r.every(o=>!this.excludeTags?.includes(o))),n}async*tapOutputIterable(e,r){for await(let n of r){if(e!==this.rootId){let o=this.keyMapByRunId[e];o&&await this.writer.write(new tg({ops:[{op:"add",path:`/logs/${o}/streamed_output/-`,value:n}]}))}yield n}}async onRunCreate(e){if(this.rootId===void 0&&(this.rootId=e.id,await this.writer.write(new tg({ops:[{op:"replace",path:"",value:{id:e.id,name:e.name,type:e.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(e))return;this.counterMapByRunName[e.name]===void 0&&(this.counterMapByRunName[e.name]=0),this.counterMapByRunName[e.name]+=1;let r=this.counterMapByRunName[e.name];this.keyMapByRunId[e.id]=r===1?e.name:`${e.name}:${r}`;let n={id:e.id,name:e.name,type:e.run_type,tags:e.tags??[],metadata:e.extra?.metadata??{},start_time:new Date(e.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};this._schemaFormat==="streaming_events"&&(n.inputs=await yke(e,this._schemaFormat)),await this.writer.write(new tg({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[e.id]}`,value:n}]}))}async onRunUpdate(e){try{let r=this.keyMapByRunId[e.id];if(r===void 0)return;let n=[];this._schemaFormat==="streaming_events"&&n.push({op:"replace",path:`/logs/${r}/inputs`,value:await yke(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await bke(e,this._schemaFormat)}),e.end_time!==void 0&&n.push({op:"add",path:`/logs/${r}/end_time`,value:new Date(e.end_time).toISOString()});let o=new tg({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new tg({ops:[{op:"replace",path:"/final_output",value:await bke(e,this._schemaFormat)}]});await this.writer.write(r),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(e,r,n){let o=this.keyMapByRunId[e.id];if(o===void 0)return;let i=e.inputs.messages!==void 0,a;i?HKt(n?.chunk)?a=n?.chunk:a=new or({id:`run-${e.id}`,content:r}):a=r;let s=new tg({ops:[{op:"add",path:`/logs/${o}/streamed_output_str/-`,value:r},{op:"add",path:`/logs/${o}/streamed_output/-`,value:a}]});await this.writer.write(s)}}});var Vq,Sf,Sn,ED=O(()=>{Vq="__run",Sf=class t{constructor(e){Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"generationInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new t({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Sn=class t extends Sf{constructor(e){super(e),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.message=e.message}concat(e){return new t({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo},message:this.message.concat(e.message)})}}});function E5({name:t,serialized:e}){return t!==void 0?t:e?.name!==void 0?e.name:e?.id!==void 0&&Array.isArray(e?.id)?e.id[e.id.length-1]:"Unnamed"}var wke,P5,Ske=O(()=>{EI();Py();TI();ED();wke=t=>t.name==="event_stream_tracer",P5=class extends Sm{constructor(e){super({_awaitHandler:!0,...e}),Object.defineProperty(this,"autoClose",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"runInfoMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"tappedPromises",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"transformStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"receiveStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"event_stream_tracer"}),Object.defineProperty(this,"lc_prefer_streaming",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=Jc.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){let r=e.tags??[],n=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(e.runType)),this.includeTags!==void 0&&(n=n||r.find(o=>this.includeTags?.includes(o))!==void 0),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(e.runType)),this.excludeTags!==void 0&&(n=n&&r.every(o=>!this.excludeTags?.includes(o))),n}async*tapOutputIterable(e,r){let n=await r.next();if(n.done)return;let o=this.runInfoMap.get(e);if(o===void 0){yield n.value;return}function i(s,u){return s==="llm"&&typeof u=="string"?new Sf({text:u}):u}let a=this.tappedPromises.get(e);if(a===void 0){let s;a=new Promise(u=>{s=u}),this.tappedPromises.set(e,a);try{let u={event:`on_${o.runType}_stream`,run_id:e,name:o.name,tags:o.tags,metadata:o.metadata,data:{}};await this.send({...u,data:{chunk:i(o.runType,n.value)}},o),yield n.value;for await(let l of r)o.runType!=="tool"&&o.runType!=="retriever"&&await this.send({...u,data:{chunk:i(o.runType,l)}},o),yield l}finally{s()}}else{yield n.value;for await(let s of r)yield s}}async send(e,r){this._includeRun(r)&&await this.writer.write(e)}async sendEndEvent(e,r){let n=this.tappedPromises.get(e.run_id);n!==void 0?n.then(()=>{this.send(e,r)}):await this.send(e,r)}async onLLMStart(e){let r=E5(e),n=e.inputs.messages!==void 0?"chat_model":"llm",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:n,inputs:e.inputs};this.runInfoMap.set(e.id,o);let i=`on_${n}_start`;await this.send({event:i,data:{input:e.inputs},name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onLLMNewToken(e,r,n){let o=this.runInfoMap.get(e.id),i,a;if(o===void 0)throw new Error(`onLLMNewToken: Run ID ${e.id} not found in run map.`);if(this.runInfoMap.size!==1){if(o.runType==="chat_model")a="on_chat_model_stream",n?.chunk===void 0?i=new or({content:r,id:`run-${e.id}`}):i=n.chunk.message;else if(o.runType==="llm")a="on_llm_stream",n?.chunk===void 0?i=new Sf({text:r}):i=n.chunk;else throw new Error(`Unexpected run type ${o.runType}`);await this.send({event:a,data:{chunk:i},run_id:e.id,name:o.name,tags:o.tags,metadata:o.metadata},o)}}async onLLMEnd(e){let r=this.runInfoMap.get(e.id);this.runInfoMap.delete(e.id);let n;if(r===void 0)throw new Error(`onLLMEnd: Run ID ${e.id} not found in run map.`);let o=e.outputs?.generations,i;if(r.runType==="chat_model"){for(let a of o??[]){if(i!==void 0)break;i=a[0]?.message}n="on_chat_model_end"}else if(r.runType==="llm")i={generations:o?.map(a=>a.map(s=>({text:s.text,generationInfo:s.generationInfo}))),llmOutput:e.outputs?.llmOutput??{}},n="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${r.runType}`);await this.sendEndEvent({event:n,data:{output:i,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async onChainStart(e){let r=E5(e),n=e.run_type??"chain",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:e.run_type},i={};e.inputs.input===""&&Object.keys(e.inputs).length===1?(i={},o.inputs={}):e.inputs.input!==void 0?(i.input=e.inputs.input,o.inputs=e.inputs.input):(i.input=e.inputs,o.inputs=e.inputs),this.runInfoMap.set(e.id,o),await this.send({event:`on_${n}_start`,data:i,name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onChainEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onChainEnd: Run ID ${e.id} not found in run map.`);let n=`on_${e.run_type}_end`,o=e.inputs??r.inputs??{},a={output:e.outputs?.output??e.outputs,input:o};o.input&&Object.keys(o).length===1&&(a.input=o.input,r.inputs=o.input),await this.sendEndEvent({event:n,data:a,run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata??{}},r)}async onToolStart(e){let r=E5(e),n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:"tool",inputs:e.inputs??{}};this.runInfoMap.set(e.id,n),await this.send({event:"on_tool_start",data:{input:e.inputs??{}},name:r,run_id:e.id,tags:e.tags??[],metadata:e.extra?.metadata??{}},n)}async onToolEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(r.inputs===void 0)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);let n=e.outputs?.output===void 0?e.outputs:e.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:n,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async onRetrieverStart(e){let r=E5(e),o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:"retriever",inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,o),await this.send({event:"on_retriever_start",data:{input:{query:e.inputs.query}},name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onRetrieverEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onRetrieverEnd: Run ID ${e.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:e.outputs?.documents??e.outputs,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async handleCustomEvent(e,r,n){let o=this.runInfoMap.get(n);if(o===void 0)throw new Error(`handleCustomEvent: Run ID ${n} not found in run map.`);await this.send({event:"on_custom_event",run_id:n,name:e,tags:o.tags,metadata:o.metadata,data:r},o)}async finish(){let e=[...this.tappedPromises.values()];Promise.all(e).finally(()=>{this.writer.close()})}}});var xke,T5,VKt,WKt,wp,PD=O(()=>{xke=B(I6(),1),T5=B(k6(),1),VKt=[400,401,402,403,404,405,406,407,409],WKt=t=>{if(t.message.startsWith("Cancel")||t.message.startsWith("AbortError")||t.name==="AbortError"||t?.code==="ECONNABORTED")throw t;let e=t?.response?.status??t?.status;if(e&&VKt.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},wp=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedAttempt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.onFailedAttempt=e.onFailedAttempt??WKt;let r="default"in T5.default?T5.default.default:T5.default;this.queue=new r({concurrency:this.maxConcurrency})}call(e,...r){return this.queue.add(()=>(0,xke.default)(()=>e(...r).catch(n=>{throw n instanceof Error?n:new Error(n)}),{onFailedAttempt:this.onFailedAttempt,retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,r,...n){return e.signal?Promise.race([this.call(r,...n),new Promise((o,i)=>{e.signal?.addEventListener("abort",()=>{i(new Error("AbortError"))})})]):this.call(r,...n)}fetch(...e){return this.call(()=>fetch(...e).then(r=>r.ok?r:Promise.reject(r)))}}});var Wq,Cke=O(()=>{EI();Wq=class extends Sm{constructor({config:e,onStart:r,onEnd:n,onError:o}){super({_awaitHandler:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RootListenersTracer"}),Object.defineProperty(this,"rootId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"argOnStart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"argOnEnd",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"argOnError",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.config=e,this.argOnStart=r,this.argOnEnd=n,this.argOnError=o}persistRun(e){return Promise.resolve()}async onRunCreate(e){this.rootId||(this.rootId=e.id,this.argOnStart&&await this.argOnStart(e,this.config))}async onRunUpdate(e){e.id===this.rootId&&(e.error?this.argOnError&&await this.argOnError(e,this.config):this.argOnEnd&&await this.argOnEnd(e,this.config))}}});function Kq(t){return t?t.lc_runnable:!1}var A5,fle=O(()=>{A5=class{constructor(e){Object.defineProperty(this,"includeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"includeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"excludeTags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.includeNames=e.includeNames,this.includeTypes=e.includeTypes,this.includeTags=e.includeTags,this.excludeNames=e.excludeNames,this.excludeTypes=e.excludeTypes,this.excludeTags=e.excludeTags}includeEvent(e,r){let n=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,o=e.tags??[];return this.includeNames!==void 0&&(n=n||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(r)),this.includeTags!==void 0&&(n=n||o.some(i=>this.includeTags?.includes(i))),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(r)),this.excludeTags!==void 0&&(n=n&&o.every(i=>!this.excludeTags?.includes(i))),n}}});var Eke,Oke,Pke,I5=O(()=>{Eke=Symbol("Let zodToJsonSchema decide on which parser to use"),Oke={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Pke=t=>typeof t=="string"?{...Oke,name:t}:{...Oke,...t}});var Tke,ple=O(()=>{I5();Tke=t=>{let e=Pke(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function mle(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function xn(t,e,r,n,o){t[e]=r,mle(t,e,n,o)}var YO=O(()=>{});function Ake(){return{}}var hle=O(()=>{});function Ike(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==ne.ZodAny&&(r.items=Kt(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&xn(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&xn(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(xn(r,"minItems",t.exactLength.value,t.exactLength.message,e),xn(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var gle=O(()=>{Uc();YO();cs()});function Mke(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?xn(r,"minimum",n.value,n.message,e):xn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),xn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?xn(r,"maximum",n.value,n.message,e):xn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),xn(r,"maximum",n.value,n.message,e));break;case"multipleOf":xn(r,"multipleOf",n.value,n.message,e);break}return r}var yle=O(()=>{YO()});function Rke(){return{type:"boolean"}}var ble=O(()=>{});function M5(t,e){return Kt(t.type._def,e)}var R5=O(()=>{cs()});var jke,_le=O(()=>{cs();jke=(t,e)=>Kt(t.innerType._def,e)});function vle(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>vle(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return KKt(t,e)}}var KKt,wle=O(()=>{YO();KKt=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":xn(r,"minimum",n.value,n.message,e);break;case"max":xn(r,"maximum",n.value,n.message,e);break}return r}});function Dke(t,e){return{...Kt(t.innerType._def,e),default:t.defaultValue()}}var Sle=O(()=>{cs()});function Nke(t,e){return e.effectStrategy==="input"?Kt(t.schema._def,e):{}}var xle=O(()=>{cs()});function Lke(t){return{type:"string",enum:Array.from(t.values)}}var Cle=O(()=>{});function Fke(t,e){let r=[Kt(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Kt(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(JKt(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...u}=i;a=u}else n=void 0;o.push(a)}}),o.length?{allOf:o,...n}:void 0}var JKt,Ole=O(()=>{cs();JKt=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function kke(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var Ele=O(()=>{});function j5(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":xn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":xn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":ng(r,"email",n.message,e);break;case"format:idn-email":ng(r,"idn-email",n.message,e);break;case"pattern:zod":Fd(r,rg.email,n.message,e);break}break;case"url":ng(r,"uri",n.message,e);break;case"uuid":ng(r,"uuid",n.message,e);break;case"regex":Fd(r,n.regex,n.message,e);break;case"cuid":Fd(r,rg.cuid,n.message,e);break;case"cuid2":Fd(r,rg.cuid2,n.message,e);break;case"startsWith":Fd(r,RegExp(`^${Tle(n.value,e)}`),n.message,e);break;case"endsWith":Fd(r,RegExp(`${Tle(n.value,e)}$`),n.message,e);break;case"datetime":ng(r,"date-time",n.message,e);break;case"date":ng(r,"date",n.message,e);break;case"time":ng(r,"time",n.message,e);break;case"duration":ng(r,"duration",n.message,e);break;case"length":xn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),xn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Fd(r,RegExp(Tle(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&ng(r,"ipv4",n.message,e),n.version!=="v4"&&ng(r,"ipv6",n.message,e);break}case"base64url":Fd(r,rg.base64url,n.message,e);break;case"jwt":Fd(r,rg.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Fd(r,rg.ipv4Cidr,n.message,e),n.version!=="v4"&&Fd(r,rg.ipv6Cidr,n.message,e);break}case"emoji":Fd(r,rg.emoji(),n.message,e);break;case"ulid":{Fd(r,rg.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ng(r,"binary",n.message,e);break}case"contentEncoding:base64":{xn(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Fd(r,rg.base64,n.message,e);break}}break}case"nanoid":Fd(r,rg.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Tle(t,e){return e.patternStrategy==="escape"?YKt(t):t}function YKt(t){let e="";for(let r=0;r<t.length;r++)GKt.has(t[r])||(e+="\\"),e+=t[r];return e}function ng(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):xn(t,"format",e,r,n)}function Fd(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Bke(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):xn(t,"pattern",Bke(e,n),r,n)}function Bke(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,a=!1,s=!1;for(let u=0;u<n.length;u++){if(i){o+=n[u],i=!1;continue}if(r.i){if(a){if(n[u].match(/[a-z]/)){s?(o+=n[u],o+=`${n[u-2]}-${n[u]}`.toUpperCase(),s=!1):n[u+1]==="-"&&n[u+2]?.match(/[a-z]/)?(o+=n[u],s=!0):o+=`${n[u]}${n[u].toUpperCase()}`;continue}}else if(n[u].match(/[a-z]/)){o+=`[${n[u]}${n[u].toUpperCase()}]`;continue}}if(r.m){if(n[u]==="^"){o+=`(^|(?<=[\r
]))`;continue}else if(n[u]==="$"){o+=`($|(?=[\r
]))`;continue}}if(r.s&&n[u]==="."){o+=a?`${n[u]}\r
`:`[${n[u]}\r
]`;continue}o+=n[u],n[u]==="\\"?i=!0:a&&n[u]==="]"?a=!1:!a&&n[u]==="["&&(a=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}var Ple,rg,GKt,D5=O(()=>{YO();rg={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ple===void 0&&(Ple=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ple),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};GKt=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function N5(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===ne.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Kt(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Kt(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===ne.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=j5(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===ne.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===ne.ZodBranded&&t.keyType._def.type._def.typeName===ne.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=M5(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var L5=O(()=>{Uc();cs();D5();R5()});function $ke(t,e){if(e.mapStrategy==="record")return N5(t,e);let r=Kt(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Kt(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var Ale=O(()=>{cs();L5()});function qke(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}var Ile=O(()=>{});function Uke(){return{not:{}}}var Mle=O(()=>{});function zke(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Rle=O(()=>{});function Vke(t,e){if(e.target==="openApi3")return Hke(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Jq&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=Jq[i._def.typeName];return a&&!o.includes(a)?[...o,a]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...o,a];case"bigint":return[...o,"integer"];case"object":if(i._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,a,s)=>s.indexOf(i)===a);return{type:o.length>1?o:o[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return Hke(t,e)}var Jq,Hke,F5=O(()=>{cs();Jq={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};Hke=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Kt(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});function Wke(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Jq[t.innerType._def.typeName],nullable:!0}:{type:[Jq[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Kt(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Kt(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var jle=O(()=>{cs();F5()});function Kke(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",mle(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?xn(r,"minimum",n.value,n.message,e):xn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),xn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?xn(r,"maximum",n.value,n.message,e):xn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),xn(r,"maximum",n.value,n.message,e));break;case"multipleOf":xn(r,"multipleOf",n.value,n.message,e);break}return r}var Dle=O(()=>{YO()});function ZKt(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Kt(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Kt(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function Jke(t,e){let r=e.target==="openAi",n={type:"object",...Object.entries(t.shape()).reduce((o,[i,a])=>{if(a===void 0||a._def===void 0)return o;let s=a.isOptional();s&&r&&(a instanceof pf&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=Kt(a._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});return u===void 0?o:{properties:{...o.properties,[i]:u},required:s?o.required:[...o.required,i]}},{properties:{},required:[]}),additionalProperties:ZKt(t,e)};return n.required.length||delete n.required,n}var Nle=O(()=>{Uc();cs()});var Gke,Lle=O(()=>{cs();Gke=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Kt(t.innerType._def,e);let r=Kt(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var Yke,Fle=O(()=>{cs();Yke=(t,e)=>{if(e.pipeStrategy==="input")return Kt(t.in._def,e);if(e.pipeStrategy==="output")return Kt(t.out._def,e);let r=Kt(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Kt(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function Zke(t,e){return Kt(t.type._def,e)}var kle=O(()=>{cs()});function Xke(t,e){let n={type:"array",uniqueItems:!0,items:Kt(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&xn(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&xn(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var Ble=O(()=>{YO();cs()});function Qke(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Kt(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Kt(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Kt(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var $le=O(()=>{cs()});function eBe(){return{not:{}}}var qle=O(()=>{});function tBe(){return{}}var Ule=O(()=>{});var rBe,zle=O(()=>{cs();rBe=(t,e)=>Kt(t.innerType._def,e)});function Kt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Eke)return a}if(n&&!r){let a=XKt(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=eJt(t,t.typeName,e);return i&&tJt(t,e,i),o.jsonSchema=i,i}var XKt,QKt,eJt,tJt,cs=O(()=>{Uc();hle();gle();yle();ble();R5();_le();wle();Sle();xle();Cle();Ole();Ele();Ale();Ile();Mle();Rle();jle();Dle();Nle();Lle();Fle();kle();L5();Ble();D5();$le();qle();F5();Ule();zle();I5();XKt=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:QKt(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},QKt=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},eJt=(t,e,r)=>{switch(e){case ne.ZodString:return j5(t,r);case ne.ZodNumber:return Kke(t,r);case ne.ZodObject:return Jke(t,r);case ne.ZodBigInt:return Mke(t,r);case ne.ZodBoolean:return Rke();case ne.ZodDate:return vle(t,r);case ne.ZodUndefined:return eBe();case ne.ZodNull:return zke(r);case ne.ZodArray:return Ike(t,r);case ne.ZodUnion:case ne.ZodDiscriminatedUnion:return Vke(t,r);case ne.ZodIntersection:return Fke(t,r);case ne.ZodTuple:return Qke(t,r);case ne.ZodRecord:return N5(t,r);case ne.ZodLiteral:return kke(t,r);case ne.ZodEnum:return Lke(t);case ne.ZodNativeEnum:return qke(t);case ne.ZodNullable:return Wke(t,r);case ne.ZodOptional:return Gke(t,r);case ne.ZodMap:return $ke(t,r);case ne.ZodSet:return Xke(t,r);case ne.ZodLazy:return Kt(t.getter()._def,r);case ne.ZodPromise:return Zke(t,r);case ne.ZodNaN:case ne.ZodNever:return Uke();case ne.ZodEffects:return Nke(t,r);case ne.ZodAny:return Ake();case ne.ZodUnknown:return tBe();case ne.ZodDefault:return Dke(t,r);case ne.ZodBranded:return M5(t,r);case ne.ZodReadonly:return rBe(t,r);case ne.ZodCatch:return jke(t,r);case ne.ZodPipeline:return Yke(t,r);case ne.ZodFunction:case ne.ZodVoid:case ne.ZodSymbol:return;default:return(n=>{})(e)}},tJt=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var Xn,Hle=O(()=>{cs();ple();Xn=(t,e)=>{let r=Tke(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:Kt(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??{}}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=Kt(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??{},a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(i.title=a);let s=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s}});var Gl=O(()=>{I5();ple();YO();cs();hle();gle();yle();ble();R5();_le();wle();Sle();xle();Cle();Ole();Ele();Ale();Ile();Mle();Rle();jle();Dle();Nle();Lle();Fle();kle();zle();L5();Ble();D5();$le();qle();F5();Ule();Hle();Hle()});function Vle(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function nJt(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
`;return e}function nBe(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:a=!0,curveStyle:s="linear",wrapLabelNWords:u=9}=r??{},l=a?`%%{init: {'flowchart': {'curve': '${s}'}}}%%
graph TD;
`:`graph TD;
`;if(a){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,v]of Object.entries(t)){let g=v.name.split(":").pop()??"",w=rJt.some(C=>g.startsWith(C)&&g.endsWith(C))?`<p>${g}</p>`:g;Object.keys(v.metadata??{}).length&&(w+=`<hr/><small><em>${Object.entries(v.metadata??{}).map(([C,P])=>`${C} = ${P}`).join(`
`)}</em></small>`);let x=(m[h]??m[p]).replace("{0}",Vle(h)).replace("{1}",w);l+=` ${x}
`}}let c={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),v=m.filter((g,_)=>g===h[_]).join(":");c[v]||(c[v]=[]),c[v].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let v=m.split(":").pop();if(d.has(v))throw new Error(`Found duplicate subgraph '${v}' -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(v),l+=` subgraph ${v}
`}for(let v of p){let{source:g,target:_,data:w,conditional:x}=v,C="";if(w!==void 0){let P=w,E=P.split(" ");E.length>u&&(P=Array.from({length:Math.ceil(E.length/u)},(A,M)=>E.slice(M*u,(M+1)*u).join(" ")).join("&nbsp;<br>&nbsp;")),C=x?` -. &nbsp;${P}&nbsp; .-> `:` -- &nbsp;${P}&nbsp; --> `}else C=x?" -.-> ":" --> ";l+=` ${Vle(g)}${C}${Vle(_)};
`}for(let v in c)v.startsWith(`${m}:`)&&v!==m&&f(c[v],v);m&&!h&&(l+=` end
`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=nJt(i??{})),l}async function oBe(t,e){let{backgroundColor:r="white"}=e??{},n=btoa(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let o=`https://mermaid.ink/img/${n}?bgColor=${r}`,i=await fetch(o);if(!i.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${i.status}`,`Status text: ${i.statusText}`].join(`
`));return await i.blob()}var rJt,iBe=O(()=>{rJt=["*","_","`"]});function oJt(t,e){if(t!==void 0&&!UO(t))return t;if(Kq(e))try{let r=e.getName();return r=r.startsWith("Runnable")?r.slice(8):r,r}catch{return e.getName()}else return e.name??"UnknownSchema"}function iJt(t){return Kq(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...Xn(t.data.schema),title:t.data.name}}}function aBe(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.source)).map(o=>o.target)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}function sBe(t,e=[]){let r=new Set(t.edges.filter(o=>!e.includes(o.target)).map(o=>o.source)),n=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!r.has(o.id)&&n.push(o);return n.length===1?n[0]:void 0}var Gq,uBe=O(()=>{Gl();zO();fle();iBe();Gq=class t{constructor(e){Object.defineProperty(this,"nodes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"edges",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((r,n)=>{e[r.id]=UO(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...iJt(r)})),edges:this.edges.map(r=>{let n={source:e[r.source],target:e[r.target]};return typeof r.data<"u"&&(n.data=r.data),typeof r.conditional<"u"&&(n.conditional=r.conditional),n})}}addNode(e,r,n){if(r!==void 0&&this.nodes[r]!==void 0)throw new Error(`Node with id ${r} already exists`);let o=r??Ra(),i={id:o,data:e,name:oJt(r,e),metadata:n};return this.nodes[o]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(r=>r.source!==e.id&&r.target!==e.id)}addEdge(e,r,n,o){if(this.nodes[e.id]===void 0)throw new Error(`Source node ${e.id} not in graph`);if(this.nodes[r.id]===void 0)throw new Error(`Target node ${r.id} not in graph`);let i={source:e.id,target:r.id,data:n,conditional:o};return this.edges.push(i),i}firstNode(){return aBe(this)}lastNode(){return sBe(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(UO)&&(n="");let i=l=>n?`${n}:${l}`:l;Object.entries(e.nodes).forEach(([l,c])=>{this.nodes[i(l)]={...c,id:i(l)}});let a=e.edges.map(l=>({...l,source:i(l.source),target:i(l.target)}));this.edges=[...this.edges,...a];let s=e.firstNode(),u=e.lastNode();return[s?{id:i(s.id),data:s.data}:void 0,u?{id:i(u.id),data:u.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&aBe(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&sBe(this,[e.id])&&this.removeNode(e)}reid(){let e=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),r=new Map;Object.values(e).forEach(o=>{r.set(o,(r.get(o)||0)+1)});let n=o=>{let i=e[o];return UO(o)&&r.get(i)===1?i:o};return new t({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[n(o),{...i,id:n(o)}])),edges:this.edges.map(o=>({...o,source:n(o.source),target:n(o.target)}))})}drawMermaid(e){let{withStyles:r,curveStyle:n,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},a=this.reid(),s=a.firstNode(),u=a.lastNode();return nBe(a.nodes,a.edges,{firstNode:s?.id,lastNode:u?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){let r=this.drawMermaid(e);return oBe(r,{backgroundColor:e?.backgroundColor})}}});function lBe(t){let e=new TextEncoder,r=new ReadableStream({async start(n){for await(let o of t)n.enqueue(e.encode(`event: data
data: ${JSON.stringify(o)}
`));n.enqueue(e.encode(`event: end
`)),n.close()}});return Jc.fromReadableStream(r)}var cBe=O(()=>{Py()});function Wle(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function k5(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*Kle(t,e){for(;;){let{value:r,done:n}=Kc.runWithConfig(vp(t),e.next.bind(e),!0);if(n)break;yield r}}async function*B5(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Kc.runWithConfig(vp(t),r.next.bind(e),!0);if(o)break;yield n}}var dBe,fBe=O(()=>{OD();Oy();dBe=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function Ju(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function aJt(t){if(s5(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function ZS(t){if(typeof t=="function")return new kd({func:t});if(ln.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=ZS(n);return new ZO({steps:e})}else throw new Error(`Expected a Runnable, function or object.
Instead got an unsupported type.`)}function sJt(t,e){let r=e.name??t.getName(),n=e.description??e.schema?.description;return e.schema.constructor===Pr.ZodString?new Yq({name:r,description:n,schema:Pr.object({input:Pr.string()}).transform(o=>o.input),bound:t}):new Yq({name:r,description:n,schema:e.schema,bound:t})}var Jle,ln,XS,$5,q5,Wo,ZO,Gle,kd,U5,TD,z5,Yq,xf=O(()=>{Uc();Jle=B(I6(),1);zO();kue();vke();Ske();xI();Py();cle();Oy();PD();Cke();fle();OD();uBe();cBe();fBe();y5();ln=class extends bf{constructor(){super(...arguments),Object.defineProperty(this,"lc_runnable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}getName(e){let r=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${r}${e}`:r}bind(e){return new XS({bound:this,kwargs:e,config:{}})}map(){return new $5({bound:this})}withRetry(e){return new q5({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new XS({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new U5({runnable:this,fallbacks:r})}_getOptionsList(e,r=0){if(Array.isArray(e)&&e.length!==r)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${e.length} options for ${r} inputs`);if(Array.isArray(e))return e.map(Wr);if(r>1&&!Array.isArray(e)&&e.runId){console.warn("Provided runId will be used only for the first element of the batch.");let n=Object.fromEntries(Object.entries(e).filter(([o])=>o!=="runId"));return Array.from({length:r},(o,i)=>Wr(i===0?e:n))}return Array.from({length:r},()=>Wr(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new wp({maxConcurrency:i,onFailedAttempt:u=>{throw u}}),s=e.map((u,l)=>a.call(async()=>{try{return await this.invoke(u,o[l])}catch(c){if(n?.returnExceptions)return c;throw c}}));return Promise.all(s)}async*_streamIterator(e,r){yield this.invoke(e,r)}async stream(e,r){let n=Wr(r),o=new YS({generator:this._streamIterator(e,n),config:n});return await o.setup,Jc.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=Wr(e):r=Wr({callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,runName:e.runName,configurable:e.configurable,recursionLimit:e.recursionLimit,maxConcurrency:e.maxConcurrency,runId:e.runId,timeout:e.timeout,signal:e.signal});let n={...e};return delete n.callbacks,delete n.tags,delete n.metadata,delete n.runName,delete n.configurable,delete n.recursionLimit,delete n.maxConcurrency,delete n.runId,delete n.timeout,delete n.signal,[r,n]}async _callWithConfig(e,r,n){let o=Wr(n),a=await(await wf(o))?.handleChainStart(this.toJSON(),Ju(r,"input"),o.runId,o?.runType,void 0,void 0,o?.runName??this.getName());delete o.runId;let s;try{let u=e.call(this,r,o,a);s=await Ey(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(Ju(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(wf)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),Ju(r[c],"input"),i[c].runId,i[c].runType,void 0,void 0,i[c].runName??this.getName());return delete i[c].runId,d})),u;try{let l=e.call(this,r,i,s,o);u=await Ey(l,i?.[0]?.signal)}catch(l){throw await Promise.all(s.map(c=>c?.handleChainError(l))),l}return await Promise.all(s.map(l=>l?.handleChainEnd(Ju(u,"output")))),u}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=Wr(n),l=await wf(u);async function*c(){for await(let f of e){if(i)if(o===void 0)o=f;else try{o=yl(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await gke(r.bind(this),c(),async()=>l?.handleChainStart(this.toJSON(),{input:""},u.runId,u.runType,void 0,void 0,u.runName??this.getName()),n?.signal,u);delete u.runId,d=f.setup;let p=d?.handlers.find(wke),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(_ke);h!==void 0&&d!==void 0&&(m=h.tapOutputIterable(d.runId,m));for await(let v of m)if(yield v,s)if(a===void 0)a=v;else try{a=yl(a,v)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:Ju(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:Ju(o,"input")})}getGraph(e){let r=new Gq,n=r.addNode({name:`${this.getName()}Input`,schema:Pr.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:Pr.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new Wo({first:this,last:ZS(e)})}pick(e){return this.pipe(new z5(e))}assign(e){return this.pipe(new TD(new ZO({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=yl(n,o);yield*this._streamIterator(n,Wr(r))}async*streamLog(e,r,n){let o=new Hq({...n,autoClose:!1,_schemaFormat:"original"}),i=Wr(r);yield*this._streamLog(e,o,i)}async*_streamLog(e,r,n){let{callbacks:o}=n;if(o===void 0)n.callbacks=[r];else if(Array.isArray(o))n.callbacks=o.concat([r]);else{let u=o.copy();u.addHandler(r,!0),n.callbacks=u}let i=this.stream(e,n);async function a(){try{let u=await i;for await(let l of u){let c=new tg({ops:[{op:"add",path:"/streamed_output/-",value:l}]});await r.writer.write(c)}}finally{await r.writer.close()}}let s=a();try{for await(let u of r)yield u}finally{await s}}streamEvents(e,r,n){let o;if(r.version==="v1")o=this._streamEventsV1(e,r,n);else if(r.version==="v2")o=this._streamEventsV2(e,r,n);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return r.encoding==="text/event-stream"?lBe(o):Jc.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new P5({...n,autoClose:!1}),i=Wr(r),a=i.runId??Ra();i.runId=a;let s=i.callbacks;if(s===void 0)i.callbacks=[o];else if(Array.isArray(s))i.callbacks=s.concat(o);else{let m=s.copy();m.addHandler(o,!0),i.callbacks=m}let u=new AbortController,l=this;async function c(){try{let m;r?.signal?"any"in AbortSignal?m=AbortSignal.any([u.signal,r.signal]):(m=r.signal,r.signal.addEventListener("abort",()=>{u.abort()},{once:!0})):m=u.signal;let h=await l.stream(e,{...i,signal:m}),v=o.tapOutputIterable(a,h);for await(let g of v)if(u.signal.aborted)break}finally{await o.finish()}}let d=c(),f=!1,p;try{for await(let m of o){if(!f){m.data.input=e,f=!0,p=m.run_id,yield m;continue}m.run_id===p&&m.event.endsWith("_end")&&m.data?.input&&delete m.data.input,yield m}}finally{u.abort(),await d}}async*_streamEventsV1(e,r,n){let o,i=!1,a=Wr(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new Hq({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new A5({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=zq.fromRunLogPatch(m),o.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;let _={...o.state},w={run_id:_.id,event:`on_${_.type}_start`,name:l,tags:s,metadata:u,data:{input:e}};d.includeEvent(w,_.type)&&(yield w)}let h=m.ops.filter(_=>_.path.startsWith("/logs/")).map(_=>_.path.split("/")[2]),v=[...new Set(h)];for(let _ of v){let w,x={},C=o.state.logs[_];if(C.end_time===void 0?C.streamed_output.length>0?w="stream":w="start":w="end",w==="start")C.inputs!==void 0&&(x.input=C.inputs);else if(w==="end")C.inputs!==void 0&&(x.input=C.inputs),x.output=C.final_output;else if(w==="stream"){let P=C.streamed_output.length;if(P!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${P} instead. Encountered in: "${C.name}"`);x={chunk:C.streamed_output[0]},C.streamed_output=[]}yield{event:`on_${C.type}_${w}`,name:C.name,run_id:C.id,tags:C.tags,metadata:C.metadata,data:x}}let{state:g}=o;if(g.streamed_output.length>0){let _=g.streamed_output.length;if(_!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${_} instead. Encountered in: "${g.name}"`);let w={chunk:g.streamed_output[0]};g.streamed_output=[];let x={event:`on_${g.type}_stream`,run_id:g.id,tags:s,metadata:u,name:l,data:w};d.includeEvent(x,g.type)&&(yield x)}}let p=o?.state;if(p!==void 0){let m={event:`on_${p.type}_end`,name:l,run_id:p.id,tags:s,metadata:u,data:{output:p.final_output}};d.includeEvent(m,p.type)&&(yield m)}}static isRunnable(e){return Kq(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new XS({bound:this,config:{},configFactories:[o=>({callbacks:[new Wq({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return sJt(this,e)}},XS=class t extends ln{static lc_name(){return"RunnableBinding"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"bound",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"kwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"configFactories",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){let r=O5(this.config,...e);return O5(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}bind(e){return new this.constructor({bound:this.bound,kwargs:{...this.kwargs,...e},config:this.config})}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new this.constructor({bound:this.bound.withRetry(e),kwargs:this.kwargs,config:this.config})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(Wr(r),this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(Wr(i),this.kwargs))):await this._mergeConfig(Wr(r),this.kwargs);return this.bound.batch(e,o,n)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(Wr(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(Wr(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(Wr(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(Wr(r),o.kwargs),version:r.version},n)};return Jc.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&ln.isRunnable(e.bound)}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[o=>({callbacks:[new Wq({config:o,onStart:e,onEnd:r,onError:n})]})]})}},$5=class t extends ln{static lc_name(){return"RunnableEach"}constructor(e){super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"bound",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.bound=e.bound}bind(e){return new t({bound:this.bound.bind(e)})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _invoke(e,r,n){return this.bound.batch(e,Da(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},q5=class extends XS{static lc_name(){return"RunnableRetry"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"maxAttemptNumber",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"onFailedAttempt",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(e,r,n){let o=e>1?`retry:attempt:${e}`:void 0;return Da(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,Jle.default)(o=>super.invoke(e,this._patchConfigForRetry(o,r,n)),{onFailedAttempt:o=>this.onFailedAttempt(o,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _batch(e,r,n,o){let i={};try{await(0,Jle.default)(async a=>{let s=e.map((f,p)=>p).filter(f=>i[f.toString()]===void 0||i[f.toString()]instanceof Error),u=s.map(f=>e[f]),l=s.map(f=>this._patchConfigForRetry(a,r?.[f],n?.[f])),c=await super.batch(u,l,{...o,returnExceptions:!0}),d;for(let f=0;f<c.length;f+=1){let p=c[f],m=s[f];p instanceof Error&&d===void 0&&(d=p,d.input=u[f]),i[m.toString()]=p}if(d)throw d;return c},{onFailedAttempt:a=>this.onFailedAttempt(a,a.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(o?.returnExceptions!==!0)throw a}return Object.keys(i).sort((a,s)=>parseInt(a,10)-parseInt(s,10)).map(a=>i[parseInt(a,10)])}async batch(e,r,n){return this._batchWithConfig(this._batch.bind(this),e,r,n)}},Wo=class t extends ln{static lc_name(){return"RunnableSequence"}constructor(e){super(e),Object.defineProperty(this,"first",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"middle",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"last",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"omitSequenceTags",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,r){let n=Wr(r),i=await(await wf(n))?.handleChainStart(this.toJSON(),Ju(e,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a=e,s;try{let u=[this.first,...this.middle];for(let l=0;l<u.length;l+=1){let d=u[l].invoke(a,Da(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`)}));a=await Ey(d,r?.signal)}if(r?.signal?.aborted)throw new Error("Aborted");s=await this.last.invoke(a,Da(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(u){throw await i?.handleChainError(u),u}return await i?.handleChainEnd(Ju(s,"output")),s}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(wf)),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),Ju(e[l],"input"),o[l].runId,void 0,void 0,void 0,o[l].runName);return delete o[l].runId,c})),s=e;try{for(let u=0;u<this.steps.length;u+=1){let c=this.steps[u].batch(s,a.map((d,f)=>{let p=d?.getChild(this.omitSequenceTags?void 0:`seq:step:${u+1}`);return Da(o[f],{callbacks:p})}),n);s=await Ey(c,o[0]?.signal)}}catch(u){throw await Promise.all(a.map(l=>l?.handleChainError(u))),u}return await Promise.all(a.map(u=>u?.handleChainEnd(Ju(s,"output")))),s}async*_streamIterator(e,r){let n=await wf(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),Ju(e,"input"),o,void 0,void 0,void 0,i?.runName),s=[this.first,...this.middle,this.last],u=!0,l;async function*c(){yield e}try{let d=s[0].transform(c(),Da(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f<s.length;f+=1)d=await s[f].transform(d,Da(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${f+1}`)}));for await(let f of d)if(r?.signal?.throwIfAborted(),yield f,u)if(l===void 0)l=f;else try{l=yl(l,f)}catch{l=void 0,u=!1}}catch(d){throw await a?.handleChainError(d),d}await a?.handleChainEnd(Ju(l,"output"))}getGraph(e){let r=new Gq,n=null;return this.steps.forEach((o,i)=>{let a=o.getGraph(e);i!==0&&a.trimFirstNode(),i!==this.steps.length-1&&a.trimLastNode(),r.extend(a);let s=a.firstNode();if(!s)throw new Error(`Runnable ${o} has no first node`);n&&r.addEdge(n,s),n=a.lastNode()}),r}pipe(e){return t.isRunnableSequence(e)?new t({first:this.first,middle:this.middle.concat([this.last,e.first,...e.middle]),last:e.last,name:this.name??e.name}):new t({first:this.first,middle:[...this.middle,this.last],last:ZS(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&ln.isRunnable(e)}static from([e,...r],n){let o={};return typeof n=="string"?o.name=n:n!==void 0&&(o=n),new t({...o,first:ZS(e),middle:r.slice(0,-1).map(ZS),last:ZS(r[r.length-1])})}},ZO=class t extends ln{static lc_name(){return"RunnableMap"}getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"steps",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.steps={};for(let[r,n]of Object.entries(e.steps))this.steps[r]=ZS(n)}static from(e){return new t({steps:e})}async invoke(e,r){let n=Wr(r),i=await(await wf(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a={};try{let s=Object.entries(this.steps).map(async([u,l])=>{a[u]=await l.invoke(e,Da(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await Ey(Promise.all(s),r?.signal)}catch(s){throw await i?.handleChainError(s),s}return await i?.handleChainEnd(a),a}async*_transform(e,r,n){let o={...this.steps},i=dle(e,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],Da(n,{callbacks:r?.getChild(`map:key:${s}`)}));return[s,c.next().then(d=>({key:s,gen:c,result:d}))]}));for(;a.size;){let s=Promise.race(a.values()),{key:u,result:l,gen:c}=await Ey(s,n?.signal);a.delete(u),l.done||(yield{[u]:l.value},a.set(u,c.next().then(d=>({key:u,gen:c,result:d}))))}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Wr(r),i=new YS({generator:this.transform(n(),o),config:o});return await i.setup,Jc.fromAsyncGenerator(i)}},Gle=class t extends ln{constructor(e){if(super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!s5(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,r){let[n]=this._getOptionsList(r??{},1),o=await wf(n),i=this.func(Da(n,{callbacks:o}),e);return Ey(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(k5(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(dBe(o)){for(;;){n?.signal?.throwIfAborted();let i=o.next();if(i.done)break;yield i.value}return}yield o}static from(e){return new t({func:e})}};kd=class t extends ln{static lc_name(){return"RunnableLambda"}constructor(e){if(s5(e.func))return Gle.from(e.func);super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),aJt(e.func),this.func=e.func}static from(e){return new t({func:e})}async _invoke(e,r,n){return new Promise((o,i)=>{let a=Da(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??C5)-1});Kc.runWithConfig(vp(a),async()=>{try{let s=await this.func(e,{...a});if(s&&ln.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(e,{...a,recursionLimit:(a.recursionLimit??C5)-1})}else if(k5(s)){let u;for await(let l of B5(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=yl(u,l)}catch{u=l}s=u}else if(Wle(s)){let u;for(let l of Kle(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=yl(u,l)}catch{u=l}s=u}o(s)}catch(s){i(s)}})})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async*_transform(e,r,n){let o;for await(let s of e)if(o===void 0)o=s;else try{o=yl(o,s)}catch{o=s}let i=Da(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??C5)-1}),a=await new Promise((s,u)=>{Kc.runWithConfig(vp(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&ln.isRunnable(a)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");let s=await a.stream(o,i);for await(let u of s)yield u}else if(k5(a))for await(let s of B5(i,a))n?.signal?.throwIfAborted(),yield s;else if(Wle(a))for(let s of Kle(i,a))n?.signal?.throwIfAborted(),yield s;else yield a}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Wr(r),i=new YS({generator:this.transform(n(),o),config:o});return await i.setup,Jc.fromAsyncGenerator(i)}},U5=class extends ln{static lc_name(){return"RunnableWithFallbacks"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"runnable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fallbacks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.runnable=e.runnable,this.fallbacks=e.fallbacks}*runnables(){yield this.runnable;for(let e of this.fallbacks)yield e}async invoke(e,r){let n=Wr(r),o=await wf(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),Ju(e,"input"),i,void 0,void 0,void 0,a?.runName),u=Da(a,{callbacks:s?.getChild()});return await Kc.runWithConfig(u,async()=>{let c;for(let d of this.runnables()){n?.signal?.throwIfAborted();try{let f=await d.invoke(e,u);return await s?.handleChainEnd(Ju(f,"output")),f}catch(f){c===void 0&&(c=f)}}throw c===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(c),c)})}async*_streamIterator(e,r){let n=Wr(r),o=await wf(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),Ju(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=Da(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=B5(f,p);break}catch(p){u===void 0&&(u=p)}}if(l===void 0){let d=u??new Error("No error stored at end of fallback.");throw await s?.handleChainError(d),d}let c;try{for await(let d of l){yield d;try{c=c===void 0?c:yl(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(Ju(c,"output"))}async batch(e,r,n){if(n?.returnExceptions)throw new Error("Not implemented.");let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(u=>wf(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),Ju(e[l],"input"),o[l].runId,void 0,void 0,void 0,o[l].runName);return delete o[l].runId,c})),s;for(let u of this.runnables()){o[0].signal?.throwIfAborted();try{let l=await u.batch(e,a.map((c,d)=>Da(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(Ju(l[d],"output")))),l}catch(l){s===void 0&&(s=l)}}throw s?(await Promise.all(a.map(u=>u?.handleChainError(s))),s):new Error("No error stored at end of fallbacks.")}};TD=class extends ln{static lc_name(){return"RunnableAssign"}constructor(e){e instanceof ZO&&(e={mapper:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"mapper",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.mapper=e.mapper}async invoke(e,r){let n=await this.mapper.invoke(e,r);return{...e,...n}}async*_transform(e,r,n){let o=this.mapper.getStepsKeys(),[i,a]=dle(e),s=this.mapper.transform(a,Da(n,{callbacks:r?.getChild()})),u=s.next();for await(let l of i){if(typeof l!="object"||Array.isArray(l))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof l}`);let c=Object.fromEntries(Object.entries(l).filter(([d])=>!o.includes(d)));Object.keys(c).length>0&&(yield c)}yield(await u).value;for await(let l of s)yield l}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Wr(r),i=new YS({generator:this.transform(n(),o),config:o});return await i.setup,Jc.fromAsyncGenerator(i)}},z5=class extends ln{static lc_name(){return"RunnablePick"}constructor(e){(typeof e=="string"||Array.isArray(e))&&(e={keys:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"keys",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keys=e.keys}async _pick(e){if(typeof this.keys=="string")return e[this.keys];{let r=this.keys.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0);return r.length===0?void 0:Object.fromEntries(r)}}async invoke(e,r){return this._callWithConfig(this._pick.bind(this),e,r)}async*_transform(e){for await(let r of e){let n=await this._pick(r);n!==void 0&&(yield n)}}transform(e,r){return this._transformStreamWithConfig(e,this._transform.bind(this),r)}async stream(e,r){async function*n(){yield e}let o=Wr(r),i=new YS({generator:this.transform(n(),o),config:o});return await i.setup,Jc.fromAsyncGenerator(i)}},Yq=class extends XS{constructor(e){let r=Wo.from([kd.from(async n=>{let o;if(vD(n))try{o=await this.schema.parseAsync(n.args)}catch{throw new PI("Received tool input did not match expected schema",JSON.stringify(n.args))}else o=n;return o}).withConfig({runName:`${e.name}:parse_input`}),e.bound]).withConfig({runName:e.name});super({bound:r,config:e.config??{}}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}}});var Kn,H5=O(()=>{Py();xf();Oy();Kn=class extends ln{static lc_name(){return"RunnablePassthrough"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","runnables"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e&&(this.func=e.func)}async invoke(e,r){let n=Wr(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=Wr(r),o,i=!0;for await(let a of this._transformStreamWithConfig(e,s=>s,n))if(yield a,i)if(o===void 0)o=a;else try{o=yl(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new TD(new ZO({steps:e}))}}});var pBe=O(()=>{xf();Oy()});var mBe=O(()=>{xf();Oy();Py()});var Yle=O(()=>{Em()});var hBe=O(()=>{xf();TI();Em();b5();_5();Bq();Yle();v5();SD();KO()});var MI=O(()=>{TI();Em();b5();_5();Bq();v5();KO();hBe();Yle();SD()});var gBe=O(()=>{MI();xf();H5()});var Zle=O(()=>{xf();Oy();H5();pBe();mBe();gBe()});var RI,jI,Sp,AD=O(()=>{Zle();Fq();RI=class extends ln{parseResultWithPrompt(e,r,n){return this.parseResult(e,n)}_baseMessageToString(e){return typeof e.content=="string"?e.content:this._baseMessageContentToString(e.content)}_baseMessageContentToString(e){return JSON.stringify(e)}async invoke(e,r){return typeof e=="string"?this._callWithConfig(async(n,o)=>this.parseResult([{text:n}],o?.callbacks),e,{...r,runType:"parser"}):this._callWithConfig(async(n,o)=>this.parseResult([{message:n,text:this._baseMessageToString(n)}],o?.callbacks),e,{...r,runType:"parser"})}},jI=class extends RI{parseResult(e,r){return this.parse(e[0].text,r)}async parseWithPrompt(e,r,n){return this.parse(e,n)}_type(){throw new Error("_type not implemented")}},Sp=class extends Error{constructor(e,r,n,o=!1){if(super(e),Object.defineProperty(this,"llmOutput",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"observation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendToLLM",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.llmOutput=r,this.observation=n,this.sendToLLM=o,o&&(n===void 0||r===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");WO(this,"OUTPUT_PARSING_FAILURE")}}});function QS(t,e){let r=typeof t;if(r!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let n=t.length;if(n!==e.length)return!1;for(let o=0;o<n;o++)if(!QS(t[o],e[o]))return!1;return!0}if(r==="object"){if(!t||!e)return t===e;let n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(let a of n)if(!QS(t[a],e[a]))return!1;return!0}return t===e}var Xle=O(()=>{});function xp(t){return encodeURI(uJt(t))}function uJt(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var V5=O(()=>{});function ex(t,e=Object.create(null),r=fJt,n=""){if(t&&typeof t=="object"&&!Array.isArray(t)){let i=t.$id||t.id;if(i){let a=new URL(i,r.href);a.hash.length>1?e[a.href]=t:(a.hash="",n===""?r=a:ex(t,e,r))}}else if(t!==!0&&t!==!1)return e;let o=r.href+(n?"#"+n:"");if(e[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(e[o]=t,t===!0||t===!1)return e;if(t.__absolute_uri__===void 0&&Object.defineProperty(t,"__absolute_uri__",{enumerable:!1,value:o}),t.$ref&&t.__absolute_ref__===void 0){let i=new URL(t.$ref,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_ref__",{enumerable:!1,value:i.href})}if(t.$recursiveRef&&t.__absolute_recursive_ref__===void 0){let i=new URL(t.$recursiveRef,r.href);i.hash=i.hash,Object.defineProperty(t,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(t.$anchor){let i=new URL("#"+t.$anchor,r.href);e[i.href]=t}for(let i in t){if(dJt[i])continue;let a=`${n}/${xp(i)}`,s=t[i];if(Array.isArray(s)){if(lJt[i]){let u=s.length;for(let l=0;l<u;l++)ex(s[l],e,r,`${a}/${l}`)}}else if(cJt[i])for(let u in s)ex(s[u],e,r,`${a}/${xp(u)}`);else ex(s,e,r,a)}return e}var lJt,cJt,dJt,fJt,W5=O(()=>{V5();lJt={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},cJt={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},dJt={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},fJt=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker")});function Cf(t){return t.test.bind(t)}function jJt(t){return t%4===0&&(t%100!==0||t%400===0)}function yBe(t){let e=t.match(pJt);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&jJt(r)?29:mJt[n])}function bBe(t,e){let r=e.match(hJt);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3],a=!!r[5];return(n<=23&&o<=59&&i<=59||n==23&&o==59&&i==60)&&(!t||a)}function NJt(t){let e=t.split(DJt);return e.length==2&&yBe(e[0])&&bBe(!0,e[1])}function kJt(t){return LJt.test(t)&&FJt.test(t)}function $Jt(t){if(BJt.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var pJt,mJt,hJt,gJt,yJt,bJt,_Jt,vJt,wJt,SJt,xJt,CJt,OJt,EJt,PJt,TJt,AJt,IJt,MJt,RJt,Qle,DJt,LJt,FJt,BJt,ece=O(()=>{pJt=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,mJt=[0,31,28,31,30,31,30,31,31,30,31,30,31],hJt=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,gJt=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,yJt=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,bJt=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,_Jt=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,vJt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,wJt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,SJt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,xJt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,CJt=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,OJt=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,EJt=/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,PJt=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,TJt=t=>{if(t[0]==='"')return!1;let[e,r,...n]=t.split("@");return!e||!r||n.length!==0||e.length>64||r.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:r.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},AJt=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,IJt=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,MJt=t=>t.length>1&&t.length<80&&(/^P\d+([.,]\d+)?W$/.test(t)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(t)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(t));RJt={date:yBe,time:bBe.bind(void 0,!1),"date-time":NJt,duration:MJt,uri:kJt,"uri-reference":Cf(yJt),"uri-template":Cf(bJt),url:Cf(_Jt),email:TJt,hostname:Cf(gJt),ipv4:Cf(AJt),ipv6:Cf(IJt),regex:$Jt,uuid:Cf(vJt),"json-pointer":Cf(wJt),"json-pointer-uri-fragment":Cf(SJt),"relative-json-pointer":Cf(xJt)},Qle={...RJt,date:Cf(CJt),time:Cf(OJt),"date-time":Cf(EJt),"uri-reference":Cf(PJt)};DJt=/t|\s/i;LJt=/\/|:/,FJt=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;BJt=/[^\\]\\Z/});var _Be,vBe=O(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(_Be||(_Be={}))});function wBe(t){let e=0,r=t.length,n=0,o;for(;n<r;)e++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<r&&(o=t.charCodeAt(n),(o&64512)==56320&&n++);return e}var tce=O(()=>{});function Ei(t,e,r="2019-09",n=ex(e),o=!0,i=null,a="#",s="#",u=Object.create(null)){if(e===!0)return{valid:!0,errors:[]};if(e===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,error:"False boolean schema."}]};let l=typeof t,c;switch(l){case"boolean":case"number":case"string":c=l;break;case"object":t===null?c="null":Array.isArray(t)?c="array":c="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:v,required:g,not:_,anyOf:w,allOf:x,oneOf:C,if:P,then:E,else:A,format:M,properties:R,patternProperties:N,additionalProperties:L,unevaluatedProperties:k,minProperties:F,maxProperties:$,propertyNames:U,dependentRequired:J,dependentSchemas:V,dependencies:j,prefixItems:z,items:W,additionalItems:K,unevaluatedItems:re,contains:De,minContains:Y,maxContains:Q,minItems:oe,maxItems:Te,uniqueItems:bt,minimum:xe,maximum:Z,exclusiveMinimum:te,exclusiveMaximum:Ee,multipleOf:Le,minLength:Ze,maxLength:Ot,pattern:Yt,__absolute_ref__:Wn,__absolute_recursive_ref__:nr}=e,ve=[];if(p===!0&&i===null&&(i=e),f==="#"){let lt=i===null?n[nr]:i,qe=`${s}/$recursiveRef`,ie=Ei(t,i===null?e:i,r,n,o,lt,a,qe,u);ie.valid||ve.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:qe,error:"A subschema had errors."},...ie.errors)}if(d!==void 0){let qe=n[Wn||d];if(qe===void 0){let _e=`Unresolved $ref "${d}".`;throw Wn&&Wn!==d&&(_e+=` Absolute URI "${Wn}".`),_e+=`
Known schemas:
- ${Object.keys(n).join(`
- `)}`,new Error(_e)}let ie=`${s}/$ref`,ce=Ei(t,qe,r,n,o,i,a,ie,u);if(ce.valid||ve.push({instanceLocation:a,keyword:"$ref",keywordLocation:ie,error:"A subschema had errors."},...ce.errors),r==="4"||r==="7")return{valid:ve.length===0,errors:ve}}if(Array.isArray(m)){let lt=m.length,qe=!1;for(let ie=0;ie<lt;ie++)if(c===m[ie]||m[ie]==="integer"&&c==="number"&&t%1===0&&t===t){qe=!0;break}qe||ve.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m.join('", "')}".`})}else m==="integer"?(c!=="number"||t%1||t!==t)&&ve.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`}):m!==void 0&&c!==m&&ve.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`});if(h!==void 0&&(c==="object"||c==="array"?QS(t,h)||ve.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):t!==h&&ve.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),v!==void 0&&(c==="object"||c==="array"?v.some(lt=>QS(t,lt))||ve.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`}):v.some(lt=>t===lt)||ve.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})),_!==void 0){let lt=`${s}/not`;Ei(t,_,r,n,o,i,a,lt).valid&&ve.push({instanceLocation:a,keyword:"not",keywordLocation:lt,error:'Instance matched "not" schema.'})}let vn=[];if(w!==void 0){let lt=`${s}/anyOf`,qe=ve.length,ie=!1;for(let ce=0;ce<w.length;ce++){let _e=w[ce],be=Object.create(u),Ue=Ei(t,_e,r,n,o,p===!0?i:null,a,`${lt}/${ce}`,be);ve.push(...Ue.errors),ie=ie||Ue.valid,Ue.valid&&vn.push(be)}ie?ve.length=qe:ve.splice(qe,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:lt,error:"Instance does not match any subschemas."})}if(x!==void 0){let lt=`${s}/allOf`,qe=ve.length,ie=!0;for(let ce=0;ce<x.length;ce++){let _e=x[ce],be=Object.create(u),Ue=Ei(t,_e,r,n,o,p===!0?i:null,a,`${lt}/${ce}`,be);ve.push(...Ue.errors),ie=ie&&Ue.valid,Ue.valid&&vn.push(be)}ie?ve.length=qe:ve.splice(qe,0,{instanceLocation:a,keyword:"allOf",keywordLocation:lt,error:"Instance does not match every subschema."})}if(C!==void 0){let lt=`${s}/oneOf`,qe=ve.length,ie=C.filter((ce,_e)=>{let be=Object.create(u),Ue=Ei(t,ce,r,n,o,p===!0?i:null,a,`${lt}/${_e}`,be);return ve.push(...Ue.errors),Ue.valid&&vn.push(be),Ue.valid}).length;ie===1?ve.length=qe:ve.splice(qe,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:lt,error:`Instance does not match exactly one subschema (${ie} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...vn),P!==void 0){let lt=`${s}/if`;if(Ei(t,P,r,n,o,i,a,lt,u).valid){if(E!==void 0){let ie=Ei(t,E,r,n,o,i,a,`${s}/then`,u);ie.valid||ve.push({instanceLocation:a,keyword:"if",keywordLocation:lt,error:'Instance does not match "then" schema.'},...ie.errors)}}else if(A!==void 0){let ie=Ei(t,A,r,n,o,i,a,`${s}/else`,u);ie.valid||ve.push({instanceLocation:a,keyword:"if",keywordLocation:lt,error:'Instance does not match "else" schema.'},...ie.errors)}}if(c==="object"){if(g!==void 0)for(let ce of g)ce in t||ve.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${ce}".`});let lt=Object.keys(t);if(F!==void 0&&lt.length<F&&ve.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${F} properties.`}),$!==void 0&&lt.length>$&&ve.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${$} properties.`}),U!==void 0){let ce=`${s}/propertyNames`;for(let _e in t){let be=`${a}/${xp(_e)}`,Ue=Ei(_e,U,r,n,o,i,be,ce);Ue.valid||ve.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:ce,error:`Property name "${_e}" does not match schema.`},...Ue.errors)}}if(J!==void 0){let ce=`${s}/dependantRequired`;for(let _e in J)if(_e in t){let be=J[_e];for(let Ue of be)Ue in t||ve.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:ce,error:`Instance has "${_e}" but does not have "${Ue}".`})}}if(V!==void 0)for(let ce in V){let _e=`${s}/dependentSchemas`;if(ce in t){let be=Ei(t,V[ce],r,n,o,i,a,`${_e}/${xp(ce)}`,u);be.valid||ve.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:_e,error:`Instance has "${ce}" but does not match dependant schema.`},...be.errors)}}if(j!==void 0){let ce=`${s}/dependencies`;for(let _e in j)if(_e in t){let be=j[_e];if(Array.isArray(be))for(let Ue of be)Ue in t||ve.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ce,error:`Instance has "${_e}" but does not have "${Ue}".`});else{let Ue=Ei(t,be,r,n,o,i,a,`${ce}/${xp(_e)}`);Ue.valid||ve.push({instanceLocation:a,keyword:"dependencies",keywordLocation:ce,error:`Instance has "${_e}" but does not match dependant schema.`},...Ue.errors)}}}let qe=Object.create(null),ie=!1;if(R!==void 0){let ce=`${s}/properties`;for(let _e in R){if(!(_e in t))continue;let be=`${a}/${xp(_e)}`,Ue=Ei(t[_e],R[_e],r,n,o,i,be,`${ce}/${xp(_e)}`);if(Ue.valid)u[_e]=qe[_e]=!0;else if(ie=o,ve.push({instanceLocation:a,keyword:"properties",keywordLocation:ce,error:`Property "${_e}" does not match schema.`},...Ue.errors),ie)break}}if(!ie&&N!==void 0){let ce=`${s}/patternProperties`;for(let _e in N){let be=new RegExp(_e,"u"),Ue=N[_e];for(let zr in t){if(!be.test(zr))continue;let ia=`${a}/${xp(zr)}`,Hu=Ei(t[zr],Ue,r,n,o,i,ia,`${ce}/${xp(_e)}`);Hu.valid?u[zr]=qe[zr]=!0:(ie=o,ve.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:ce,error:`Property "${zr}" matches pattern "${_e}" but does not match associated schema.`},...Hu.errors))}}}if(!ie&&L!==void 0){let ce=`${s}/additionalProperties`;for(let _e in t){if(qe[_e])continue;let be=`${a}/${xp(_e)}`,Ue=Ei(t[_e],L,r,n,o,i,be,ce);Ue.valid?u[_e]=!0:(ie=o,ve.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:ce,error:`Property "${_e}" does not match additional properties schema.`},...Ue.errors))}}else if(!ie&&k!==void 0){let ce=`${s}/unevaluatedProperties`;for(let _e in t)if(!u[_e]){let be=`${a}/${xp(_e)}`,Ue=Ei(t[_e],k,r,n,o,i,be,ce);Ue.valid?u[_e]=!0:ve.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:ce,error:`Property "${_e}" does not match unevaluated properties schema.`},...Ue.errors)}}}else if(c==="array"){Te!==void 0&&t.length>Te&&ve.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${Te}).`}),oe!==void 0&&t.length<oe&&ve.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${oe}).`});let lt=t.length,qe=0,ie=!1;if(z!==void 0){let ce=`${s}/prefixItems`,_e=Math.min(z.length,lt);for(;qe<_e;qe++){let be=Ei(t[qe],z[qe],r,n,o,i,`${a}/${qe}`,`${ce}/${qe}`);if(u[qe]=!0,!be.valid&&(ie=o,ve.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:ce,error:"Items did not match schema."},...be.errors),ie))break}}if(W!==void 0){let ce=`${s}/items`;if(Array.isArray(W)){let _e=Math.min(W.length,lt);for(;qe<_e;qe++){let be=Ei(t[qe],W[qe],r,n,o,i,`${a}/${qe}`,`${ce}/${qe}`);if(u[qe]=!0,!be.valid&&(ie=o,ve.push({instanceLocation:a,keyword:"items",keywordLocation:ce,error:"Items did not match schema."},...be.errors),ie))break}}else for(;qe<lt;qe++){let _e=Ei(t[qe],W,r,n,o,i,`${a}/${qe}`,ce);if(u[qe]=!0,!_e.valid&&(ie=o,ve.push({instanceLocation:a,keyword:"items",keywordLocation:ce,error:"Items did not match schema."},..._e.errors),ie))break}if(!ie&&K!==void 0){let _e=`${s}/additionalItems`;for(;qe<lt;qe++){let be=Ei(t[qe],K,r,n,o,i,`${a}/${qe}`,_e);u[qe]=!0,be.valid||(ie=o,ve.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:_e,error:"Items did not match additional items schema."},...be.errors))}}}if(De!==void 0)if(lt===0&&Y===void 0)ve.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Y!==void 0&&lt<Y)ve.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${lt}) than minContains (${Y}).`});else{let ce=`${s}/contains`,_e=ve.length,be=0;for(let Ue=0;Ue<lt;Ue++){let zr=Ei(t[Ue],De,r,n,o,i,`${a}/${Ue}`,ce);zr.valid?(u[Ue]=!0,be++):ve.push(...zr.errors)}be>=(Y||0)&&(ve.length=_e),Y===void 0&&Q===void 0&&be===0?ve.splice(_e,0,{instanceLocation:a,keyword:"contains",keywordLocation:ce,error:"Array does not contain item matching schema."}):Y!==void 0&&be<Y?ve.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${Y} items matching schema. Only ${be} items were found.`}):Q!==void 0&&be>Q&&ve.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${Q} items matching schema. ${be} items were found.`})}if(!ie&&re!==void 0){let ce=`${s}/unevaluatedItems`;for(qe;qe<lt;qe++){if(u[qe])continue;let _e=Ei(t[qe],re,r,n,o,i,`${a}/${qe}`,ce);u[qe]=!0,_e.valid||ve.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:ce,error:"Items did not match unevaluated items schema."},..._e.errors)}}if(bt)for(let ce=0;ce<lt;ce++){let _e=t[ce],be=typeof _e=="object"&&_e!==null;for(let Ue=0;Ue<lt;Ue++){if(ce===Ue)continue;let zr=t[Ue];(_e===zr||be&&(typeof zr=="object"&&zr!==null)&&QS(_e,zr))&&(ve.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${ce} and ${Ue}.`}),ce=Number.MAX_SAFE_INTEGER,Ue=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(xe!==void 0&&(te===!0&&t<=xe||t<xe)&&ve.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${te?"or equal to ":""} ${xe}.`}),Z!==void 0&&(Ee===!0&&t>=Z||t>Z)&&ve.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Ee?"or equal to ":""} ${Z}.`})):(xe!==void 0&&t<xe&&ve.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${xe}.`}),Z!==void 0&&t>Z&&ve.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Z}.`}),te!==void 0&&t<=te&&ve.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${te}.`}),Ee!==void 0&&t>=Ee&&ve.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Ee}.`})),Le!==void 0){let lt=t%Le;Math.abs(0-lt)>=11920929e-14&&Math.abs(Le-lt)>=11920929e-14&&ve.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${Le}.`})}}else if(c==="string"){let lt=Ze===void 0&&Ot===void 0?0:wBe(t);Ze!==void 0&&lt<Ze&&ve.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${lt} < ${Ze}).`}),Ot!==void 0&&lt>Ot&&ve.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${lt} > ${Ot}).`}),Yt!==void 0&&!new RegExp(Yt,"u").test(t)&&ve.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),M!==void 0&&Qle[M]&&!Qle[M](t)&&ve.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${M}".`})}return{valid:ve.length===0,errors:ve}}var rce=O(()=>{Xle();W5();ece();V5();tce()});var SBe=O(()=>{W5();rce()});var Zq=O(()=>{Xle();W5();ece();V5();vBe();tce();rce();SBe()});var DI,NI,XO=O(()=>{Zq();AD();Em();KO();ED();DI=class extends jI{async*_transform(e){for await(let r of e)typeof r=="string"?yield this.parseResult([{text:r}]):yield this.parseResult([{message:r,text:this._baseMessageToString(r)}])}async*transform(e,r){yield*this._transformStreamWithConfig(e,this._transform.bind(this),{...r,runType:"parser"})}},NI=class extends DI{constructor(e){super(e),Object.defineProperty(this,"diff",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.diff=e?.diff??this.diff}async*_transform(e){let r,n;for await(let o of e){if(typeof o!="string"&&typeof o.content!="string")throw new Error("Cannot handle non-string output.");let i;if(Zue(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Sn({message:o,text:o.content})}else if(Om(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Sn({message:ele(o),text:o.content})}else i=new Sf({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!QS(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var xBe=O(()=>{XO()});var CBe=O(()=>{AD();XO()});var K5,OBe=O(()=>{XO();K5=class extends DI{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","output_parsers","string"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}static lc_name(){return"StrOutputParser"}parse(e){return Promise.resolve(e)}getFormatInstructions(){return""}_textContentToString(e){return e.text}_imageUrlContentToString(e){throw new Error('Cannot coerce a multimodal "image_url" message part into a string.')}_messageContentComplexToString(e){switch(e.type){case"text":case"text_delta":if("text"in e)return this._textContentToString(e);break;case"image_url":if("image_url"in e)return this._imageUrlContentToString(e);break;default:throw new Error(`Cannot coerce "${e.type}" message part into a string.`)}throw new Error(`Invalid content type: ${e.type}`)}_baseMessageContentToString(e){return e.reduce((r,n)=>r+this._messageContentComplexToString(n),"")}}});var Yl,EBe=O(()=>{Uc();Gl();AD();Yl=class extends jI{static lc_name(){return"StructuredOutputParser"}toJSON(){return this.toJSONNotImplemented()}constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","structured"]})}static fromZodSchema(e){return new this(e)}static fromNamesAndDescriptions(e){let r=Pr.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Pr.string().describe(o)])));return new this(r)}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance.
"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents.
For example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}}
would match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings.
Thus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted.
Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas!
Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:
\`\`\`json
${JSON.stringify(Xn(this.schema))}
\`\`\`
`}async parse(e){try{let n=(e.includes("```")?e.trim().split(/```(?:json)?/)[1]:e.trim()).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await this.schema.parseAsync(JSON.parse(n))}catch(r){throw new Sp(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var nce=O(()=>{$ue()});var Zl,oce=O(()=>{XO();nce();Yue();Zl=class extends NI{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","output_parsers"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}static lc_name(){return"JsonOutputParser"}_diff(e,r){if(r)return e?h5(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return Gue(e[0].text)}async parse(e){return Gue(e,JSON.parse)}getFormatInstructions(){return""}}});var PBe=O(()=>{});var TBe=O(()=>{XO();nce();PBe()});var ABe=O(()=>{AD();xBe();CBe();OBe();EBe();XO();oce();TBe()});var og=O(()=>{ABe()});var Xq,ID,MD,J5,Qq=O(()=>{xI();Bq();KO();Xq=class extends bf{},ID=class extends Xq{static lc_name(){return"StringPromptValue"}constructor(e){super({value:e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompt_values"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.value=e}toString(){return this.value}toChatMessages(){return[new Ga(this.value)]}},MD=class extends Xq{static lc_name(){return"ChatPromptValue"}constructor(e){Array.isArray(e)&&(e={messages:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompt_values"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"messages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.messages=e.messages}toString(){return Ld(this.messages)}toChatMessages(){return this.messages}},J5=class extends Xq{static lc_name(){return"ImagePromptValue"}constructor(e){"imageUrl"in e||(e={imageUrl:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompt_values"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"imageUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.imageUrl=e.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new Ga({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var tx,eU=O(()=>{Qq();RD();tx=class extends Ty{async formatPromptValue(e){let r=await this.format(e);return new ID(r)}}});function ace(t){return typeof t=="function"}function UJt(t){return DD(t)?"array":typeof t}function ice(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function IBe(t,e){return t!=null&&typeof t=="object"&&e in t}function zJt(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function VJt(t,e){return HJt.call(t,e)}function KJt(t){return!VJt(WJt,t)}function GJt(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return JJt[r]})}function eGt(t,e){if(!t)return[];var r=!1,n=[],o=[],i=[],a=!1,s=!1,u="",l=0;function c(){if(a&&!s)for(;i.length;)delete o[i.pop()];else i=[];a=!1,s=!1}var d,f,p;function m(A){if(typeof A=="string"&&(A=A.split(ZJt,2)),!DD(A)||A.length!==2)throw new Error("Invalid tags: "+A);d=new RegExp(ice(A[0])+"\\s*"),f=new RegExp("\\s*"+ice(A[1])),p=new RegExp("\\s*"+ice("}"+A[1]))}m(e||Tm.tags);for(var h=new rU(t),v,g,_,w,x,C;!h.eos();){if(v=h.pos,_=h.scanUntil(d),_)for(var P=0,E=_.length;P<E;++P)w=_.charAt(P),KJt(w)?(i.push(o.length),u+=w):(s=!0,r=!0,u+=" "),o.push(["text",w,v,v+1]),v+=1,w===`
`&&(c(),u="",l=0,r=!1);if(!h.scan(d))break;if(a=!0,g=h.scan(QJt)||"name",h.scan(YJt),g==="="?(_=h.scanUntil(MBe),h.scan(MBe),h.scanUntil(f)):g==="{"?(_=h.scanUntil(p),h.scan(XJt),h.scanUntil(f),g="&"):_=h.scanUntil(f),!h.scan(f))throw new Error("Unclosed tag at "+h.pos);if(g==">"?x=[g,_,v,h.pos,u,l,r]:x=[g,_,v,h.pos],l++,o.push(x),g==="#"||g==="^")n.push(x);else if(g==="/"){if(C=n.pop(),!C)throw new Error('Unopened section "'+_+'" at '+v);if(C[1]!==_)throw new Error('Unclosed section "'+C[1]+'" at '+v)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&m(_)}if(c(),C=n.pop(),C)throw new Error('Unclosed section "'+C[1]+'" at '+h.pos);return rGt(tGt(o))}function tGt(t){for(var e=[],r,n,o=0,i=t.length;o<i;++o)r=t[o],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(e.push(r),n=r));return e}function rGt(t){for(var e=[],r=e,n=[],o,i,a=0,s=t.length;a<s;++a)switch(o=t[a],o[0]){case"#":case"^":r.push(o),n.push(o),r=o[4]=[];break;case"/":i=n.pop(),i[5]=o[2],r=n.length>0?n[n.length-1][4]:e;break;default:r.push(o)}return e}function rU(t){this.string=t,this.tail=t,this.pos=0}function jD(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Bd(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var qJt,DD,HJt,WJt,JJt,YJt,ZJt,MBe,XJt,QJt,Tm,tU,G5,RBe=O(()=>{qJt=Object.prototype.toString,DD=Array.isArray||function(e){return qJt.call(e)==="[object Array]"};HJt=RegExp.prototype.test;WJt=/\S/;JJt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};YJt=/\s*/,ZJt=/\s+/,MBe=/\s*=/,XJt=/\s*\}/,QJt=/#|\^|\/|>|\{|&|=|!/;rU.prototype.eos=function(){return this.tail===""};rU.prototype.scan=function(e){var r=this.tail.match(e);if(!r||r.index!==0)return"";var n=r[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};rU.prototype.scanUntil=function(e){var r=this.tail.search(e),n;switch(r){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=n.length,n};jD.prototype.push=function(e){return new jD(e,this)};jD.prototype.lookup=function(e){var r=this.cache,n;if(r.hasOwnProperty(e))n=r[e];else{for(var o=this,i,a,s,u=!1;o;){if(e.indexOf(".")>0)for(i=o.view,a=e.split("."),s=0;i!=null&&s<a.length;)s===a.length-1&&(u=IBe(i,a[s])||zJt(i,a[s])),i=i[a[s++]];else i=o.view[e],u=IBe(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return ace(n)&&(n=n.call(this.view)),n};Bd.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Bd.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||Tm.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=eGt(e,r),i&&n.set(o,a)),a};Bd.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof jD?r:new jD(r,void 0);return this.renderTokens(a,s,n,e,o)};Bd.prototype.renderTokens=function(e,r,n,o,i){for(var a="",s,u,l,c=0,d=e.length;c<d;++c)l=void 0,s=e[c],u=s[0],u==="#"?l=this.renderSection(s,r,n,o,i):u==="^"?l=this.renderInverted(s,r,n,o,i):u===">"?l=this.renderPartial(s,r,n,i):u==="&"?l=this.unescapedValue(s,r):u==="name"?l=this.escapedValue(s,r,i):u==="text"&&(l=this.rawValue(s)),l!==void 0&&(a+=l);return a};Bd.prototype.renderSection=function(e,r,n,o,i){var a=this,s="",u=r.lookup(e[1]);function l(f){return a.render(f,r,n,i)}if(u){if(DD(u))for(var c=0,d=u.length;c<d;++c)s+=this.renderTokens(e[4],r.push(u[c]),n,o,i);else if(typeof u=="object"||typeof u=="string"||typeof u=="number")s+=this.renderTokens(e[4],r.push(u),n,o,i);else if(ace(u)){if(typeof o!="string")throw new Error("Cannot use higher-order sections without the original template");u=u.call(r.view,o.slice(e[3],e[5]),l),u!=null&&(s+=u)}else s+=this.renderTokens(e[4],r,n,o,i);return s}};Bd.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||DD(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};Bd.prototype.indentPartial=function(e,r,n){for(var o=r.replace(/[^ \t]/g,""),i=e.split(`
`),a=0;a<i.length;a++)i[a].length&&(a>0||!n)&&(i[a]=o+i[a]);return i.join(`
`)};Bd.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=ace(n)?n(e[1]):n[e[1]];if(a!=null){var s=e[6],u=e[5],l=e[4],c=a;u==0&&l&&(c=this.indentPartial(a,l,s));var d=this.parse(c,i);return this.renderTokens(d,r,n,c,o)}}};Bd.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};Bd.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||Tm.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===Tm.escape?String(i):o(i)};Bd.prototype.rawValue=function(e){return e[1]};Bd.prototype.getConfigTags=function(e){return DD(e)?e:e&&typeof e=="object"?e.tags:void 0};Bd.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!DD(e))return e.escape};Tm={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){tU.templateCache=t},get templateCache(){return tU.templateCache}},tU=new Bd;Tm.clearCache=function(){return tU.clearCache()};Tm.parse=function(e,r){return tU.parse(e,r)};Tm.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+UJt(e)+'" was given as the first argument for mustache#render(template, view, partials)');return tU.render(e,r,n,o)};Tm.escape=GJt;Tm.Scanner=rU;Tm.Context=jD;Tm.Writer=Bd;G5=Tm});function jBe(){G5.escape=t=>t}var nU,nGt,Y5,oGt,iGt,sce,aGt,ig,DBe,LI,ND=O(()=>{RBe();Fq();nU=t=>{let e=t.split(""),r=[],n=(i,a)=>{for(let s=a;s<e.length;s+=1)if(i.includes(e[s]))return s;return-1},o=0;for(;o<e.length;)if(e[o]==="{"&&o+1<e.length&&e[o+1]==="{")r.push({type:"literal",text:"{"}),o+=2;else if(e[o]==="}"&&o+1<e.length&&e[o+1]==="}")r.push({type:"literal",text:"}"}),o+=2;else if(e[o]==="{"){let i=n("}",o);if(i<0)throw new Error("Unclosed '{' in template.");r.push({type:"variable",name:e.slice(o+1,i).join("")}),o=i+1}else{if(e[o]==="}")throw new Error("Single '}' in template.");{let i=n("{}",o),a=(i<0?e.slice(o):e.slice(o,i)).join("");r.push({type:"literal",text:a}),o=i<0?e.length:i}}return r},nGt=t=>t.map(e=>e[0]==="name"?{type:"variable",name:e[1].includes(".")?e[1].split(".")[0]:e[1]}:["#","&","^",">"].includes(e[0])?{type:"variable",name:e[1]}:{type:"literal",text:e[1]}),Y5=t=>{jBe();let e=G5.parse(t);return nGt(e)},oGt=(t,e)=>nU(t).reduce((r,n)=>{if(n.type==="variable"){if(n.name in e){let o=typeof e[n.name]=="string"?e[n.name]:JSON.stringify(e[n.name]);return r+o}throw new Error(`(f-string) Missing value for input ${n.name}`)}return r+n.text},""),iGt=(t,e)=>(jBe(),G5.render(t,e)),sce={"f-string":oGt,mustache:iGt},aGt={"f-string":nU,mustache:Y5},ig=(t,e,r)=>{try{return sce[e](t,r)}catch(n){throw WO(n,"INVALID_PROMPT_INPUT")}},DBe=(t,e)=>aGt[e](t),LI=(t,e,r)=>{if(!(e in sce)){let n=Object.keys(sce);throw new Error(`Invalid template format. Got \`${e}\`;
should be one of ${n}`)}try{let n=r.reduce((o,i)=>(o[i]="foo",o),{});Array.isArray(t)?t.forEach(o=>{if(o.type==="text")ig(o.text,e,n);else if(o.type==="image_url")if(typeof o.image_url=="string")ig(o.image_url,e,n);else{let i=o.image_url.url;ig(i,e,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):ig(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var uce={};ff(uce,{PromptTemplate:()=>$d});var $d,LD=O(()=>{eU();ND();$d=class t extends tx{static lc_name(){return"PromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"additionalContentFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e.templateFormat==="mustache"&&e.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,e),this.validateTemplate){if(this.templateFormat==="mustache")throw new Error("Mustache templates cannot be validated.");let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),LI(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(e){let r=await this.mergePartialAndUserVariables(e);return ig(this.template,this.templateFormat,r)}static fromExamples(e,r,n,o=`
`,i=""){let a=[i,...e,r].join(o);return new t({inputVariables:n,template:a})}static fromTemplate(e,r){let{templateFormat:n="f-string",...o}=r??{},i=new Set;return DBe(e,n).forEach(a=>{a.type==="variable"&&i.add(a.name)}),new t({inputVariables:[...i],templateFormat:n,template:e,...o})}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}serialize(){if(this.outputParser!==void 0)throw new Error("Cannot serialize a prompt template with an output parser");return{_type:this._getPromptType(),input_variables:this.inputVariables,template:this.template,template_format:this.templateFormat}}static async deserialize(e){if(!e.template)throw new Error("Prompt template must have a template");return new t({inputVariables:e.input_variables,template:e.template,templateFormat:e.template_format})}}});var FD,lce=O(()=>{Qq();RD();ND();FD=class t extends Ty{static lc_name(){return"ImagePromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","image"]}),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"additionalContentFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e.template,this.templateFormat=e.templateFormat??this.templateFormat,this.validateTemplate=e.validateTemplate??this.validateTemplate,this.additionalContentFields=e.additionalContentFields,this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),LI([{type:"image_url",image_url:this.template}],this.templateFormat,r)}}_getPromptType(){return"prompt"}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}async format(e){let r={};for(let[a,s]of Object.entries(this.template))typeof s=="string"?r[a]=ig(s,this.templateFormat,e):r[a]=s;let n=e.url||r.url,o=e.detail||r.detail;if(!n)throw new Error("Must provide either an image URL.");if(typeof n!="string")throw new Error("url must be a string.");let i={url:n};return o&&(i.detail=o),i}async formatPromptValue(e){let r=await this.format(e);return new J5(r)}}});function sGt(t){return typeof t.formatMessages=="function"}function uGt(t,e){if(sGt(t)||Om(t))return t;if(Array.isArray(t)&&t[0]==="placeholder"){let o=t[1];if(e?.templateFormat==="mustache"&&typeof o=="string"&&o.slice(0,2)==="{{"&&o.slice(-2)==="}}"){let i=o.slice(2,-2);return new Ay({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new Ay({variableName:i,optional:!0})}throw new Error(`Invalid placeholder template for format ${e?.templateFormat??'"f-string"'}: "${t[1]}". Expected a variable name surrounded by ${e?.templateFormat==="mustache"?"double":"single"} curly braces.`)}let r=eg(t),n;if(typeof r.content=="string"?n=r.content:n=r.content.map(o=>"text"in o?{...o,text:o.text}:"image_url"in o?{...o,image_url:o.image_url}:o),r._getType()==="human")return Iy.fromTemplate(n,e);if(r._getType()==="ai")return fce.fromTemplate(n,e);if(r._getType()==="system")return QO.fromTemplate(n,e);if(Ja.isInstance(r))return dce.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function lGt(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var oU,Ay,cce,iU,dce,aU,Iy,fce,QO,Of,sU=O(()=>{MI();Qq();xf();eU();RD();LD();lce();ND();Fq();oU=class extends ln{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","chat"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}async invoke(e,r){return this._callWithConfig(n=>this.formatMessages(n),e,{...r,runType:"prompt"})}},Ay=class extends oU{static lc_name(){return"MessagesPlaceholder"}constructor(e){typeof e=="string"&&(e={variableName:e}),super(e),Object.defineProperty(this,"variableName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"optional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.variableName=e.variableName,this.optional=e.optional??!1}get inputVariables(){return[this.variableName]}async formatMessages(e){let r=e[this.variableName];if(this.optional&&!r)return[];if(!r){let o=new Error(`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages as an input value. Received: undefined`);throw o.name="InputFormatError",o}let n;try{Array.isArray(r)?n=r.map(eg):n=[eg(r)]}catch(o){let i=typeof r=="string"?r:JSON.stringify(r,null,2),a=new Error([`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages or coerceable values as input.`,`Received value: ${i}`,`Additional message: ${o.message}`].join(`
`));throw a.name="InputFormatError",a.lc_error_code=o.lc_error_code,a}return n}},cce=class extends oU{constructor(e){"prompt"in e||(e={prompt:e}),super(e),Object.defineProperty(this,"prompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.prompt=e.prompt}get inputVariables(){return this.prompt.inputVariables}async formatMessages(e){return[await this.format(e)]}},iU=class extends Ty{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){let r=await this.formatMessages(e);return new MD(r)}},dce=class extends cce{static lc_name(){return"ChatMessagePromptTemplate"}constructor(e,r){"prompt"in e||(e={prompt:e,role:r}),super(e),Object.defineProperty(this,"role",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.role=e.role}async format(e){return new Ja(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this($d.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}},aU=class extends oU{static _messageClass(){throw new Error("Can not invoke _messageClass from inside _StringImageMessagePromptTemplate")}constructor(e,r){if("prompt"in e||(e={prompt:e}),super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","chat"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"additionalOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"prompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"messageClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chatMessageClass",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.prompt=e.prompt,Array.isArray(this.prompt)){let n=[];this.prompt.forEach(o=>{"inputVariables"in o&&(n=n.concat(o.inputVariables))}),this.inputVariables=n}else this.inputVariables=this.prompt.inputVariables;this.additionalOptions=r??this.additionalOptions}createMessage(e){let r=this.constructor;if(r._messageClass()){let n=r._messageClass();return new n({content:e})}else if(r.chatMessageClass){let n=r.chatMessageClass();return new n({content:e,role:this.getRoleFromMessageClass(n.lc_name())})}else throw new Error("No message class defined")}getRoleFromMessageClass(e){switch(e){case"HumanMessage":return"human";case"AIMessage":return"ai";case"SystemMessage":return"system";case"ChatMessage":return"chat";default:throw new Error("Invalid message class name")}}static fromTemplate(e,r){if(typeof e=="string")return new this($d.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string"||typeof o=="object"&&"text"in o){let i="";typeof o=="string"?i=o:typeof o.text=="string"&&(i=o.text??"");let a={...r,...typeof o!="string"?{additionalContentFields:o}:{}};n.push($d.fromTemplate(i,a))}else if(typeof o=="object"&&"image_url"in o){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=Y5(i):u=nU(i);let l=u.flatMap(c=>c.type==="variable"?[c.name]:[]);if((l?.length??0)>0){if(l.length>1)throw new Error(`Only one format variable allowed per image template.
Got: ${l}
From: ${i}`);s=[l[0]]}else s=[];i={url:i},a=new FD({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=Y5(i.url):u=nU(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new FD({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else throw new Error("Invalid image template");n.push(a)}return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof tx){let r=await this.prompt.format(e);return this.createMessage(r)}else{let r=[];for(let n of this.prompt){let o={};if(!("inputVariables"in n))throw new Error(`Prompt ${n} does not have inputVariables defined.`);for(let i of n.inputVariables)o||(o={[i]:e[i]}),o={...o,[i]:e[i]};if(n instanceof tx){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof FD){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"image_url",image_url:i})}}return this.createMessage(r)}}async formatMessages(e){return[await this.format(e)]}},Iy=class extends aU{static _messageClass(){return Ga}static lc_name(){return"HumanMessagePromptTemplate"}},fce=class extends aU{static _messageClass(){return en}static lc_name(){return"AIMessagePromptTemplate"}},QO=class extends aU{static _messageClass(){return GS}static lc_name(){return"SystemMessagePromptTemplate"}};Of=class t extends iU{static lc_name(){return"ChatPromptTemplate"}get lc_aliases(){return{promptMessages:"messages"}}constructor(e){if(super(e),Object.defineProperty(this,"promptMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),e.templateFormat==="mustache"&&e.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,e),this.validateTemplate){let r=new Set;for(let s of this.promptMessages)if(!(s instanceof Ku))for(let u of s.inputVariables)r.add(u);let n=this.inputVariables,o=new Set(this.partialVariables?n.concat(Object.keys(this.partialVariables)):n),i=new Set([...o].filter(s=>!r.has(s)));if(i.size>0)throw new Error(`Input variables \`${[...i]}\` are not used in any of the prompt messages.`);let a=new Set([...r].filter(s=>!o.has(s)));if(a.size>0)throw new Error(`Input variables \`${[...a]}\` are used in prompt messages but not in the prompt template.`)}}_getPromptType(){return"chat"}async _parseImagePrompts(e,r){if(typeof e.content=="string")return e;let n=await Promise.all(e.content.map(async o=>{if(o.type!=="image_url")return o;let i="";typeof o.image_url=="string"?i=o.image_url:i=o.image_url.url;let s=await $d.fromTemplate(i,{templateFormat:this.templateFormat}).format(r);return typeof o.image_url!="string"&&"url"in o.image_url?o.image_url.url=s:o.image_url=s,o}));return e.content=n,e}async formatMessages(e){let r=await this.mergePartialAndUserVariables(e),n=[];for(let o of this.promptMessages)if(o instanceof Ku)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(lGt(o)&&o.optional))throw WO(new Error(`Missing value for input variable \`${u.toString()}\``),"INVALID_PROMPT_INPUT");return s[u]=r[u],s},{}),a=await o.formatMessages(i);n=n.concat(a)}return n}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}static fromTemplate(e,r){let n=$d.fromTemplate(e,r),o=new Iy({prompt:n});return this.fromMessages([o])}static fromMessages(e,r){let n=e.reduce((a,s)=>a.concat(s instanceof t?s.promptMessages:[uGt(s,r)]),[]),o=e.reduce((a,s)=>s instanceof t?Object.assign(a,s.partialVariables):a,Object.create(null)),i=new Set;for(let a of n)if(!(a instanceof Ku))for(let s of a.inputVariables)s in o||i.add(s);return new this({...r,inputVariables:[...i],promptMessages:n,partialVariables:o,templateFormat:r?.templateFormat})}static fromPromptMessages(e){return this.fromMessages(e)}}});var NBe={};ff(NBe,{FewShotChatMessagePromptTemplate:()=>mce,FewShotPromptTemplate:()=>pce});var pce,mce,hce=O(()=>{eU();ND();LD();sU();pce=class t extends tx{constructor(e){if(super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:`
`}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.assign(this,e),this.examples!==void 0&&this.exampleSelector!==void 0)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(this.examples===void 0&&this.exampleSelector===void 0)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),LI(this.prefix+this.suffix,this.templateFormat,r)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(e){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}async format(e){let r=await this.mergePartialAndUserVariables(e),n=await this.getExamples(r),o=await Promise.all(n.map(a=>this.examplePrompt.format(a))),i=[this.prefix,...o,this.suffix].join(this.exampleSeparator);return ig(i,this.templateFormat,r)}serialize(){if(this.exampleSelector||!this.examples)throw new Error("Serializing an example selector is not currently supported");if(this.outputParser!==void 0)throw new Error("Serializing an output parser is not currently supported");return{_type:this._getPromptType(),input_variables:this.inputVariables,example_prompt:this.examplePrompt.serialize(),example_separator:this.exampleSeparator,suffix:this.suffix,prefix:this.prefix,template_format:this.templateFormat,examples:this.examples}}static async deserialize(e){let{example_prompt:r}=e;if(!r)throw new Error("Missing example prompt");let n=await $d.deserialize(r),o;if(Array.isArray(e.examples))o=e.examples;else throw new Error("Invalid examples format. Only list or string are supported.");return new t({inputVariables:e.input_variables,examplePrompt:n,examples:o,exampleSeparator:e.example_separator,prefix:e.prefix,suffix:e.suffix,templateFormat:e.template_format})}},mce=class t extends iU{_getPromptType(){return"few_shot_chat"}static lc_name(){return"FewShotChatMessagePromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:`
`}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.examples=e.examples,this.examplePrompt=e.examplePrompt,this.exampleSeparator=e.exampleSeparator??`
`,this.exampleSelector=e.exampleSelector,this.prefix=e.prefix??"",this.suffix=e.suffix??"",this.templateFormat=e.templateFormat??"f-string",this.validateTemplate=e.validateTemplate??!0,this.examples!==void 0&&this.exampleSelector!==void 0)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(this.examples===void 0&&this.exampleSelector===void 0)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let r=this.inputVariables;this.partialVariables&&(r=r.concat(Object.keys(this.partialVariables))),LI(this.prefix+this.suffix,this.templateFormat,r)}}async getExamples(e){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async formatMessages(e){let r=await this.mergePartialAndUserVariables(e),n=await this.getExamples(r);n=n.map(i=>{let a={};return this.examplePrompt.inputVariables.forEach(s=>{a[s]=i[s]}),a});let o=[];for(let i of n){let a=await this.examplePrompt.formatMessages(i);o.push(...a)}return o}async format(e){let r=await this.mergePartialAndUserVariables(e),n=await this.getExamples(r),i=(await Promise.all(n.map(s=>this.examplePrompt.formatMessages(s)))).flat().map(s=>s.content),a=[this.prefix,...i,this.suffix].join(this.exampleSeparator);return ig(a,this.templateFormat,r)}async partial(e){let r=this.inputVariables.filter(i=>!(i in e)),n={...this.partialVariables??{},...e},o={...this,inputVariables:r,partialVariables:n};return new t(o)}}});var Ty,RD=O(()=>{xf();Ty=class extends ln{get lc_attributes(){return{partialVariables:void 0}}constructor(e){super(e),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts",this._getPromptType()]}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"partialVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let{inputVariables:r}=e;if(r.includes("stop"))throw new Error("Cannot have an input variable named 'stop', as it is used internally, please rename.");Object.assign(this,e)}async mergePartialAndUserVariables(e){let r=this.partialVariables??{},n={};for(let[i,a]of Object.entries(r))typeof a=="string"?n[i]=a:n[i]=await a();return{...n,...e}}async invoke(e,r){let n={...this.metadata,...r?.metadata},o=[...this.tags??[],...r?.tags??[]];return this._callWithConfig(i=>this.formatPromptValue(i),e,{...r,tags:o,metadata:n,runType:"prompt"})}serialize(){throw new Error("Use .toJSON() instead")}static async deserialize(e){switch(e._type){case"prompt":{let{PromptTemplate:r}=await Promise.resolve().then(()=>(LD(),uce));return r.deserialize(e)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>(LD(),uce));return r.deserialize({...e,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(hce(),NBe));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}});var LBe=O(()=>{RD();sU()});var FBe=O(()=>{});var kBe=O(()=>{sU()});var BBe=O(()=>{RD();sU();hce();LBe();LD();FBe();eU();ND();lce();kBe()});var eE=O(()=>{BBe()});var Cp=O(()=>{Zle()});var n$e=b(cn=>{"use strict";var lU=Symbol.for("react.element"),yGt=Symbol.for("react.portal"),bGt=Symbol.for("react.fragment"),_Gt=Symbol.for("react.strict_mode"),vGt=Symbol.for("react.profiler"),wGt=Symbol.for("react.provider"),SGt=Symbol.for("react.context"),xGt=Symbol.for("react.forward_ref"),CGt=Symbol.for("react.suspense"),OGt=Symbol.for("react.memo"),EGt=Symbol.for("react.lazy"),KBe=Symbol.iterator;function PGt(t){return t===null||typeof t!="object"?null:(t=KBe&&t[KBe]||t["@@iterator"],typeof t=="function"?t:null)}var YBe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ZBe=Object.assign,XBe={};function BD(t,e,r){this.props=t,this.context=e,this.refs=XBe,this.updater=r||YBe}BD.prototype.isReactComponent={};BD.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};BD.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function QBe(){}QBe.prototype=BD.prototype;function xce(t,e,r){this.props=t,this.context=e,this.refs=XBe,this.updater=r||YBe}var Cce=xce.prototype=new QBe;Cce.constructor=xce;ZBe(Cce,BD.prototype);Cce.isPureReactComponent=!0;var JBe=Array.isArray,e$e=Object.prototype.hasOwnProperty,Oce={current:null},t$e={key:!0,ref:!0,__self:!0,__source:!0};function r$e(t,e,r){var n,o={},i=null,a=null;if(e!=null)for(n in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(i=""+e.key),e)e$e.call(e,n)&&!t$e.hasOwnProperty(n)&&(o[n]=e[n]);var s=arguments.length-2;if(s===1)o.children=r;else if(1<s){for(var u=Array(s),l=0;l<s;l++)u[l]=arguments[l+2];o.children=u}if(t&&t.defaultProps)for(n in s=t.defaultProps,s)o[n]===void 0&&(o[n]=s[n]);return{$$typeof:lU,type:t,key:i,ref:a,props:o,_owner:Oce.current}}function TGt(t,e){return{$$typeof:lU,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Ece(t){return typeof t=="object"&&t!==null&&t.$$typeof===lU}function AGt(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var GBe=/\/+/g;function Sce(t,e){return typeof t=="object"&&t!==null&&t.key!=null?AGt(""+t.key):e.toString(36)}function t9(t,e,r,n,o){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case lU:case yGt:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+Sce(a,0):n,JBe(o)?(r="",t!=null&&(r=t.replace(GBe,"$&/")+"/"),t9(o,e,r,"",function(l){return l})):o!=null&&(Ece(o)&&(o=TGt(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(GBe,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",JBe(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+Sce(i,s);a+=t9(i,e,r,u,o)}else if(u=PGt(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+Sce(i,s++),a+=t9(i,e,r,u,o);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function e9(t,e,r){if(t==null)return t;var n=[],o=0;return t9(t,n,"","",function(i){return e.call(r,i,o++)}),n}function IGt(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var qd={current:null},r9={transition:null},MGt={ReactCurrentDispatcher:qd,ReactCurrentBatchConfig:r9,ReactCurrentOwner:Oce};cn.Children={map:e9,forEach:function(t,e,r){e9(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return e9(t,function(){e++}),e},toArray:function(t){return e9(t,function(e){return e})||[]},only:function(t){if(!Ece(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};cn.Component=BD;cn.Fragment=bGt;cn.Profiler=vGt;cn.PureComponent=xce;cn.StrictMode=_Gt;cn.Suspense=CGt;cn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=MGt;cn.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=ZBe({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=Oce.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)e$e.call(e,u)&&!t$e.hasOwnProperty(u)&&(n[u]=e[u]===void 0&&s!==void 0?s[u]:e[u])}var u=arguments.length-2;if(u===1)n.children=r;else if(1<u){s=Array(u);for(var l=0;l<u;l++)s[l]=arguments[l+2];n.children=s}return{$$typeof:lU,type:t.type,key:o,ref:i,props:n,_owner:a}};cn.createContext=function(t){return t={$$typeof:SGt,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:wGt,_context:t},t.Consumer=t};cn.createElement=r$e;cn.createFactory=function(t){var e=r$e.bind(null,t);return e.type=t,e};cn.createRef=function(){return{current:null}};cn.forwardRef=function(t){return{$$typeof:xGt,render:t}};cn.isValidElement=Ece;cn.lazy=function(t){return{$$typeof:EGt,_payload:{_status:-1,_result:t},_init:IGt}};cn.memo=function(t,e){return{$$typeof:OGt,type:t,compare:e===void 0?null:e}};cn.startTransition=function(t){var e=r9.transition;r9.transition={};try{t()}finally{r9.transition=e}};cn.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};cn.useCallback=function(t,e){return qd.current.useCallback(t,e)};cn.useContext=function(t){return qd.current.useContext(t)};cn.useDebugValue=function(){};cn.useDeferredValue=function(t){return qd.current.useDeferredValue(t)};cn.useEffect=function(t,e){return qd.current.useEffect(t,e)};cn.useId=function(){return qd.current.useId()};cn.useImperativeHandle=function(t,e,r){return qd.current.useImperativeHandle(t,e,r)};cn.useInsertionEffect=function(t,e){return qd.current.useInsertionEffect(t,e)};cn.useLayoutEffect=function(t,e){return qd.current.useLayoutEffect(t,e)};cn.useMemo=function(t,e){return qd.current.useMemo(t,e)};cn.useReducer=function(t,e,r){return qd.current.useReducer(t,e,r)};cn.useRef=function(t){return qd.current.useRef(t)};cn.useState=function(t){return qd.current.useState(t)};cn.useSyncExternalStore=function(t,e,r){return qd.current.useSyncExternalStore(t,e,r)};cn.useTransition=function(){return qd.current.useTransition()};cn.version="18.2.0"});var X=b((cTn,o$e)=>{"use strict";o$e.exports=n$e()});var d$e=b((Rce,$D)=>{(function(t,e){typeof Rce=="object"&&typeof $D<"u"?$D.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(Rce,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(y){t=y}function n(y){return y instanceof Array||Object.prototype.toString.call(y)==="[object Array]"}function o(y){return y!=null&&Object.prototype.toString.call(y)==="[object Object]"}function i(y,S){return Object.prototype.hasOwnProperty.call(y,S)}function a(y){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(y).length===0;var S;for(S in y)if(i(y,S))return!1;return!0}function s(y){return y===void 0}function u(y){return typeof y=="number"||Object.prototype.toString.call(y)==="[object Number]"}function l(y){return y instanceof Date||Object.prototype.toString.call(y)==="[object Date]"}function c(y,S){var T=[],I,D=y.length;for(I=0;I<D;++I)T.push(S(y[I],I));return T}function d(y,S){for(var T in S)i(S,T)&&(y[T]=S[T]);return i(S,"toString")&&(y.toString=S.toString),i(S,"valueOf")&&(y.valueOf=S.valueOf),y}function f(y,S,T,I){return tDe(y,S,T,I,!0).utc()}function p(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function m(y){return y._pf==null&&(y._pf=p()),y._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(y){var S=Object(this),T=S.length>>>0,I;for(I=0;I<T;I++)if(I in S&&y.call(this,S[I],I,S))return!0;return!1};function v(y){if(y._isValid==null){var S=m(y),T=h.call(S.parsedDateParts,function(D){return D!=null}),I=!isNaN(y._d.getTime())&&S.overflow<0&&!S.empty&&!S.invalidEra&&!S.invalidMonth&&!S.invalidWeekday&&!S.weekdayMismatch&&!S.nullInput&&!S.invalidFormat&&!S.userInvalidated&&(!S.meridiem||S.meridiem&&T);if(y._strict&&(I=I&&S.charsLeftOver===0&&S.unusedTokens.length===0&&S.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(y))y._isValid=I;else return I}return y._isValid}function g(y){var S=f(NaN);return y!=null?d(m(S),y):m(S).userInvalidated=!0,S}var _=e.momentProperties=[],w=!1;function x(y,S){var T,I,D,H=_.length;if(s(S._isAMomentObject)||(y._isAMomentObject=S._isAMomentObject),s(S._i)||(y._i=S._i),s(S._f)||(y._f=S._f),s(S._l)||(y._l=S._l),s(S._strict)||(y._strict=S._strict),s(S._tzm)||(y._tzm=S._tzm),s(S._isUTC)||(y._isUTC=S._isUTC),s(S._offset)||(y._offset=S._offset),s(S._pf)||(y._pf=m(S)),s(S._locale)||(y._locale=S._locale),H>0)for(T=0;T<H;T++)I=_[T],D=S[I],s(D)||(y[I]=D);return y}function C(y){x(this,y),this._d=new Date(y._d!=null?y._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),w===!1&&(w=!0,e.updateOffset(this),w=!1)}function P(y){return y instanceof C||y!=null&&y._isAMomentObject!=null}function E(y){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+y)}function A(y,S){var T=!0;return d(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,y),T){var I=[],D,H,ue,$t=arguments.length;for(H=0;H<$t;H++){if(D="",typeof arguments[H]=="object"){D+=`
[`+H+"] ";for(ue in arguments[0])i(arguments[0],ue)&&(D+=ue+": "+arguments[0][ue]+", ");D=D.slice(0,-2)}else D=arguments[H];I.push(D)}E(y+`
Arguments: `+Array.prototype.slice.call(I).join("")+`
`+new Error().stack),T=!1}return S.apply(this,arguments)},S)}var M={};function R(y,S){e.deprecationHandler!=null&&e.deprecationHandler(y,S),M[y]||(E(S),M[y]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function N(y){return typeof Function<"u"&&y instanceof Function||Object.prototype.toString.call(y)==="[object Function]"}function L(y){var S,T;for(T in y)i(y,T)&&(S=y[T],N(S)?this[T]=S:this["_"+T]=S);this._config=y,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function k(y,S){var T=d({},y),I;for(I in S)i(S,I)&&(o(y[I])&&o(S[I])?(T[I]={},d(T[I],y[I]),d(T[I],S[I])):S[I]!=null?T[I]=S[I]:delete T[I]);for(I in y)i(y,I)&&!i(S,I)&&o(y[I])&&(T[I]=d({},T[I]));return T}function F(y){y!=null&&this.set(y)}var $;Object.keys?$=Object.keys:$=function(y){var S,T=[];for(S in y)i(y,S)&&T.push(S);return T};var U={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function J(y,S,T){var I=this._calendar[y]||this._calendar.sameElse;return N(I)?I.call(S,T):I}function V(y,S,T){var I=""+Math.abs(y),D=S-I.length,H=y>=0;return(H?T?"+":"":"-")+Math.pow(10,Math.max(0,D)).toString().substr(1)+I}var j=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,z=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,W={},K={};function re(y,S,T,I){var D=I;typeof I=="string"&&(D=function(){return this[I]()}),y&&(K[y]=D),S&&(K[S[0]]=function(){return V(D.apply(this,arguments),S[1],S[2])}),T&&(K[T]=function(){return this.localeData().ordinal(D.apply(this,arguments),y)})}function De(y){return y.match(/\[[\s\S]/)?y.replace(/^\[|\]$/g,""):y.replace(/\\/g,"")}function Y(y){var S=y.match(j),T,I;for(T=0,I=S.length;T<I;T++)K[S[T]]?S[T]=K[S[T]]:S[T]=De(S[T]);return function(D){var H="",ue;for(ue=0;ue<I;ue++)H+=N(S[ue])?S[ue].call(D,y):S[ue];return H}}function Q(y,S){return y.isValid()?(S=oe(S,y.localeData()),W[S]=W[S]||Y(S),W[S](y)):y.localeData().invalidDate()}function oe(y,S){var T=5;function I(D){return S.longDateFormat(D)||D}for(z.lastIndex=0;T>=0&&z.test(y);)y=y.replace(z,I),z.lastIndex=0,T-=1;return y}var Te={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function bt(y){var S=this._longDateFormat[y],T=this._longDateFormat[y.toUpperCase()];return S||!T?S:(this._longDateFormat[y]=T.match(j).map(function(I){return I==="MMMM"||I==="MM"||I==="DD"||I==="dddd"?I.slice(1):I}).join(""),this._longDateFormat[y])}var xe="Invalid date";function Z(){return this._invalidDate}var te="%d",Ee=/\d{1,2}/;function Le(y){return this._ordinal.replace("%d",y)}var Ze={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Ot(y,S,T,I){var D=this._relativeTime[T];return N(D)?D(y,S,T,I):D.replace(/%d/i,y)}function Yt(y,S){var T=this._relativeTime[y>0?"future":"past"];return N(T)?T(S):T.replace(/%s/i,S)}var Wn={};function nr(y,S){var T=y.toLowerCase();Wn[T]=Wn[T+"s"]=Wn[S]=y}function ve(y){return typeof y=="string"?Wn[y]||Wn[y.toLowerCase()]:void 0}function vn(y){var S={},T,I;for(I in y)i(y,I)&&(T=ve(I),T&&(S[T]=y[I]));return S}var lt={};function qe(y,S){lt[y]=S}function ie(y){var S=[],T;for(T in y)i(y,T)&&S.push({unit:T,priority:lt[T]});return S.sort(function(I,D){return I.priority-D.priority}),S}function ce(y){return y%4===0&&y%100!==0||y%400===0}function _e(y){return y<0?Math.ceil(y)||0:Math.floor(y)}function be(y){var S=+y,T=0;return S!==0&&isFinite(S)&&(T=_e(S)),T}function Ue(y,S){return function(T){return T!=null?(ia(this,y,T),e.updateOffset(this,S),this):zr(this,y)}}function zr(y,S){return y.isValid()?y._d["get"+(y._isUTC?"UTC":"")+S]():NaN}function ia(y,S,T){y.isValid()&&!isNaN(T)&&(S==="FullYear"&&ce(y.year())&&y.month()===1&&y.date()===29?(T=be(T),y._d["set"+(y._isUTC?"UTC":"")+S](T,y.month(),u6(T,y.month()))):y._d["set"+(y._isUTC?"UTC":"")+S](T))}function Hu(y){return y=ve(y),N(this[y])?this[y]():this}function Jh(y,S){if(typeof y=="object"){y=vn(y);var T=ie(y),I,D=T.length;for(I=0;I<D;I++)this[T[I].unit](y[T[I].unit])}else if(y=ve(y),N(this[y]))return this[y](S);return this}var Gh=/\d/,Ia=/\d\d/,gm=/\d{3}/,hp=/\d{4}/,ym=/[+-]?\d{6}/,wn=/\d\d?/,DO=/\d\d\d\d?/,ZA=/\d\d\d\d\d\d?/,NO=/\d{1,3}/,Ma=/\d{1,4}/,us=/[+-]?\d{1,6}/,aa=/\d+/,Od=/[+-]?\d+/,Bc=/Z|[+-]\d\d:?\d\d/gi,Va=/Z|[+-]\d\d(?::?\d\d)?/gi,df=/[+-]?\d+(\.\d{1,3})?/,Ed=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,un;un={};function ze(y,S,T){un[y]=N(S)?S:function(I,D){return I&&T?T:S}}function Pd(y,S){return i(un,y)?un[y](S._strict,S._locale):new RegExp(gp(y))}function gp(y){return Vu(y.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(S,T,I,D,H){return T||I||D||H}))}function Vu(y){return y.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var MS={};function an(y,S){var T,I=S,D;for(typeof y=="string"&&(y=[y]),u(S)&&(I=function(H,ue){ue[S]=be(H)}),D=y.length,T=0;T<D;T++)MS[y[T]]=I}function Yh(y,S){an(y,function(T,I,D,H){D._w=D._w||{},S(T,D._w,D,H)})}function lq(y,S,T){S!=null&&i(MS,y)&&MS[y](S,T._a,T,y)}var $c=0,RS=1,vy=2,Wu=3,Zh=4,jS=5,XA=6,k4t=7,B4t=8;function $4t(y,S){return(y%S+S)%S}var Wa;Array.prototype.indexOf?Wa=Array.prototype.indexOf:Wa=function(y){var S;for(S=0;S<this.length;++S)if(this[S]===y)return S;return-1};function u6(y,S){if(isNaN(y)||isNaN(S))return NaN;var T=$4t(S,12);return y+=(S-T)/12,T===1?ce(y)?29:28:31-T%7%2}re("M",["MM",2],"Mo",function(){return this.month()+1}),re("MMM",0,0,function(y){return this.localeData().monthsShort(this,y)}),re("MMMM",0,0,function(y){return this.localeData().months(this,y)}),nr("month","M"),qe("month",8),ze("M",wn),ze("MM",wn,Ia),ze("MMM",function(y,S){return S.monthsShortRegex(y)}),ze("MMMM",function(y,S){return S.monthsRegex(y)}),an(["M","MM"],function(y,S){S[RS]=be(y)-1}),an(["MMM","MMMM"],function(y,S,T,I){var D=T._locale.monthsParse(y,I,T._strict);D!=null?S[RS]=D:m(T).invalidMonth=y});var q4t="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),$je="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),qje=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,U4t=Ed,z4t=Ed;function H4t(y,S){return y?n(this._months)?this._months[y.month()]:this._months[(this._months.isFormat||qje).test(S)?"format":"standalone"][y.month()]:n(this._months)?this._months:this._months.standalone}function V4t(y,S){return y?n(this._monthsShort)?this._monthsShort[y.month()]:this._monthsShort[qje.test(S)?"format":"standalone"][y.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function W4t(y,S,T){var I,D,H,ue=y.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],I=0;I<12;++I)H=f([2e3,I]),this._shortMonthsParse[I]=this.monthsShort(H,"").toLocaleLowerCase(),this._longMonthsParse[I]=this.months(H,"").toLocaleLowerCase();return T?S==="MMM"?(D=Wa.call(this._shortMonthsParse,ue),D!==-1?D:null):(D=Wa.call(this._longMonthsParse,ue),D!==-1?D:null):S==="MMM"?(D=Wa.call(this._shortMonthsParse,ue),D!==-1?D:(D=Wa.call(this._longMonthsParse,ue),D!==-1?D:null)):(D=Wa.call(this._longMonthsParse,ue),D!==-1?D:(D=Wa.call(this._shortMonthsParse,ue),D!==-1?D:null))}function K4t(y,S,T){var I,D,H;if(this._monthsParseExact)return W4t.call(this,y,S,T);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),I=0;I<12;I++){if(D=f([2e3,I]),T&&!this._longMonthsParse[I]&&(this._longMonthsParse[I]=new RegExp("^"+this.months(D,"").replace(".","")+"$","i"),this._shortMonthsParse[I]=new RegExp("^"+this.monthsShort(D,"").replace(".","")+"$","i")),!T&&!this._monthsParse[I]&&(H="^"+this.months(D,"")+"|^"+this.monthsShort(D,""),this._monthsParse[I]=new RegExp(H.replace(".",""),"i")),T&&S==="MMMM"&&this._longMonthsParse[I].test(y))return I;if(T&&S==="MMM"&&this._shortMonthsParse[I].test(y))return I;if(!T&&this._monthsParse[I].test(y))return I}}function Uje(y,S){var T;if(!y.isValid())return y;if(typeof S=="string"){if(/^\d+$/.test(S))S=be(S);else if(S=y.localeData().monthsParse(S),!u(S))return y}return T=Math.min(y.date(),u6(y.year(),S)),y._d["set"+(y._isUTC?"UTC":"")+"Month"](S,T),y}function zje(y){return y!=null?(Uje(this,y),e.updateOffset(this,!0),this):zr(this,"Month")}function J4t(){return u6(this.year(),this.month())}function G4t(y){return this._monthsParseExact?(i(this,"_monthsRegex")||Hje.call(this),y?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=U4t),this._monthsShortStrictRegex&&y?this._monthsShortStrictRegex:this._monthsShortRegex)}function Y4t(y){return this._monthsParseExact?(i(this,"_monthsRegex")||Hje.call(this),y?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=z4t),this._monthsStrictRegex&&y?this._monthsStrictRegex:this._monthsRegex)}function Hje(){function y(ue,$t){return $t.length-ue.length}var S=[],T=[],I=[],D,H;for(D=0;D<12;D++)H=f([2e3,D]),S.push(this.monthsShort(H,"")),T.push(this.months(H,"")),I.push(this.months(H,"")),I.push(this.monthsShort(H,""));for(S.sort(y),T.sort(y),I.sort(y),D=0;D<12;D++)S[D]=Vu(S[D]),T[D]=Vu(T[D]);for(D=0;D<24;D++)I[D]=Vu(I[D]);this._monthsRegex=new RegExp("^("+I.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+T.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+S.join("|")+")","i")}re("Y",0,0,function(){var y=this.year();return y<=9999?V(y,4):"+"+y}),re(0,["YY",2],0,function(){return this.year()%100}),re(0,["YYYY",4],0,"year"),re(0,["YYYYY",5],0,"year"),re(0,["YYYYYY",6,!0],0,"year"),nr("year","y"),qe("year",1),ze("Y",Od),ze("YY",wn,Ia),ze("YYYY",Ma,hp),ze("YYYYY",us,ym),ze("YYYYYY",us,ym),an(["YYYYY","YYYYYY"],$c),an("YYYY",function(y,S){S[$c]=y.length===2?e.parseTwoDigitYear(y):be(y)}),an("YY",function(y,S){S[$c]=e.parseTwoDigitYear(y)}),an("Y",function(y,S){S[$c]=parseInt(y,10)});function cq(y){return ce(y)?366:365}e.parseTwoDigitYear=function(y){return be(y)+(be(y)>68?1900:2e3)};var Vje=Ue("FullYear",!0);function Z4t(){return ce(this.year())}function X4t(y,S,T,I,D,H,ue){var $t;return y<100&&y>=0?($t=new Date(y+400,S,T,I,D,H,ue),isFinite($t.getFullYear())&&$t.setFullYear(y)):$t=new Date(y,S,T,I,D,H,ue),$t}function dq(y){var S,T;return y<100&&y>=0?(T=Array.prototype.slice.call(arguments),T[0]=y+400,S=new Date(Date.UTC.apply(null,T)),isFinite(S.getUTCFullYear())&&S.setUTCFullYear(y)):S=new Date(Date.UTC.apply(null,arguments)),S}function l6(y,S,T){var I=7+S-T,D=(7+dq(y,0,I).getUTCDay()-S)%7;return-D+I-1}function Wje(y,S,T,I,D){var H=(7+T-I)%7,ue=l6(y,I,D),$t=1+7*(S-1)+H+ue,Hr,Qo;return $t<=0?(Hr=y-1,Qo=cq(Hr)+$t):$t>cq(y)?(Hr=y+1,Qo=$t-cq(y)):(Hr=y,Qo=$t),{year:Hr,dayOfYear:Qo}}function fq(y,S,T){var I=l6(y.year(),S,T),D=Math.floor((y.dayOfYear()-I-1)/7)+1,H,ue;return D<1?(ue=y.year()-1,H=D+DS(ue,S,T)):D>DS(y.year(),S,T)?(H=D-DS(y.year(),S,T),ue=y.year()+1):(ue=y.year(),H=D),{week:H,year:ue}}function DS(y,S,T){var I=l6(y,S,T),D=l6(y+1,S,T);return(cq(y)-I+D)/7}re("w",["ww",2],"wo","week"),re("W",["WW",2],"Wo","isoWeek"),nr("week","w"),nr("isoWeek","W"),qe("week",5),qe("isoWeek",5),ze("w",wn),ze("ww",wn,Ia),ze("W",wn),ze("WW",wn,Ia),Yh(["w","ww","W","WW"],function(y,S,T,I){S[I.substr(0,1)]=be(y)});function Q4t(y){return fq(y,this._week.dow,this._week.doy).week}var e3t={dow:0,doy:6};function t3t(){return this._week.dow}function r3t(){return this._week.doy}function n3t(y){var S=this.localeData().week(this);return y==null?S:this.add((y-S)*7,"d")}function o3t(y){var S=fq(this,1,4).week;return y==null?S:this.add((y-S)*7,"d")}re("d",0,"do","day"),re("dd",0,0,function(y){return this.localeData().weekdaysMin(this,y)}),re("ddd",0,0,function(y){return this.localeData().weekdaysShort(this,y)}),re("dddd",0,0,function(y){return this.localeData().weekdays(this,y)}),re("e",0,0,"weekday"),re("E",0,0,"isoWeekday"),nr("day","d"),nr("weekday","e"),nr("isoWeekday","E"),qe("day",11),qe("weekday",11),qe("isoWeekday",11),ze("d",wn),ze("e",wn),ze("E",wn),ze("dd",function(y,S){return S.weekdaysMinRegex(y)}),ze("ddd",function(y,S){return S.weekdaysShortRegex(y)}),ze("dddd",function(y,S){return S.weekdaysRegex(y)}),Yh(["dd","ddd","dddd"],function(y,S,T,I){var D=T._locale.weekdaysParse(y,I,T._strict);D!=null?S.d=D:m(T).invalidWeekday=y}),Yh(["d","e","E"],function(y,S,T,I){S[I]=be(y)});function i3t(y,S){return typeof y!="string"?y:isNaN(y)?(y=S.weekdaysParse(y),typeof y=="number"?y:null):parseInt(y,10)}function a3t(y,S){return typeof y=="string"?S.weekdaysParse(y)%7||7:isNaN(y)?null:y}function Ese(y,S){return y.slice(S,7).concat(y.slice(0,S))}var s3t="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Kje="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),u3t="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),l3t=Ed,c3t=Ed,d3t=Ed;function f3t(y,S){var T=n(this._weekdays)?this._weekdays:this._weekdays[y&&y!==!0&&this._weekdays.isFormat.test(S)?"format":"standalone"];return y===!0?Ese(T,this._week.dow):y?T[y.day()]:T}function p3t(y){return y===!0?Ese(this._weekdaysShort,this._week.dow):y?this._weekdaysShort[y.day()]:this._weekdaysShort}function m3t(y){return y===!0?Ese(this._weekdaysMin,this._week.dow):y?this._weekdaysMin[y.day()]:this._weekdaysMin}function h3t(y,S,T){var I,D,H,ue=y.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],I=0;I<7;++I)H=f([2e3,1]).day(I),this._minWeekdaysParse[I]=this.weekdaysMin(H,"").toLocaleLowerCase(),this._shortWeekdaysParse[I]=this.weekdaysShort(H,"").toLocaleLowerCase(),this._weekdaysParse[I]=this.weekdays(H,"").toLocaleLowerCase();return T?S==="dddd"?(D=Wa.call(this._weekdaysParse,ue),D!==-1?D:null):S==="ddd"?(D=Wa.call(this._shortWeekdaysParse,ue),D!==-1?D:null):(D=Wa.call(this._minWeekdaysParse,ue),D!==-1?D:null):S==="dddd"?(D=Wa.call(this._weekdaysParse,ue),D!==-1||(D=Wa.call(this._shortWeekdaysParse,ue),D!==-1)?D:(D=Wa.call(this._minWeekdaysParse,ue),D!==-1?D:null)):S==="ddd"?(D=Wa.call(this._shortWeekdaysParse,ue),D!==-1||(D=Wa.call(this._weekdaysParse,ue),D!==-1)?D:(D=Wa.call(this._minWeekdaysParse,ue),D!==-1?D:null)):(D=Wa.call(this._minWeekdaysParse,ue),D!==-1||(D=Wa.call(this._weekdaysParse,ue),D!==-1)?D:(D=Wa.call(this._shortWeekdaysParse,ue),D!==-1?D:null))}function g3t(y,S,T){var I,D,H;if(this._weekdaysParseExact)return h3t.call(this,y,S,T);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),I=0;I<7;I++){if(D=f([2e3,1]).day(I),T&&!this._fullWeekdaysParse[I]&&(this._fullWeekdaysParse[I]=new RegExp("^"+this.weekdays(D,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[I]=new RegExp("^"+this.weekdaysShort(D,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[I]=new RegExp("^"+this.weekdaysMin(D,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[I]||(H="^"+this.weekdays(D,"")+"|^"+this.weekdaysShort(D,"")+"|^"+this.weekdaysMin(D,""),this._weekdaysParse[I]=new RegExp(H.replace(".",""),"i")),T&&S==="dddd"&&this._fullWeekdaysParse[I].test(y))return I;if(T&&S==="ddd"&&this._shortWeekdaysParse[I].test(y))return I;if(T&&S==="dd"&&this._minWeekdaysParse[I].test(y))return I;if(!T&&this._weekdaysParse[I].test(y))return I}}function y3t(y){if(!this.isValid())return y!=null?this:NaN;var S=this._isUTC?this._d.getUTCDay():this._d.getDay();return y!=null?(y=i3t(y,this.localeData()),this.add(y-S,"d")):S}function b3t(y){if(!this.isValid())return y!=null?this:NaN;var S=(this.day()+7-this.localeData()._week.dow)%7;return y==null?S:this.add(y-S,"d")}function _3t(y){if(!this.isValid())return y!=null?this:NaN;if(y!=null){var S=a3t(y,this.localeData());return this.day(this.day()%7?S:S-7)}else return this.day()||7}function v3t(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Pse.call(this),y?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=l3t),this._weekdaysStrictRegex&&y?this._weekdaysStrictRegex:this._weekdaysRegex)}function w3t(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Pse.call(this),y?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=c3t),this._weekdaysShortStrictRegex&&y?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function S3t(y){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Pse.call(this),y?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=d3t),this._weekdaysMinStrictRegex&&y?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Pse(){function y(Td,BS){return BS.length-Td.length}var S=[],T=[],I=[],D=[],H,ue,$t,Hr,Qo;for(H=0;H<7;H++)ue=f([2e3,1]).day(H),$t=Vu(this.weekdaysMin(ue,"")),Hr=Vu(this.weekdaysShort(ue,"")),Qo=Vu(this.weekdays(ue,"")),S.push($t),T.push(Hr),I.push(Qo),D.push($t),D.push(Hr),D.push(Qo);S.sort(y),T.sort(y),I.sort(y),D.sort(y),this._weekdaysRegex=new RegExp("^("+D.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+T.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+S.join("|")+")","i")}function Tse(){return this.hours()%12||12}function x3t(){return this.hours()||24}re("H",["HH",2],0,"hour"),re("h",["hh",2],0,Tse),re("k",["kk",2],0,x3t),re("hmm",0,0,function(){return""+Tse.apply(this)+V(this.minutes(),2)}),re("hmmss",0,0,function(){return""+Tse.apply(this)+V(this.minutes(),2)+V(this.seconds(),2)}),re("Hmm",0,0,function(){return""+this.hours()+V(this.minutes(),2)}),re("Hmmss",0,0,function(){return""+this.hours()+V(this.minutes(),2)+V(this.seconds(),2)});function Jje(y,S){re(y,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),S)})}Jje("a",!0),Jje("A",!1),nr("hour","h"),qe("hour",13);function Gje(y,S){return S._meridiemParse}ze("a",Gje),ze("A",Gje),ze("H",wn),ze("h",wn),ze("k",wn),ze("HH",wn,Ia),ze("hh",wn,Ia),ze("kk",wn,Ia),ze("hmm",DO),ze("hmmss",ZA),ze("Hmm",DO),ze("Hmmss",ZA),an(["H","HH"],Wu),an(["k","kk"],function(y,S,T){var I=be(y);S[Wu]=I===24?0:I}),an(["a","A"],function(y,S,T){T._isPm=T._locale.isPM(y),T._meridiem=y}),an(["h","hh"],function(y,S,T){S[Wu]=be(y),m(T).bigHour=!0}),an("hmm",function(y,S,T){var I=y.length-2;S[Wu]=be(y.substr(0,I)),S[Zh]=be(y.substr(I)),m(T).bigHour=!0}),an("hmmss",function(y,S,T){var I=y.length-4,D=y.length-2;S[Wu]=be(y.substr(0,I)),S[Zh]=be(y.substr(I,2)),S[jS]=be(y.substr(D)),m(T).bigHour=!0}),an("Hmm",function(y,S,T){var I=y.length-2;S[Wu]=be(y.substr(0,I)),S[Zh]=be(y.substr(I))}),an("Hmmss",function(y,S,T){var I=y.length-4,D=y.length-2;S[Wu]=be(y.substr(0,I)),S[Zh]=be(y.substr(I,2)),S[jS]=be(y.substr(D))});function C3t(y){return(y+"").toLowerCase().charAt(0)==="p"}var O3t=/[ap]\.?m?\.?/i,E3t=Ue("Hours",!0);function P3t(y,S,T){return y>11?T?"pm":"PM":T?"am":"AM"}var Yje={calendar:U,longDateFormat:Te,invalidDate:xe,ordinal:te,dayOfMonthOrdinalParse:Ee,relativeTime:Ze,months:q4t,monthsShort:$je,week:e3t,weekdays:s3t,weekdaysMin:u3t,weekdaysShort:Kje,meridiemParse:O3t},Hi={},pq={},mq;function T3t(y,S){var T,I=Math.min(y.length,S.length);for(T=0;T<I;T+=1)if(y[T]!==S[T])return T;return I}function Zje(y){return y&&y.toLowerCase().replace("_","-")}function A3t(y){for(var S=0,T,I,D,H;S<y.length;){for(H=Zje(y[S]).split("-"),T=H.length,I=Zje(y[S+1]),I=I?I.split("-"):null;T>0;){if(D=c6(H.slice(0,T).join("-")),D)return D;if(I&&I.length>=T&&T3t(H,I)>=T-1)break;T--}S++}return mq}function I3t(y){return y.match("^[^/\\\\]*$")!=null}function c6(y){var S=null,T;if(Hi[y]===void 0&&typeof $D<"u"&&$D&&$D.exports&&I3t(y))try{S=mq._abbr,T=require,T("./locale/"+y),LO(S)}catch{Hi[y]=null}return Hi[y]}function LO(y,S){var T;return y&&(s(S)?T=NS(y):T=Ase(y,S),T?mq=T:typeof console<"u"&&console.warn&&console.warn("Locale "+y+" not found. Did you forget to load it?")),mq._abbr}function Ase(y,S){if(S!==null){var T,I=Yje;if(S.abbr=y,Hi[y]!=null)R("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),I=Hi[y]._config;else if(S.parentLocale!=null)if(Hi[S.parentLocale]!=null)I=Hi[S.parentLocale]._config;else if(T=c6(S.parentLocale),T!=null)I=T._config;else return pq[S.parentLocale]||(pq[S.parentLocale]=[]),pq[S.parentLocale].push({name:y,config:S}),null;return Hi[y]=new F(k(I,S)),pq[y]&&pq[y].forEach(function(D){Ase(D.name,D.config)}),LO(y),Hi[y]}else return delete Hi[y],null}function M3t(y,S){if(S!=null){var T,I,D=Yje;Hi[y]!=null&&Hi[y].parentLocale!=null?Hi[y].set(k(Hi[y]._config,S)):(I=c6(y),I!=null&&(D=I._config),S=k(D,S),I==null&&(S.abbr=y),T=new F(S),T.parentLocale=Hi[y],Hi[y]=T),LO(y)}else Hi[y]!=null&&(Hi[y].parentLocale!=null?(Hi[y]=Hi[y].parentLocale,y===LO()&&LO(y)):Hi[y]!=null&&delete Hi[y]);return Hi[y]}function NS(y){var S;if(y&&y._locale&&y._locale._abbr&&(y=y._locale._abbr),!y)return mq;if(!n(y)){if(S=c6(y),S)return S;y=[y]}return A3t(y)}function R3t(){return $(Hi)}function Ise(y){var S,T=y._a;return T&&m(y).overflow===-2&&(S=T[RS]<0||T[RS]>11?RS:T[vy]<1||T[vy]>u6(T[$c],T[RS])?vy:T[Wu]<0||T[Wu]>24||T[Wu]===24&&(T[Zh]!==0||T[jS]!==0||T[XA]!==0)?Wu:T[Zh]<0||T[Zh]>59?Zh:T[jS]<0||T[jS]>59?jS:T[XA]<0||T[XA]>999?XA:-1,m(y)._overflowDayOfYear&&(S<$c||S>vy)&&(S=vy),m(y)._overflowWeeks&&S===-1&&(S=k4t),m(y)._overflowWeekday&&S===-1&&(S=B4t),m(y).overflow=S),y}var j3t=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,D3t=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,N3t=/Z|[+-]\d\d(?::?\d\d)?/,d6=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Mse=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],L3t=/^\/?Date\((-?\d+)/i,F3t=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,k3t={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Xje(y){var S,T,I=y._i,D=j3t.exec(I)||D3t.exec(I),H,ue,$t,Hr,Qo=d6.length,Td=Mse.length;if(D){for(m(y).iso=!0,S=0,T=Qo;S<T;S++)if(d6[S][1].exec(D[1])){ue=d6[S][0],H=d6[S][2]!==!1;break}if(ue==null){y._isValid=!1;return}if(D[3]){for(S=0,T=Td;S<T;S++)if(Mse[S][1].exec(D[3])){$t=(D[2]||" ")+Mse[S][0];break}if($t==null){y._isValid=!1;return}}if(!H&&$t!=null){y._isValid=!1;return}if(D[4])if(N3t.exec(D[4]))Hr="Z";else{y._isValid=!1;return}y._f=ue+($t||"")+(Hr||""),jse(y)}else y._isValid=!1}function B3t(y,S,T,I,D,H){var ue=[$3t(y),$je.indexOf(S),parseInt(T,10),parseInt(I,10),parseInt(D,10)];return H&&ue.push(parseInt(H,10)),ue}function $3t(y){var S=parseInt(y,10);return S<=49?2e3+S:S<=999?1900+S:S}function q3t(y){return y.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function U3t(y,S,T){if(y){var I=Kje.indexOf(y),D=new Date(S[0],S[1],S[2]).getDay();if(I!==D)return m(T).weekdayMismatch=!0,T._isValid=!1,!1}return!0}function z3t(y,S,T){if(y)return k3t[y];if(S)return 0;var I=parseInt(T,10),D=I%100,H=(I-D)/100;return H*60+D}function Qje(y){var S=F3t.exec(q3t(y._i)),T;if(S){if(T=B3t(S[4],S[3],S[2],S[5],S[6],S[7]),!U3t(S[1],T,y))return;y._a=T,y._tzm=z3t(S[8],S[9],S[10]),y._d=dq.apply(null,y._a),y._d.setUTCMinutes(y._d.getUTCMinutes()-y._tzm),m(y).rfc2822=!0}else y._isValid=!1}function H3t(y){var S=L3t.exec(y._i);if(S!==null){y._d=new Date(+S[1]);return}if(Xje(y),y._isValid===!1)delete y._isValid;else return;if(Qje(y),y._isValid===!1)delete y._isValid;else return;y._strict?y._isValid=!1:e.createFromInputFallback(y)}e.createFromInputFallback=A("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(y){y._d=new Date(y._i+(y._useUTC?" UTC":""))});function tD(y,S,T){return y??S??T}function V3t(y){var S=new Date(e.now());return y._useUTC?[S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate()]:[S.getFullYear(),S.getMonth(),S.getDate()]}function Rse(y){var S,T,I=[],D,H,ue;if(!y._d){for(D=V3t(y),y._w&&y._a[vy]==null&&y._a[RS]==null&&W3t(y),y._dayOfYear!=null&&(ue=tD(y._a[$c],D[$c]),(y._dayOfYear>cq(ue)||y._dayOfYear===0)&&(m(y)._overflowDayOfYear=!0),T=dq(ue,0,y._dayOfYear),y._a[RS]=T.getUTCMonth(),y._a[vy]=T.getUTCDate()),S=0;S<3&&y._a[S]==null;++S)y._a[S]=I[S]=D[S];for(;S<7;S++)y._a[S]=I[S]=y._a[S]==null?S===2?1:0:y._a[S];y._a[Wu]===24&&y._a[Zh]===0&&y._a[jS]===0&&y._a[XA]===0&&(y._nextDay=!0,y._a[Wu]=0),y._d=(y._useUTC?dq:X4t).apply(null,I),H=y._useUTC?y._d.getUTCDay():y._d.getDay(),y._tzm!=null&&y._d.setUTCMinutes(y._d.getUTCMinutes()-y._tzm),y._nextDay&&(y._a[Wu]=24),y._w&&typeof y._w.d<"u"&&y._w.d!==H&&(m(y).weekdayMismatch=!0)}}function W3t(y){var S,T,I,D,H,ue,$t,Hr,Qo;S=y._w,S.GG!=null||S.W!=null||S.E!=null?(H=1,ue=4,T=tD(S.GG,y._a[$c],fq(Ci(),1,4).year),I=tD(S.W,1),D=tD(S.E,1),(D<1||D>7)&&(Hr=!0)):(H=y._locale._week.dow,ue=y._locale._week.doy,Qo=fq(Ci(),H,ue),T=tD(S.gg,y._a[$c],Qo.year),I=tD(S.w,Qo.week),S.d!=null?(D=S.d,(D<0||D>6)&&(Hr=!0)):S.e!=null?(D=S.e+H,(S.e<0||S.e>6)&&(Hr=!0)):D=H),I<1||I>DS(T,H,ue)?m(y)._overflowWeeks=!0:Hr!=null?m(y)._overflowWeekday=!0:($t=Wje(T,I,D,H,ue),y._a[$c]=$t.year,y._dayOfYear=$t.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function jse(y){if(y._f===e.ISO_8601){Xje(y);return}if(y._f===e.RFC_2822){Qje(y);return}y._a=[],m(y).empty=!0;var S=""+y._i,T,I,D,H,ue,$t=S.length,Hr=0,Qo,Td;for(D=oe(y._f,y._locale).match(j)||[],Td=D.length,T=0;T<Td;T++)H=D[T],I=(S.match(Pd(H,y))||[])[0],I&&(ue=S.substr(0,S.indexOf(I)),ue.length>0&&m(y).unusedInput.push(ue),S=S.slice(S.indexOf(I)+I.length),Hr+=I.length),K[H]?(I?m(y).empty=!1:m(y).unusedTokens.push(H),lq(H,I,y)):y._strict&&!I&&m(y).unusedTokens.push(H);m(y).charsLeftOver=$t-Hr,S.length>0&&m(y).unusedInput.push(S),y._a[Wu]<=12&&m(y).bigHour===!0&&y._a[Wu]>0&&(m(y).bigHour=void 0),m(y).parsedDateParts=y._a.slice(0),m(y).meridiem=y._meridiem,y._a[Wu]=K3t(y._locale,y._a[Wu],y._meridiem),Qo=m(y).era,Qo!==null&&(y._a[$c]=y._locale.erasConvertYear(Qo,y._a[$c])),Rse(y),Ise(y)}function K3t(y,S,T){var I;return T==null?S:y.meridiemHour!=null?y.meridiemHour(S,T):(y.isPM!=null&&(I=y.isPM(T),I&&S<12&&(S+=12),!I&&S===12&&(S=0)),S)}function J3t(y){var S,T,I,D,H,ue,$t=!1,Hr=y._f.length;if(Hr===0){m(y).invalidFormat=!0,y._d=new Date(NaN);return}for(D=0;D<Hr;D++)H=0,ue=!1,S=x({},y),y._useUTC!=null&&(S._useUTC=y._useUTC),S._f=y._f[D],jse(S),v(S)&&(ue=!0),H+=m(S).charsLeftOver,H+=m(S).unusedTokens.length*10,m(S).score=H,$t?H<I&&(I=H,T=S):(I==null||H<I||ue)&&(I=H,T=S,ue&&($t=!0));d(y,T||S)}function G3t(y){if(!y._d){var S=vn(y._i),T=S.day===void 0?S.date:S.day;y._a=c([S.year,S.month,T,S.hour,S.minute,S.second,S.millisecond],function(I){return I&&parseInt(I,10)}),Rse(y)}}function Y3t(y){var S=new C(Ise(eDe(y)));return S._nextDay&&(S.add(1,"d"),S._nextDay=void 0),S}function eDe(y){var S=y._i,T=y._f;return y._locale=y._locale||NS(y._l),S===null||T===void 0&&S===""?g({nullInput:!0}):(typeof S=="string"&&(y._i=S=y._locale.preparse(S)),P(S)?new C(Ise(S)):(l(S)?y._d=S:n(T)?J3t(y):T?jse(y):Z3t(y),v(y)||(y._d=null),y))}function Z3t(y){var S=y._i;s(S)?y._d=new Date(e.now()):l(S)?y._d=new Date(S.valueOf()):typeof S=="string"?H3t(y):n(S)?(y._a=c(S.slice(0),function(T){return parseInt(T,10)}),Rse(y)):o(S)?G3t(y):u(S)?y._d=new Date(S):e.createFromInputFallback(y)}function tDe(y,S,T,I,D){var H={};return(S===!0||S===!1)&&(I=S,S=void 0),(T===!0||T===!1)&&(I=T,T=void 0),(o(y)&&a(y)||n(y)&&y.length===0)&&(y=void 0),H._isAMomentObject=!0,H._useUTC=H._isUTC=D,H._l=T,H._i=y,H._f=S,H._strict=I,Y3t(H)}function Ci(y,S,T,I){return tDe(y,S,T,I,!1)}var X3t=A("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var y=Ci.apply(null,arguments);return this.isValid()&&y.isValid()?y<this?this:y:g()}),Q3t=A("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var y=Ci.apply(null,arguments);return this.isValid()&&y.isValid()?y>this?this:y:g()});function rDe(y,S){var T,I;if(S.length===1&&n(S[0])&&(S=S[0]),!S.length)return Ci();for(T=S[0],I=1;I<S.length;++I)(!S[I].isValid()||S[I][y](T))&&(T=S[I]);return T}function eHt(){var y=[].slice.call(arguments,0);return rDe("isBefore",y)}function tHt(){var y=[].slice.call(arguments,0);return rDe("isAfter",y)}var rHt=function(){return Date.now?Date.now():+new Date},hq=["year","quarter","month","week","day","hour","minute","second","millisecond"];function nHt(y){var S,T=!1,I,D=hq.length;for(S in y)if(i(y,S)&&!(Wa.call(hq,S)!==-1&&(y[S]==null||!isNaN(y[S]))))return!1;for(I=0;I<D;++I)if(y[hq[I]]){if(T)return!1;parseFloat(y[hq[I]])!==be(y[hq[I]])&&(T=!0)}return!0}function oHt(){return this._isValid}function iHt(){return Xh(NaN)}function f6(y){var S=vn(y),T=S.year||0,I=S.quarter||0,D=S.month||0,H=S.week||S.isoWeek||0,ue=S.day||0,$t=S.hour||0,Hr=S.minute||0,Qo=S.second||0,Td=S.millisecond||0;this._isValid=nHt(S),this._milliseconds=+Td+Qo*1e3+Hr*6e4+$t*1e3*60*60,this._days=+ue+H*7,this._months=+D+I*3+T*12,this._data={},this._locale=NS(),this._bubble()}function p6(y){return y instanceof f6}function Dse(y){return y<0?Math.round(-1*y)*-1:Math.round(y)}function aHt(y,S,T){var I=Math.min(y.length,S.length),D=Math.abs(y.length-S.length),H=0,ue;for(ue=0;ue<I;ue++)(T&&y[ue]!==S[ue]||!T&&be(y[ue])!==be(S[ue]))&&H++;return H+D}function nDe(y,S){re(y,0,0,function(){var T=this.utcOffset(),I="+";return T<0&&(T=-T,I="-"),I+V(~~(T/60),2)+S+V(~~T%60,2)})}nDe("Z",":"),nDe("ZZ",""),ze("Z",Va),ze("ZZ",Va),an(["Z","ZZ"],function(y,S,T){T._useUTC=!0,T._tzm=Nse(Va,y)});var sHt=/([\+\-]|\d\d)/gi;function Nse(y,S){var T=(S||"").match(y),I,D,H;return T===null?null:(I=T[T.length-1]||[],D=(I+"").match(sHt)||["-",0,0],H=+(D[1]*60)+be(D[2]),H===0?0:D[0]==="+"?H:-H)}function Lse(y,S){var T,I;return S._isUTC?(T=S.clone(),I=(P(y)||l(y)?y.valueOf():Ci(y).valueOf())-T.valueOf(),T._d.setTime(T._d.valueOf()+I),e.updateOffset(T,!1),T):Ci(y).local()}function Fse(y){return-Math.round(y._d.getTimezoneOffset())}e.updateOffset=function(){};function uHt(y,S,T){var I=this._offset||0,D;if(!this.isValid())return y!=null?this:NaN;if(y!=null){if(typeof y=="string"){if(y=Nse(Va,y),y===null)return this}else Math.abs(y)<16&&!T&&(y=y*60);return!this._isUTC&&S&&(D=Fse(this)),this._offset=y,this._isUTC=!0,D!=null&&this.add(D,"m"),I!==y&&(!S||this._changeInProgress?sDe(this,Xh(y-I,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?I:Fse(this)}function lHt(y,S){return y!=null?(typeof y!="string"&&(y=-y),this.utcOffset(y,S),this):-this.utcOffset()}function cHt(y){return this.utcOffset(0,y)}function dHt(y){return this._isUTC&&(this.utcOffset(0,y),this._isUTC=!1,y&&this.subtract(Fse(this),"m")),this}function fHt(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var y=Nse(Bc,this._i);y!=null?this.utcOffset(y):this.utcOffset(0,!0)}return this}function pHt(y){return this.isValid()?(y=y?Ci(y).utcOffset():0,(this.utcOffset()-y)%60===0):!1}function mHt(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function hHt(){if(!s(this._isDSTShifted))return this._isDSTShifted;var y={},S;return x(y,this),y=eDe(y),y._a?(S=y._isUTC?f(y._a):Ci(y._a),this._isDSTShifted=this.isValid()&&aHt(y._a,S.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function gHt(){return this.isValid()?!this._isUTC:!1}function yHt(){return this.isValid()?this._isUTC:!1}function oDe(){return this.isValid()?this._isUTC&&this._offset===0:!1}var bHt=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,_Ht=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Xh(y,S){var T=y,I=null,D,H,ue;return p6(y)?T={ms:y._milliseconds,d:y._days,M:y._months}:u(y)||!isNaN(+y)?(T={},S?T[S]=+y:T.milliseconds=+y):(I=bHt.exec(y))?(D=I[1]==="-"?-1:1,T={y:0,d:be(I[vy])*D,h:be(I[Wu])*D,m:be(I[Zh])*D,s:be(I[jS])*D,ms:be(Dse(I[XA]*1e3))*D}):(I=_Ht.exec(y))?(D=I[1]==="-"?-1:1,T={y:QA(I[2],D),M:QA(I[3],D),w:QA(I[4],D),d:QA(I[5],D),h:QA(I[6],D),m:QA(I[7],D),s:QA(I[8],D)}):T==null?T={}:typeof T=="object"&&("from"in T||"to"in T)&&(ue=vHt(Ci(T.from),Ci(T.to)),T={},T.ms=ue.milliseconds,T.M=ue.months),H=new f6(T),p6(y)&&i(y,"_locale")&&(H._locale=y._locale),p6(y)&&i(y,"_isValid")&&(H._isValid=y._isValid),H}Xh.fn=f6.prototype,Xh.invalid=iHt;function QA(y,S){var T=y&&parseFloat(y.replace(",","."));return(isNaN(T)?0:T)*S}function iDe(y,S){var T={};return T.months=S.month()-y.month()+(S.year()-y.year())*12,y.clone().add(T.months,"M").isAfter(S)&&--T.months,T.milliseconds=+S-+y.clone().add(T.months,"M"),T}function vHt(y,S){var T;return y.isValid()&&S.isValid()?(S=Lse(S,y),y.isBefore(S)?T=iDe(y,S):(T=iDe(S,y),T.milliseconds=-T.milliseconds,T.months=-T.months),T):{milliseconds:0,months:0}}function aDe(y,S){return function(T,I){var D,H;return I!==null&&!isNaN(+I)&&(R(S,"moment()."+S+"(period, number) is deprecated. Please use moment()."+S+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),H=T,T=I,I=H),D=Xh(T,I),sDe(this,D,y),this}}function sDe(y,S,T,I){var D=S._milliseconds,H=Dse(S._days),ue=Dse(S._months);y.isValid()&&(I=I??!0,ue&&Uje(y,zr(y,"Month")+ue*T),H&&ia(y,"Date",zr(y,"Date")+H*T),D&&y._d.setTime(y._d.valueOf()+D*T),I&&e.updateOffset(y,H||ue))}var wHt=aDe(1,"add"),SHt=aDe(-1,"subtract");function uDe(y){return typeof y=="string"||y instanceof String}function xHt(y){return P(y)||l(y)||uDe(y)||u(y)||OHt(y)||CHt(y)||y===null||y===void 0}function CHt(y){var S=o(y)&&!a(y),T=!1,I=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],D,H,ue=I.length;for(D=0;D<ue;D+=1)H=I[D],T=T||i(y,H);return S&&T}function OHt(y){var S=n(y),T=!1;return S&&(T=y.filter(function(I){return!u(I)&&uDe(y)}).length===0),S&&T}function EHt(y){var S=o(y)&&!a(y),T=!1,I=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],D,H;for(D=0;D<I.length;D+=1)H=I[D],T=T||i(y,H);return S&&T}function PHt(y,S){var T=y.diff(S,"days",!0);return T<-6?"sameElse":T<-1?"lastWeek":T<0?"lastDay":T<1?"sameDay":T<2?"nextDay":T<7?"nextWeek":"sameElse"}function THt(y,S){arguments.length===1&&(arguments[0]?xHt(arguments[0])?(y=arguments[0],S=void 0):EHt(arguments[0])&&(S=arguments[0],y=void 0):(y=void 0,S=void 0));var T=y||Ci(),I=Lse(T,this).startOf("day"),D=e.calendarFormat(this,I)||"sameElse",H=S&&(N(S[D])?S[D].call(this,T):S[D]);return this.format(H||this.localeData().calendar(D,this,Ci(T)))}function AHt(){return new C(this)}function IHt(y,S){var T=P(y)?y:Ci(y);return this.isValid()&&T.isValid()?(S=ve(S)||"millisecond",S==="millisecond"?this.valueOf()>T.valueOf():T.valueOf()<this.clone().startOf(S).valueOf()):!1}function MHt(y,S){var T=P(y)?y:Ci(y);return this.isValid()&&T.isValid()?(S=ve(S)||"millisecond",S==="millisecond"?this.valueOf()<T.valueOf():this.clone().endOf(S).valueOf()<T.valueOf()):!1}function RHt(y,S,T,I){var D=P(y)?y:Ci(y),H=P(S)?S:Ci(S);return this.isValid()&&D.isValid()&&H.isValid()?(I=I||"()",(I[0]==="("?this.isAfter(D,T):!this.isBefore(D,T))&&(I[1]===")"?this.isBefore(H,T):!this.isAfter(H,T))):!1}function jHt(y,S){var T=P(y)?y:Ci(y),I;return this.isValid()&&T.isValid()?(S=ve(S)||"millisecond",S==="millisecond"?this.valueOf()===T.valueOf():(I=T.valueOf(),this.clone().startOf(S).valueOf()<=I&&I<=this.clone().endOf(S).valueOf())):!1}function DHt(y,S){return this.isSame(y,S)||this.isAfter(y,S)}function NHt(y,S){return this.isSame(y,S)||this.isBefore(y,S)}function LHt(y,S,T){var I,D,H;if(!this.isValid())return NaN;if(I=Lse(y,this),!I.isValid())return NaN;switch(D=(I.utcOffset()-this.utcOffset())*6e4,S=ve(S),S){case"year":H=m6(this,I)/12;break;case"month":H=m6(this,I);break;case"quarter":H=m6(this,I)/3;break;case"second":H=(this-I)/1e3;break;case"minute":H=(this-I)/6e4;break;case"hour":H=(this-I)/36e5;break;case"day":H=(this-I-D)/864e5;break;case"week":H=(this-I-D)/6048e5;break;default:H=this-I}return T?H:_e(H)}function m6(y,S){if(y.date()<S.date())return-m6(S,y);var T=(S.year()-y.year())*12+(S.month()-y.month()),I=y.clone().add(T,"months"),D,H;return S-I<0?(D=y.clone().add(T-1,"months"),H=(S-I)/(I-D)):(D=y.clone().add(T+1,"months"),H=(S-I)/(D-I)),-(T+H)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function FHt(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function kHt(y){if(!this.isValid())return null;var S=y!==!0,T=S?this.clone().utc():this;return T.year()<0||T.year()>9999?Q(T,S?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):N(Date.prototype.toISOString)?S?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Q(T,"Z")):Q(T,S?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function BHt(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var y="moment",S="",T,I,D,H;return this.isLocal()||(y=this.utcOffset()===0?"moment.utc":"moment.parseZone",S="Z"),T="["+y+'("]',I=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",D="-MM-DD[T]HH:mm:ss.SSS",H=S+'[")]',this.format(T+I+D+H)}function $Ht(y){y||(y=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var S=Q(this,y);return this.localeData().postformat(S)}function qHt(y,S){return this.isValid()&&(P(y)&&y.isValid()||Ci(y).isValid())?Xh({to:this,from:y}).locale(this.locale()).humanize(!S):this.localeData().invalidDate()}function UHt(y){return this.from(Ci(),y)}function zHt(y,S){return this.isValid()&&(P(y)&&y.isValid()||Ci(y).isValid())?Xh({from:this,to:y}).locale(this.locale()).humanize(!S):this.localeData().invalidDate()}function HHt(y){return this.to(Ci(),y)}function lDe(y){var S;return y===void 0?this._locale._abbr:(S=NS(y),S!=null&&(this._locale=S),this)}var cDe=A("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(y){return y===void 0?this.localeData():this.locale(y)});function dDe(){return this._locale}var h6=1e3,rD=60*h6,g6=60*rD,fDe=(365*400+97)*24*g6;function nD(y,S){return(y%S+S)%S}function pDe(y,S,T){return y<100&&y>=0?new Date(y+400,S,T)-fDe:new Date(y,S,T).valueOf()}function mDe(y,S,T){return y<100&&y>=0?Date.UTC(y+400,S,T)-fDe:Date.UTC(y,S,T)}function VHt(y){var S,T;if(y=ve(y),y===void 0||y==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?mDe:pDe,y){case"year":S=T(this.year(),0,1);break;case"quarter":S=T(this.year(),this.month()-this.month()%3,1);break;case"month":S=T(this.year(),this.month(),1);break;case"week":S=T(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":S=T(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":S=T(this.year(),this.month(),this.date());break;case"hour":S=this._d.valueOf(),S-=nD(S+(this._isUTC?0:this.utcOffset()*rD),g6);break;case"minute":S=this._d.valueOf(),S-=nD(S,rD);break;case"second":S=this._d.valueOf(),S-=nD(S,h6);break}return this._d.setTime(S),e.updateOffset(this,!0),this}function WHt(y){var S,T;if(y=ve(y),y===void 0||y==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?mDe:pDe,y){case"year":S=T(this.year()+1,0,1)-1;break;case"quarter":S=T(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":S=T(this.year(),this.month()+1,1)-1;break;case"week":S=T(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":S=T(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":S=T(this.year(),this.month(),this.date()+1)-1;break;case"hour":S=this._d.valueOf(),S+=g6-nD(S+(this._isUTC?0:this.utcOffset()*rD),g6)-1;break;case"minute":S=this._d.valueOf(),S+=rD-nD(S,rD)-1;break;case"second":S=this._d.valueOf(),S+=h6-nD(S,h6)-1;break}return this._d.setTime(S),e.updateOffset(this,!0),this}function KHt(){return this._d.valueOf()-(this._offset||0)*6e4}function JHt(){return Math.floor(this.valueOf()/1e3)}function GHt(){return new Date(this.valueOf())}function YHt(){var y=this;return[y.year(),y.month(),y.date(),y.hour(),y.minute(),y.second(),y.millisecond()]}function ZHt(){var y=this;return{years:y.year(),months:y.month(),date:y.date(),hours:y.hours(),minutes:y.minutes(),seconds:y.seconds(),milliseconds:y.milliseconds()}}function XHt(){return this.isValid()?this.toISOString():null}function QHt(){return v(this)}function e8t(){return d({},m(this))}function t8t(){return m(this).overflow}function r8t(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}re("N",0,0,"eraAbbr"),re("NN",0,0,"eraAbbr"),re("NNN",0,0,"eraAbbr"),re("NNNN",0,0,"eraName"),re("NNNNN",0,0,"eraNarrow"),re("y",["y",1],"yo","eraYear"),re("y",["yy",2],0,"eraYear"),re("y",["yyy",3],0,"eraYear"),re("y",["yyyy",4],0,"eraYear"),ze("N",kse),ze("NN",kse),ze("NNN",kse),ze("NNNN",p8t),ze("NNNNN",m8t),an(["N","NN","NNN","NNNN","NNNNN"],function(y,S,T,I){var D=T._locale.erasParse(y,I,T._strict);D?m(T).era=D:m(T).invalidEra=y}),ze("y",aa),ze("yy",aa),ze("yyy",aa),ze("yyyy",aa),ze("yo",h8t),an(["y","yy","yyy","yyyy"],$c),an(["yo"],function(y,S,T,I){var D;T._locale._eraYearOrdinalRegex&&(D=y.match(T._locale._eraYearOrdinalRegex)),T._locale.eraYearOrdinalParse?S[$c]=T._locale.eraYearOrdinalParse(y,D):S[$c]=parseInt(y,10)});function n8t(y,S){var T,I,D,H=this._eras||NS("en")._eras;for(T=0,I=H.length;T<I;++T){switch(typeof H[T].since){case"string":D=e(H[T].since).startOf("day"),H[T].since=D.valueOf();break}switch(typeof H[T].until){case"undefined":H[T].until=1/0;break;case"string":D=e(H[T].until).startOf("day").valueOf(),H[T].until=D.valueOf();break}}return H}function o8t(y,S,T){var I,D,H=this.eras(),ue,$t,Hr;for(y=y.toUpperCase(),I=0,D=H.length;I<D;++I)if(ue=H[I].name.toUpperCase(),$t=H[I].abbr.toUpperCase(),Hr=H[I].narrow.toUpperCase(),T)switch(S){case"N":case"NN":case"NNN":if($t===y)return H[I];break;case"NNNN":if(ue===y)return H[I];break;case"NNNNN":if(Hr===y)return H[I];break}else if([ue,$t,Hr].indexOf(y)>=0)return H[I]}function i8t(y,S){var T=y.since<=y.until?1:-1;return S===void 0?e(y.since).year():e(y.since).year()+(S-y.offset)*T}function a8t(){var y,S,T,I=this.localeData().eras();for(y=0,S=I.length;y<S;++y)if(T=this.clone().startOf("day").valueOf(),I[y].since<=T&&T<=I[y].until||I[y].until<=T&&T<=I[y].since)return I[y].name;return""}function s8t(){var y,S,T,I=this.localeData().eras();for(y=0,S=I.length;y<S;++y)if(T=this.clone().startOf("day").valueOf(),I[y].since<=T&&T<=I[y].until||I[y].until<=T&&T<=I[y].since)return I[y].narrow;return""}function u8t(){var y,S,T,I=this.localeData().eras();for(y=0,S=I.length;y<S;++y)if(T=this.clone().startOf("day").valueOf(),I[y].since<=T&&T<=I[y].until||I[y].until<=T&&T<=I[y].since)return I[y].abbr;return""}function l8t(){var y,S,T,I,D=this.localeData().eras();for(y=0,S=D.length;y<S;++y)if(T=D[y].since<=D[y].until?1:-1,I=this.clone().startOf("day").valueOf(),D[y].since<=I&&I<=D[y].until||D[y].until<=I&&I<=D[y].since)return(this.year()-e(D[y].since).year())*T+D[y].offset;return this.year()}function c8t(y){return i(this,"_erasNameRegex")||Bse.call(this),y?this._erasNameRegex:this._erasRegex}function d8t(y){return i(this,"_erasAbbrRegex")||Bse.call(this),y?this._erasAbbrRegex:this._erasRegex}function f8t(y){return i(this,"_erasNarrowRegex")||Bse.call(this),y?this._erasNarrowRegex:this._erasRegex}function kse(y,S){return S.erasAbbrRegex(y)}function p8t(y,S){return S.erasNameRegex(y)}function m8t(y,S){return S.erasNarrowRegex(y)}function h8t(y,S){return S._eraYearOrdinalRegex||aa}function Bse(){var y=[],S=[],T=[],I=[],D,H,ue=this.eras();for(D=0,H=ue.length;D<H;++D)S.push(Vu(ue[D].name)),y.push(Vu(ue[D].abbr)),T.push(Vu(ue[D].narrow)),I.push(Vu(ue[D].name)),I.push(Vu(ue[D].abbr)),I.push(Vu(ue[D].narrow));this._erasRegex=new RegExp("^("+I.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+S.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+y.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+T.join("|")+")","i")}re(0,["gg",2],0,function(){return this.weekYear()%100}),re(0,["GG",2],0,function(){return this.isoWeekYear()%100});function y6(y,S){re(0,[y,y.length],0,S)}y6("gggg","weekYear"),y6("ggggg","weekYear"),y6("GGGG","isoWeekYear"),y6("GGGGG","isoWeekYear"),nr("weekYear","gg"),nr("isoWeekYear","GG"),qe("weekYear",1),qe("isoWeekYear",1),ze("G",Od),ze("g",Od),ze("GG",wn,Ia),ze("gg",wn,Ia),ze("GGGG",Ma,hp),ze("gggg",Ma,hp),ze("GGGGG",us,ym),ze("ggggg",us,ym),Yh(["gggg","ggggg","GGGG","GGGGG"],function(y,S,T,I){S[I.substr(0,2)]=be(y)}),Yh(["gg","GG"],function(y,S,T,I){S[I]=e.parseTwoDigitYear(y)});function g8t(y){return hDe.call(this,y,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function y8t(y){return hDe.call(this,y,this.isoWeek(),this.isoWeekday(),1,4)}function b8t(){return DS(this.year(),1,4)}function _8t(){return DS(this.isoWeekYear(),1,4)}function v8t(){var y=this.localeData()._week;return DS(this.year(),y.dow,y.doy)}function w8t(){var y=this.localeData()._week;return DS(this.weekYear(),y.dow,y.doy)}function hDe(y,S,T,I,D){var H;return y==null?fq(this,I,D).year:(H=DS(y,I,D),S>H&&(S=H),S8t.call(this,y,S,T,I,D))}function S8t(y,S,T,I,D){var H=Wje(y,S,T,I,D),ue=dq(H.year,0,H.dayOfYear);return this.year(ue.getUTCFullYear()),this.month(ue.getUTCMonth()),this.date(ue.getUTCDate()),this}re("Q",0,"Qo","quarter"),nr("quarter","Q"),qe("quarter",7),ze("Q",Gh),an("Q",function(y,S){S[RS]=(be(y)-1)*3});function x8t(y){return y==null?Math.ceil((this.month()+1)/3):this.month((y-1)*3+this.month()%3)}re("D",["DD",2],"Do","date"),nr("date","D"),qe("date",9),ze("D",wn),ze("DD",wn,Ia),ze("Do",function(y,S){return y?S._dayOfMonthOrdinalParse||S._ordinalParse:S._dayOfMonthOrdinalParseLenient}),an(["D","DD"],vy),an("Do",function(y,S){S[vy]=be(y.match(wn)[0])});var gDe=Ue("Date",!0);re("DDD",["DDDD",3],"DDDo","dayOfYear"),nr("dayOfYear","DDD"),qe("dayOfYear",4),ze("DDD",NO),ze("DDDD",gm),an(["DDD","DDDD"],function(y,S,T){T._dayOfYear=be(y)});function C8t(y){var S=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return y==null?S:this.add(y-S,"d")}re("m",["mm",2],0,"minute"),nr("minute","m"),qe("minute",14),ze("m",wn),ze("mm",wn,Ia),an(["m","mm"],Zh);var O8t=Ue("Minutes",!1);re("s",["ss",2],0,"second"),nr("second","s"),qe("second",15),ze("s",wn),ze("ss",wn,Ia),an(["s","ss"],jS);var E8t=Ue("Seconds",!1);re("S",0,0,function(){return~~(this.millisecond()/100)}),re(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),re(0,["SSS",3],0,"millisecond"),re(0,["SSSS",4],0,function(){return this.millisecond()*10}),re(0,["SSSSS",5],0,function(){return this.millisecond()*100}),re(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),re(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),re(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),re(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),nr("millisecond","ms"),qe("millisecond",16),ze("S",NO,Gh),ze("SS",NO,Ia),ze("SSS",NO,gm);var FO,yDe;for(FO="SSSS";FO.length<=9;FO+="S")ze(FO,aa);function P8t(y,S){S[XA]=be(("0."+y)*1e3)}for(FO="S";FO.length<=9;FO+="S")an(FO,P8t);yDe=Ue("Milliseconds",!1),re("z",0,0,"zoneAbbr"),re("zz",0,0,"zoneName");function T8t(){return this._isUTC?"UTC":""}function A8t(){return this._isUTC?"Coordinated Universal Time":""}var je=C.prototype;je.add=wHt,je.calendar=THt,je.clone=AHt,je.diff=LHt,je.endOf=WHt,je.format=$Ht,je.from=qHt,je.fromNow=UHt,je.to=zHt,je.toNow=HHt,je.get=Hu,je.invalidAt=t8t,je.isAfter=IHt,je.isBefore=MHt,je.isBetween=RHt,je.isSame=jHt,je.isSameOrAfter=DHt,je.isSameOrBefore=NHt,je.isValid=QHt,je.lang=cDe,je.locale=lDe,je.localeData=dDe,je.max=Q3t,je.min=X3t,je.parsingFlags=e8t,je.set=Jh,je.startOf=VHt,je.subtract=SHt,je.toArray=YHt,je.toObject=ZHt,je.toDate=GHt,je.toISOString=kHt,je.inspect=BHt,typeof Symbol<"u"&&Symbol.for!=null&&(je[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),je.toJSON=XHt,je.toString=FHt,je.unix=JHt,je.valueOf=KHt,je.creationData=r8t,je.eraName=a8t,je.eraNarrow=s8t,je.eraAbbr=u8t,je.eraYear=l8t,je.year=Vje,je.isLeapYear=Z4t,je.weekYear=g8t,je.isoWeekYear=y8t,je.quarter=je.quarters=x8t,je.month=zje,je.daysInMonth=J4t,je.week=je.weeks=n3t,je.isoWeek=je.isoWeeks=o3t,je.weeksInYear=v8t,je.weeksInWeekYear=w8t,je.isoWeeksInYear=b8t,je.isoWeeksInISOWeekYear=_8t,je.date=gDe,je.day=je.days=y3t,je.weekday=b3t,je.isoWeekday=_3t,je.dayOfYear=C8t,je.hour=je.hours=E3t,je.minute=je.minutes=O8t,je.second=je.seconds=E8t,je.millisecond=je.milliseconds=yDe,je.utcOffset=uHt,je.utc=cHt,je.local=dHt,je.parseZone=fHt,je.hasAlignedHourOffset=pHt,je.isDST=mHt,je.isLocal=gHt,je.isUtcOffset=yHt,je.isUtc=oDe,je.isUTC=oDe,je.zoneAbbr=T8t,je.zoneName=A8t,je.dates=A("dates accessor is deprecated. Use date instead.",gDe),je.months=A("months accessor is deprecated. Use month instead",zje),je.years=A("years accessor is deprecated. Use year instead",Vje),je.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",lHt),je.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",hHt);function I8t(y){return Ci(y*1e3)}function M8t(){return Ci.apply(null,arguments).parseZone()}function bDe(y){return y}var Zn=F.prototype;Zn.calendar=J,Zn.longDateFormat=bt,Zn.invalidDate=Z,Zn.ordinal=Le,Zn.preparse=bDe,Zn.postformat=bDe,Zn.relativeTime=Ot,Zn.pastFuture=Yt,Zn.set=L,Zn.eras=n8t,Zn.erasParse=o8t,Zn.erasConvertYear=i8t,Zn.erasAbbrRegex=d8t,Zn.erasNameRegex=c8t,Zn.erasNarrowRegex=f8t,Zn.months=H4t,Zn.monthsShort=V4t,Zn.monthsParse=K4t,Zn.monthsRegex=Y4t,Zn.monthsShortRegex=G4t,Zn.week=Q4t,Zn.firstDayOfYear=r3t,Zn.firstDayOfWeek=t3t,Zn.weekdays=f3t,Zn.weekdaysMin=m3t,Zn.weekdaysShort=p3t,Zn.weekdaysParse=g3t,Zn.weekdaysRegex=v3t,Zn.weekdaysShortRegex=w3t,Zn.weekdaysMinRegex=S3t,Zn.isPM=C3t,Zn.meridiem=P3t;function b6(y,S,T,I){var D=NS(),H=f().set(I,S);return D[T](H,y)}function _De(y,S,T){if(u(y)&&(S=y,y=void 0),y=y||"",S!=null)return b6(y,S,T,"month");var I,D=[];for(I=0;I<12;I++)D[I]=b6(y,I,T,"month");return D}function $se(y,S,T,I){typeof y=="boolean"?(u(S)&&(T=S,S=void 0),S=S||""):(S=y,T=S,y=!1,u(S)&&(T=S,S=void 0),S=S||"");var D=NS(),H=y?D._week.dow:0,ue,$t=[];if(T!=null)return b6(S,(T+H)%7,I,"day");for(ue=0;ue<7;ue++)$t[ue]=b6(S,(ue+H)%7,I,"day");return $t}function R8t(y,S){return _De(y,S,"months")}function j8t(y,S){return _De(y,S,"monthsShort")}function D8t(y,S,T){return $se(y,S,T,"weekdays")}function N8t(y,S,T){return $se(y,S,T,"weekdaysShort")}function L8t(y,S,T){return $se(y,S,T,"weekdaysMin")}LO("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(y){var S=y%10,T=be(y%100/10)===1?"th":S===1?"st":S===2?"nd":S===3?"rd":"th";return y+T}}),e.lang=A("moment.lang is deprecated. Use moment.locale instead.",LO),e.langData=A("moment.langData is deprecated. Use moment.localeData instead.",NS);var LS=Math.abs;function F8t(){var y=this._data;return this._milliseconds=LS(this._milliseconds),this._days=LS(this._days),this._months=LS(this._months),y.milliseconds=LS(y.milliseconds),y.seconds=LS(y.seconds),y.minutes=LS(y.minutes),y.hours=LS(y.hours),y.months=LS(y.months),y.years=LS(y.years),this}function vDe(y,S,T,I){var D=Xh(S,T);return y._milliseconds+=I*D._milliseconds,y._days+=I*D._days,y._months+=I*D._months,y._bubble()}function k8t(y,S){return vDe(this,y,S,1)}function B8t(y,S){return vDe(this,y,S,-1)}function wDe(y){return y<0?Math.floor(y):Math.ceil(y)}function $8t(){var y=this._milliseconds,S=this._days,T=this._months,I=this._data,D,H,ue,$t,Hr;return y>=0&&S>=0&&T>=0||y<=0&&S<=0&&T<=0||(y+=wDe(qse(T)+S)*864e5,S=0,T=0),I.milliseconds=y%1e3,D=_e(y/1e3),I.seconds=D%60,H=_e(D/60),I.minutes=H%60,ue=_e(H/60),I.hours=ue%24,S+=_e(ue/24),Hr=_e(SDe(S)),T+=Hr,S-=wDe(qse(Hr)),$t=_e(T/12),T%=12,I.days=S,I.months=T,I.years=$t,this}function SDe(y){return y*4800/146097}function qse(y){return y*146097/4800}function q8t(y){if(!this.isValid())return NaN;var S,T,I=this._milliseconds;if(y=ve(y),y==="month"||y==="quarter"||y==="year")switch(S=this._days+I/864e5,T=this._months+SDe(S),y){case"month":return T;case"quarter":return T/3;case"year":return T/12}else switch(S=this._days+Math.round(qse(this._months)),y){case"week":return S/7+I/6048e5;case"day":return S+I/864e5;case"hour":return S*24+I/36e5;case"minute":return S*1440+I/6e4;case"second":return S*86400+I/1e3;case"millisecond":return Math.floor(S*864e5)+I;default:throw new Error("Unknown unit "+y)}}function U8t(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+be(this._months/12)*31536e6:NaN}function FS(y){return function(){return this.as(y)}}var z8t=FS("ms"),H8t=FS("s"),V8t=FS("m"),W8t=FS("h"),K8t=FS("d"),J8t=FS("w"),G8t=FS("M"),Y8t=FS("Q"),Z8t=FS("y");function X8t(){return Xh(this)}function Q8t(y){return y=ve(y),this.isValid()?this[y+"s"]():NaN}function eI(y){return function(){return this.isValid()?this._data[y]:NaN}}var eVt=eI("milliseconds"),tVt=eI("seconds"),rVt=eI("minutes"),nVt=eI("hours"),oVt=eI("days"),iVt=eI("months"),aVt=eI("years");function sVt(){return _e(this.days()/7)}var kS=Math.round,oD={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function uVt(y,S,T,I,D){return D.relativeTime(S||1,!!T,y,I)}function lVt(y,S,T,I){var D=Xh(y).abs(),H=kS(D.as("s")),ue=kS(D.as("m")),$t=kS(D.as("h")),Hr=kS(D.as("d")),Qo=kS(D.as("M")),Td=kS(D.as("w")),BS=kS(D.as("y")),kO=H<=T.ss&&["s",H]||H<T.s&&["ss",H]||ue<=1&&["m"]||ue<T.m&&["mm",ue]||$t<=1&&["h"]||$t<T.h&&["hh",$t]||Hr<=1&&["d"]||Hr<T.d&&["dd",Hr];return T.w!=null&&(kO=kO||Td<=1&&["w"]||Td<T.w&&["ww",Td]),kO=kO||Qo<=1&&["M"]||Qo<T.M&&["MM",Qo]||BS<=1&&["y"]||["yy",BS],kO[2]=S,kO[3]=+y>0,kO[4]=I,uVt.apply(null,kO)}function cVt(y){return y===void 0?kS:typeof y=="function"?(kS=y,!0):!1}function dVt(y,S){return oD[y]===void 0?!1:S===void 0?oD[y]:(oD[y]=S,y==="s"&&(oD.ss=S-1),!0)}function fVt(y,S){if(!this.isValid())return this.localeData().invalidDate();var T=!1,I=oD,D,H;return typeof y=="object"&&(S=y,y=!1),typeof y=="boolean"&&(T=y),typeof S=="object"&&(I=Object.assign({},oD,S),S.s!=null&&S.ss==null&&(I.ss=S.s-1)),D=this.localeData(),H=lVt(this,!T,I,D),T&&(H=D.pastFuture(+this,H)),D.postformat(H)}var Use=Math.abs;function iD(y){return(y>0)-(y<0)||+y}function _6(){if(!this.isValid())return this.localeData().invalidDate();var y=Use(this._milliseconds)/1e3,S=Use(this._days),T=Use(this._months),I,D,H,ue,$t=this.asSeconds(),Hr,Qo,Td,BS;return $t?(I=_e(y/60),D=_e(I/60),y%=60,I%=60,H=_e(T/12),T%=12,ue=y?y.toFixed(3).replace(/\.?0+$/,""):"",Hr=$t<0?"-":"",Qo=iD(this._months)!==iD($t)?"-":"",Td=iD(this._days)!==iD($t)?"-":"",BS=iD(this._milliseconds)!==iD($t)?"-":"",Hr+"P"+(H?Qo+H+"Y":"")+(T?Qo+T+"M":"")+(S?Td+S+"D":"")+(D||I||y?"T":"")+(D?BS+D+"H":"")+(I?BS+I+"M":"")+(y?BS+ue+"S":"")):"P0D"}var In=f6.prototype;In.isValid=oHt,In.abs=F8t,In.add=k8t,In.subtract=B8t,In.as=q8t,In.asMilliseconds=z8t,In.asSeconds=H8t,In.asMinutes=V8t,In.asHours=W8t,In.asDays=K8t,In.asWeeks=J8t,In.asMonths=G8t,In.asQuarters=Y8t,In.asYears=Z8t,In.valueOf=U8t,In._bubble=$8t,In.clone=X8t,In.get=Q8t,In.milliseconds=eVt,In.seconds=tVt,In.minutes=rVt,In.hours=nVt,In.days=oVt,In.weeks=sVt,In.months=iVt,In.years=aVt,In.humanize=fVt,In.toISOString=_6,In.toString=_6,In.toJSON=_6,In.locale=lDe,In.localeData=dDe,In.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",_6),In.lang=cDe,re("X",0,0,"unix"),re("x",0,0,"valueOf"),ze("x",Od),ze("X",df),an("X",function(y,S,T){T._d=new Date(parseFloat(y)*1e3)}),an("x",function(y,S,T){T._d=new Date(be(y))});return e.version="2.29.4",r(Ci),e.fn=je,e.min=eHt,e.max=tHt,e.now=rHt,e.utc=f,e.unix=I8t,e.months=R8t,e.isDate=l,e.locale=LO,e.invalid=g,e.duration=Xh,e.isMoment=P,e.weekdays=D8t,e.parseZone=M8t,e.localeData=NS,e.isDuration=p6,e.monthsShort=j8t,e.weekdaysMin=L8t,e.defineLocale=Ase,e.updateLocale=M3t,e.locales=R3t,e.weekdaysShort=N8t,e.normalizeUnits=ve,e.relativeTimeRounding=cVt,e.relativeTimeThreshold=dVt,e.calendarFormat=PHt,e.prototype=je,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e})});var Wce=b(f9=>{"use strict";f9.byteLength=qGt;f9.toByteArray=zGt;f9.fromByteArray=WGt;var jy=[],Im=[],$Gt=typeof Uint8Array<"u"?Uint8Array:Array,Vce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(zI=0,E$e=Vce.length;zI<E$e;++zI)jy[zI]=Vce[zI],Im[Vce.charCodeAt(zI)]=zI;var zI,E$e;Im[45]=62;Im[95]=63;function P$e(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function qGt(t){var e=P$e(t),r=e[0],n=e[1];return(r+n)*3/4-n}function UGt(t,e,r){return(e+r)*3/4-r}function zGt(t){var e,r=P$e(t),n=r[0],o=r[1],i=new $Gt(UGt(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=Im[t.charCodeAt(u)]<<18|Im[t.charCodeAt(u+1)]<<12|Im[t.charCodeAt(u+2)]<<6|Im[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=Im[t.charCodeAt(u)]<<2|Im[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=Im[t.charCodeAt(u)]<<10|Im[t.charCodeAt(u+1)]<<4|Im[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function HGt(t){return jy[t>>18&63]+jy[t>>12&63]+jy[t>>6&63]+jy[t&63]}function VGt(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),o.push(HGt(n));return o.join("")}function WGt(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(VGt(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(jy[e>>2]+jy[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(jy[e>>10]+jy[e>>4&63]+jy[e<<2&63]+"=")),o.join("")}});var T$e=b(Kce=>{Kce.read=function(t,e,r,n,o){var i,a,s=o*8-n-1,u=(1<<s)-1,l=u>>1,c=-7,d=r?o-1:0,f=r?-1:1,p=t[e+d];for(d+=f,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=i*256+t[e+d],d+=f,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=a*256+t[e+d],d+=f,c-=8);if(i===0)i=1-l;else{if(i===u)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-l}return(p?-1:1)*a*Math.pow(2,i-n)};Kce.write=function(t,e,r,n,o,i){var a,s,u,l=i*8-o-1,c=(1<<l)-1,d=c>>1,f=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?e+=f/u:e+=f*Math.pow(2,1-d),e*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(e*u-1)*Math.pow(2,o),a=a+d):(s=e*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;t[r+p]=s&255,p+=m,s/=256,o-=8);for(a=a<<o|s,l+=o;l>0;t[r+p]=a&255,p+=m,a/=256,l-=8);t[r+p-m]|=h*128}});var Tf=b(YD=>{"use strict";var Jce=Wce(),JD=T$e(),A$e=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;YD.Buffer=fe;YD.SlowBuffer=XGt;YD.INSPECT_MAX_BYTES=50;var p9=2147483647;YD.kMaxLength=p9;fe.TYPED_ARRAY_SUPPORT=KGt();!fe.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function KGt(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(fe.prototype,"parent",{enumerable:!0,get:function(){if(fe.isBuffer(this))return this.buffer}});Object.defineProperty(fe.prototype,"offset",{enumerable:!0,get:function(){if(fe.isBuffer(this))return this.byteOffset}});function ax(t){if(t>p9)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,fe.prototype),e}function fe(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Xce(t)}return j$e(t,e,r)}fe.poolSize=8192;function j$e(t,e,r){if(typeof t=="string")return GGt(t,e);if(ArrayBuffer.isView(t))return YGt(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Dy(t,ArrayBuffer)||t&&Dy(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Dy(t,SharedArrayBuffer)||t&&Dy(t.buffer,SharedArrayBuffer)))return Yce(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return fe.from(n,e,r);let o=ZGt(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return fe.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}fe.from=function(t,e,r){return j$e(t,e,r)};Object.setPrototypeOf(fe.prototype,Uint8Array.prototype);Object.setPrototypeOf(fe,Uint8Array);function D$e(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function JGt(t,e,r){return D$e(t),t<=0?ax(t):e!==void 0?typeof r=="string"?ax(t).fill(e,r):ax(t).fill(e):ax(t)}fe.alloc=function(t,e,r){return JGt(t,e,r)};function Xce(t){return D$e(t),ax(t<0?0:Qce(t)|0)}fe.allocUnsafe=function(t){return Xce(t)};fe.allocUnsafeSlow=function(t){return Xce(t)};function GGt(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!fe.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=N$e(t,e)|0,n=ax(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function Gce(t){let e=t.length<0?0:Qce(t.length)|0,r=ax(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function YGt(t){if(Dy(t,Uint8Array)){let e=new Uint8Array(t);return Yce(e.buffer,e.byteOffset,e.byteLength)}return Gce(t)}function Yce(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,fe.prototype),n}function ZGt(t){if(fe.isBuffer(t)){let e=Qce(t.length)|0,r=ax(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||tde(t.length)?ax(0):Gce(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Gce(t.data)}function Qce(t){if(t>=p9)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+p9.toString(16)+" bytes");return t|0}function XGt(t){return+t!=t&&(t=0),fe.alloc(+t)}fe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==fe.prototype};fe.compare=function(e,r){if(Dy(e,Uint8Array)&&(e=fe.from(e,e.offset,e.byteLength)),Dy(r,Uint8Array)&&(r=fe.from(r,r.offset,r.byteLength)),!fe.isBuffer(e)||!fe.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,o=r.length;for(let i=0,a=Math.min(n,o);i<a;++i)if(e[i]!==r[i]){n=e[i],o=r[i];break}return n<o?-1:o<n?1:0};fe.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};fe.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return fe.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=fe.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(Dy(a,Uint8Array))i+a.length>o.length?(fe.isBuffer(a)||(a=fe.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(fe.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function N$e(t,e){if(fe.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Dy(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Zce(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return H$e(t).length;default:if(o)return n?-1:Zce(t).length;e=(""+e).toLowerCase(),o=!0}}fe.byteLength=N$e;function QGt(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return l7t(this,e,r);case"utf8":case"utf-8":return F$e(this,e,r);case"ascii":return s7t(this,e,r);case"latin1":case"binary":return u7t(this,e,r);case"base64":return i7t(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c7t(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}fe.prototype._isBuffer=!0;function HI(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}fe.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)HI(this,r,r+1);return this};fe.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)HI(this,r,r+3),HI(this,r+1,r+2);return this};fe.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)HI(this,r,r+7),HI(this,r+1,r+6),HI(this,r+2,r+5),HI(this,r+3,r+4);return this};fe.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?F$e(this,0,e):QGt.apply(this,arguments)};fe.prototype.toLocaleString=fe.prototype.toString;fe.prototype.equals=function(e){if(!fe.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:fe.compare(this,e)===0};fe.prototype.inspect=function(){let e="",r=YD.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};A$e&&(fe.prototype[A$e]=fe.prototype.inspect);fe.prototype.compare=function(e,r,n,o,i){if(Dy(e,Uint8Array)&&(e=fe.from(e,e.offset,e.byteLength)),!fe.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),r<0||n>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===e)return 0;let a=i-o,s=n-r,u=Math.min(a,s),l=this.slice(o,i),c=e.slice(r,n);for(let d=0;d<u;++d)if(l[d]!==c[d]){a=l[d],s=c[d];break}return a<s?-1:s<a?1:0};function L$e(t,e,r,n,o){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,tde(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof e=="string"&&(e=fe.from(e,n)),fe.isBuffer(e))return e.length===0?-1:I$e(t,e,r,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):I$e(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function I$e(t,e,r,n,o){let i=1,a=t.length,s=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;i=2,a/=2,s/=2,r/=2}function u(c,d){return i===1?c[d]:c.readUInt16BE(d*i)}let l;if(o){let c=-1;for(l=r;l<a;l++)if(u(t,l)===u(e,c===-1?0:l-c)){if(c===-1&&(c=l),l-c+1===s)return c*i}else c!==-1&&(l-=l-c),c=-1}else for(r+s>a&&(r=a-s),l=r;l>=0;l--){let c=!0;for(let d=0;d<s;d++)if(u(t,l+d)!==u(e,d)){c=!1;break}if(c)return l}return-1}fe.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};fe.prototype.indexOf=function(e,r,n){return L$e(this,e,r,n,!0)};fe.prototype.lastIndexOf=function(e,r,n){return L$e(this,e,r,n,!1)};function e7t(t,e,r,n){r=Number(r)||0;let o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;let i=e.length;n>i/2&&(n=i/2);let a;for(a=0;a<n;++a){let s=parseInt(e.substr(a*2,2),16);if(tde(s))return a;t[r+a]=s}return a}function t7t(t,e,r,n){return m9(Zce(e,t.length-r),t,r,n)}function r7t(t,e,r,n){return m9(m7t(e),t,r,n)}function n7t(t,e,r,n){return m9(H$e(e),t,r,n)}function o7t(t,e,r,n){return m9(h7t(e,t.length-r),t,r,n)}fe.prototype.write=function(e,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let i=this.length-r;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let a=!1;for(;;)switch(o){case"hex":return e7t(this,e,r,n);case"utf8":case"utf-8":return t7t(this,e,r,n);case"ascii":case"latin1":case"binary":return r7t(this,e,r,n);case"base64":return n7t(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o7t(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};fe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function i7t(t,e,r){return e===0&&r===t.length?Jce.fromByteArray(t):Jce.fromByteArray(t.slice(e,r))}function F$e(t,e,r){r=Math.min(t.length,r);let n=[],o=e;for(;o<r;){let i=t[o],a=null,s=i>239?4:i>223?3:i>191?2:1;if(o+s<=r){let u,l,c,d;switch(s){case 1:i<128&&(a=i);break;case 2:u=t[o+1],(u&192)===128&&(d=(i&31)<<6|u&63,d>127&&(a=d));break;case 3:u=t[o+1],l=t[o+2],(u&192)===128&&(l&192)===128&&(d=(i&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:u=t[o+1],l=t[o+2],c=t[o+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(d=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),o+=s}return a7t(n)}var M$e=4096;function a7t(t){let e=t.length;if(e<=M$e)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=M$e));return r}function s7t(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]&127);return n}function u7t(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function l7t(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let i=e;i<r;++i)o+=g7t[t[i]];return o}function c7t(t,e,r){let n=t.slice(e,r),o="";for(let i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}fe.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let o=this.subarray(e,r);return Object.setPrototypeOf(o,fe.prototype),o};function Sl(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}fe.prototype.readUintLE=fe.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Sl(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};fe.prototype.readUintBE=fe.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Sl(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};fe.prototype.readUint8=fe.prototype.readUInt8=function(e,r){return e=e>>>0,r||Sl(e,1,this.length),this[e]};fe.prototype.readUint16LE=fe.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Sl(e,2,this.length),this[e]|this[e+1]<<8};fe.prototype.readUint16BE=fe.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Sl(e,2,this.length),this[e]<<8|this[e+1]};fe.prototype.readUint32LE=fe.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Sl(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};fe.prototype.readUint32BE=fe.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Sl(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};fe.prototype.readBigUInt64LE=sE(function(e){e=e>>>0,GD(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&mU(e,this.length-8);let o=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(i)<<BigInt(32))});fe.prototype.readBigUInt64BE=sE(function(e){e=e>>>0,GD(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&mU(e,this.length-8);let o=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(o)<<BigInt(32))+BigInt(i)});fe.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Sl(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o};fe.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Sl(e,r,this.length);let o=r,i=1,a=this[e+--o];for(;o>0&&(i*=256);)a+=this[e+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*r)),a};fe.prototype.readInt8=function(e,r){return e=e>>>0,r||Sl(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};fe.prototype.readInt16LE=function(e,r){e=e>>>0,r||Sl(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};fe.prototype.readInt16BE=function(e,r){e=e>>>0,r||Sl(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};fe.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Sl(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};fe.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Sl(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};fe.prototype.readBigInt64LE=sE(function(e){e=e>>>0,GD(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&mU(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(o)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});fe.prototype.readBigInt64BE=sE(function(e){e=e>>>0,GD(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&mU(e,this.length-8);let o=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});fe.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Sl(e,4,this.length),JD.read(this,e,!0,23,4)};fe.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Sl(e,4,this.length),JD.read(this,e,!1,23,4)};fe.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Sl(e,8,this.length),JD.read(this,e,!0,52,8)};fe.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Sl(e,8,this.length),JD.read(this,e,!1,52,8)};function Pf(t,e,r,n,o,i){if(!fe.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}fe.prototype.writeUintLE=fe.prototype.writeUIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;Pf(this,e,r,n,s,0)}let i=1,a=0;for(this[r]=e&255;++a<n&&(i*=256);)this[r+a]=e/i&255;return r+n};fe.prototype.writeUintBE=fe.prototype.writeUIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){let s=Math.pow(2,8*n)-1;Pf(this,e,r,n,s,0)}let i=n-1,a=1;for(this[r+i]=e&255;--i>=0&&(a*=256);)this[r+i]=e/a&255;return r+n};fe.prototype.writeUint8=fe.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Pf(this,e,r,1,255,0),this[r]=e&255,r+1};fe.prototype.writeUint16LE=fe.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Pf(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};fe.prototype.writeUint16BE=fe.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Pf(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};fe.prototype.writeUint32LE=fe.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Pf(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};fe.prototype.writeUint32BE=fe.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Pf(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function k$e(t,e,r,n,o){z$e(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i=i>>8,t[r++]=i,i=i>>8,t[r++]=i,i=i>>8,t[r++]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,r}function B$e(t,e,r,n,o){z$e(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i=i>>8,t[r+6]=i,i=i>>8,t[r+5]=i,i=i>>8,t[r+4]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a=a>>8,t[r+2]=a,a=a>>8,t[r+1]=a,a=a>>8,t[r]=a,r+8}fe.prototype.writeBigUInt64LE=sE(function(e,r=0){return k$e(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});fe.prototype.writeBigUInt64BE=sE(function(e,r=0){return B$e(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});fe.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Pf(this,e,r,n,u-1,-u)}let i=0,a=1,s=0;for(this[r]=e&255;++i<n&&(a*=256);)e<0&&s===0&&this[r+i-1]!==0&&(s=1),this[r+i]=(e/a>>0)-s&255;return r+n};fe.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Pf(this,e,r,n,u-1,-u)}let i=n-1,a=1,s=0;for(this[r+i]=e&255;--i>=0&&(a*=256);)e<0&&s===0&&this[r+i+1]!==0&&(s=1),this[r+i]=(e/a>>0)-s&255;return r+n};fe.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Pf(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};fe.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Pf(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};fe.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Pf(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};fe.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Pf(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};fe.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Pf(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};fe.prototype.writeBigInt64LE=sE(function(e,r=0){return k$e(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});fe.prototype.writeBigInt64BE=sE(function(e,r=0){return B$e(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function $$e(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function q$e(t,e,r,n,o){return e=+e,r=r>>>0,o||$$e(t,e,r,4,34028234663852886e22,-34028234663852886e22),JD.write(t,e,r,n,23,4),r+4}fe.prototype.writeFloatLE=function(e,r,n){return q$e(this,e,r,!0,n)};fe.prototype.writeFloatBE=function(e,r,n){return q$e(this,e,r,!1,n)};function U$e(t,e,r,n,o){return e=+e,r=r>>>0,o||$$e(t,e,r,8,17976931348623157e292,-17976931348623157e292),JD.write(t,e,r,n,52,8),r+8}fe.prototype.writeDoubleLE=function(e,r,n){return U$e(this,e,r,!0,n)};fe.prototype.writeDoubleBE=function(e,r,n){return U$e(this,e,r,!1,n)};fe.prototype.copy=function(e,r,n,o){if(!fe.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);let i=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),r),i};fe.prototype.fill=function(e,r,n,o){if(typeof e=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!fe.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let a=e.charCodeAt(0);(o==="utf8"&&a<128||o==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let i;if(typeof e=="number")for(i=r;i<n;++i)this[i]=e;else{let a=fe.isBuffer(e)?e:fe.from(e,o),s=a.length;if(s===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-r;++i)this[i+r]=a[i%s]}return this};var KD={};function ede(t,e,r){KD[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}ede("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ede("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ede("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=R$e(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=R$e(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function R$e(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function d7t(t,e,r){GD(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&mU(e,t.length-(r+1))}function z$e(t,e,r,n,o,i){if(t>r||t<e){let a=typeof e=="bigint"?"n":"",s;throw i>3?e===0||e===BigInt(0)?s=`>= 0${a} and < 2${a} ** ${(i+1)*8}${a}`:s=`>= -(2${a} ** ${(i+1)*8-1}${a}) and < 2 ** ${(i+1)*8-1}${a}`:s=`>= ${e}${a} and <= ${r}${a}`,new KD.ERR_OUT_OF_RANGE("value",s,t)}d7t(n,o,i)}function GD(t,e){if(typeof t!="number")throw new KD.ERR_INVALID_ARG_TYPE(e,"number",t)}function mU(t,e,r){throw Math.floor(t)!==t?(GD(t,r),new KD.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new KD.ERR_BUFFER_OUT_OF_BOUNDS:new KD.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var f7t=/[^+/0-9A-Za-z-_]/g;function p7t(t){if(t=t.split("=")[0],t=t.trim().replace(f7t,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Zce(t,e){e=e||1/0;let r,n=t.length,o=null,i=[];for(let a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}function m7t(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function h7t(t,e){let r,n,o,i=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function H$e(t){return Jce.toByteArray(p7t(t))}function m9(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function Dy(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function tde(t){return t!==t}var g7t=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function sE(t){return typeof BigInt>"u"?y7t:t}function y7t(){throw new Error("BigInt not supported")}});var uqe=b(gi=>{"use strict";function dde(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<S9(o,e))t[n]=e,t[r]=o,r=n;else break e}}function lg(t){return t.length===0?null:t[0]}function C9(t){if(t.length===0)return null;var e=t[0],r=t.pop();if(r!==e){t[0]=r;e:for(var n=0,o=t.length,i=o>>>1;n<i;){var a=2*(n+1)-1,s=t[a],u=a+1,l=t[u];if(0>S9(s,r))u<o&&0>S9(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>S9(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function S9(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(Q$e=performance,gi.unstable_now=function(){return Q$e.now()}):(ude=Date,eqe=ude.now(),gi.unstable_now=function(){return ude.now()-eqe});var Q$e,ude,eqe,Ly=[],uE=[],w7t=1,Mm=null,Yc=3,O9=!1,VI=!1,yU=!1,nqe=typeof setTimeout=="function"?setTimeout:null,oqe=typeof clearTimeout=="function"?clearTimeout:null,tqe=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function fde(t){for(var e=lg(uE);e!==null;){if(e.callback===null)C9(uE);else if(e.startTime<=t)C9(uE),e.sortIndex=e.expirationTime,dde(Ly,e);else break;e=lg(uE)}}function pde(t){if(yU=!1,fde(t),!VI)if(lg(Ly)!==null)VI=!0,hde(mde);else{var e=lg(uE);e!==null&&gde(pde,e.startTime-t)}}function mde(t,e){VI=!1,yU&&(yU=!1,oqe(bU),bU=-1),O9=!0;var r=Yc;try{for(fde(e),Mm=lg(Ly);Mm!==null&&(!(Mm.expirationTime>e)||t&&!sqe());){var n=Mm.callback;if(typeof n=="function"){Mm.callback=null,Yc=Mm.priorityLevel;var o=n(Mm.expirationTime<=e);e=gi.unstable_now(),typeof o=="function"?Mm.callback=o:Mm===lg(Ly)&&C9(Ly),fde(e)}else C9(Ly);Mm=lg(Ly)}if(Mm!==null)var i=!0;else{var a=lg(uE);a!==null&&gde(pde,a.startTime-e),i=!1}return i}finally{Mm=null,Yc=r,O9=!1}}var E9=!1,x9=null,bU=-1,iqe=5,aqe=-1;function sqe(){return!(gi.unstable_now()-aqe<iqe)}function lde(){if(x9!==null){var t=gi.unstable_now();aqe=t;var e=!0;try{e=x9(!0,t)}finally{e?gU():(E9=!1,x9=null)}}else E9=!1}var gU;typeof tqe=="function"?gU=function(){tqe(lde)}:typeof MessageChannel<"u"?(cde=new MessageChannel,rqe=cde.port2,cde.port1.onmessage=lde,gU=function(){rqe.postMessage(null)}):gU=function(){nqe(lde,0)};var cde,rqe;function hde(t){x9=t,E9||(E9=!0,gU())}function gde(t,e){bU=nqe(function(){t(gi.unstable_now())},e)}gi.unstable_IdlePriority=5;gi.unstable_ImmediatePriority=1;gi.unstable_LowPriority=4;gi.unstable_NormalPriority=3;gi.unstable_Profiling=null;gi.unstable_UserBlockingPriority=2;gi.unstable_cancelCallback=function(t){t.callback=null};gi.unstable_continueExecution=function(){VI||O9||(VI=!0,hde(mde))};gi.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):iqe=0<t?Math.floor(1e3/t):5};gi.unstable_getCurrentPriorityLevel=function(){return Yc};gi.unstable_getFirstCallbackNode=function(){return lg(Ly)};gi.unstable_next=function(t){switch(Yc){case 1:case 2:case 3:var e=3;break;default:e=Yc}var r=Yc;Yc=e;try{return t()}finally{Yc=r}};gi.unstable_pauseExecution=function(){};gi.unstable_requestPaint=function(){};gi.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=Yc;Yc=t;try{return e()}finally{Yc=r}};gi.unstable_scheduleCallback=function(t,e,r){var n=gi.unstable_now();switch(typeof r=="object"&&r!==null?(r=r.delay,r=typeof r=="number"&&0<r?n+r:n):r=n,t){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return o=r+o,t={id:w7t++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,dde(uE,t),lg(Ly)===null&&t===lg(uE)&&(yU?(oqe(bU),bU=-1):yU=!0,gde(pde,r-n))):(t.sortIndex=o,dde(Ly,t),VI||O9||(VI=!0,hde(mde))),t};gi.unstable_shouldYield=sqe;gi.unstable_wrapCallback=function(t){var e=Yc;return function(){var r=Yc;Yc=e;try{return t.apply(this,arguments)}finally{Yc=r}}}});var cqe=b((GTn,lqe)=>{"use strict";lqe.exports=uqe()});var g2e=b(Mp=>{"use strict";var yUe=X(),Ap=cqe();function Me(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var bUe=new Set,$U={};function oM(t,e){_N(t,e),_N(t+"Capture",e)}function _N(t,e){for($U[t]=e,t=0;t<e.length;t++)bUe.add(e[t])}var fx=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bde=Object.prototype.hasOwnProperty,S7t=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,dqe={},fqe={};function x7t(t){return Bde.call(fqe,t)?!0:Bde.call(dqe,t)?!1:S7t.test(t)?fqe[t]=!0:(dqe[t]=!0,!1)}function C7t(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function O7t(t,e,r,n){if(e===null||typeof e>"u"||C7t(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Hd(t,e,r,n,o,i,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=a}var ec={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){ec[t]=new Hd(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];ec[e]=new Hd(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){ec[t]=new Hd(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){ec[t]=new Hd(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){ec[t]=new Hd(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){ec[t]=new Hd(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){ec[t]=new Hd(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){ec[t]=new Hd(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){ec[t]=new Hd(t,5,!1,t.toLowerCase(),null,!1,!1)});var Mfe=/[\-:]([a-z])/g;function Rfe(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Mfe,Rfe);ec[e]=new Hd(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Mfe,Rfe);ec[e]=new Hd(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Mfe,Rfe);ec[e]=new Hd(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){ec[t]=new Hd(t,1,!1,t.toLowerCase(),null,!1,!1)});ec.xlinkHref=new Hd("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){ec[t]=new Hd(t,1,!1,t.toLowerCase(),null,!0,!0)});function jfe(t,e,r,n){var o=ec.hasOwnProperty(e)?ec[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(O7t(e,r,o,n)&&(r=null),n||o===null?x7t(e)&&(r===null?t.removeAttribute(e):t.setAttribute(e,""+r)):o.mustUseProperty?t[o.propertyName]=r===null?o.type===3?!1:"":r:(e=o.attributeName,n=o.attributeNamespace,r===null?t.removeAttribute(e):(o=o.type,r=o===3||o===4&&r===!0?"":""+r,n?t.setAttributeNS(n,e,r):t.setAttribute(e,r))))}var gx=yUe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,P9=Symbol.for("react.element"),tN=Symbol.for("react.portal"),rN=Symbol.for("react.fragment"),Dfe=Symbol.for("react.strict_mode"),$de=Symbol.for("react.profiler"),_Ue=Symbol.for("react.provider"),vUe=Symbol.for("react.context"),Nfe=Symbol.for("react.forward_ref"),qde=Symbol.for("react.suspense"),Ude=Symbol.for("react.suspense_list"),Lfe=Symbol.for("react.memo"),cE=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var wUe=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var pqe=Symbol.iterator;function _U(t){return t===null||typeof t!="object"?null:(t=pqe&&t[pqe]||t["@@iterator"],typeof t=="function"?t:null)}var la=Object.assign,yde;function PU(t){if(yde===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);yde=e&&e[1]||""}return`
`+yde+t}var bde=!1;function _de(t,e){if(!t||bde)return"";bde=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(l){var n=l}Reflect.construct(t,[],e)}else{try{e.call()}catch(l){n=l}t.call(e.prototype)}else{try{throw Error()}catch(l){n=l}t()}}catch(l){if(l&&n&&typeof l.stack=="string"){for(var o=l.stack.split(`
`),i=n.stack.split(`
`),a=o.length-1,s=i.length-1;1<=a&&0<=s&&o[a]!==i[s];)s--;for(;1<=a&&0<=s;a--,s--)if(o[a]!==i[s]){if(a!==1||s!==1)do if(a--,s--,0>s||o[a]!==i[s]){var u=`
`+o[a].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=a&&0<=s);break}}}finally{bde=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?PU(t):""}function E7t(t){switch(t.tag){case 5:return PU(t.type);case 16:return PU("Lazy");case 13:return PU("Suspense");case 19:return PU("SuspenseList");case 0:case 2:case 15:return t=_de(t.type,!1),t;case 11:return t=_de(t.type.render,!1),t;case 1:return t=_de(t.type,!0),t;default:return""}}function zde(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case rN:return"Fragment";case tN:return"Portal";case $de:return"Profiler";case Dfe:return"StrictMode";case qde:return"Suspense";case Ude:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case vUe:return(t.displayName||"Context")+".Consumer";case _Ue:return(t._context.displayName||"Context")+".Provider";case Nfe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Lfe:return e=t.displayName||null,e!==null?e:zde(t.type)||"Memo";case cE:e=t._payload,t=t._init;try{return zde(t(e))}catch{}}return null}function P7t(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return zde(e);case 8:return e===Dfe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function CE(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function SUe(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function T7t(t){var e=SUe(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(a){n=""+a,i.call(this,a)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(a){n=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function T9(t){t._valueTracker||(t._valueTracker=T7t(t))}function xUe(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=SUe(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function rW(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Hde(t,e){var r=e.checked;return la({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function mqe(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=CE(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function CUe(t,e){e=e.checked,e!=null&&jfe(t,"checked",e,!1)}function Vde(t,e){CUe(t,e);var r=CE(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Wde(t,e.type,r):e.hasOwnProperty("defaultValue")&&Wde(t,e.type,CE(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function hqe(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function Wde(t,e,r){(e!=="number"||rW(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var TU=Array.isArray;function pN(t,e,r,n){if(t=t.options,e){e={};for(var o=0;o<r.length;o++)e["$"+r[o]]=!0;for(r=0;r<t.length;r++)o=e.hasOwnProperty("$"+t[r].value),t[r].selected!==o&&(t[r].selected=o),o&&n&&(t[r].defaultSelected=!0)}else{for(r=""+CE(r),e=null,o=0;o<t.length;o++){if(t[o].value===r){t[o].selected=!0,n&&(t[o].defaultSelected=!0);return}e!==null||t[o].disabled||(e=t[o])}e!==null&&(e.selected=!0)}}function Kde(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Me(91));return la({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function gqe(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(Me(92));if(TU(r)){if(1<r.length)throw Error(Me(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:CE(r)}}function OUe(t,e){var r=CE(e.value),n=CE(e.defaultValue);r!=null&&(r=""+r,r!==t.value&&(t.value=r),e.defaultValue==null&&t.defaultValue!==r&&(t.defaultValue=r)),n!=null&&(t.defaultValue=""+n)}function yqe(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function EUe(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Jde(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?EUe(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var A9,PUe=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,r,n,o){MSApp.execUnsafeLocalFunction(function(){return t(e,r,n,o)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(A9=A9||document.createElement("div"),A9.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=A9.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function qU(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var MU={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},A7t=["Webkit","ms","Moz","O"];Object.keys(MU).forEach(function(t){A7t.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),MU[e]=MU[t]})});function TUe(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||MU.hasOwnProperty(t)&&MU[t]?(""+e).trim():e+"px"}function AUe(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=TUe(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var I7t=la({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Gde(t,e){if(e){if(I7t[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Me(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Me(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Me(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Me(62))}}function Yde(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Zde=null;function Ffe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Xde=null,mN=null,hN=null;function bqe(t){if(t=iz(t)){if(typeof Xde!="function")throw Error(Me(280));var e=t.stateNode;e&&(e=IW(e),Xde(t.stateNode,t.type,e))}}function IUe(t){mN?hN?hN.push(t):hN=[t]:mN=t}function MUe(){if(mN){var t=mN,e=hN;if(hN=mN=null,bqe(t),e)for(t=0;t<e.length;t++)bqe(e[t])}}function RUe(t,e){return t(e)}function jUe(){}var vde=!1;function DUe(t,e,r){if(vde)return t(e,r);vde=!0;try{return RUe(t,e,r)}finally{vde=!1,(mN!==null||hN!==null)&&(jUe(),MUe())}}function UU(t,e){var r=t.stateNode;if(r===null)return null;var n=IW(r);if(n===null)return null;r=n[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(Me(231,e,typeof r));return r}var Qde=!1;if(fx)try{QD={},Object.defineProperty(QD,"passive",{get:function(){Qde=!0}}),window.addEventListener("test",QD,QD),window.removeEventListener("test",QD,QD)}catch{Qde=!1}var QD;function M7t(t,e,r,n,o,i,a,s,u){var l=Array.prototype.slice.call(arguments,3);try{e.apply(r,l)}catch(c){this.onError(c)}}var RU=!1,nW=null,oW=!1,efe=null,R7t={onError:function(t){RU=!0,nW=t}};function j7t(t,e,r,n,o,i,a,s,u){RU=!1,nW=null,M7t.apply(R7t,arguments)}function D7t(t,e,r,n,o,i,a,s,u){if(j7t.apply(this,arguments),RU){if(RU){var l=nW;RU=!1,nW=null}else throw Error(Me(198));oW||(oW=!0,efe=l)}}function iM(t){var e=t,r=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.flags&4098)!==0&&(r=e.return),t=e.return;while(t)}return e.tag===3?r:null}function NUe(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function _qe(t){if(iM(t)!==t)throw Error(Me(188))}function N7t(t){var e=t.alternate;if(!e){if(e=iM(t),e===null)throw Error(Me(188));return e!==t?null:t}for(var r=t,n=e;;){var o=r.return;if(o===null)break;var i=o.alternate;if(i===null){if(n=o.return,n!==null){r=n;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===r)return _qe(o),t;if(i===n)return _qe(o),e;i=i.sibling}throw Error(Me(188))}if(r.return!==n.return)r=o,n=i;else{for(var a=!1,s=o.child;s;){if(s===r){a=!0,r=o,n=i;break}if(s===n){a=!0,n=o,r=i;break}s=s.sibling}if(!a){for(s=i.child;s;){if(s===r){a=!0,r=i,n=o;break}if(s===n){a=!0,n=i,r=o;break}s=s.sibling}if(!a)throw Error(Me(189))}}if(r.alternate!==n)throw Error(Me(190))}if(r.tag!==3)throw Error(Me(188));return r.stateNode.current===r?t:e}function LUe(t){return t=N7t(t),t!==null?FUe(t):null}function FUe(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=FUe(t);if(e!==null)return e;t=t.sibling}return null}var kUe=Ap.unstable_scheduleCallback,vqe=Ap.unstable_cancelCallback,L7t=Ap.unstable_shouldYield,F7t=Ap.unstable_requestPaint,Za=Ap.unstable_now,k7t=Ap.unstable_getCurrentPriorityLevel,kfe=Ap.unstable_ImmediatePriority,BUe=Ap.unstable_UserBlockingPriority,iW=Ap.unstable_NormalPriority,B7t=Ap.unstable_LowPriority,$Ue=Ap.unstable_IdlePriority,EW=null,$y=null;function $7t(t){if($y&&typeof $y.onCommitFiberRoot=="function")try{$y.onCommitFiberRoot(EW,t,void 0,(t.current.flags&128)===128)}catch{}}var mg=Math.clz32?Math.clz32:z7t,q7t=Math.log,U7t=Math.LN2;function z7t(t){return t>>>=0,t===0?32:31-(q7t(t)/U7t|0)|0}var I9=64,M9=4194304;function AU(t){switch(t&-t){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: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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function aW(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,o=t.suspendedLanes,i=t.pingedLanes,a=r&268435455;if(a!==0){var s=a&~o;s!==0?n=AU(s):(i&=a,i!==0&&(n=AU(i)))}else a=r&~o,a!==0?n=AU(a):i!==0&&(n=AU(i));if(n===0)return 0;if(e!==0&&e!==n&&(e&o)===0&&(o=n&-n,i=e&-e,o>=i||o===16&&(i&4194240)!==0))return e;if((n&4)!==0&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0<e;)r=31-mg(e),o=1<<r,n|=t[r],e&=~o;return n}function H7t(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64: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 e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function V7t(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-mg(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=H7t(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function tfe(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function qUe(){var t=I9;return I9<<=1,(I9&4194240)===0&&(I9=64),t}function wde(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function nz(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-mg(e),t[e]=r}function W7t(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0<r;){var o=31-mg(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function Bfe(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-mg(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var Ko=0;function UUe(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var zUe,$fe,HUe,VUe,WUe,rfe=!1,R9=[],gE=null,yE=null,bE=null,zU=new Map,HU=new Map,fE=[],K7t="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function wqe(t,e){switch(t){case"focusin":case"focusout":gE=null;break;case"dragenter":case"dragleave":yE=null;break;case"mouseover":case"mouseout":bE=null;break;case"pointerover":case"pointerout":zU.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":HU.delete(e.pointerId)}}function vU(t,e,r,n,o,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[o]},e!==null&&(e=iz(e),e!==null&&$fe(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function J7t(t,e,r,n,o){switch(e){case"focusin":return gE=vU(gE,t,e,r,n,o),!0;case"dragenter":return yE=vU(yE,t,e,r,n,o),!0;case"mouseover":return bE=vU(bE,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return zU.set(i,vU(zU.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,HU.set(i,vU(HU.get(i)||null,t,e,r,n,o)),!0}return!1}function KUe(t){var e=JI(t.target);if(e!==null){var r=iM(e);if(r!==null){if(e=r.tag,e===13){if(e=NUe(r),e!==null){t.blockedOn=e,WUe(t.priority,function(){HUe(r)});return}}else if(e===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function W9(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=nfe(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);Zde=n,r.target.dispatchEvent(n),Zde=null}else return e=iz(r),e!==null&&$fe(e),t.blockedOn=r,!1;e.shift()}return!0}function Sqe(t,e,r){W9(t)&&r.delete(e)}function G7t(){rfe=!1,gE!==null&&W9(gE)&&(gE=null),yE!==null&&W9(yE)&&(yE=null),bE!==null&&W9(bE)&&(bE=null),zU.forEach(Sqe),HU.forEach(Sqe)}function wU(t,e){t.blockedOn===e&&(t.blockedOn=null,rfe||(rfe=!0,Ap.unstable_scheduleCallback(Ap.unstable_NormalPriority,G7t)))}function VU(t){function e(o){return wU(o,t)}if(0<R9.length){wU(R9[0],t);for(var r=1;r<R9.length;r++){var n=R9[r];n.blockedOn===t&&(n.blockedOn=null)}}for(gE!==null&&wU(gE,t),yE!==null&&wU(yE,t),bE!==null&&wU(bE,t),zU.forEach(e),HU.forEach(e),r=0;r<fE.length;r++)n=fE[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<fE.length&&(r=fE[0],r.blockedOn===null);)KUe(r),r.blockedOn===null&&fE.shift()}var gN=gx.ReactCurrentBatchConfig,sW=!0;function Y7t(t,e,r,n){var o=Ko,i=gN.transition;gN.transition=null;try{Ko=1,qfe(t,e,r,n)}finally{Ko=o,gN.transition=i}}function Z7t(t,e,r,n){var o=Ko,i=gN.transition;gN.transition=null;try{Ko=4,qfe(t,e,r,n)}finally{Ko=o,gN.transition=i}}function qfe(t,e,r,n){if(sW){var o=nfe(t,e,r,n);if(o===null)Tde(t,e,n,uW,r),wqe(t,n);else if(J7t(o,t,e,r,n))n.stopPropagation();else if(wqe(t,n),e&4&&-1<K7t.indexOf(t)){for(;o!==null;){var i=iz(o);if(i!==null&&zUe(i),i=nfe(t,e,r,n),i===null&&Tde(t,e,n,uW,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else Tde(t,e,n,null,r)}}var uW=null;function nfe(t,e,r,n){if(uW=null,t=Ffe(n),t=JI(t),t!==null)if(e=iM(t),e===null)t=null;else if(r=e.tag,r===13){if(t=NUe(e),t!==null)return t;t=null}else if(r===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return uW=t,null}function JUe(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(k7t()){case kfe:return 1;case BUe:return 4;case iW:case B7t:return 16;case $Ue:return 536870912;default:return 16}default:return 16}}var mE=null,Ufe=null,K9=null;function GUe(){if(K9)return K9;var t,e=Ufe,r=e.length,n,o="value"in mE?mE.value:mE.textContent,i=o.length;for(t=0;t<r&&e[t]===o[t];t++);var a=r-t;for(n=1;n<=a&&e[r-n]===o[i-n];n++);return K9=o.slice(t,1<n?1-n:void 0)}function J9(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function j9(){return!0}function xqe(){return!1}function Ip(t){function e(r,n,o,i,a){this._reactName=r,this._targetInst=o,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var s in t)t.hasOwnProperty(s)&&(r=t[s],this[s]=r?r(i):i[s]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?j9:xqe,this.isPropagationStopped=xqe,this}return la(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=j9)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=j9)},persist:function(){},isPersistent:j9}),e}var EN={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zfe=Ip(EN),oz=la({},EN,{view:0,detail:0}),X7t=Ip(oz),Sde,xde,SU,PW=la({},oz,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hfe,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==SU&&(SU&&t.type==="mousemove"?(Sde=t.screenX-SU.screenX,xde=t.screenY-SU.screenY):xde=Sde=0,SU=t),Sde)},movementY:function(t){return"movementY"in t?t.movementY:xde}}),Cqe=Ip(PW),Q7t=la({},PW,{dataTransfer:0}),eYt=Ip(Q7t),tYt=la({},oz,{relatedTarget:0}),Cde=Ip(tYt),rYt=la({},EN,{animationName:0,elapsedTime:0,pseudoElement:0}),nYt=Ip(rYt),oYt=la({},EN,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),iYt=Ip(oYt),aYt=la({},EN,{data:0}),Oqe=Ip(aYt),sYt={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},uYt={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},lYt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cYt(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=lYt[t])?!!e[t]:!1}function Hfe(){return cYt}var dYt=la({},oz,{key:function(t){if(t.key){var e=sYt[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=J9(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?uYt[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hfe,charCode:function(t){return t.type==="keypress"?J9(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?J9(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),fYt=Ip(dYt),pYt=la({},PW,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Eqe=Ip(pYt),mYt=la({},oz,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hfe}),hYt=Ip(mYt),gYt=la({},EN,{propertyName:0,elapsedTime:0,pseudoElement:0}),yYt=Ip(gYt),bYt=la({},PW,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),_Yt=Ip(bYt),vYt=[9,13,27,32],Vfe=fx&&"CompositionEvent"in window,jU=null;fx&&"documentMode"in document&&(jU=document.documentMode);var wYt=fx&&"TextEvent"in window&&!jU,YUe=fx&&(!Vfe||jU&&8<jU&&11>=jU),Pqe=" ",Tqe=!1;function ZUe(t,e){switch(t){case"keyup":return vYt.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function XUe(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var nN=!1;function SYt(t,e){switch(t){case"compositionend":return XUe(e);case"keypress":return e.which!==32?null:(Tqe=!0,Pqe);case"textInput":return t=e.data,t===Pqe&&Tqe?null:t;default:return null}}function xYt(t,e){if(nN)return t==="compositionend"||!Vfe&&ZUe(t,e)?(t=GUe(),K9=Ufe=mE=null,nN=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return YUe&&e.locale!=="ko"?null:e.data;default:return null}}var CYt={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Aqe(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!CYt[t.type]:e==="textarea"}function QUe(t,e,r,n){IUe(n),e=lW(e,"onChange"),0<e.length&&(r=new zfe("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var DU=null,WU=null;function OYt(t){cze(t,0)}function TW(t){var e=aN(t);if(xUe(e))return t}function EYt(t,e){if(t==="change")return e}var eze=!1;fx&&(fx?(N9="oninput"in document,N9||(Ode=document.createElement("div"),Ode.setAttribute("oninput","return;"),N9=typeof Ode.oninput=="function"),D9=N9):D9=!1,eze=D9&&(!document.documentMode||9<document.documentMode));var D9,N9,Ode;function Iqe(){DU&&(DU.detachEvent("onpropertychange",tze),WU=DU=null)}function tze(t){if(t.propertyName==="value"&&TW(WU)){var e=[];QUe(e,WU,t,Ffe(t)),DUe(OYt,e)}}function PYt(t,e,r){t==="focusin"?(Iqe(),DU=e,WU=r,DU.attachEvent("onpropertychange",tze)):t==="focusout"&&Iqe()}function TYt(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return TW(WU)}function AYt(t,e){if(t==="click")return TW(e)}function IYt(t,e){if(t==="input"||t==="change")return TW(e)}function MYt(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var gg=typeof Object.is=="function"?Object.is:MYt;function KU(t,e){if(gg(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var o=r[n];if(!Bde.call(e,o)||!gg(t[o],e[o]))return!1}return!0}function Mqe(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Rqe(t,e){var r=Mqe(t);t=0;for(var n;r;){if(r.nodeType===3){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Mqe(r)}}function rze(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?rze(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function nze(){for(var t=window,e=rW();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=rW(t.document)}return e}function Wfe(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function RYt(t){var e=nze(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&rze(r.ownerDocument.documentElement,r)){if(n!==null&&Wfe(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var o=r.textContent.length,i=Math.min(n.start,o);n=n.end===void 0?i:Math.min(n.end,o),!t.extend&&i>n&&(o=n,n=i,i=o),o=Rqe(r,i);var a=Rqe(r,n);o&&a&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(o.node,o.offset),t.removeAllRanges(),i>n?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<e.length;r++)t=e[r],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var jYt=fx&&"documentMode"in document&&11>=document.documentMode,oN=null,ofe=null,NU=null,ife=!1;function jqe(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ife||oN==null||oN!==rW(n)||(n=oN,"selectionStart"in n&&Wfe(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),NU&&KU(NU,n)||(NU=n,n=lW(ofe,"onSelect"),0<n.length&&(e=new zfe("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=oN)))}function L9(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var iN={animationend:L9("Animation","AnimationEnd"),animationiteration:L9("Animation","AnimationIteration"),animationstart:L9("Animation","AnimationStart"),transitionend:L9("Transition","TransitionEnd")},Ede={},oze={};fx&&(oze=document.createElement("div").style,"AnimationEvent"in window||(delete iN.animationend.animation,delete iN.animationiteration.animation,delete iN.animationstart.animation),"TransitionEvent"in window||delete iN.transitionend.transition);function AW(t){if(Ede[t])return Ede[t];if(!iN[t])return t;var e=iN[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in oze)return Ede[t]=e[r];return t}var ize=AW("animationend"),aze=AW("animationiteration"),sze=AW("animationstart"),uze=AW("transitionend"),lze=new Map,Dqe="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function EE(t,e){lze.set(t,e),oM(e,[t])}for(F9=0;F9<Dqe.length;F9++)k9=Dqe[F9],Nqe=k9.toLowerCase(),Lqe=k9[0].toUpperCase()+k9.slice(1),EE(Nqe,"on"+Lqe);var k9,Nqe,Lqe,F9;EE(ize,"onAnimationEnd");EE(aze,"onAnimationIteration");EE(sze,"onAnimationStart");EE("dblclick","onDoubleClick");EE("focusin","onFocus");EE("focusout","onBlur");EE(uze,"onTransitionEnd");_N("onMouseEnter",["mouseout","mouseover"]);_N("onMouseLeave",["mouseout","mouseover"]);_N("onPointerEnter",["pointerout","pointerover"]);_N("onPointerLeave",["pointerout","pointerover"]);oM("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));oM("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));oM("onBeforeInput",["compositionend","keypress","textInput","paste"]);oM("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));oM("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));oM("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var IU="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),DYt=new Set("cancel close invalid load scroll toggle".split(" ").concat(IU));function Fqe(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,D7t(n,e,void 0,t),t.currentTarget=null}function cze(t,e){e=(e&4)!==0;for(var r=0;r<t.length;r++){var n=t[r],o=n.event;n=n.listeners;e:{var i=void 0;if(e)for(var a=n.length-1;0<=a;a--){var s=n[a],u=s.instance,l=s.currentTarget;if(s=s.listener,u!==i&&o.isPropagationStopped())break e;Fqe(o,s,l),i=u}else for(a=0;a<n.length;a++){if(s=n[a],u=s.instance,l=s.currentTarget,s=s.listener,u!==i&&o.isPropagationStopped())break e;Fqe(o,s,l),i=u}}}if(oW)throw t=efe,oW=!1,efe=null,t}function Ti(t,e){var r=e[cfe];r===void 0&&(r=e[cfe]=new Set);var n=t+"__bubble";r.has(n)||(dze(e,t,2,!1),r.add(n))}function Pde(t,e,r){var n=0;e&&(n|=4),dze(r,t,n,e)}var B9="_reactListening"+Math.random().toString(36).slice(2);function JU(t){if(!t[B9]){t[B9]=!0,bUe.forEach(function(r){r!=="selectionchange"&&(DYt.has(r)||Pde(r,!1,t),Pde(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[B9]||(e[B9]=!0,Pde("selectionchange",!1,e))}}function dze(t,e,r,n){switch(JUe(e)){case 1:var o=Y7t;break;case 4:o=Z7t;break;default:o=qfe}r=o.bind(null,e,r,t),o=void 0,!Qde||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(o=!0),n?o!==void 0?t.addEventListener(e,r,{capture:!0,passive:o}):t.addEventListener(e,r,!0):o!==void 0?t.addEventListener(e,r,{passive:o}):t.addEventListener(e,r,!1)}function Tde(t,e,r,n,o){var i=n;if((e&1)===0&&(e&2)===0&&n!==null)e:for(;;){if(n===null)return;var a=n.tag;if(a===3||a===4){var s=n.stateNode.containerInfo;if(s===o||s.nodeType===8&&s.parentNode===o)break;if(a===4)for(a=n.return;a!==null;){var u=a.tag;if((u===3||u===4)&&(u=a.stateNode.containerInfo,u===o||u.nodeType===8&&u.parentNode===o))return;a=a.return}for(;s!==null;){if(a=JI(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}DUe(function(){var l=i,c=Ffe(r),d=[];e:{var f=lze.get(t);if(f!==void 0){var p=zfe,m=t;switch(t){case"keypress":if(J9(r)===0)break e;case"keydown":case"keyup":p=fYt;break;case"focusin":m="focus",p=Cde;break;case"focusout":m="blur",p=Cde;break;case"beforeblur":case"afterblur":p=Cde;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Cqe;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=eYt;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=hYt;break;case ize:case aze:case sze:p=nYt;break;case uze:p=yYt;break;case"scroll":p=X7t;break;case"wheel":p=_Yt;break;case"copy":case"cut":case"paste":p=iYt;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Eqe}var h=(e&4)!==0,v=!h&&t==="scroll",g=h?f!==null?f+"Capture":null:f;h=[];for(var _=l,w;_!==null;){w=_;var x=w.stateNode;if(w.tag===5&&x!==null&&(w=x,g!==null&&(x=UU(_,g),x!=null&&h.push(GU(_,x,w)))),v)break;_=_.return}0<h.length&&(f=new p(f,m,null,r,c),d.push({event:f,listeners:h}))}}if((e&7)===0){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&r!==Zde&&(m=r.relatedTarget||r.fromElement)&&(JI(m)||m[px]))break e;if((p||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=r.relatedTarget||r.toElement,p=l,m=m?JI(m):null,m!==null&&(v=iM(m),m!==v||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=l),p!==m)){if(h=Cqe,x="onMouseLeave",g="onMouseEnter",_="mouse",(t==="pointerout"||t==="pointerover")&&(h=Eqe,x="onPointerLeave",g="onPointerEnter",_="pointer"),v=p==null?f:aN(p),w=m==null?f:aN(m),f=new h(x,_+"leave",p,r,c),f.target=v,f.relatedTarget=w,x=null,JI(c)===l&&(h=new h(g,_+"enter",m,r,c),h.target=w,h.relatedTarget=v,x=h),v=x,p&&m)t:{for(h=p,g=m,_=0,w=h;w;w=eN(w))_++;for(w=0,x=g;x;x=eN(x))w++;for(;0<_-w;)h=eN(h),_--;for(;0<w-_;)g=eN(g),w--;for(;_--;){if(h===g||g!==null&&h===g.alternate)break t;h=eN(h),g=eN(g)}h=null}else h=null;p!==null&&kqe(d,f,p,h,!1),m!==null&&v!==null&&kqe(d,v,m,h,!0)}}e:{if(f=l?aN(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var C=EYt;else if(Aqe(f))if(eze)C=IYt;else{C=TYt;var P=PYt}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=AYt);if(C&&(C=C(t,l))){QUe(d,C,r,c);break e}P&&P(t,f,l),t==="focusout"&&(P=f._wrapperState)&&P.controlled&&f.type==="number"&&Wde(f,"number",f.value)}switch(P=l?aN(l):window,t){case"focusin":(Aqe(P)||P.contentEditable==="true")&&(oN=P,ofe=l,NU=null);break;case"focusout":NU=ofe=oN=null;break;case"mousedown":ife=!0;break;case"contextmenu":case"mouseup":case"dragend":ife=!1,jqe(d,r,c);break;case"selectionchange":if(jYt)break;case"keydown":case"keyup":jqe(d,r,c)}var E;if(Vfe)e:{switch(t){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else nN?ZUe(t,r)&&(A="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(A="onCompositionStart");A&&(YUe&&r.locale!=="ko"&&(nN||A!=="onCompositionStart"?A==="onCompositionEnd"&&nN&&(E=GUe()):(mE=c,Ufe="value"in mE?mE.value:mE.textContent,nN=!0)),P=lW(l,A),0<P.length&&(A=new Oqe(A,t,null,r,c),d.push({event:A,listeners:P}),E?A.data=E:(E=XUe(r),E!==null&&(A.data=E)))),(E=wYt?SYt(t,r):xYt(t,r))&&(l=lW(l,"onBeforeInput"),0<l.length&&(c=new Oqe("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=E))}cze(d,e)})}function GU(t,e,r){return{instance:t,listener:e,currentTarget:r}}function lW(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=UU(t,r),i!=null&&n.unshift(GU(t,i,o)),i=UU(t,e),i!=null&&n.push(GU(t,i,o))),t=t.return}return n}function eN(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function kqe(t,e,r,n,o){for(var i=e._reactName,a=[];r!==null&&r!==n;){var s=r,u=s.alternate,l=s.stateNode;if(u!==null&&u===n)break;s.tag===5&&l!==null&&(s=l,o?(u=UU(r,i),u!=null&&a.unshift(GU(r,u,s))):o||(u=UU(r,i),u!=null&&a.push(GU(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var NYt=/\r\n?/g,LYt=/\u0000|\uFFFD/g;function Bqe(t){return(typeof t=="string"?t:""+t).replace(NYt,`
`).replace(LYt,"")}function $9(t,e,r){if(e=Bqe(e),Bqe(t)!==e&&r)throw Error(Me(425))}function cW(){}var afe=null,sfe=null;function ufe(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var lfe=typeof setTimeout=="function"?setTimeout:void 0,FYt=typeof clearTimeout=="function"?clearTimeout:void 0,$qe=typeof Promise=="function"?Promise:void 0,kYt=typeof queueMicrotask=="function"?queueMicrotask:typeof $qe<"u"?function(t){return $qe.resolve(null).then(t).catch(BYt)}:lfe;function BYt(t){setTimeout(function(){throw t})}function Ade(t,e){var r=e,n=0;do{var o=r.nextSibling;if(t.removeChild(r),o&&o.nodeType===8)if(r=o.data,r==="/$"){if(n===0){t.removeChild(o),VU(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);VU(e)}function _E(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function qqe(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"){if(e===0)return t;e--}else r==="/$"&&e++}t=t.previousSibling}return null}var PN=Math.random().toString(36).slice(2),By="__reactFiber$"+PN,YU="__reactProps$"+PN,px="__reactContainer$"+PN,cfe="__reactEvents$"+PN,$Yt="__reactListeners$"+PN,qYt="__reactHandles$"+PN;function JI(t){var e=t[By];if(e)return e;for(var r=t.parentNode;r;){if(e=r[px]||r[By]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=qqe(t);t!==null;){if(r=t[By])return r;t=qqe(t)}return e}t=r,r=t.parentNode}return null}function iz(t){return t=t[By]||t[px],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function aN(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Me(33))}function IW(t){return t[YU]||null}var dfe=[],sN=-1;function PE(t){return{current:t}}function Ai(t){0>sN||(t.current=dfe[sN],dfe[sN]=null,sN--)}function yi(t,e){sN++,dfe[sN]=t.current,t.current=e}var OE={},ed=PE(OE),Mf=PE(!1),QI=OE;function vN(t,e){var r=t.type.contextTypes;if(!r)return OE;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in r)o[i]=e[i];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function Rf(t){return t=t.childContextTypes,t!=null}function dW(){Ai(Mf),Ai(ed)}function Uqe(t,e,r){if(ed.current!==OE)throw Error(Me(168));yi(ed,e),yi(Mf,r)}function fze(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var o in n)if(!(o in e))throw Error(Me(108,P7t(t)||"Unknown",o));return la({},r,n)}function fW(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||OE,QI=ed.current,yi(ed,t),yi(Mf,Mf.current),!0}function zqe(t,e,r){var n=t.stateNode;if(!n)throw Error(Me(169));r?(t=fze(t,e,QI),n.__reactInternalMemoizedMergedChildContext=t,Ai(Mf),Ai(ed),yi(ed,t)):Ai(Mf),yi(Mf,r)}var ux=null,MW=!1,Ide=!1;function pze(t){ux===null?ux=[t]:ux.push(t)}function UYt(t){MW=!0,pze(t)}function TE(){if(!Ide&&ux!==null){Ide=!0;var t=0,e=Ko;try{var r=ux;for(Ko=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}ux=null,MW=!1}catch(o){throw ux!==null&&(ux=ux.slice(t+1)),kUe(kfe,TE),o}finally{Ko=e,Ide=!1}}return null}var uN=[],lN=0,pW=null,mW=0,Rm=[],jm=0,eM=null,lx=1,cx="";function WI(t,e){uN[lN++]=mW,uN[lN++]=pW,pW=t,mW=e}function mze(t,e,r){Rm[jm++]=lx,Rm[jm++]=cx,Rm[jm++]=eM,eM=t;var n=lx;t=cx;var o=32-mg(n)-1;n&=~(1<<o),r+=1;var i=32-mg(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,lx=1<<32-mg(e)+o|r<<o|n,cx=i+t}else lx=1<<i|r<<o|n,cx=t}function Kfe(t){t.return!==null&&(WI(t,1),mze(t,1,0))}function Jfe(t){for(;t===pW;)pW=uN[--lN],uN[lN]=null,mW=uN[--lN],uN[lN]=null;for(;t===eM;)eM=Rm[--jm],Rm[jm]=null,cx=Rm[--jm],Rm[jm]=null,lx=Rm[--jm],Rm[jm]=null}var Tp=null,Pp=null,Wi=!1,pg=null;function hze(t,e){var r=Dm(5,null,null,0);r.elementType="DELETED",r.stateNode=e,r.return=t,e=t.deletions,e===null?(t.deletions=[r],t.flags|=16):e.push(r)}function Hqe(t,e){switch(t.tag){case 5:var r=t.type;return e=e.nodeType!==1||r.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Tp=t,Pp=_E(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Tp=t,Pp=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=eM!==null?{id:lx,overflow:cx}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=Dm(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Tp=t,Pp=null,!0):!1;default:return!1}}function ffe(t){return(t.mode&1)!==0&&(t.flags&128)===0}function pfe(t){if(Wi){var e=Pp;if(e){var r=e;if(!Hqe(t,e)){if(ffe(t))throw Error(Me(418));e=_E(r.nextSibling);var n=Tp;e&&Hqe(t,e)?hze(n,r):(t.flags=t.flags&-4097|2,Wi=!1,Tp=t)}}else{if(ffe(t))throw Error(Me(418));t.flags=t.flags&-4097|2,Wi=!1,Tp=t}}}function Vqe(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Tp=t}function q9(t){if(t!==Tp)return!1;if(!Wi)return Vqe(t),Wi=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!ufe(t.type,t.memoizedProps)),e&&(e=Pp)){if(ffe(t))throw gze(),Error(Me(418));for(;e;)hze(t,e),e=_E(e.nextSibling)}if(Vqe(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Me(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Pp=_E(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Pp=null}}else Pp=Tp?_E(t.stateNode.nextSibling):null;return!0}function gze(){for(var t=Pp;t;)t=_E(t.nextSibling)}function wN(){Pp=Tp=null,Wi=!1}function Gfe(t){pg===null?pg=[t]:pg.push(t)}var zYt=gx.ReactCurrentBatchConfig;function dg(t,e){if(t&&t.defaultProps){e=la({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var hW=PE(null),gW=null,cN=null,Yfe=null;function Zfe(){Yfe=cN=gW=null}function Xfe(t){var e=hW.current;Ai(hW),t._currentValue=e}function mfe(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function yN(t,e){gW=t,Yfe=cN=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(If=!0),t.firstContext=null)}function Lm(t){var e=t._currentValue;if(Yfe!==t)if(t={context:t,memoizedValue:e,next:null},cN===null){if(gW===null)throw Error(Me(308));cN=t,gW.dependencies={lanes:0,firstContext:t}}else cN=cN.next=t;return e}var GI=null;function Qfe(t){GI===null?GI=[t]:GI.push(t)}function yze(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,Qfe(e)):(r.next=o.next,o.next=r),e.interleaved=r,mx(t,n)}function mx(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var dE=!1;function epe(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function bze(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function dx(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function vE(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,(Jn&2)!==0){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,mx(t,r)}return o=n.interleaved,o===null?(e.next=e,Qfe(n)):(e.next=o.next,o.next=e),n.interleaved=e,mx(t,r)}function G9(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Bfe(t,r)}}function Wqe(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var o=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var a={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?o=i=a:i=i.next=a,r=r.next}while(r!==null);i===null?o=i=e:i=i.next=e}else o=i=e;r={baseState:n.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function yW(t,e,r,n){var o=t.updateQueue;dE=!1;var i=o.firstBaseUpdate,a=o.lastBaseUpdate,s=o.shared.pending;if(s!==null){o.shared.pending=null;var u=s,l=u.next;u.next=null,a===null?i=l:a.next=l,a=u;var c=t.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==a&&(s===null?c.firstBaseUpdate=l:s.next=l,c.lastBaseUpdate=u))}if(i!==null){var d=o.baseState;a=0,c=l=u=null,s=i;do{var f=s.lane,p=s.eventTime;if((n&f)===f){c!==null&&(c=c.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var m=t,h=s;switch(f=e,p=r,h.tag){case 1:if(m=h.payload,typeof m=="function"){d=m.call(p,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m=="function"?m.call(p,d,f):m,f==null)break e;d=la({},d,f);break e;case 2:dE=!0}}s.callback!==null&&s.lane!==0&&(t.flags|=64,f=o.effects,f===null?o.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(l=c=p,u=d):c=c.next=p,a|=f;if(s=s.next,s===null){if(s=o.shared.pending,s===null)break;f=s,s=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(c===null&&(u=d),o.baseState=u,o.firstBaseUpdate=l,o.lastBaseUpdate=c,e=o.shared.interleaved,e!==null){o=e;do a|=o.lane,o=o.next;while(o!==e)}else i===null&&(o.shared.lanes=0);rM|=a,t.lanes=a,t.memoizedState=d}}function Kqe(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],o=n.callback;if(o!==null){if(n.callback=null,n=r,typeof o!="function")throw Error(Me(191,o));o.call(n)}}}var _ze=new yUe.Component().refs;function hfe(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:la({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var RW={isMounted:function(t){return(t=t._reactInternals)?iM(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=zd(),o=SE(t),i=dx(n,o);i.payload=e,r!=null&&(i.callback=r),e=vE(t,i,o),e!==null&&(hg(e,t,o,n),G9(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=zd(),o=SE(t),i=dx(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=vE(t,i,o),e!==null&&(hg(e,t,o,n),G9(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=zd(),n=SE(t),o=dx(r,n);o.tag=2,e!=null&&(o.callback=e),e=vE(t,o,n),e!==null&&(hg(e,t,n,r),G9(e,t,n))}};function Jqe(t,e,r,n,o,i,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,i,a):e.prototype&&e.prototype.isPureReactComponent?!KU(r,n)||!KU(o,i):!0}function vze(t,e,r){var n=!1,o=OE,i=e.contextType;return typeof i=="object"&&i!==null?i=Lm(i):(o=Rf(e)?QI:ed.current,n=e.contextTypes,i=(n=n!=null)?vN(t,o):OE),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=RW,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function Gqe(t,e,r,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(r,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(r,n),e.state!==t&&RW.enqueueReplaceState(e,e.state,null)}function gfe(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=_ze,epe(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=Lm(i):(i=Rf(e)?QI:ed.current,o.context=vN(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(hfe(t,e,i,r),o.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(e=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),e!==o.state&&RW.enqueueReplaceState(o,o.state,null),yW(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function xU(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(Me(309));var n=r.stateNode}if(!n)throw Error(Me(147,t));var o=n,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(a){var s=o.refs;s===_ze&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(Me(284));if(!r._owner)throw Error(Me(290,t))}return t}function U9(t,e){throw t=Object.prototype.toString.call(e),Error(Me(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Yqe(t){var e=t._init;return e(t._payload)}function wze(t){function e(g,_){if(t){var w=g.deletions;w===null?(g.deletions=[_],g.flags|=16):w.push(_)}}function r(g,_){if(!t)return null;for(;_!==null;)e(g,_),_=_.sibling;return null}function n(g,_){for(g=new Map;_!==null;)_.key!==null?g.set(_.key,_):g.set(_.index,_),_=_.sibling;return g}function o(g,_){return g=xE(g,_),g.index=0,g.sibling=null,g}function i(g,_,w){return g.index=w,t?(w=g.alternate,w!==null?(w=w.index,w<_?(g.flags|=2,_):w):(g.flags|=2,_)):(g.flags|=1048576,_)}function a(g){return t&&g.alternate===null&&(g.flags|=2),g}function s(g,_,w,x){return _===null||_.tag!==6?(_=Fde(w,g.mode,x),_.return=g,_):(_=o(_,w),_.return=g,_)}function u(g,_,w,x){var C=w.type;return C===rN?c(g,_,w.props.children,x,w.key):_!==null&&(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===cE&&Yqe(C)===_.type)?(x=o(_,w.props),x.ref=xU(g,_,w),x.return=g,x):(x=tW(w.type,w.key,w.props,null,g.mode,x),x.ref=xU(g,_,w),x.return=g,x)}function l(g,_,w,x){return _===null||_.tag!==4||_.stateNode.containerInfo!==w.containerInfo||_.stateNode.implementation!==w.implementation?(_=kde(w,g.mode,x),_.return=g,_):(_=o(_,w.children||[]),_.return=g,_)}function c(g,_,w,x,C){return _===null||_.tag!==7?(_=XI(w,g.mode,x,C),_.return=g,_):(_=o(_,w),_.return=g,_)}function d(g,_,w){if(typeof _=="string"&&_!==""||typeof _=="number")return _=Fde(""+_,g.mode,w),_.return=g,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case P9:return w=tW(_.type,_.key,_.props,null,g.mode,w),w.ref=xU(g,null,_),w.return=g,w;case tN:return _=kde(_,g.mode,w),_.return=g,_;case cE:var x=_._init;return d(g,x(_._payload),w)}if(TU(_)||_U(_))return _=XI(_,g.mode,w,null),_.return=g,_;U9(g,_)}return null}function f(g,_,w,x){var C=_!==null?_.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:s(g,_,""+w,x);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case P9:return w.key===C?u(g,_,w,x):null;case tN:return w.key===C?l(g,_,w,x):null;case cE:return C=w._init,f(g,_,C(w._payload),x)}if(TU(w)||_U(w))return C!==null?null:c(g,_,w,x,null);U9(g,w)}return null}function p(g,_,w,x,C){if(typeof x=="string"&&x!==""||typeof x=="number")return g=g.get(w)||null,s(_,g,""+x,C);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case P9:return g=g.get(x.key===null?w:x.key)||null,u(_,g,x,C);case tN:return g=g.get(x.key===null?w:x.key)||null,l(_,g,x,C);case cE:var P=x._init;return p(g,_,w,P(x._payload),C)}if(TU(x)||_U(x))return g=g.get(w)||null,c(_,g,x,C,null);U9(_,x)}return null}function m(g,_,w,x){for(var C=null,P=null,E=_,A=_=0,M=null;E!==null&&A<w.length;A++){E.index>A?(M=E,E=null):M=E.sibling;var R=f(g,E,w[A],x);if(R===null){E===null&&(E=M);break}t&&E&&R.alternate===null&&e(g,E),_=i(R,_,A),P===null?C=R:P.sibling=R,P=R,E=M}if(A===w.length)return r(g,E),Wi&&WI(g,A),C;if(E===null){for(;A<w.length;A++)E=d(g,w[A],x),E!==null&&(_=i(E,_,A),P===null?C=E:P.sibling=E,P=E);return Wi&&WI(g,A),C}for(E=n(g,E);A<w.length;A++)M=p(E,g,A,w[A],x),M!==null&&(t&&M.alternate!==null&&E.delete(M.key===null?A:M.key),_=i(M,_,A),P===null?C=M:P.sibling=M,P=M);return t&&E.forEach(function(N){return e(g,N)}),Wi&&WI(g,A),C}function h(g,_,w,x){var C=_U(w);if(typeof C!="function")throw Error(Me(150));if(w=C.call(w),w==null)throw Error(Me(151));for(var P=C=null,E=_,A=_=0,M=null,R=w.next();E!==null&&!R.done;A++,R=w.next()){E.index>A?(M=E,E=null):M=E.sibling;var N=f(g,E,R.value,x);if(N===null){E===null&&(E=M);break}t&&E&&N.alternate===null&&e(g,E),_=i(N,_,A),P===null?C=N:P.sibling=N,P=N,E=M}if(R.done)return r(g,E),Wi&&WI(g,A),C;if(E===null){for(;!R.done;A++,R=w.next())R=d(g,R.value,x),R!==null&&(_=i(R,_,A),P===null?C=R:P.sibling=R,P=R);return Wi&&WI(g,A),C}for(E=n(g,E);!R.done;A++,R=w.next())R=p(E,g,A,R.value,x),R!==null&&(t&&R.alternate!==null&&E.delete(R.key===null?A:R.key),_=i(R,_,A),P===null?C=R:P.sibling=R,P=R);return t&&E.forEach(function(L){return e(g,L)}),Wi&&WI(g,A),C}function v(g,_,w,x){if(typeof w=="object"&&w!==null&&w.type===rN&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case P9:e:{for(var C=w.key,P=_;P!==null;){if(P.key===C){if(C=w.type,C===rN){if(P.tag===7){r(g,P.sibling),_=o(P,w.props.children),_.return=g,g=_;break e}}else if(P.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===cE&&Yqe(C)===P.type){r(g,P.sibling),_=o(P,w.props),_.ref=xU(g,P,w),_.return=g,g=_;break e}r(g,P);break}else e(g,P);P=P.sibling}w.type===rN?(_=XI(w.props.children,g.mode,x,w.key),_.return=g,g=_):(x=tW(w.type,w.key,w.props,null,g.mode,x),x.ref=xU(g,_,w),x.return=g,g=x)}return a(g);case tN:e:{for(P=w.key;_!==null;){if(_.key===P)if(_.tag===4&&_.stateNode.containerInfo===w.containerInfo&&_.stateNode.implementation===w.implementation){r(g,_.sibling),_=o(_,w.children||[]),_.return=g,g=_;break e}else{r(g,_);break}else e(g,_);_=_.sibling}_=kde(w,g.mode,x),_.return=g,g=_}return a(g);case cE:return P=w._init,v(g,_,P(w._payload),x)}if(TU(w))return m(g,_,w,x);if(_U(w))return h(g,_,w,x);U9(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,_!==null&&_.tag===6?(r(g,_.sibling),_=o(_,w),_.return=g,g=_):(r(g,_),_=Fde(w,g.mode,x),_.return=g,g=_),a(g)):r(g,_)}return v}var SN=wze(!0),Sze=wze(!1),az={},qy=PE(az),ZU=PE(az),XU=PE(az);function YI(t){if(t===az)throw Error(Me(174));return t}function tpe(t,e){switch(yi(XU,e),yi(ZU,t),yi(qy,az),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Jde(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Jde(e,t)}Ai(qy),yi(qy,e)}function xN(){Ai(qy),Ai(ZU),Ai(XU)}function xze(t){YI(XU.current);var e=YI(qy.current),r=Jde(e,t.type);e!==r&&(yi(ZU,t),yi(qy,r))}function rpe(t){ZU.current===t&&(Ai(qy),Ai(ZU))}var sa=PE(0);function bW(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if((e.flags&128)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Mde=[];function npe(){for(var t=0;t<Mde.length;t++)Mde[t]._workInProgressVersionPrimary=null;Mde.length=0}var Y9=gx.ReactCurrentDispatcher,Rde=gx.ReactCurrentBatchConfig,tM=0,ua=null,Gu=null,xl=null,_W=!1,LU=!1,QU=0,HYt=0;function Zc(){throw Error(Me(321))}function ope(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!gg(t[r],e[r]))return!1;return!0}function ipe(t,e,r,n,o,i){if(tM=i,ua=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Y9.current=t===null||t.memoizedState===null?JYt:GYt,t=r(n,o),LU){i=0;do{if(LU=!1,QU=0,25<=i)throw Error(Me(301));i+=1,xl=Gu=null,e.updateQueue=null,Y9.current=YYt,t=r(n,o)}while(LU)}if(Y9.current=vW,e=Gu!==null&&Gu.next!==null,tM=0,xl=Gu=ua=null,_W=!1,e)throw Error(Me(300));return t}function ape(){var t=QU!==0;return QU=0,t}function ky(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xl===null?ua.memoizedState=xl=t:xl=xl.next=t,xl}function Fm(){if(Gu===null){var t=ua.alternate;t=t!==null?t.memoizedState:null}else t=Gu.next;var e=xl===null?ua.memoizedState:xl.next;if(e!==null)xl=e,Gu=t;else{if(t===null)throw Error(Me(310));Gu=t,t={memoizedState:Gu.memoizedState,baseState:Gu.baseState,baseQueue:Gu.baseQueue,queue:Gu.queue,next:null},xl===null?ua.memoizedState=xl=t:xl=xl.next=t}return xl}function ez(t,e){return typeof e=="function"?e(t):e}function jde(t){var e=Fm(),r=e.queue;if(r===null)throw Error(Me(311));r.lastRenderedReducer=t;var n=Gu,o=n.baseQueue,i=r.pending;if(i!==null){if(o!==null){var a=o.next;o.next=i.next,i.next=a}n.baseQueue=o=i,r.pending=null}if(o!==null){i=o.next,n=n.baseState;var s=a=null,u=null,l=i;do{var c=l.lane;if((tM&c)===c)u!==null&&(u=u.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),n=l.hasEagerState?l.eagerState:t(n,l.action);else{var d={lane:c,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};u===null?(s=u=d,a=n):u=u.next=d,ua.lanes|=c,rM|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,gg(n,e.memoizedState)||(If=!0),e.memoizedState=n,e.baseState=a,e.baseQueue=u,r.lastRenderedState=n}if(t=r.interleaved,t!==null){o=t;do i=o.lane,ua.lanes|=i,rM|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function Dde(t){var e=Fm(),r=e.queue;if(r===null)throw Error(Me(311));r.lastRenderedReducer=t;var n=r.dispatch,o=r.pending,i=e.memoizedState;if(o!==null){r.pending=null;var a=o=o.next;do i=t(i,a.action),a=a.next;while(a!==o);gg(i,e.memoizedState)||(If=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function Cze(){}function Oze(t,e){var r=ua,n=Fm(),o=e(),i=!gg(n.memoizedState,o);if(i&&(n.memoizedState=o,If=!0),n=n.queue,spe(Tze.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||xl!==null&&xl.memoizedState.tag&1){if(r.flags|=2048,tz(9,Pze.bind(null,r,n,o,e),void 0,null),Cl===null)throw Error(Me(349));(tM&30)!==0||Eze(r,e,o)}return o}function Eze(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=ua.updateQueue,e===null?(e={lastEffect:null,stores:null},ua.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function Pze(t,e,r,n){e.value=r,e.getSnapshot=n,Aze(e)&&Ize(t)}function Tze(t,e,r){return r(function(){Aze(e)&&Ize(t)})}function Aze(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!gg(t,r)}catch{return!0}}function Ize(t){var e=mx(t,1);e!==null&&hg(e,t,1,-1)}function Zqe(t){var e=ky();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ez,lastRenderedState:t},e.queue=t,t=t.dispatch=KYt.bind(null,ua,t),[e.memoizedState,t]}function tz(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=ua.updateQueue,e===null?(e={lastEffect:null,stores:null},ua.updateQueue=e,e.lastEffect=t.next=t):(r=e.lastEffect,r===null?e.lastEffect=t.next=t:(n=r.next,r.next=t,t.next=n,e.lastEffect=t)),t}function Mze(){return Fm().memoizedState}function Z9(t,e,r,n){var o=ky();ua.flags|=t,o.memoizedState=tz(1|e,r,void 0,n===void 0?null:n)}function jW(t,e,r,n){var o=Fm();n=n===void 0?null:n;var i=void 0;if(Gu!==null){var a=Gu.memoizedState;if(i=a.destroy,n!==null&&ope(n,a.deps)){o.memoizedState=tz(e,r,i,n);return}}ua.flags|=t,o.memoizedState=tz(1|e,r,i,n)}function Xqe(t,e){return Z9(8390656,8,t,e)}function spe(t,e){return jW(2048,8,t,e)}function Rze(t,e){return jW(4,2,t,e)}function jze(t,e){return jW(4,4,t,e)}function Dze(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Nze(t,e,r){return r=r!=null?r.concat([t]):null,jW(4,4,Dze.bind(null,e,t),r)}function upe(){}function Lze(t,e){var r=Fm();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&ope(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function Fze(t,e){var r=Fm();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&ope(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function kze(t,e,r){return(tM&21)===0?(t.baseState&&(t.baseState=!1,If=!0),t.memoizedState=r):(gg(r,e)||(r=qUe(),ua.lanes|=r,rM|=r,t.baseState=!0),e)}function VYt(t,e){var r=Ko;Ko=r!==0&&4>r?r:4,t(!0);var n=Rde.transition;Rde.transition={};try{t(!1),e()}finally{Ko=r,Rde.transition=n}}function Bze(){return Fm().memoizedState}function WYt(t,e,r){var n=SE(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},$ze(t))qze(e,r);else if(r=yze(t,e,r,n),r!==null){var o=zd();hg(r,t,n,o),Uze(r,e,n)}}function KYt(t,e,r){var n=SE(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if($ze(t))qze(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var a=e.lastRenderedState,s=i(a,r);if(o.hasEagerState=!0,o.eagerState=s,gg(s,a)){var u=e.interleaved;u===null?(o.next=o,Qfe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=yze(t,e,o,n),r!==null&&(o=zd(),hg(r,t,n,o),Uze(r,e,n))}}function $ze(t){var e=t.alternate;return t===ua||e!==null&&e===ua}function qze(t,e){LU=_W=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Uze(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Bfe(t,r)}}var vW={readContext:Lm,useCallback:Zc,useContext:Zc,useEffect:Zc,useImperativeHandle:Zc,useInsertionEffect:Zc,useLayoutEffect:Zc,useMemo:Zc,useReducer:Zc,useRef:Zc,useState:Zc,useDebugValue:Zc,useDeferredValue:Zc,useTransition:Zc,useMutableSource:Zc,useSyncExternalStore:Zc,useId:Zc,unstable_isNewReconciler:!1},JYt={readContext:Lm,useCallback:function(t,e){return ky().memoizedState=[t,e===void 0?null:e],t},useContext:Lm,useEffect:Xqe,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,Z9(4194308,4,Dze.bind(null,e,t),r)},useLayoutEffect:function(t,e){return Z9(4194308,4,t,e)},useInsertionEffect:function(t,e){return Z9(4,2,t,e)},useMemo:function(t,e){var r=ky();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=ky();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=WYt.bind(null,ua,t),[n.memoizedState,t]},useRef:function(t){var e=ky();return t={current:t},e.memoizedState=t},useState:Zqe,useDebugValue:upe,useDeferredValue:function(t){return ky().memoizedState=t},useTransition:function(){var t=Zqe(!1),e=t[0];return t=VYt.bind(null,t[1]),ky().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ua,o=ky();if(Wi){if(r===void 0)throw Error(Me(407));r=r()}else{if(r=e(),Cl===null)throw Error(Me(349));(tM&30)!==0||Eze(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,Xqe(Tze.bind(null,n,i,t),[t]),n.flags|=2048,tz(9,Pze.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=ky(),e=Cl.identifierPrefix;if(Wi){var r=cx,n=lx;r=(n&~(1<<32-mg(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=QU++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=HYt++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},GYt={readContext:Lm,useCallback:Lze,useContext:Lm,useEffect:spe,useImperativeHandle:Nze,useInsertionEffect:Rze,useLayoutEffect:jze,useMemo:Fze,useReducer:jde,useRef:Mze,useState:function(){return jde(ez)},useDebugValue:upe,useDeferredValue:function(t){var e=Fm();return kze(e,Gu.memoizedState,t)},useTransition:function(){var t=jde(ez)[0],e=Fm().memoizedState;return[t,e]},useMutableSource:Cze,useSyncExternalStore:Oze,useId:Bze,unstable_isNewReconciler:!1},YYt={readContext:Lm,useCallback:Lze,useContext:Lm,useEffect:spe,useImperativeHandle:Nze,useInsertionEffect:Rze,useLayoutEffect:jze,useMemo:Fze,useReducer:Dde,useRef:Mze,useState:function(){return Dde(ez)},useDebugValue:upe,useDeferredValue:function(t){var e=Fm();return Gu===null?e.memoizedState=t:kze(e,Gu.memoizedState,t)},useTransition:function(){var t=Dde(ez)[0],e=Fm().memoizedState;return[t,e]},useMutableSource:Cze,useSyncExternalStore:Oze,useId:Bze,unstable_isNewReconciler:!1};function CN(t,e){try{var r="",n=e;do r+=E7t(n),n=n.return;while(n);var o=r}catch(i){o=`
Error generating stack: `+i.message+`
`+i.stack}return{value:t,source:e,stack:o,digest:null}}function Nde(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function yfe(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var ZYt=typeof WeakMap=="function"?WeakMap:Map;function zze(t,e,r){r=dx(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){SW||(SW=!0,Pfe=n),yfe(t,e)},r}function Hze(t,e,r){r=dx(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var o=e.value;r.payload=function(){return n(o)},r.callback=function(){yfe(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){yfe(t,e),typeof n!="function"&&(wE===null?wE=new Set([this]):wE.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function Qqe(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new ZYt;var o=new Set;n.set(e,o)}else o=n.get(e),o===void 0&&(o=new Set,n.set(e,o));o.has(r)||(o.add(r),t=dZt.bind(null,t,e,r),e.then(t,t))}function eUe(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function tUe(t,e,r,n,o){return(t.mode&1)===0?(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=dx(-1,1),e.tag=2,vE(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var XYt=gx.ReactCurrentOwner,If=!1;function Ud(t,e,r,n){e.child=t===null?Sze(e,null,r,n):SN(e,t.child,r,n)}function rUe(t,e,r,n,o){r=r.render;var i=e.ref;return yN(e,o),n=ipe(t,e,r,n,i,o),r=ape(),t!==null&&!If?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,hx(t,e,o)):(Wi&&r&&Kfe(e),e.flags|=1,Ud(t,e,n,o),e.child)}function nUe(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!gpe(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,Vze(t,e,i,n,o)):(t=tW(r.type,null,n,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,(t.lanes&o)===0){var a=i.memoizedProps;if(r=r.compare,r=r!==null?r:KU,r(a,n)&&t.ref===e.ref)return hx(t,e,o)}return e.flags|=1,t=xE(i,n),t.ref=e.ref,t.return=e,e.child=t}function Vze(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(KU(i,n)&&t.ref===e.ref)if(If=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(If=!0);else return e.lanes=t.lanes,hx(t,e,o)}return bfe(t,e,r,n,o)}function Wze(t,e,r){var n=e.pendingProps,o=n.children,i=t!==null?t.memoizedState:null;if(n.mode==="hidden")if((e.mode&1)===0)e.memoizedState={baseLanes:0,cachePool:null,transitions:null},yi(fN,Ep),Ep|=r;else{if((r&1073741824)===0)return t=i!==null?i.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,yi(fN,Ep),Ep|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,yi(fN,Ep),Ep|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,yi(fN,Ep),Ep|=n;return Ud(t,e,o,r),e.child}function Kze(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function bfe(t,e,r,n,o){var i=Rf(r)?QI:ed.current;return i=vN(e,i),yN(e,o),r=ipe(t,e,r,n,i,o),n=ape(),t!==null&&!If?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,hx(t,e,o)):(Wi&&n&&Kfe(e),e.flags|=1,Ud(t,e,r,o),e.child)}function oUe(t,e,r,n,o){if(Rf(r)){var i=!0;fW(e)}else i=!1;if(yN(e,o),e.stateNode===null)X9(t,e),vze(e,r,n),gfe(e,r,n,o),n=!0;else if(t===null){var a=e.stateNode,s=e.memoizedProps;a.props=s;var u=a.context,l=r.contextType;typeof l=="object"&&l!==null?l=Lm(l):(l=Rf(r)?QI:ed.current,l=vN(e,l));var c=r.getDerivedStateFromProps,d=typeof c=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==n||u!==l)&&Gqe(e,a,n,l),dE=!1;var f=e.memoizedState;a.state=f,yW(e,n,a,o),u=e.memoizedState,s!==n||f!==u||Mf.current||dE?(typeof c=="function"&&(hfe(e,r,c,n),u=e.memoizedState),(s=dE||Jqe(e,r,s,n,f,u,l))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=u),a.props=n,a.state=u,a.context=l,n=s):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{a=e.stateNode,bze(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:dg(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=Lm(u):(u=Rf(r)?QI:ed.current,u=vN(e,u));var p=r.getDerivedStateFromProps;(c=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(s!==d||f!==u)&&Gqe(e,a,n,u),dE=!1,f=e.memoizedState,a.state=f,yW(e,n,a,o);var m=e.memoizedState;s!==d||f!==m||Mf.current||dE?(typeof p=="function"&&(hfe(e,r,p,n),m=e.memoizedState),(l=dE||Jqe(e,r,l,n,f,m,u)||!1)?(c||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,m,u),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,m,u)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=m),a.props=n,a.state=m,a.context=u,n=l):(typeof a.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),n=!1)}return _fe(t,e,r,n,i,o)}function _fe(t,e,r,n,o,i){Kze(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&zqe(e,r,!1),hx(t,e,i);n=e.stateNode,XYt.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=SN(e,t.child,null,i),e.child=SN(e,null,s,i)):Ud(t,e,s,i),e.memoizedState=n.state,o&&zqe(e,r,!0),e.child}function Jze(t){var e=t.stateNode;e.pendingContext?Uqe(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Uqe(t,e.context,!1),tpe(t,e.containerInfo)}function iUe(t,e,r,n,o){return wN(),Gfe(o),e.flags|=256,Ud(t,e,r,n),e.child}var vfe={dehydrated:null,treeContext:null,retryLane:0};function wfe(t){return{baseLanes:t,cachePool:null,transitions:null}}function Gze(t,e,r){var n=e.pendingProps,o=sa.current,i=!1,a=(e.flags&128)!==0,s;if((s=a)||(s=t!==null&&t.memoizedState===null?!1:(o&2)!==0),s?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(o|=1),yi(sa,o&1),t===null)return pfe(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((e.mode&1)===0?e.lanes=1:t.data==="$!"?e.lanes=8:e.lanes=1073741824,null):(a=n.children,t=n.fallback,i?(n=e.mode,i=e.child,a={mode:"hidden",children:a},(n&1)===0&&i!==null?(i.childLanes=0,i.pendingProps=a):i=LW(a,n,0,null),t=XI(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=wfe(r),e.memoizedState=vfe,t):lpe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return QYt(t,e,a,n,s,o,r);if(i){i=n.fallback,a=e.mode,o=t.child,s=o.sibling;var u={mode:"hidden",children:n.children};return(a&1)===0&&e.child!==o?(n=e.child,n.childLanes=0,n.pendingProps=u,e.deletions=null):(n=xE(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=xE(s,i):(i=XI(i,a,r,null),i.flags|=2),i.return=e,n.return=e,n.sibling=i,e.child=n,n=i,i=e.child,a=t.child.memoizedState,a=a===null?wfe(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=vfe,n}return i=t.child,t=i.sibling,n=xE(i,{mode:"visible",children:n.children}),(e.mode&1)===0&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function lpe(t,e){return e=LW({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function z9(t,e,r,n){return n!==null&&Gfe(n),SN(e,t.child,null,r),t=lpe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function QYt(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=Nde(Error(Me(422))),z9(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=LW({mode:"visible",children:n.children},o,0,null),i=XI(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&SN(e,t.child,null,a),e.child.memoizedState=wfe(a),e.memoizedState=vfe,i);if((e.mode&1)===0)return z9(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(Me(419)),n=Nde(i,n,void 0),z9(t,e,a,n)}if(s=(a&t.childLanes)!==0,If||s){if(n=Cl,n!==null){switch(a&-a){case 4:o=2;break;case 16:o=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=(o&(n.suspendedLanes|a))!==0?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,mx(t,o),hg(n,t,o,-1))}return hpe(),n=Nde(Error(Me(421))),z9(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=fZt.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,Pp=_E(o.nextSibling),Tp=e,Wi=!0,pg=null,t!==null&&(Rm[jm++]=lx,Rm[jm++]=cx,Rm[jm++]=eM,lx=t.id,cx=t.overflow,eM=e),e=lpe(e,n.children),e.flags|=4096,e)}function aUe(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),mfe(t.return,e,r)}function Lde(t,e,r,n,o){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:o}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=o)}function Yze(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(Ud(t,e,n.children,r),n=sa.current,(n&2)!==0)n=n&1|2,e.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&aUe(t,r,e);else if(t.tag===19)aUe(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(yi(sa,n),(e.mode&1)===0)e.memoizedState=null;else switch(o){case"forwards":for(r=e.child,o=null;r!==null;)t=r.alternate,t!==null&&bW(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),Lde(e,!1,o,r,i);break;case"backwards":for(r=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&bW(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}Lde(e,!0,r,null,i);break;case"together":Lde(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function X9(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function hx(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),rM|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(Me(153));if(e.child!==null){for(t=e.child,r=xE(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=xE(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function eZt(t,e,r){switch(e.tag){case 3:Jze(e),wN();break;case 5:xze(e);break;case 1:Rf(e.type)&&fW(e);break;case 4:tpe(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;yi(hW,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(yi(sa,sa.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?Gze(t,e,r):(yi(sa,sa.current&1),t=hx(t,e,r),t!==null?t.sibling:null);yi(sa,sa.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return Yze(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),yi(sa,sa.current),n)break;return null;case 22:case 23:return e.lanes=0,Wze(t,e,r)}return hx(t,e,r)}var Zze,Sfe,Xze,Qze;Zze=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Sfe=function(){};Xze=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,YI(qy.current);var i=null;switch(r){case"input":o=Hde(t,o),n=Hde(t,n),i=[];break;case"select":o=la({},o,{value:void 0}),n=la({},n,{value:void 0}),i=[];break;case"textarea":o=Kde(t,o),n=Kde(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=cW)}Gde(r,n);var a;r=null;for(l in o)if(!n.hasOwnProperty(l)&&o.hasOwnProperty(l)&&o[l]!=null)if(l==="style"){var s=o[l];for(a in s)s.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else l!=="dangerouslySetInnerHTML"&&l!=="children"&&l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&($U.hasOwnProperty(l)?i||(i=[]):(i=i||[]).push(l,null));for(l in n){var u=n[l];if(s=o?.[l],n.hasOwnProperty(l)&&u!==s&&(u!=null||s!=null))if(l==="style")if(s){for(a in s)!s.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in u)u.hasOwnProperty(a)&&s[a]!==u[a]&&(r||(r={}),r[a]=u[a])}else r||(i||(i=[]),i.push(l,r)),r=u;else l==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,s=s?s.__html:void 0,u!=null&&s!==u&&(i=i||[]).push(l,u)):l==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(l,""+u):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&($U.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&Ti("scroll",t),i||s===u||(i=[])):(i=i||[]).push(l,u))}r&&(i=i||[]).push("style",r);var l=i;(e.updateQueue=l)&&(e.flags|=4)}};Qze=function(t,e,r,n){r!==n&&(e.flags|=4)};function CU(t,e){if(!Wi)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function Xc(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var o=t.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags&14680064,n|=o.flags&14680064,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags,n|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function tZt(t,e,r){var n=e.pendingProps;switch(Jfe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xc(e),null;case 1:return Rf(e.type)&&dW(),Xc(e),null;case 3:return n=e.stateNode,xN(),Ai(Mf),Ai(ed),npe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(q9(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,pg!==null&&(Ife(pg),pg=null))),Sfe(t,e),Xc(e),null;case 5:rpe(e);var o=YI(XU.current);if(r=e.type,t!==null&&e.stateNode!=null)Xze(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(Me(166));return Xc(e),null}if(t=YI(qy.current),q9(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[By]=e,n[YU]=i,t=(e.mode&1)!==0,r){case"dialog":Ti("cancel",n),Ti("close",n);break;case"iframe":case"object":case"embed":Ti("load",n);break;case"video":case"audio":for(o=0;o<IU.length;o++)Ti(IU[o],n);break;case"source":Ti("error",n);break;case"img":case"image":case"link":Ti("error",n),Ti("load",n);break;case"details":Ti("toggle",n);break;case"input":mqe(n,i),Ti("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},Ti("invalid",n);break;case"textarea":gqe(n,i),Ti("invalid",n)}Gde(r,i),o=null;for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];a==="children"?typeof s=="string"?n.textContent!==s&&(i.suppressHydrationWarning!==!0&&$9(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&$9(n.textContent,s,t),o=["children",""+s]):$U.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&Ti("scroll",n)}switch(r){case"input":T9(n),hqe(n,i,!0);break;case"textarea":T9(n),yqe(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=cW)}n=o,e.updateQueue=n,n!==null&&(e.flags|=4)}else{a=o.nodeType===9?o:o.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=EUe(r)),t==="http://www.w3.org/1999/xhtml"?r==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=a.createElement(r,{is:n.is}):(t=a.createElement(r),r==="select"&&(a=t,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):t=a.createElementNS(t,r),t[By]=e,t[YU]=n,Zze(t,e,!1,!1),e.stateNode=t;e:{switch(a=Yde(r,n),r){case"dialog":Ti("cancel",t),Ti("close",t),o=n;break;case"iframe":case"object":case"embed":Ti("load",t),o=n;break;case"video":case"audio":for(o=0;o<IU.length;o++)Ti(IU[o],t);o=n;break;case"source":Ti("error",t),o=n;break;case"img":case"image":case"link":Ti("error",t),Ti("load",t),o=n;break;case"details":Ti("toggle",t),o=n;break;case"input":mqe(t,n),o=Hde(t,n),Ti("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=la({},n,{value:void 0}),Ti("invalid",t);break;case"textarea":gqe(t,n),o=Kde(t,n),Ti("invalid",t);break;default:o=n}Gde(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?AUe(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&PUe(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&qU(t,u):typeof u=="number"&&qU(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&($U.hasOwnProperty(i)?u!=null&&i==="onScroll"&&Ti("scroll",t):u!=null&&jfe(t,i,u,a))}switch(r){case"input":T9(t),hqe(t,n,!1);break;case"textarea":T9(t),yqe(t);break;case"option":n.value!=null&&t.setAttribute("value",""+CE(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?pN(t,!!n.multiple,i,!1):n.defaultValue!=null&&pN(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=cW)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Xc(e),null;case 6:if(t&&e.stateNode!=null)Qze(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(Me(166));if(r=YI(XU.current),YI(qy.current),q9(e)){if(n=e.stateNode,r=e.memoizedProps,n[By]=e,(i=n.nodeValue!==r)&&(t=Tp,t!==null))switch(t.tag){case 3:$9(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&$9(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[By]=e,e.stateNode=n}return Xc(e),null;case 13:if(Ai(sa),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Wi&&Pp!==null&&(e.mode&1)!==0&&(e.flags&128)===0)gze(),wN(),e.flags|=98560,i=!1;else if(i=q9(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(Me(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Me(317));i[By]=e}else wN(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Xc(e),i=!1}else pg!==null&&(Ife(pg),pg=null),i=!0;if(!i)return e.flags&65536?e:null}return(e.flags&128)!==0?(e.lanes=r,e):(n=n!==null,n!==(t!==null&&t.memoizedState!==null)&&n&&(e.child.flags|=8192,(e.mode&1)!==0&&(t===null||(sa.current&1)!==0?Yu===0&&(Yu=3):hpe())),e.updateQueue!==null&&(e.flags|=4),Xc(e),null);case 4:return xN(),Sfe(t,e),t===null&&JU(e.stateNode.containerInfo),Xc(e),null;case 10:return Xfe(e.type._context),Xc(e),null;case 17:return Rf(e.type)&&dW(),Xc(e),null;case 19:if(Ai(sa),i=e.memoizedState,i===null)return Xc(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)CU(i,!1);else{if(Yu!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=bW(t),a!==null){for(e.flags|=128,CU(i,!1),n=a.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=r,r=e.child;r!==null;)i=r,t=n,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,t=a.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),r=r.sibling;return yi(sa,sa.current&1|2),e.child}t=t.sibling}i.tail!==null&&Za()>ON&&(e.flags|=128,n=!0,CU(i,!1),e.lanes=4194304)}else{if(!n)if(t=bW(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),CU(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Wi)return Xc(e),null}else 2*Za()-i.renderingStartTime>ON&&r!==1073741824&&(e.flags|=128,n=!0,CU(i,!1),e.lanes=4194304);i.isBackwards?(a.sibling=e.child,e.child=a):(r=i.last,r!==null?r.sibling=a:e.child=a,i.last=a)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Za(),e.sibling=null,r=sa.current,yi(sa,n?r&1|2:r&1),e):(Xc(e),null);case 22:case 23:return mpe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(Ep&1073741824)!==0&&(Xc(e),e.subtreeFlags&6&&(e.flags|=8192)):Xc(e),null;case 24:return null;case 25:return null}throw Error(Me(156,e.tag))}function rZt(t,e){switch(Jfe(e),e.tag){case 1:return Rf(e.type)&&dW(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return xN(),Ai(Mf),Ai(ed),npe(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return rpe(e),null;case 13:if(Ai(sa),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Me(340));wN()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ai(sa),null;case 4:return xN(),null;case 10:return Xfe(e.type._context),null;case 22:case 23:return mpe(),null;case 24:return null;default:return null}}var H9=!1,Qc=!1,nZt=typeof WeakSet=="function"?WeakSet:Set,ft=null;function dN(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Na(t,e,n)}else r.current=null}function xfe(t,e,r){try{r()}catch(n){Na(t,e,n)}}var sUe=!1;function oZt(t,e){if(afe=sW,t=nze(),Wfe(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var o=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var a=0,s=-1,u=-1,l=0,c=0,d=t,f=null;t:for(;;){for(var p;d!==r||o!==0&&d.nodeType!==3||(s=a+o),d!==i||n!==0&&d.nodeType!==3||(u=a+n),d.nodeType===3&&(a+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===r&&++l===o&&(s=a),f===i&&++c===n&&(u=a),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}r=s===-1||u===-1?null:{start:s,end:u}}else r=null}r=r||{start:0,end:0}}else r=null;for(sfe={focusedElem:t,selectionRange:r},sW=!1,ft=e;ft!==null;)if(e=ft,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ft=t;else for(;ft!==null;){e=ft;try{var m=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var h=m.memoizedProps,v=m.memoizedState,g=e.stateNode,_=g.getSnapshotBeforeUpdate(e.elementType===e.type?h:dg(e.type,h),v);g.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Me(163))}}catch(x){Na(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,ft=t;break}ft=e.return}return m=sUe,sUe=!1,m}function FU(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&t)===t){var i=o.destroy;o.destroy=void 0,i!==void 0&&xfe(e,r,i)}o=o.next}while(o!==n)}}function DW(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Cfe(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function e2e(t){var e=t.alternate;e!==null&&(t.alternate=null,e2e(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[By],delete e[YU],delete e[cfe],delete e[$Yt],delete e[qYt])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function t2e(t){return t.tag===5||t.tag===3||t.tag===4}function uUe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||t2e(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Ofe(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=cW));else if(n!==4&&(t=t.child,t!==null))for(Ofe(t,e,r),t=t.sibling;t!==null;)Ofe(t,e,r),t=t.sibling}function Efe(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Efe(t,e,r),t=t.sibling;t!==null;)Efe(t,e,r),t=t.sibling}var Xl=null,fg=!1;function lE(t,e,r){for(r=r.child;r!==null;)r2e(t,e,r),r=r.sibling}function r2e(t,e,r){if($y&&typeof $y.onCommitFiberUnmount=="function")try{$y.onCommitFiberUnmount(EW,r)}catch{}switch(r.tag){case 5:Qc||dN(r,e);case 6:var n=Xl,o=fg;Xl=null,lE(t,e,r),Xl=n,fg=o,Xl!==null&&(fg?(t=Xl,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Xl.removeChild(r.stateNode));break;case 18:Xl!==null&&(fg?(t=Xl,r=r.stateNode,t.nodeType===8?Ade(t.parentNode,r):t.nodeType===1&&Ade(t,r),VU(t)):Ade(Xl,r.stateNode));break;case 4:n=Xl,o=fg,Xl=r.stateNode.containerInfo,fg=!0,lE(t,e,r),Xl=n,fg=o;break;case 0:case 11:case 14:case 15:if(!Qc&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){o=n=n.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&((i&2)!==0||(i&4)!==0)&&xfe(r,e,a),o=o.next}while(o!==n)}lE(t,e,r);break;case 1:if(!Qc&&(dN(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Na(r,e,s)}lE(t,e,r);break;case 21:lE(t,e,r);break;case 22:r.mode&1?(Qc=(n=Qc)||r.memoizedState!==null,lE(t,e,r),Qc=n):lE(t,e,r);break;default:lE(t,e,r)}}function lUe(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new nZt),e.forEach(function(n){var o=pZt.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function cg(t,e){var r=e.deletions;if(r!==null)for(var n=0;n<r.length;n++){var o=r[n];try{var i=t,a=e,s=a;e:for(;s!==null;){switch(s.tag){case 5:Xl=s.stateNode,fg=!1;break e;case 3:Xl=s.stateNode.containerInfo,fg=!0;break e;case 4:Xl=s.stateNode.containerInfo,fg=!0;break e}s=s.return}if(Xl===null)throw Error(Me(160));r2e(i,a,o),Xl=null,fg=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Na(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)n2e(e,t),e=e.sibling}function n2e(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(cg(e,t),Fy(t),n&4){try{FU(3,t,t.return),DW(3,t)}catch(h){Na(t,t.return,h)}try{FU(5,t,t.return)}catch(h){Na(t,t.return,h)}}break;case 1:cg(e,t),Fy(t),n&512&&r!==null&&dN(r,r.return);break;case 5:if(cg(e,t),Fy(t),n&512&&r!==null&&dN(r,r.return),t.flags&32){var o=t.stateNode;try{qU(o,"")}catch(h){Na(t,t.return,h)}}if(n&4&&(o=t.stateNode,o!=null)){var i=t.memoizedProps,a=r!==null?r.memoizedProps:i,s=t.type,u=t.updateQueue;if(t.updateQueue=null,u!==null)try{s==="input"&&i.type==="radio"&&i.name!=null&&CUe(o,i),Yde(s,a);var l=Yde(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?AUe(o,d):c==="dangerouslySetInnerHTML"?PUe(o,d):c==="children"?qU(o,d):jfe(o,c,d,l)}switch(s){case"input":Vde(o,i);break;case"textarea":OUe(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?pN(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?pN(o,!!i.multiple,i.defaultValue,!0):pN(o,!!i.multiple,i.multiple?[]:"",!1))}o[YU]=i}catch(h){Na(t,t.return,h)}}break;case 6:if(cg(e,t),Fy(t),n&4){if(t.stateNode===null)throw Error(Me(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(h){Na(t,t.return,h)}}break;case 3:if(cg(e,t),Fy(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{VU(e.containerInfo)}catch(h){Na(t,t.return,h)}break;case 4:cg(e,t),Fy(t);break;case 13:cg(e,t),Fy(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(fpe=Za())),n&4&&lUe(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(Qc=(l=Qc)||c,cg(e,t),Qc=l):cg(e,t),Fy(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(ft=t,c=t.child;c!==null;){for(d=ft=c;ft!==null;){switch(f=ft,p=f.child,f.tag){case 0:case 11:case 14:case 15:FU(4,f,f.return);break;case 1:dN(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){n=f,r=f.return;try{e=n,m.props=e.memoizedProps,m.state=e.memoizedState,m.componentWillUnmount()}catch(h){Na(n,r,h)}}break;case 5:dN(f,f.return);break;case 22:if(f.memoizedState!==null){dUe(d);continue}}p!==null?(p.return=f,ft=p):dUe(d)}c=c.sibling}e:for(c=null,d=t;;){if(d.tag===5){if(c===null){c=d;try{o=d.stateNode,l?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(s=d.stateNode,u=d.memoizedProps.style,a=u!=null&&u.hasOwnProperty("display")?u.display:null,s.style.display=TUe("display",a))}catch(h){Na(t,t.return,h)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(h){Na(t,t.return,h)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:cg(e,t),Fy(t),n&4&&lUe(t);break;case 21:break;default:cg(e,t),Fy(t)}}function Fy(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(t2e(r)){var n=r;break e}r=r.return}throw Error(Me(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(qU(o,""),n.flags&=-33);var i=uUe(t);Efe(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=uUe(t);Ofe(t,s,a);break;default:throw Error(Me(161))}}catch(u){Na(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function iZt(t,e,r){ft=t,o2e(t,e,r)}function o2e(t,e,r){for(var n=(t.mode&1)!==0;ft!==null;){var o=ft,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||H9;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||Qc;s=H9;var l=Qc;if(H9=a,(Qc=u)&&!l)for(ft=o;ft!==null;)a=ft,u=a.child,a.tag===22&&a.memoizedState!==null?fUe(o):u!==null?(u.return=a,ft=u):fUe(o);for(;i!==null;)ft=i,o2e(i,e,r),i=i.sibling;ft=o,H9=s,Qc=l}cUe(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,ft=i):cUe(t,e,r)}}function cUe(t){for(;ft!==null;){var e=ft;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:Qc||DW(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!Qc)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:dg(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&Kqe(e,i,n);break;case 3:var a=e.updateQueue;if(a!==null){if(r=null,e.child!==null)switch(e.child.tag){case 5:r=e.child.stateNode;break;case 1:r=e.child.stateNode}Kqe(e,a,r)}break;case 5:var s=e.stateNode;if(r===null&&e.flags&4){r=s;var u=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&r.focus();break;case"img":u.src&&(r.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var l=e.alternate;if(l!==null){var c=l.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&VU(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Me(163))}Qc||e.flags&512&&Cfe(e)}catch(f){Na(e,e.return,f)}}if(e===t){ft=null;break}if(r=e.sibling,r!==null){r.return=e.return,ft=r;break}ft=e.return}}function dUe(t){for(;ft!==null;){var e=ft;if(e===t){ft=null;break}var r=e.sibling;if(r!==null){r.return=e.return,ft=r;break}ft=e.return}}function fUe(t){for(;ft!==null;){var e=ft;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{DW(4,e)}catch(u){Na(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){Na(e,o,u)}}var i=e.return;try{Cfe(e)}catch(u){Na(e,i,u)}break;case 5:var a=e.return;try{Cfe(e)}catch(u){Na(e,a,u)}}}catch(u){Na(e,e.return,u)}if(e===t){ft=null;break}var s=e.sibling;if(s!==null){s.return=e.return,ft=s;break}ft=e.return}}var aZt=Math.ceil,wW=gx.ReactCurrentDispatcher,cpe=gx.ReactCurrentOwner,Nm=gx.ReactCurrentBatchConfig,Jn=0,Cl=null,ds=null,Ql=0,Ep=0,fN=PE(0),Yu=0,rz=null,rM=0,NW=0,dpe=0,kU=null,Af=null,fpe=0,ON=1/0,sx=null,SW=!1,Pfe=null,wE=null,V9=!1,hE=null,xW=0,BU=0,Tfe=null,Q9=-1,eW=0;function zd(){return(Jn&6)!==0?Za():Q9!==-1?Q9:Q9=Za()}function SE(t){return(t.mode&1)===0?1:(Jn&2)!==0&&Ql!==0?Ql&-Ql:zYt.transition!==null?(eW===0&&(eW=qUe()),eW):(t=Ko,t!==0||(t=window.event,t=t===void 0?16:JUe(t.type)),t)}function hg(t,e,r,n){if(50<BU)throw BU=0,Tfe=null,Error(Me(185));nz(t,r,n),((Jn&2)===0||t!==Cl)&&(t===Cl&&((Jn&2)===0&&(NW|=r),Yu===4&&pE(t,Ql)),jf(t,n),r===1&&Jn===0&&(e.mode&1)===0&&(ON=Za()+500,MW&&TE()))}function jf(t,e){var r=t.callbackNode;V7t(t,e);var n=aW(t,t===Cl?Ql:0);if(n===0)r!==null&&vqe(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&vqe(r),e===1)t.tag===0?UYt(pUe.bind(null,t)):pze(pUe.bind(null,t)),kYt(function(){(Jn&6)===0&&TE()}),r=null;else{switch(UUe(n)){case 1:r=kfe;break;case 4:r=BUe;break;case 16:r=iW;break;case 536870912:r=$Ue;break;default:r=iW}r=f2e(r,i2e.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function i2e(t,e){if(Q9=-1,eW=0,(Jn&6)!==0)throw Error(Me(327));var r=t.callbackNode;if(bN()&&t.callbackNode!==r)return null;var n=aW(t,t===Cl?Ql:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=CW(t,n);else{e=n;var o=Jn;Jn|=2;var i=s2e();(Cl!==t||Ql!==e)&&(sx=null,ON=Za()+500,ZI(t,e));do try{lZt();break}catch(s){a2e(t,s)}while(!0);Zfe(),wW.current=i,Jn=o,ds!==null?e=0:(Cl=null,Ql=0,e=Yu)}if(e!==0){if(e===2&&(o=tfe(t),o!==0&&(n=o,e=Afe(t,o))),e===1)throw r=rz,ZI(t,0),pE(t,n),jf(t,Za()),r;if(e===6)pE(t,n);else{if(o=t.current.alternate,(n&30)===0&&!sZt(o)&&(e=CW(t,n),e===2&&(i=tfe(t),i!==0&&(n=i,e=Afe(t,i))),e===1))throw r=rz,ZI(t,0),pE(t,n),jf(t,Za()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(Me(345));case 2:KI(t,Af,sx);break;case 3:if(pE(t,n),(n&130023424)===n&&(e=fpe+500-Za(),10<e)){if(aW(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){zd(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=lfe(KI.bind(null,t,Af,sx),e);break}KI(t,Af,sx);break;case 4:if(pE(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-mg(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=Za()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*aZt(n/1960))-n,10<n){t.timeoutHandle=lfe(KI.bind(null,t,Af,sx),n);break}KI(t,Af,sx);break;case 5:KI(t,Af,sx);break;default:throw Error(Me(329))}}}return jf(t,Za()),t.callbackNode===r?i2e.bind(null,t):null}function Afe(t,e){var r=kU;return t.current.memoizedState.isDehydrated&&(ZI(t,e).flags|=256),t=CW(t,e),t!==2&&(e=Af,Af=r,e!==null&&Ife(e)),t}function Ife(t){Af===null?Af=t:Af.push.apply(Af,t)}function sZt(t){for(var e=t;;){if(e.flags&16384){var r=e.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var o=r[n],i=o.getSnapshot;o=o.value;try{if(!gg(i(),o))return!1}catch{return!1}}}if(r=e.child,e.subtreeFlags&16384&&r!==null)r.return=e,e=r;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function pE(t,e){for(e&=~dpe,e&=~NW,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-mg(e),n=1<<r;t[r]=-1,e&=~n}}function pUe(t){if((Jn&6)!==0)throw Error(Me(327));bN();var e=aW(t,0);if((e&1)===0)return jf(t,Za()),null;var r=CW(t,e);if(t.tag!==0&&r===2){var n=tfe(t);n!==0&&(e=n,r=Afe(t,n))}if(r===1)throw r=rz,ZI(t,0),pE(t,e),jf(t,Za()),r;if(r===6)throw Error(Me(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,KI(t,Af,sx),jf(t,Za()),null}function ppe(t,e){var r=Jn;Jn|=1;try{return t(e)}finally{Jn=r,Jn===0&&(ON=Za()+500,MW&&TE())}}function nM(t){hE!==null&&hE.tag===0&&(Jn&6)===0&&bN();var e=Jn;Jn|=1;var r=Nm.transition,n=Ko;try{if(Nm.transition=null,Ko=1,t)return t()}finally{Ko=n,Nm.transition=r,Jn=e,(Jn&6)===0&&TE()}}function mpe(){Ep=fN.current,Ai(fN)}function ZI(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,FYt(r)),ds!==null)for(r=ds.return;r!==null;){var n=r;switch(Jfe(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&dW();break;case 3:xN(),Ai(Mf),Ai(ed),npe();break;case 5:rpe(n);break;case 4:xN();break;case 13:Ai(sa);break;case 19:Ai(sa);break;case 10:Xfe(n.type._context);break;case 22:case 23:mpe()}r=r.return}if(Cl=t,ds=t=xE(t.current,null),Ql=Ep=e,Yu=0,rz=null,dpe=NW=rM=0,Af=kU=null,GI!==null){for(e=0;e<GI.length;e++)if(r=GI[e],n=r.interleaved,n!==null){r.interleaved=null;var o=n.next,i=r.pending;if(i!==null){var a=i.next;i.next=o,n.next=a}r.pending=n}GI=null}return t}function a2e(t,e){do{var r=ds;try{if(Zfe(),Y9.current=vW,_W){for(var n=ua.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}_W=!1}if(tM=0,xl=Gu=ua=null,LU=!1,QU=0,cpe.current=null,r===null||r.return===null){Yu=1,rz=e,ds=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=Ql,s.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var l=u,c=s,d=c.tag;if((c.mode&1)===0&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=eUe(a);if(p!==null){p.flags&=-257,tUe(p,a,s,i,e),p.mode&1&&Qqe(i,l,e),e=p,u=l;var m=e.updateQueue;if(m===null){var h=new Set;h.add(u),e.updateQueue=h}else m.add(u);break e}else{if((e&1)===0){Qqe(i,l,e),hpe();break e}u=Error(Me(426))}}else if(Wi&&s.mode&1){var v=eUe(a);if(v!==null){(v.flags&65536)===0&&(v.flags|=256),tUe(v,a,s,i,e),Gfe(CN(u,s));break e}}i=u=CN(u,s),Yu!==4&&(Yu=2),kU===null?kU=[i]:kU.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=zze(i,u,e);Wqe(i,g);break e;case 1:s=u;var _=i.type,w=i.stateNode;if((i.flags&128)===0&&(typeof _.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(wE===null||!wE.has(w)))){i.flags|=65536,e&=-e,i.lanes|=e;var x=Hze(i,s,e);Wqe(i,x);break e}}i=i.return}while(i!==null)}l2e(r)}catch(C){e=C,ds===r&&r!==null&&(ds=r=r.return);continue}break}while(!0)}function s2e(){var t=wW.current;return wW.current=vW,t===null?vW:t}function hpe(){(Yu===0||Yu===3||Yu===2)&&(Yu=4),Cl===null||(rM&268435455)===0&&(NW&268435455)===0||pE(Cl,Ql)}function CW(t,e){var r=Jn;Jn|=2;var n=s2e();(Cl!==t||Ql!==e)&&(sx=null,ZI(t,e));do try{uZt();break}catch(o){a2e(t,o)}while(!0);if(Zfe(),Jn=r,wW.current=n,ds!==null)throw Error(Me(261));return Cl=null,Ql=0,Yu}function uZt(){for(;ds!==null;)u2e(ds)}function lZt(){for(;ds!==null&&!L7t();)u2e(ds)}function u2e(t){var e=d2e(t.alternate,t,Ep);t.memoizedProps=t.pendingProps,e===null?l2e(t):ds=e,cpe.current=null}function l2e(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=tZt(r,e,Ep),r!==null){ds=r;return}}else{if(r=rZt(r,e),r!==null){r.flags&=32767,ds=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Yu=6,ds=null;return}}if(e=e.sibling,e!==null){ds=e;return}ds=e=t}while(e!==null);Yu===0&&(Yu=5)}function KI(t,e,r){var n=Ko,o=Nm.transition;try{Nm.transition=null,Ko=1,cZt(t,e,r,n)}finally{Nm.transition=o,Ko=n}return null}function cZt(t,e,r,n){do bN();while(hE!==null);if((Jn&6)!==0)throw Error(Me(327));r=t.finishedWork;var o=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(Me(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(W7t(t,i),t===Cl&&(ds=Cl=null,Ql=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||V9||(V9=!0,f2e(iW,function(){return bN(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=Nm.transition,Nm.transition=null;var a=Ko;Ko=1;var s=Jn;Jn|=4,cpe.current=null,oZt(t,r),n2e(r,t),RYt(sfe),sW=!!afe,sfe=afe=null,t.current=r,iZt(r,t,o),F7t(),Jn=s,Ko=a,Nm.transition=i}else t.current=r;if(V9&&(V9=!1,hE=t,xW=o),i=t.pendingLanes,i===0&&(wE=null),$7t(r.stateNode,n),jf(t,Za()),e!==null)for(n=t.onRecoverableError,r=0;r<e.length;r++)o=e[r],n(o.value,{componentStack:o.stack,digest:o.digest});if(SW)throw SW=!1,t=Pfe,Pfe=null,t;return(xW&1)!==0&&t.tag!==0&&bN(),i=t.pendingLanes,(i&1)!==0?t===Tfe?BU++:(BU=0,Tfe=t):BU=0,TE(),null}function bN(){if(hE!==null){var t=UUe(xW),e=Nm.transition,r=Ko;try{if(Nm.transition=null,Ko=16>t?16:t,hE===null)var n=!1;else{if(t=hE,hE=null,xW=0,(Jn&6)!==0)throw Error(Me(331));var o=Jn;for(Jn|=4,ft=t.current;ft!==null;){var i=ft,a=i.child;if((ft.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(ft=l;ft!==null;){var c=ft;switch(c.tag){case 0:case 11:case 15:FU(8,c,i)}var d=c.child;if(d!==null)d.return=c,ft=d;else for(;ft!==null;){c=ft;var f=c.sibling,p=c.return;if(e2e(c),c===l){ft=null;break}if(f!==null){f.return=p,ft=f;break}ft=p}}}var m=i.alternate;if(m!==null){var h=m.child;if(h!==null){m.child=null;do{var v=h.sibling;h.sibling=null,h=v}while(h!==null)}}ft=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,ft=a;else e:for(;ft!==null;){if(i=ft,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:FU(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,ft=g;break e}ft=i.return}}var _=t.current;for(ft=_;ft!==null;){a=ft;var w=a.child;if((a.subtreeFlags&2064)!==0&&w!==null)w.return=a,ft=w;else e:for(a=_;ft!==null;){if(s=ft,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:DW(9,s)}}catch(C){Na(s,s.return,C)}if(s===a){ft=null;break e}var x=s.sibling;if(x!==null){x.return=s.return,ft=x;break e}ft=s.return}}if(Jn=o,TE(),$y&&typeof $y.onPostCommitFiberRoot=="function")try{$y.onPostCommitFiberRoot(EW,t)}catch{}n=!0}return n}finally{Ko=r,Nm.transition=e}}return!1}function mUe(t,e,r){e=CN(r,e),e=zze(t,e,1),t=vE(t,e,1),e=zd(),t!==null&&(nz(t,1,e),jf(t,e))}function Na(t,e,r){if(t.tag===3)mUe(t,t,r);else for(;e!==null;){if(e.tag===3){mUe(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(wE===null||!wE.has(n))){t=CN(r,t),t=Hze(e,t,1),e=vE(e,t,1),t=zd(),e!==null&&(nz(e,1,t),jf(e,t));break}}e=e.return}}function dZt(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=zd(),t.pingedLanes|=t.suspendedLanes&r,Cl===t&&(Ql&r)===r&&(Yu===4||Yu===3&&(Ql&130023424)===Ql&&500>Za()-fpe?ZI(t,0):dpe|=r),jf(t,e)}function c2e(t,e){e===0&&((t.mode&1)===0?e=1:(e=M9,M9<<=1,(M9&130023424)===0&&(M9=4194304)));var r=zd();t=mx(t,e),t!==null&&(nz(t,e,r),jf(t,r))}function fZt(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),c2e(t,r)}function pZt(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,o=t.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(Me(314))}n!==null&&n.delete(e),c2e(t,r)}var d2e;d2e=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Mf.current)If=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return If=!1,eZt(t,e,r);If=(t.flags&131072)!==0}else If=!1,Wi&&(e.flags&1048576)!==0&&mze(e,mW,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;X9(t,e),t=e.pendingProps;var o=vN(e,ed.current);yN(e,r),o=ipe(null,e,n,t,o,r);var i=ape();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Rf(n)?(i=!0,fW(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,epe(e),o.updater=RW,e.stateNode=o,o._reactInternals=e,gfe(e,n,t,r),e=_fe(null,e,n,!0,i,r)):(e.tag=0,Wi&&i&&Kfe(e),Ud(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(X9(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=hZt(n),t=dg(n,t),o){case 0:e=bfe(null,e,n,t,r);break e;case 1:e=oUe(null,e,n,t,r);break e;case 11:e=rUe(null,e,n,t,r);break e;case 14:e=nUe(null,e,n,dg(n.type,t),r);break e}throw Error(Me(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:dg(n,o),bfe(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:dg(n,o),oUe(t,e,n,o,r);case 3:e:{if(Jze(e),t===null)throw Error(Me(387));n=e.pendingProps,i=e.memoizedState,o=i.element,bze(t,e),yW(e,n,null,r);var a=e.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=CN(Error(Me(423)),e),e=iUe(t,e,n,r,o);break e}else if(n!==o){o=CN(Error(Me(424)),e),e=iUe(t,e,n,r,o);break e}else for(Pp=_E(e.stateNode.containerInfo.firstChild),Tp=e,Wi=!0,pg=null,r=Sze(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(wN(),n===o){e=hx(t,e,r);break e}Ud(t,e,n,r)}e=e.child}return e;case 5:return xze(e),t===null&&pfe(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,ufe(n,o)?a=null:i!==null&&ufe(n,i)&&(e.flags|=32),Kze(t,e),Ud(t,e,a,r),e.child;case 6:return t===null&&pfe(e),null;case 13:return Gze(t,e,r);case 4:return tpe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=SN(e,null,n,r):Ud(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:dg(n,o),rUe(t,e,n,o,r);case 7:return Ud(t,e,e.pendingProps,r),e.child;case 8:return Ud(t,e,e.pendingProps.children,r),e.child;case 12:return Ud(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,o=e.pendingProps,i=e.memoizedProps,a=o.value,yi(hW,n._currentValue),n._currentValue=a,i!==null)if(gg(i.value,a)){if(i.children===o.children&&!Mf.current){e=hx(t,e,r);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var s=i.dependencies;if(s!==null){a=i.child;for(var u=s.firstContext;u!==null;){if(u.context===n){if(i.tag===1){u=dx(-1,r&-r),u.tag=2;var l=i.updateQueue;if(l!==null){l=l.shared;var c=l.pending;c===null?u.next=u:(u.next=c.next,c.next=u),l.pending=u}}i.lanes|=r,u=i.alternate,u!==null&&(u.lanes|=r),mfe(i.return,r,e),s.lanes|=r;break}u=u.next}}else if(i.tag===10)a=i.type===e.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Me(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),mfe(a,r,e),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===e){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Ud(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,yN(e,r),o=Lm(o),n=n(o),e.flags|=1,Ud(t,e,n,r),e.child;case 14:return n=e.type,o=dg(n,e.pendingProps),o=dg(n.type,o),nUe(t,e,n,o,r);case 15:return Vze(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:dg(n,o),X9(t,e),e.tag=1,Rf(n)?(t=!0,fW(e)):t=!1,yN(e,r),vze(e,n,o),gfe(e,n,o,r),_fe(null,e,n,!0,t,r);case 19:return Yze(t,e,r);case 22:return Wze(t,e,r)}throw Error(Me(156,e.tag))};function f2e(t,e){return kUe(t,e)}function mZt(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dm(t,e,r,n){return new mZt(t,e,r,n)}function gpe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function hZt(t){if(typeof t=="function")return gpe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Nfe)return 11;if(t===Lfe)return 14}return 2}function xE(t,e){var r=t.alternate;return r===null?(r=Dm(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function tW(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")gpe(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case rN:return XI(r.children,o,i,e);case Dfe:a=8,o|=8;break;case $de:return t=Dm(12,r,e,o|2),t.elementType=$de,t.lanes=i,t;case qde:return t=Dm(13,r,e,o),t.elementType=qde,t.lanes=i,t;case Ude:return t=Dm(19,r,e,o),t.elementType=Ude,t.lanes=i,t;case wUe:return LW(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case _Ue:a=10;break e;case vUe:a=9;break e;case Nfe:a=11;break e;case Lfe:a=14;break e;case cE:a=16,n=null;break e}throw Error(Me(130,t==null?t:typeof t,""))}return e=Dm(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function XI(t,e,r,n){return t=Dm(7,t,n,e),t.lanes=r,t}function LW(t,e,r,n){return t=Dm(22,t,n,e),t.elementType=wUe,t.lanes=r,t.stateNode={isHidden:!1},t}function Fde(t,e,r){return t=Dm(6,t,null,e),t.lanes=r,t}function kde(t,e,r){return e=Dm(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function gZt(t,e,r,n,o){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=wde(0),this.expirationTimes=wde(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wde(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function ype(t,e,r,n,o,i,a,s,u){return t=new gZt(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Dm(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},epe(i),t}function yZt(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:tN,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function p2e(t){if(!t)return OE;t=t._reactInternals;e:{if(iM(t)!==t||t.tag!==1)throw Error(Me(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Rf(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Me(171))}if(t.tag===1){var r=t.type;if(Rf(r))return fze(t,r,e)}return e}function m2e(t,e,r,n,o,i,a,s,u){return t=ype(r,n,!0,t,o,i,a,s,u),t.context=p2e(null),r=t.current,n=zd(),o=SE(r),i=dx(n,o),i.callback=e??null,vE(r,i,o),t.current.lanes=o,nz(t,o,n),jf(t,n),t}function FW(t,e,r,n){var o=e.current,i=zd(),a=SE(o);return r=p2e(r),e.context===null?e.context=r:e.pendingContext=r,e=dx(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=vE(o,e,a),t!==null&&(hg(t,o,a,i),G9(t,o,a)),a}function OW(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function hUe(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function bpe(t,e){hUe(t,e),(t=t.alternate)&&hUe(t,e)}function bZt(){return null}var h2e=typeof reportError=="function"?reportError:function(t){console.error(t)};function _pe(t){this._internalRoot=t}kW.prototype.render=_pe.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Me(409));FW(t,e,null,null)};kW.prototype.unmount=_pe.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;nM(function(){FW(null,t,null,null)}),e[px]=null}};function kW(t){this._internalRoot=t}kW.prototype.unstable_scheduleHydration=function(t){if(t){var e=VUe();t={blockedOn:null,target:t,priority:e};for(var r=0;r<fE.length&&e!==0&&e<fE[r].priority;r++);fE.splice(r,0,t),r===0&&KUe(t)}};function vpe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function BW(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function gUe(){}function _Zt(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=OW(a);i.call(l)}}var a=m2e(e,n,t,0,null,!1,!1,"",gUe);return t._reactRootContainer=a,t[px]=a.current,JU(t.nodeType===8?t.parentNode:t),nM(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=OW(u);s.call(l)}}var u=ype(t,0,!1,null,null,!1,!1,"",gUe);return t._reactRootContainer=u,t[px]=u.current,JU(t.nodeType===8?t.parentNode:t),nM(function(){FW(e,u,r,n)}),u}function $W(t,e,r,n,o){var i=r._reactRootContainer;if(i){var a=i;if(typeof o=="function"){var s=o;o=function(){var u=OW(a);s.call(u)}}FW(e,a,t,o)}else a=_Zt(r,e,t,o,n);return OW(a)}zUe=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=AU(e.pendingLanes);r!==0&&(Bfe(e,r|1),jf(e,Za()),(Jn&6)===0&&(ON=Za()+500,TE()))}break;case 13:nM(function(){var n=mx(t,1);if(n!==null){var o=zd();hg(n,t,1,o)}}),bpe(t,1)}};$fe=function(t){if(t.tag===13){var e=mx(t,134217728);if(e!==null){var r=zd();hg(e,t,134217728,r)}bpe(t,134217728)}};HUe=function(t){if(t.tag===13){var e=SE(t),r=mx(t,e);if(r!==null){var n=zd();hg(r,t,e,n)}bpe(t,e)}};VUe=function(){return Ko};WUe=function(t,e){var r=Ko;try{return Ko=t,e()}finally{Ko=r}};Xde=function(t,e,r){switch(e){case"input":if(Vde(t,r),e=r.name,r.type==="radio"&&e!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<r.length;e++){var n=r[e];if(n!==t&&n.form===t.form){var o=IW(n);if(!o)throw Error(Me(90));xUe(n),Vde(n,o)}}}break;case"textarea":OUe(t,r);break;case"select":e=r.value,e!=null&&pN(t,!!r.multiple,e,!1)}};RUe=ppe;jUe=nM;var vZt={usingClientEntryPoint:!1,Events:[iz,aN,IW,IUe,MUe,ppe]},OU={findFiberByHostInstance:JI,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},wZt={bundleType:OU.bundleType,version:OU.version,rendererPackageName:OU.rendererPackageName,rendererConfig:OU.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:gx.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=LUe(t),t===null?null:t.stateNode},findFiberByHostInstance:OU.findFiberByHostInstance||bZt,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(EU=__REACT_DEVTOOLS_GLOBAL_HOOK__,!EU.isDisabled&&EU.supportsFiber))try{EW=EU.inject(wZt),$y=EU}catch{}var EU;Mp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=vZt;Mp.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!vpe(e))throw Error(Me(200));return yZt(t,e,null,r)};Mp.createRoot=function(t,e){if(!vpe(t))throw Error(Me(299));var r=!1,n="",o=h2e;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=ype(t,1,!1,null,null,r,!1,n,o),t[px]=e.current,JU(t.nodeType===8?t.parentNode:t),new _pe(e)};Mp.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(Me(188)):(t=Object.keys(t).join(","),Error(Me(268,t)));return t=LUe(e),t=t===null?null:t.stateNode,t};Mp.flushSync=function(t){return nM(t)};Mp.hydrate=function(t,e,r){if(!BW(e))throw Error(Me(200));return $W(null,t,e,!0,r)};Mp.hydrateRoot=function(t,e,r){if(!vpe(t))throw Error(Me(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=h2e;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=m2e(e,null,t,1,r??null,o,!1,i,a),t[px]=e.current,JU(t),n)for(t=0;t<n.length;t++)r=n[t],o=r._getVersion,o=o(r._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[r,o]:e.mutableSourceEagerHydrationData.push(r,o);return new kW(e)};Mp.render=function(t,e,r){if(!BW(e))throw Error(Me(200));return $W(null,t,e,!1,r)};Mp.unmountComponentAtNode=function(t){if(!BW(t))throw Error(Me(40));return t._reactRootContainer?(nM(function(){$W(null,null,t,!1,function(){t._reactRootContainer=null,t[px]=null})}),!0):!1};Mp.unstable_batchedUpdates=ppe;Mp.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!BW(r))throw Error(Me(200));if(t==null||t._reactInternals===void 0)throw Error(Me(38));return $W(t,e,r,!1,n)};Mp.version="18.2.0-next-9e3b772b8-20220608"});var fs=b((ZTn,b2e)=>{"use strict";function y2e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(y2e)}catch(t){console.error(t)}}y2e(),b2e.exports=g2e()});var km=b(wpe=>{"use strict";var _2e=fs();wpe.createRoot=_2e.createRoot,wpe.hydrateRoot=_2e.hydrateRoot;var XTn});var S2e=b(qW=>{"use strict";var xZt=X(),CZt=Symbol.for("react.element"),OZt=Symbol.for("react.fragment"),EZt=Object.prototype.hasOwnProperty,PZt=xZt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,TZt={key:!0,ref:!0,__self:!0,__source:!0};function w2e(t,e,r){var n,o={},i=null,a=null;r!==void 0&&(i=""+r),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(a=e.ref);for(n in e)EZt.call(e,n)&&!TZt.hasOwnProperty(n)&&(o[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)o[n]===void 0&&(o[n]=e[n]);return{$$typeof:CZt,type:t,key:i,ref:a,props:o,_owner:PZt.current}}qW.Fragment=OZt;qW.jsx=w2e;qW.jsxs=w2e});var _t=b((rAn,x2e)=>{"use strict";x2e.exports=S2e()});var U2e=b(KW=>{"use strict";Object.defineProperty(KW,"__esModule",{value:!0});KW.V2ChatStreamRequestCitationMode=void 0;KW.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var z2e=b(JW=>{"use strict";Object.defineProperty(JW,"__esModule",{value:!0});JW.V2ChatRequestCitationMode=void 0;JW.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var V2e=b(H2e=>{"use strict";Object.defineProperty(H2e,"__esModule",{value:!0})});var K2e=b(W2e=>{"use strict";Object.defineProperty(W2e,"__esModule",{value:!0})});var G2e=b(J2e=>{"use strict";Object.defineProperty(J2e,"__esModule",{value:!0})});var Z2e=b(Y2e=>{"use strict";Object.defineProperty(Y2e,"__esModule",{value:!0})});var Q2e=b(X2e=>{"use strict";Object.defineProperty(X2e,"__esModule",{value:!0})});var t4e=b(e4e=>{"use strict";Object.defineProperty(e4e,"__esModule",{value:!0})});var n4e=b(r4e=>{"use strict";Object.defineProperty(r4e,"__esModule",{value:!0})});var i4e=b(o4e=>{"use strict";Object.defineProperty(o4e,"__esModule",{value:!0})});var s4e=b(a4e=>{"use strict";Object.defineProperty(a4e,"__esModule",{value:!0})});var l4e=b(u4e=>{"use strict";Object.defineProperty(u4e,"__esModule",{value:!0})});var d4e=b(c4e=>{"use strict";Object.defineProperty(c4e,"__esModule",{value:!0})});var p4e=b(f4e=>{"use strict";Object.defineProperty(f4e,"__esModule",{value:!0})});var h4e=b(m4e=>{"use strict";Object.defineProperty(m4e,"__esModule",{value:!0})});var y4e=b(g4e=>{"use strict";Object.defineProperty(g4e,"__esModule",{value:!0})});var _4e=b(b4e=>{"use strict";Object.defineProperty(b4e,"__esModule",{value:!0})});var w4e=b(v4e=>{"use strict";Object.defineProperty(v4e,"__esModule",{value:!0})});var x4e=b(S4e=>{"use strict";Object.defineProperty(S4e,"__esModule",{value:!0})});var O4e=b(C4e=>{"use strict";Object.defineProperty(C4e,"__esModule",{value:!0})});var P4e=b(E4e=>{"use strict";Object.defineProperty(E4e,"__esModule",{value:!0})});var A4e=b(T4e=>{"use strict";Object.defineProperty(T4e,"__esModule",{value:!0})});var M4e=b(I4e=>{"use strict";Object.defineProperty(I4e,"__esModule",{value:!0})});var j4e=b(R4e=>{"use strict";Object.defineProperty(R4e,"__esModule",{value:!0})});var N4e=b(D4e=>{"use strict";Object.defineProperty(D4e,"__esModule",{value:!0})});var L4e=b(GW=>{"use strict";Object.defineProperty(GW,"__esModule",{value:!0});GW.ChatFinishReason=void 0;GW.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});var k4e=b(F4e=>{"use strict";Object.defineProperty(F4e,"__esModule",{value:!0})});var $4e=b(B4e=>{"use strict";Object.defineProperty(B4e,"__esModule",{value:!0})});var U4e=b(q4e=>{"use strict";Object.defineProperty(q4e,"__esModule",{value:!0})});var H4e=b(z4e=>{"use strict";Object.defineProperty(z4e,"__esModule",{value:!0})});var W4e=b(V4e=>{"use strict";Object.defineProperty(V4e,"__esModule",{value:!0})});var J4e=b(K4e=>{"use strict";Object.defineProperty(K4e,"__esModule",{value:!0})});var Y4e=b(G4e=>{"use strict";Object.defineProperty(G4e,"__esModule",{value:!0})});var X4e=b(Z4e=>{"use strict";Object.defineProperty(Z4e,"__esModule",{value:!0})});var e3e=b(Q4e=>{"use strict";Object.defineProperty(Q4e,"__esModule",{value:!0})});var r3e=b(t3e=>{"use strict";Object.defineProperty(t3e,"__esModule",{value:!0})});var o3e=b(n3e=>{"use strict";Object.defineProperty(n3e,"__esModule",{value:!0})});var a3e=b(i3e=>{"use strict";Object.defineProperty(i3e,"__esModule",{value:!0})});var u3e=b(s3e=>{"use strict";Object.defineProperty(s3e,"__esModule",{value:!0})});var c3e=b(l3e=>{"use strict";Object.defineProperty(l3e,"__esModule",{value:!0})});var f3e=b(d3e=>{"use strict";Object.defineProperty(d3e,"__esModule",{value:!0})});var m3e=b(p3e=>{"use strict";Object.defineProperty(p3e,"__esModule",{value:!0})});var g3e=b(h3e=>{"use strict";Object.defineProperty(h3e,"__esModule",{value:!0})});var b3e=b(y3e=>{"use strict";Object.defineProperty(y3e,"__esModule",{value:!0})});var v3e=b(_3e=>{"use strict";Object.defineProperty(_3e,"__esModule",{value:!0})});var S3e=b(w3e=>{"use strict";Object.defineProperty(w3e,"__esModule",{value:!0})});var C3e=b(x3e=>{"use strict";Object.defineProperty(x3e,"__esModule",{value:!0})});var E3e=b(O3e=>{"use strict";Object.defineProperty(O3e,"__esModule",{value:!0})});var T3e=b(P3e=>{"use strict";Object.defineProperty(P3e,"__esModule",{value:!0})});var I3e=b(A3e=>{"use strict";Object.defineProperty(A3e,"__esModule",{value:!0})});var R3e=b(M3e=>{"use strict";Object.defineProperty(M3e,"__esModule",{value:!0})});var D3e=b(j3e=>{"use strict";Object.defineProperty(j3e,"__esModule",{value:!0})});var L3e=b(N3e=>{"use strict";Object.defineProperty(N3e,"__esModule",{value:!0})});var k3e=b(F3e=>{"use strict";Object.defineProperty(F3e,"__esModule",{value:!0})});var $3e=b(B3e=>{"use strict";Object.defineProperty(B3e,"__esModule",{value:!0})});var U3e=b(q3e=>{"use strict";Object.defineProperty(q3e,"__esModule",{value:!0})});var H3e=b(z3e=>{"use strict";Object.defineProperty(z3e,"__esModule",{value:!0})});var W3e=b(V3e=>{"use strict";Object.defineProperty(V3e,"__esModule",{value:!0})});var J3e=b(K3e=>{"use strict";Object.defineProperty(K3e,"__esModule",{value:!0})});var Tpe=b(gt=>{"use strict";var mXt=gt&&gt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pt=gt&&gt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mXt(e,t,r)};Object.defineProperty(gt,"__esModule",{value:!0});Pt(U2e(),gt);Pt(z2e(),gt);Pt(V2e(),gt);Pt(K2e(),gt);Pt(G2e(),gt);Pt(Z2e(),gt);Pt(Q2e(),gt);Pt(t4e(),gt);Pt(n4e(),gt);Pt(i4e(),gt);Pt(s4e(),gt);Pt(l4e(),gt);Pt(d4e(),gt);Pt(p4e(),gt);Pt(h4e(),gt);Pt(y4e(),gt);Pt(_4e(),gt);Pt(w4e(),gt);Pt(x4e(),gt);Pt(O4e(),gt);Pt(P4e(),gt);Pt(A4e(),gt);Pt(M4e(),gt);Pt(j4e(),gt);Pt(N4e(),gt);Pt(L4e(),gt);Pt(k4e(),gt);Pt($4e(),gt);Pt(U4e(),gt);Pt(H4e(),gt);Pt(W4e(),gt);Pt(J4e(),gt);Pt(Y4e(),gt);Pt(X4e(),gt);Pt(e3e(),gt);Pt(r3e(),gt);Pt(o3e(),gt);Pt(a3e(),gt);Pt(u3e(),gt);Pt(c3e(),gt);Pt(f3e(),gt);Pt(m3e(),gt);Pt(g3e(),gt);Pt(b3e(),gt);Pt(v3e(),gt);Pt(S3e(),gt);Pt(C3e(),gt);Pt(E3e(),gt);Pt(T3e(),gt);Pt(I3e(),gt);Pt(R3e(),gt);Pt(D3e(),gt);Pt(L3e(),gt);Pt(k3e(),gt);Pt($3e(),gt);Pt(U3e(),gt);Pt(H3e(),gt);Pt(W3e(),gt);Pt(J3e(),gt)});var Ape=b(G3e=>{"use strict";Object.defineProperty(G3e,"__esModule",{value:!0})});var Y3e=b(fM=>{"use strict";var hXt=fM&&fM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gXt=fM&&fM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hXt(e,t,r)};Object.defineProperty(fM,"__esModule",{value:!0});gXt(Ape(),fM)});var X3e=b(FE=>{"use strict";var yXt=FE&&FE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z3e=FE&&FE.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yXt(e,t,r)};Object.defineProperty(FE,"__esModule",{value:!0});Z3e(Tpe(),FE);Z3e(Y3e(),FE)});var Q3e=b(YW=>{"use strict";Object.defineProperty(YW,"__esModule",{value:!0});YW.CreateEmbedJobRequestTruncate=void 0;YW.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var Ipe=b(pM=>{"use strict";var bXt=pM&&pM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Xt=pM&&pM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bXt(e,t,r)};Object.defineProperty(pM,"__esModule",{value:!0});_Xt(Q3e(),pM)});var Mpe=b(eHe=>{"use strict";Object.defineProperty(eHe,"__esModule",{value:!0})});var tHe=b(mM=>{"use strict";var vXt=mM&&mM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wXt=mM&&mM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vXt(e,t,r)};Object.defineProperty(mM,"__esModule",{value:!0});wXt(Mpe(),mM)});var nHe=b(kE=>{"use strict";var SXt=kE&&kE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rHe=kE&&kE.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&SXt(e,t,r)};Object.defineProperty(kE,"__esModule",{value:!0});rHe(Ipe(),kE);rHe(tHe(),kE)});var iHe=b(oHe=>{"use strict";Object.defineProperty(oHe,"__esModule",{value:!0})});var sHe=b(aHe=>{"use strict";Object.defineProperty(aHe,"__esModule",{value:!0})});var lHe=b(uHe=>{"use strict";Object.defineProperty(uHe,"__esModule",{value:!0})});var dHe=b(cHe=>{"use strict";Object.defineProperty(cHe,"__esModule",{value:!0})});var pHe=b(fHe=>{"use strict";Object.defineProperty(fHe,"__esModule",{value:!0})});var Rpe=b(vg=>{"use strict";var xXt=vg&&vg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jz=vg&&vg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xXt(e,t,r)};Object.defineProperty(vg,"__esModule",{value:!0});jz(iHe(),vg);jz(sHe(),vg);jz(lHe(),vg);jz(dHe(),vg);jz(pHe(),vg)});var jpe=b(mHe=>{"use strict";Object.defineProperty(mHe,"__esModule",{value:!0})});var hHe=b(hM=>{"use strict";var CXt=hM&&hM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OXt=hM&&hM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&CXt(e,t,r)};Object.defineProperty(hM,"__esModule",{value:!0});OXt(jpe(),hM)});var yHe=b(BE=>{"use strict";var EXt=BE&&BE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gHe=BE&&BE.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&EXt(e,t,r)};Object.defineProperty(BE,"__esModule",{value:!0});gHe(Rpe(),BE);gHe(hHe(),BE)});var bHe=b(ZW=>{"use strict";Object.defineProperty(ZW,"__esModule",{value:!0});ZW.BaseType=void 0;ZW.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var _He=b(XW=>{"use strict";Object.defineProperty(XW,"__esModule",{value:!0});XW.Strategy=void 0;XW.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var wHe=b(vHe=>{"use strict";Object.defineProperty(vHe,"__esModule",{value:!0})});var xHe=b(SHe=>{"use strict";Object.defineProperty(SHe,"__esModule",{value:!0})});var OHe=b(CHe=>{"use strict";Object.defineProperty(CHe,"__esModule",{value:!0})});var PHe=b(EHe=>{"use strict";Object.defineProperty(EHe,"__esModule",{value:!0})});var THe=b(QW=>{"use strict";Object.defineProperty(QW,"__esModule",{value:!0});QW.Status=void 0;QW.Status={StatusUnspecified:"STATUS_UNSPECIFIED",StatusFinetuning:"STATUS_FINETUNING",StatusDeployingApi:"STATUS_DEPLOYING_API",StatusReady:"STATUS_READY",StatusFailed:"STATUS_FAILED",StatusDeleted:"STATUS_DELETED",StatusTemporarilyOffline:"STATUS_TEMPORARILY_OFFLINE",StatusPaused:"STATUS_PAUSED",StatusQueued:"STATUS_QUEUED"}});var IHe=b(AHe=>{"use strict";Object.defineProperty(AHe,"__esModule",{value:!0})});var RHe=b(MHe=>{"use strict";Object.defineProperty(MHe,"__esModule",{value:!0})});var DHe=b(jHe=>{"use strict";Object.defineProperty(jHe,"__esModule",{value:!0})});var LHe=b(NHe=>{"use strict";Object.defineProperty(NHe,"__esModule",{value:!0})});var kHe=b(FHe=>{"use strict";Object.defineProperty(FHe,"__esModule",{value:!0})});var $He=b(BHe=>{"use strict";Object.defineProperty(BHe,"__esModule",{value:!0})});var UHe=b(qHe=>{"use strict";Object.defineProperty(qHe,"__esModule",{value:!0})});var HHe=b(zHe=>{"use strict";Object.defineProperty(zHe,"__esModule",{value:!0})});var WHe=b(VHe=>{"use strict";Object.defineProperty(VHe,"__esModule",{value:!0})});var JHe=b(KHe=>{"use strict";Object.defineProperty(KHe,"__esModule",{value:!0})});var Dpe=b(ca=>{"use strict";var PXt=ca&&ca.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rc=ca&&ca.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&PXt(e,t,r)};Object.defineProperty(ca,"__esModule",{value:!0});rc(bHe(),ca);rc(_He(),ca);rc(wHe(),ca);rc(xHe(),ca);rc(OHe(),ca);rc(PHe(),ca);rc(THe(),ca);rc(IHe(),ca);rc(RHe(),ca);rc(DHe(),ca);rc(LHe(),ca);rc(kHe(),ca);rc($He(),ca);rc(UHe(),ca);rc(HHe(),ca);rc(WHe(),ca);rc(JHe(),ca)});var GHe=b(gM=>{"use strict";var TXt=gM&&gM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AXt=gM&&gM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TXt(e,t,r)};Object.defineProperty(gM,"__esModule",{value:!0});AXt(Dpe(),gM)});var ZHe=b(jp=>{"use strict";var YHe=jp&&jp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IXt=jp&&jp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MXt=jp&&jp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YHe(e,t,r);return IXt(e,t),e},RXt=jp&&jp.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&YHe(e,t,r)};Object.defineProperty(jp,"__esModule",{value:!0});jp.finetuning=void 0;jp.finetuning=MXt(GHe());RXt(Dpe(),jp)});var Npe=b(XHe=>{"use strict";Object.defineProperty(XHe,"__esModule",{value:!0})});var QHe=b(yM=>{"use strict";var jXt=yM&&yM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DXt=yM&&yM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jXt(e,t,r)};Object.defineProperty(yM,"__esModule",{value:!0});DXt(Npe(),yM)});var t8e=b($E=>{"use strict";var NXt=$E&&$E.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e8e=$E&&$E.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&NXt(e,t,r)};Object.defineProperty($E,"__esModule",{value:!0});e8e(ZHe(),$E);e8e(QHe(),$E)});var Lpe=b(r8e=>{"use strict";Object.defineProperty(r8e,"__esModule",{value:!0})});var n8e=b(bM=>{"use strict";var LXt=bM&&bM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FXt=bM&&bM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LXt(e,t,r)};Object.defineProperty(bM,"__esModule",{value:!0});FXt(Lpe(),bM)});var o8e=b(_M=>{"use strict";var kXt=_M&&_M.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BXt=_M&&_M.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kXt(e,t,r)};Object.defineProperty(_M,"__esModule",{value:!0});BXt(n8e(),_M)});var Fpe=b(i8e=>{"use strict";Object.defineProperty(i8e,"__esModule",{value:!0})});var a8e=b(vM=>{"use strict";var $Xt=vM&&vM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qXt=vM&&vM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$Xt(e,t,r)};Object.defineProperty(vM,"__esModule",{value:!0});qXt(Fpe(),vM)});var s8e=b(wM=>{"use strict";var UXt=wM&&wM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zXt=wM&&wM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UXt(e,t,r)};Object.defineProperty(wM,"__esModule",{value:!0});zXt(a8e(),wM)});var l8e=b(Mo=>{"use strict";var u8e=Mo&&Mo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HXt=Mo&&Mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NN=Mo&&Mo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u8e(e,t,r);return HXt(e,t),e},Cx=Mo&&Mo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&u8e(e,t,r)};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.models=Mo.connectors=Mo.finetuning=Mo.datasets=Mo.embedJobs=Mo.v2=void 0;Mo.v2=NN(X3e());Cx(Tpe(),Mo);Mo.embedJobs=NN(nHe());Cx(Ipe(),Mo);Mo.datasets=NN(yHe());Cx(Rpe(),Mo);Mo.finetuning=NN(t8e());Mo.connectors=NN(o8e());Mo.models=NN(s8e());Cx(Ape(),Mo);Cx(Mpe(),Mo);Cx(jpe(),Mo);Cx(Lpe(),Mo);Cx(Fpe(),Mo);Cx(Npe(),Mo)});var c8e=b(eK=>{"use strict";Object.defineProperty(eK,"__esModule",{value:!0});eK.ChatStreamRequestPromptTruncation=void 0;eK.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var d8e=b(tK=>{"use strict";Object.defineProperty(tK,"__esModule",{value:!0});tK.ChatStreamRequestCitationQuality=void 0;tK.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var p8e=b(f8e=>{"use strict";Object.defineProperty(f8e,"__esModule",{value:!0})});var m8e=b(rK=>{"use strict";Object.defineProperty(rK,"__esModule",{value:!0});rK.ChatStreamRequestSafetyMode=void 0;rK.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var g8e=b(h8e=>{"use strict";Object.defineProperty(h8e,"__esModule",{value:!0})});var b8e=b(y8e=>{"use strict";Object.defineProperty(y8e,"__esModule",{value:!0})});var v8e=b(_8e=>{"use strict";Object.defineProperty(_8e,"__esModule",{value:!0})});var S8e=b(w8e=>{"use strict";Object.defineProperty(w8e,"__esModule",{value:!0})});var C8e=b(x8e=>{"use strict";Object.defineProperty(x8e,"__esModule",{value:!0})});var O8e=b(nK=>{"use strict";Object.defineProperty(nK,"__esModule",{value:!0});nK.ChatRequestPromptTruncation=void 0;nK.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var E8e=b(oK=>{"use strict";Object.defineProperty(oK,"__esModule",{value:!0});oK.ChatRequestCitationQuality=void 0;oK.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var T8e=b(P8e=>{"use strict";Object.defineProperty(P8e,"__esModule",{value:!0})});var A8e=b(iK=>{"use strict";Object.defineProperty(iK,"__esModule",{value:!0});iK.ChatRequestSafetyMode=void 0;iK.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var I8e=b(aK=>{"use strict";Object.defineProperty(aK,"__esModule",{value:!0});aK.GenerateStreamRequestTruncate=void 0;aK.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var M8e=b(sK=>{"use strict";Object.defineProperty(sK,"__esModule",{value:!0});sK.GenerateStreamRequestReturnLikelihoods=void 0;sK.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var R8e=b(uK=>{"use strict";Object.defineProperty(uK,"__esModule",{value:!0});uK.GenerateRequestTruncate=void 0;uK.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var j8e=b(lK=>{"use strict";Object.defineProperty(lK,"__esModule",{value:!0});lK.GenerateRequestReturnLikelihoods=void 0;lK.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var D8e=b(cK=>{"use strict";Object.defineProperty(cK,"__esModule",{value:!0});cK.EmbedRequestTruncate=void 0;cK.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var L8e=b(N8e=>{"use strict";Object.defineProperty(N8e,"__esModule",{value:!0})});var k8e=b(F8e=>{"use strict";Object.defineProperty(F8e,"__esModule",{value:!0})});var $8e=b(B8e=>{"use strict";Object.defineProperty(B8e,"__esModule",{value:!0})});var U8e=b(q8e=>{"use strict";Object.defineProperty(q8e,"__esModule",{value:!0})});var H8e=b(z8e=>{"use strict";Object.defineProperty(z8e,"__esModule",{value:!0})});var V8e=b(dK=>{"use strict";Object.defineProperty(dK,"__esModule",{value:!0});dK.ClassifyRequestTruncate=void 0;dK.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var K8e=b(W8e=>{"use strict";Object.defineProperty(W8e,"__esModule",{value:!0})});var J8e=b(fK=>{"use strict";Object.defineProperty(fK,"__esModule",{value:!0});fK.ClassifyResponseClassificationsItemClassificationType=void 0;fK.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var Y8e=b(G8e=>{"use strict";Object.defineProperty(G8e,"__esModule",{value:!0})});var X8e=b(Z8e=>{"use strict";Object.defineProperty(Z8e,"__esModule",{value:!0})});var Q8e=b(pK=>{"use strict";Object.defineProperty(pK,"__esModule",{value:!0});pK.SummarizeRequestLength=void 0;pK.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var eVe=b(mK=>{"use strict";Object.defineProperty(mK,"__esModule",{value:!0});mK.SummarizeRequestFormat=void 0;mK.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var tVe=b(hK=>{"use strict";Object.defineProperty(hK,"__esModule",{value:!0});hK.SummarizeRequestExtractiveness=void 0;hK.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var nVe=b(rVe=>{"use strict";Object.defineProperty(rVe,"__esModule",{value:!0})});var iVe=b(oVe=>{"use strict";Object.defineProperty(oVe,"__esModule",{value:!0})});var sVe=b(aVe=>{"use strict";Object.defineProperty(aVe,"__esModule",{value:!0})});var lVe=b(uVe=>{"use strict";Object.defineProperty(uVe,"__esModule",{value:!0})});var dVe=b(cVe=>{"use strict";Object.defineProperty(cVe,"__esModule",{value:!0})});var pVe=b(fVe=>{"use strict";Object.defineProperty(fVe,"__esModule",{value:!0})});var hVe=b(mVe=>{"use strict";Object.defineProperty(mVe,"__esModule",{value:!0})});var yVe=b(gVe=>{"use strict";Object.defineProperty(gVe,"__esModule",{value:!0})});var _Ve=b(bVe=>{"use strict";Object.defineProperty(bVe,"__esModule",{value:!0})});var wVe=b(vVe=>{"use strict";Object.defineProperty(vVe,"__esModule",{value:!0})});var xVe=b(SVe=>{"use strict";Object.defineProperty(SVe,"__esModule",{value:!0})});var OVe=b(CVe=>{"use strict";Object.defineProperty(CVe,"__esModule",{value:!0})});var PVe=b(EVe=>{"use strict";Object.defineProperty(EVe,"__esModule",{value:!0})});var AVe=b(TVe=>{"use strict";Object.defineProperty(TVe,"__esModule",{value:!0})});var MVe=b(IVe=>{"use strict";Object.defineProperty(IVe,"__esModule",{value:!0})});var jVe=b(RVe=>{"use strict";Object.defineProperty(RVe,"__esModule",{value:!0})});var NVe=b(DVe=>{"use strict";Object.defineProperty(DVe,"__esModule",{value:!0})});var FVe=b(LVe=>{"use strict";Object.defineProperty(LVe,"__esModule",{value:!0})});var BVe=b(kVe=>{"use strict";Object.defineProperty(kVe,"__esModule",{value:!0})});var qVe=b($Ve=>{"use strict";Object.defineProperty($Ve,"__esModule",{value:!0})});var UVe=b(gK=>{"use strict";Object.defineProperty(gK,"__esModule",{value:!0});gK.FinishReason=void 0;gK.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var HVe=b(zVe=>{"use strict";Object.defineProperty(zVe,"__esModule",{value:!0})});var WVe=b(VVe=>{"use strict";Object.defineProperty(VVe,"__esModule",{value:!0})});var JVe=b(KVe=>{"use strict";Object.defineProperty(KVe,"__esModule",{value:!0})});var YVe=b(GVe=>{"use strict";Object.defineProperty(GVe,"__esModule",{value:!0})});var XVe=b(ZVe=>{"use strict";Object.defineProperty(ZVe,"__esModule",{value:!0})});var e6e=b(QVe=>{"use strict";Object.defineProperty(QVe,"__esModule",{value:!0})});var r6e=b(t6e=>{"use strict";Object.defineProperty(t6e,"__esModule",{value:!0})});var o6e=b(n6e=>{"use strict";Object.defineProperty(n6e,"__esModule",{value:!0})});var a6e=b(i6e=>{"use strict";Object.defineProperty(i6e,"__esModule",{value:!0})});var u6e=b(s6e=>{"use strict";Object.defineProperty(s6e,"__esModule",{value:!0})});var c6e=b(l6e=>{"use strict";Object.defineProperty(l6e,"__esModule",{value:!0})});var f6e=b(d6e=>{"use strict";Object.defineProperty(d6e,"__esModule",{value:!0})});var p6e=b(yK=>{"use strict";Object.defineProperty(yK,"__esModule",{value:!0});yK.ChatStreamEndEventFinishReason=void 0;yK.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var h6e=b(m6e=>{"use strict";Object.defineProperty(m6e,"__esModule",{value:!0})});var y6e=b(g6e=>{"use strict";Object.defineProperty(g6e,"__esModule",{value:!0})});var _6e=b(b6e=>{"use strict";Object.defineProperty(b6e,"__esModule",{value:!0})});var w6e=b(v6e=>{"use strict";Object.defineProperty(v6e,"__esModule",{value:!0})});var x6e=b(S6e=>{"use strict";Object.defineProperty(S6e,"__esModule",{value:!0})});var O6e=b(C6e=>{"use strict";Object.defineProperty(C6e,"__esModule",{value:!0})});var P6e=b(E6e=>{"use strict";Object.defineProperty(E6e,"__esModule",{value:!0})});var A6e=b(T6e=>{"use strict";Object.defineProperty(T6e,"__esModule",{value:!0})});var M6e=b(I6e=>{"use strict";Object.defineProperty(I6e,"__esModule",{value:!0})});var j6e=b(R6e=>{"use strict";Object.defineProperty(R6e,"__esModule",{value:!0})});var N6e=b(D6e=>{"use strict";Object.defineProperty(D6e,"__esModule",{value:!0})});var F6e=b(L6e=>{"use strict";Object.defineProperty(L6e,"__esModule",{value:!0})});var B6e=b(k6e=>{"use strict";Object.defineProperty(k6e,"__esModule",{value:!0})});var q6e=b($6e=>{"use strict";Object.defineProperty($6e,"__esModule",{value:!0})});var z6e=b(U6e=>{"use strict";Object.defineProperty(U6e,"__esModule",{value:!0})});var V6e=b(H6e=>{"use strict";Object.defineProperty(H6e,"__esModule",{value:!0})});var K6e=b(W6e=>{"use strict";Object.defineProperty(W6e,"__esModule",{value:!0})});var G6e=b(J6e=>{"use strict";Object.defineProperty(J6e,"__esModule",{value:!0})});var Z6e=b(Y6e=>{"use strict";Object.defineProperty(Y6e,"__esModule",{value:!0})});var Q6e=b(X6e=>{"use strict";Object.defineProperty(X6e,"__esModule",{value:!0})});var e5e=b(bK=>{"use strict";Object.defineProperty(bK,"__esModule",{value:!0});bK.EmbedInputType=void 0;bK.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var t5e=b(_K=>{"use strict";Object.defineProperty(_K,"__esModule",{value:!0});_K.EmbeddingType=void 0;_K.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var n5e=b(r5e=>{"use strict";Object.defineProperty(r5e,"__esModule",{value:!0})});var i5e=b(o5e=>{"use strict";Object.defineProperty(o5e,"__esModule",{value:!0})});var s5e=b(a5e=>{"use strict";Object.defineProperty(a5e,"__esModule",{value:!0})});var u5e=b(vK=>{"use strict";Object.defineProperty(vK,"__esModule",{value:!0});vK.EmbedJobStatus=void 0;vK.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var l5e=b(wK=>{"use strict";Object.defineProperty(wK,"__esModule",{value:!0});wK.EmbedJobTruncate=void 0;wK.EmbedJobTruncate={Start:"START",End:"END"}});var d5e=b(c5e=>{"use strict";Object.defineProperty(c5e,"__esModule",{value:!0})});var p5e=b(f5e=>{"use strict";Object.defineProperty(f5e,"__esModule",{value:!0})});var h5e=b(m5e=>{"use strict";Object.defineProperty(m5e,"__esModule",{value:!0})});var y5e=b(g5e=>{"use strict";Object.defineProperty(g5e,"__esModule",{value:!0})});var _5e=b(b5e=>{"use strict";Object.defineProperty(b5e,"__esModule",{value:!0})});var v5e=b(SK=>{"use strict";Object.defineProperty(SK,"__esModule",{value:!0});SK.DatasetValidationStatus=void 0;SK.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var w5e=b(xK=>{"use strict";Object.defineProperty(xK,"__esModule",{value:!0});xK.DatasetType=void 0;xK.DatasetType={EmbedInput:"embed-input",EmbedResult:"embed-result",ClusterResult:"cluster-result",ClusterOutliers:"cluster-outliers",RerankerFinetuneInput:"reranker-finetune-input",SingleLabelClassificationFinetuneInput:"single-label-classification-finetune-input",ChatFinetuneInput:"chat-finetune-input",MultiLabelClassificationFinetuneInput:"multi-label-classification-finetune-input"}});var x5e=b(S5e=>{"use strict";Object.defineProperty(S5e,"__esModule",{value:!0})});var O5e=b(C5e=>{"use strict";Object.defineProperty(C5e,"__esModule",{value:!0})});var P5e=b(E5e=>{"use strict";Object.defineProperty(E5e,"__esModule",{value:!0})});var A5e=b(T5e=>{"use strict";Object.defineProperty(T5e,"__esModule",{value:!0})});var M5e=b(I5e=>{"use strict";Object.defineProperty(I5e,"__esModule",{value:!0})});var j5e=b(R5e=>{"use strict";Object.defineProperty(R5e,"__esModule",{value:!0})});var N5e=b(D5e=>{"use strict";Object.defineProperty(D5e,"__esModule",{value:!0})});var F5e=b(L5e=>{"use strict";Object.defineProperty(L5e,"__esModule",{value:!0})});var B5e=b(k5e=>{"use strict";Object.defineProperty(k5e,"__esModule",{value:!0})});var q5e=b($5e=>{"use strict";Object.defineProperty($5e,"__esModule",{value:!0})});var z5e=b(U5e=>{"use strict";Object.defineProperty(U5e,"__esModule",{value:!0})});var V5e=b(H5e=>{"use strict";Object.defineProperty(H5e,"__esModule",{value:!0})});var W5e=b(CK=>{"use strict";Object.defineProperty(CK,"__esModule",{value:!0});CK.ConnectorAuthStatus=void 0;CK.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var J5e=b(K5e=>{"use strict";Object.defineProperty(K5e,"__esModule",{value:!0})});var Y5e=b(G5e=>{"use strict";Object.defineProperty(G5e,"__esModule",{value:!0})});var X5e=b(Z5e=>{"use strict";Object.defineProperty(Z5e,"__esModule",{value:!0})});var Q5e=b(OK=>{"use strict";Object.defineProperty(OK,"__esModule",{value:!0});OK.AuthTokenType=void 0;OK.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var t9e=b(e9e=>{"use strict";Object.defineProperty(e9e,"__esModule",{value:!0})});var n9e=b(r9e=>{"use strict";Object.defineProperty(r9e,"__esModule",{value:!0})});var i9e=b(o9e=>{"use strict";Object.defineProperty(o9e,"__esModule",{value:!0})});var s9e=b(a9e=>{"use strict";Object.defineProperty(a9e,"__esModule",{value:!0})});var l9e=b(u9e=>{"use strict";Object.defineProperty(u9e,"__esModule",{value:!0})});var d9e=b(c9e=>{"use strict";Object.defineProperty(c9e,"__esModule",{value:!0})});var f9e=b(EK=>{"use strict";Object.defineProperty(EK,"__esModule",{value:!0});EK.CompatibleEndpoint=void 0;EK.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var m9e=b(p9e=>{"use strict";Object.defineProperty(p9e,"__esModule",{value:!0})});var g9e=b(h9e=>{"use strict";Object.defineProperty(h9e,"__esModule",{value:!0})});var y9e=b(ae=>{"use strict";var VXt=ae&&ae.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),me=ae&&ae.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&VXt(e,t,r)};Object.defineProperty(ae,"__esModule",{value:!0});me(c8e(),ae);me(d8e(),ae);me(p8e(),ae);me(m8e(),ae);me(g8e(),ae);me(b8e(),ae);me(v8e(),ae);me(S8e(),ae);me(C8e(),ae);me(O8e(),ae);me(E8e(),ae);me(T8e(),ae);me(A8e(),ae);me(I8e(),ae);me(M8e(),ae);me(R8e(),ae);me(j8e(),ae);me(D8e(),ae);me(L8e(),ae);me(k8e(),ae);me($8e(),ae);me(U8e(),ae);me(H8e(),ae);me(V8e(),ae);me(K8e(),ae);me(J8e(),ae);me(Y8e(),ae);me(X8e(),ae);me(Q8e(),ae);me(eVe(),ae);me(tVe(),ae);me(nVe(),ae);me(iVe(),ae);me(sVe(),ae);me(lVe(),ae);me(dVe(),ae);me(pVe(),ae);me(hVe(),ae);me(yVe(),ae);me(_Ve(),ae);me(wVe(),ae);me(xVe(),ae);me(OVe(),ae);me(PVe(),ae);me(AVe(),ae);me(MVe(),ae);me(jVe(),ae);me(NVe(),ae);me(FVe(),ae);me(BVe(),ae);me(qVe(),ae);me(UVe(),ae);me(HVe(),ae);me(WVe(),ae);me(JVe(),ae);me(YVe(),ae);me(XVe(),ae);me(e6e(),ae);me(r6e(),ae);me(o6e(),ae);me(a6e(),ae);me(u6e(),ae);me(c6e(),ae);me(f6e(),ae);me(p6e(),ae);me(h6e(),ae);me(y6e(),ae);me(_6e(),ae);me(w6e(),ae);me(x6e(),ae);me(O6e(),ae);me(P6e(),ae);me(A6e(),ae);me(M6e(),ae);me(j6e(),ae);me(N6e(),ae);me(F6e(),ae);me(B6e(),ae);me(q6e(),ae);me(z6e(),ae);me(V6e(),ae);me(K6e(),ae);me(G6e(),ae);me(Z6e(),ae);me(Q6e(),ae);me(e5e(),ae);me(t5e(),ae);me(n5e(),ae);me(i5e(),ae);me(s5e(),ae);me(u5e(),ae);me(l5e(),ae);me(d5e(),ae);me(p5e(),ae);me(h5e(),ae);me(y5e(),ae);me(_5e(),ae);me(v5e(),ae);me(w5e(),ae);me(x5e(),ae);me(O5e(),ae);me(P5e(),ae);me(A5e(),ae);me(M5e(),ae);me(j5e(),ae);me(N5e(),ae);me(F5e(),ae);me(B5e(),ae);me(q5e(),ae);me(z5e(),ae);me(V5e(),ae);me(W5e(),ae);me(J5e(),ae);me(Y5e(),ae);me(X5e(),ae);me(Q5e(),ae);me(t9e(),ae);me(n9e(),ae);me(i9e(),ae);me(s9e(),ae);me(l9e(),ae);me(d9e(),ae);me(f9e(),ae);me(m9e(),ae);me(g9e(),ae)});var b9e=b(PK=>{"use strict";Object.defineProperty(PK,"__esModule",{value:!0});PK.CohereError=void 0;var kpe=class t extends Error{constructor({message:e,statusCode:r,body:n}){super(WXt({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};PK.CohereError=kpe;function WXt({message:t,statusCode:e,body:r}){let n=[];return t!=null&&n.push(t),e!=null&&n.push(`Status code: ${e.toString()}`),r!=null&&n.push(`Body: ${JSON.stringify(r,void 0,2)}`),n.join(`
`)}});var _9e=b(TK=>{"use strict";Object.defineProperty(TK,"__esModule",{value:!0});TK.CohereTimeoutError=void 0;var Bpe=class t extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,t.prototype)}};TK.CohereTimeoutError=Bpe});var Xa=b(LN=>{"use strict";Object.defineProperty(LN,"__esModule",{value:!0});LN.CohereTimeoutError=LN.CohereError=void 0;var KXt=b9e();Object.defineProperty(LN,"CohereError",{enumerable:!0,get:function(){return KXt.CohereError}});var JXt=_9e();Object.defineProperty(LN,"CohereTimeoutError",{enumerable:!0,get:function(){return JXt.CohereTimeoutError}})});var v9e=b(Wy=>{"use strict";var GXt=Wy&&Wy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YXt=Wy&&Wy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZXt=Wy&&Wy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GXt(e,t,r);return YXt(e,t),e};Object.defineProperty(Wy,"__esModule",{value:!0});Wy.BadRequestError=void 0;var XXt=ZXt(Xa()),$pe=class t extends XXt.CohereError{constructor(e){super({message:"BadRequestError",statusCode:400,body:e}),Object.setPrototypeOf(this,t.prototype)}};Wy.BadRequestError=$pe});var w9e=b(Ky=>{"use strict";var QXt=Ky&&Ky.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eQt=Ky&&Ky.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tQt=Ky&&Ky.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QXt(e,t,r);return eQt(e,t),e};Object.defineProperty(Ky,"__esModule",{value:!0});Ky.UnauthorizedError=void 0;var rQt=tQt(Xa()),qpe=class t extends rQt.CohereError{constructor(e){super({message:"UnauthorizedError",statusCode:401,body:e}),Object.setPrototypeOf(this,t.prototype)}};Ky.UnauthorizedError=qpe});var S9e=b(Jy=>{"use strict";var nQt=Jy&&Jy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oQt=Jy&&Jy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iQt=Jy&&Jy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nQt(e,t,r);return oQt(e,t),e};Object.defineProperty(Jy,"__esModule",{value:!0});Jy.ForbiddenError=void 0;var aQt=iQt(Xa()),Upe=class t extends aQt.CohereError{constructor(e){super({message:"ForbiddenError",statusCode:403,body:e}),Object.setPrototypeOf(this,t.prototype)}};Jy.ForbiddenError=Upe});var x9e=b(Gy=>{"use strict";var sQt=Gy&&Gy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uQt=Gy&&Gy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lQt=Gy&&Gy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sQt(e,t,r);return uQt(e,t),e};Object.defineProperty(Gy,"__esModule",{value:!0});Gy.NotFoundError=void 0;var cQt=lQt(Xa()),zpe=class t extends cQt.CohereError{constructor(e){super({message:"NotFoundError",statusCode:404,body:e}),Object.setPrototypeOf(this,t.prototype)}};Gy.NotFoundError=zpe});var C9e=b(Yy=>{"use strict";var dQt=Yy&&Yy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fQt=Yy&&Yy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pQt=Yy&&Yy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dQt(e,t,r);return fQt(e,t),e};Object.defineProperty(Yy,"__esModule",{value:!0});Yy.UnprocessableEntityError=void 0;var mQt=pQt(Xa()),Hpe=class t extends mQt.CohereError{constructor(e){super({message:"UnprocessableEntityError",statusCode:422,body:e}),Object.setPrototypeOf(this,t.prototype)}};Yy.UnprocessableEntityError=Hpe});var O9e=b(Zy=>{"use strict";var hQt=Zy&&Zy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gQt=Zy&&Zy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yQt=Zy&&Zy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hQt(e,t,r);return gQt(e,t),e};Object.defineProperty(Zy,"__esModule",{value:!0});Zy.TooManyRequestsError=void 0;var bQt=yQt(Xa()),Vpe=class t extends bQt.CohereError{constructor(e){super({message:"TooManyRequestsError",statusCode:429,body:e}),Object.setPrototypeOf(this,t.prototype)}};Zy.TooManyRequestsError=Vpe});var E9e=b(Xy=>{"use strict";var _Qt=Xy&&Xy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vQt=Xy&&Xy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wQt=Xy&&Xy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Qt(e,t,r);return vQt(e,t),e};Object.defineProperty(Xy,"__esModule",{value:!0});Xy.ClientClosedRequestError=void 0;var SQt=wQt(Xa()),Wpe=class t extends SQt.CohereError{constructor(e){super({message:"ClientClosedRequestError",statusCode:499,body:e}),Object.setPrototypeOf(this,t.prototype)}};Xy.ClientClosedRequestError=Wpe});var P9e=b(Qy=>{"use strict";var xQt=Qy&&Qy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CQt=Qy&&Qy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OQt=Qy&&Qy.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xQt(e,t,r);return CQt(e,t),e};Object.defineProperty(Qy,"__esModule",{value:!0});Qy.InternalServerError=void 0;var EQt=OQt(Xa()),Kpe=class t extends EQt.CohereError{constructor(e){super({message:"InternalServerError",statusCode:500,body:e}),Object.setPrototypeOf(this,t.prototype)}};Qy.InternalServerError=Kpe});var T9e=b(eb=>{"use strict";var PQt=eb&&eb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TQt=eb&&eb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AQt=eb&&eb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PQt(e,t,r);return TQt(e,t),e};Object.defineProperty(eb,"__esModule",{value:!0});eb.NotImplementedError=void 0;var IQt=AQt(Xa()),Jpe=class t extends IQt.CohereError{constructor(e){super({message:"NotImplementedError",statusCode:501,body:e}),Object.setPrototypeOf(this,t.prototype)}};eb.NotImplementedError=Jpe});var A9e=b(tb=>{"use strict";var MQt=tb&&tb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RQt=tb&&tb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jQt=tb&&tb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MQt(e,t,r);return RQt(e,t),e};Object.defineProperty(tb,"__esModule",{value:!0});tb.ServiceUnavailableError=void 0;var DQt=jQt(Xa()),Gpe=class t extends DQt.CohereError{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,body:e}),Object.setPrototypeOf(this,t.prototype)}};tb.ServiceUnavailableError=Gpe});var I9e=b(rb=>{"use strict";var NQt=rb&&rb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LQt=rb&&rb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FQt=rb&&rb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NQt(e,t,r);return LQt(e,t),e};Object.defineProperty(rb,"__esModule",{value:!0});rb.GatewayTimeoutError=void 0;var kQt=FQt(Xa()),Ype=class t extends kQt.CohereError{constructor(e){super({message:"GatewayTimeoutError",statusCode:504,body:e}),Object.setPrototypeOf(this,t.prototype)}};rb.GatewayTimeoutError=Ype});var M9e=b(nc=>{"use strict";var BQt=nc&&nc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wg=nc&&nc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BQt(e,t,r)};Object.defineProperty(nc,"__esModule",{value:!0});wg(v9e(),nc);wg(w9e(),nc);wg(S9e(),nc);wg(x9e(),nc);wg(C9e(),nc);wg(O9e(),nc);wg(E9e(),nc);wg(P9e(),nc);wg(T9e(),nc);wg(A9e(),nc);wg(I9e(),nc)});var j9e=b(R9e=>{"use strict";Object.defineProperty(R9e,"__esModule",{value:!0})});var D9e=b(SM=>{"use strict";var $Qt=SM&&SM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qQt=SM&&SM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$Qt(e,t,r)};Object.defineProperty(SM,"__esModule",{value:!0});qQt(j9e(),SM)});var Ox=b(nb=>{"use strict";var UQt=nb&&nb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AK=nb&&nb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UQt(e,t,r)};Object.defineProperty(nb,"__esModule",{value:!0});AK(l8e(),nb);AK(y9e(),nb);AK(M9e(),nb);AK(D9e(),nb)});var Qpe={};ff(Qpe,{__addDisposableResource:()=>tWe,__assign:()=>IK,__asyncDelegator:()=>K9e,__asyncGenerator:()=>W9e,__asyncValues:()=>J9e,__await:()=>FN,__awaiter:()=>$9e,__classPrivateFieldGet:()=>X9e,__classPrivateFieldIn:()=>eWe,__classPrivateFieldSet:()=>Q9e,__createBinding:()=>RK,__decorate:()=>F9e,__disposeResources:()=>rWe,__esDecorate:()=>zQt,__exportStar:()=>U9e,__extends:()=>N9e,__generator:()=>q9e,__importDefault:()=>Z9e,__importStar:()=>Y9e,__makeTemplateObject:()=>G9e,__metadata:()=>B9e,__param:()=>k9e,__propKey:()=>VQt,__read:()=>Xpe,__rest:()=>L9e,__runInitializers:()=>HQt,__setFunctionName:()=>WQt,__spread:()=>z9e,__spreadArray:()=>V9e,__spreadArrays:()=>H9e,__values:()=>MK,default:()=>GQt});function N9e(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Zpe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function L9e(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function F9e(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function k9e(t,e){return function(r,n){e(r,n,t)}}function zQt(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var v=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(d=a(v.get))&&(c.get=d),(d=a(v.set))&&(c.set=d),(d=a(v.init))&&o.unshift(d)}else(d=a(v))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function HQt(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function VQt(t){return typeof t=="symbol"?t:"".concat(t)}function WQt(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function B9e(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function $9e(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function q9e(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function U9e(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RK(e,t,r)}function MK(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Xpe(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function z9e(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Xpe(arguments[e]));return t}function H9e(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function V9e(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function FN(t){return this instanceof FN?(this.v=t,this):new FN(t)}function W9e(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(v,g){i.push([p,h,v,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof FN?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function K9e(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:FN(t[o](a)),done:!1}:i?i(a):a}:i}}function J9e(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof MK=="function"?MK(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function G9e(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Y9e(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RK(e,t,r);return KQt(e,t),e}function Z9e(t){return t&&t.__esModule?t:{default:t}}function X9e(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function Q9e(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function eWe(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function tWe(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function rWe(t){function e(i){t.error=t.hasError?new JQt(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}var Zpe,IK,RK,KQt,JQt,GQt,eme=O(()=>{Zpe=function(t,e){return Zpe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Zpe(t,e)};IK=function(){return IK=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},IK.apply(this,arguments)};RK=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};KQt=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};JQt=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};GQt={__extends:N9e,__assign:IK,__rest:L9e,__decorate:F9e,__param:k9e,__metadata:B9e,__awaiter:$9e,__generator:q9e,__createBinding:RK,__exportStar:U9e,__values:MK,__read:Xpe,__spread:z9e,__spreadArrays:H9e,__spreadArray:V9e,__await:FN,__asyncGenerator:W9e,__asyncDelegator:K9e,__asyncValues:J9e,__makeTemplateObject:G9e,__importStar:Y9e,__importDefault:Z9e,__classPrivateFieldGet:X9e,__classPrivateFieldSet:Q9e,__classPrivateFieldIn:eWe,__addDisposableResource:tWe,__disposeResources:rWe}});var tme=b($m=>{"use strict";Object.defineProperty($m,"__esModule",{value:!0});$m.MAX_HASHABLE_LENGTH=$m.INIT=$m.KEY=$m.DIGEST_LENGTH=$m.BLOCK_SIZE=void 0;$m.BLOCK_SIZE=64;$m.DIGEST_LENGTH=32;$m.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);$m.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];$m.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var nWe=b(jK=>{"use strict";Object.defineProperty(jK,"__esModule",{value:!0});jK.RawSha256=void 0;var qm=tme(),YQt=function(){function t(){this.state=Int32Array.from(qm.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return t.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var r=0,n=e.byteLength;if(this.bytesHashed+=n,this.bytesHashed*8>qm.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[r++],n--,this.bufferLength===qm.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},t.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(r.setUint8(this.bufferLength++,128),n%qm.BLOCK_SIZE>=qm.BLOCK_SIZE-8){for(var o=this.bufferLength;o<qm.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<qm.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(qm.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(qm.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(qm.DIGEST_LENGTH),o=0;o<8;o++)i[o*4]=this.state[o]>>>24&255,i[o*4+1]=this.state[o]>>>16&255,i[o*4+2]=this.state[o]>>>8&255,i[o*4+3]=this.state[o]>>>0&255;return i},t.prototype.hashBuffer=function(){for(var e=this,r=e.buffer,n=e.state,o=n[0],i=n[1],a=n[2],s=n[3],u=n[4],l=n[5],c=n[6],d=n[7],f=0;f<qm.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(r[f*4]&255)<<24|(r[f*4+1]&255)<<16|(r[f*4+2]&255)<<8|r[f*4+3]&255;else{var p=this.temp[f-2],m=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var v=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(qm.KEY[f]+this.temp[f]|0)|0)|0,g=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&i^o&a^i&a)|0;d=c,c=l,l=u,u=s+v|0,s=a,a=i,i=o,o=v+g|0}n[0]+=o,n[1]+=i,n[2]+=a,n[3]+=s,n[4]+=u,n[5]+=l,n[6]+=c,n[7]+=d},t}();jK.RawSha256=YQt});var aWe=b((gLn,iWe)=>{var DK=Object.defineProperty,ZQt=Object.getOwnPropertyDescriptor,XQt=Object.getOwnPropertyNames,QQt=Object.prototype.hasOwnProperty,eer=(t,e)=>DK(t,"name",{value:e,configurable:!0}),ter=(t,e)=>{for(var r in e)DK(t,r,{get:e[r],enumerable:!0})},rer=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of XQt(e))!QQt.call(t,o)&&o!==r&&DK(t,o,{get:()=>e[o],enumerable:!(n=ZQt(e,o))||n.enumerable});return t},ner=t=>rer(DK({},"__esModule",{value:!0}),t),oWe={};ter(oWe,{isArrayBuffer:()=>oer});iWe.exports=ner(oWe);var oer=eer(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var cWe=b((yLn,lWe)=>{var NK=Object.defineProperty,ier=Object.getOwnPropertyDescriptor,aer=Object.getOwnPropertyNames,ser=Object.prototype.hasOwnProperty,sWe=(t,e)=>NK(t,"name",{value:e,configurable:!0}),uer=(t,e)=>{for(var r in e)NK(t,r,{get:e[r],enumerable:!0})},ler=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of aer(e))!ser.call(t,o)&&o!==r&&NK(t,o,{get:()=>e[o],enumerable:!(n=ier(e,o))||n.enumerable});return t},cer=t=>ler(NK({},"__esModule",{value:!0}),t),uWe={};uer(uWe,{fromArrayBuffer:()=>fer,fromString:()=>per});lWe.exports=cer(uWe);var der=aWe(),rme=Tf(),fer=sWe((t,e=0,r=t.byteLength-e)=>{if(!(0,der.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return rme.Buffer.from(t,e,r)},"fromArrayBuffer"),per=sWe((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?rme.Buffer.from(t,e):rme.Buffer.from(t)},"fromString")});var hWe=b((bLn,mWe)=>{var LK=Object.defineProperty,mer=Object.getOwnPropertyDescriptor,her=Object.getOwnPropertyNames,ger=Object.prototype.hasOwnProperty,nme=(t,e)=>LK(t,"name",{value:e,configurable:!0}),yer=(t,e)=>{for(var r in e)LK(t,r,{get:e[r],enumerable:!0})},ber=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of her(e))!ger.call(t,o)&&o!==r&&LK(t,o,{get:()=>e[o],enumerable:!(n=mer(e,o))||n.enumerable});return t},_er=t=>ber(LK({},"__esModule",{value:!0}),t),dWe={};yer(dWe,{fromUtf8:()=>pWe,toUint8Array:()=>ver,toUtf8:()=>wer});mWe.exports=_er(dWe);var fWe=cWe(),pWe=nme(t=>{let e=(0,fWe.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),ver=nme(t=>typeof t=="string"?pWe(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),wer=nme(t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return(0,fWe.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var gWe=b(FK=>{"use strict";Object.defineProperty(FK,"__esModule",{value:!0});FK.convertToBuffer=void 0;var Ser=hWe(),xer=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:Ser.fromUtf8;function Cer(t){return t instanceof Uint8Array?t:typeof t=="string"?xer(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}FK.convertToBuffer=Cer});var yWe=b(kK=>{"use strict";Object.defineProperty(kK,"__esModule",{value:!0});kK.isEmptyData=void 0;function Oer(t){return typeof t=="string"?t.length===0:t.byteLength===0}kK.isEmptyData=Oer});var bWe=b(BK=>{"use strict";Object.defineProperty(BK,"__esModule",{value:!0});BK.numToUint8=void 0;function Eer(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}BK.numToUint8=Eer});var _We=b($K=>{"use strict";Object.defineProperty($K,"__esModule",{value:!0});$K.uint32ArrayFrom=void 0;function Per(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r<t.length;)e[r]=t[r],r+=1;return e}return Uint32Array.from(t)}$K.uint32ArrayFrom=Per});var qK=b(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.uint32ArrayFrom=ob.numToUint8=ob.isEmptyData=ob.convertToBuffer=void 0;var Ter=gWe();Object.defineProperty(ob,"convertToBuffer",{enumerable:!0,get:function(){return Ter.convertToBuffer}});var Aer=yWe();Object.defineProperty(ob,"isEmptyData",{enumerable:!0,get:function(){return Aer.isEmptyData}});var Ier=bWe();Object.defineProperty(ob,"numToUint8",{enumerable:!0,get:function(){return Ier.numToUint8}});var Mer=_We();Object.defineProperty(ob,"uint32ArrayFrom",{enumerable:!0,get:function(){return Mer.uint32ArrayFrom}})});var wWe=b(HK=>{"use strict";Object.defineProperty(HK,"__esModule",{value:!0});HK.Sha256=void 0;var vWe=(eme(),gl(Qpe)),zK=tme(),UK=nWe(),ome=qK(),Rer=function(){function t(e){this.secret=e,this.hash=new UK.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,ome.isEmptyData)(e)||this.error))try{this.hash.update((0,ome.convertToBuffer)(e))}catch(r){this.error=r}},t.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},t.prototype.digest=function(){return vWe.__awaiter(this,void 0,void 0,function(){return vWe.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new UK.RawSha256,this.secret){this.outer=new UK.RawSha256;var e=jer(this.secret),r=new Uint8Array(zK.BLOCK_SIZE);r.set(e);for(var n=0;n<zK.BLOCK_SIZE;n++)e[n]^=54,r[n]^=92;this.hash.update(e),this.outer.update(r);for(var n=0;n<e.byteLength;n++)e[n]=0}},t}();HK.Sha256=Rer;function jer(t){var e=(0,ome.convertToBuffer)(t);if(e.byteLength>zK.BLOCK_SIZE){var r=new UK.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(zK.BLOCK_SIZE);return n.set(e),n}});var ame=b(ime=>{"use strict";Object.defineProperty(ime,"__esModule",{value:!0});var Der=(eme(),gl(Qpe));Der.__exportStar(wWe(),ime)});var SWe=O(()=>{});var xWe=O(()=>{});var CWe=O(()=>{});var xM,Dz=O(()=>{xM=class t extends Error{constructor(e,r=!0){let n,o=!0;typeof r=="boolean"?(n=void 0,o=r):r!=null&&typeof r=="object"&&(n=r.logger,o=r.tryNextLink??!0),super(e),this.name="ProviderError",this.tryNextLink=o,Object.setPrototypeOf(this,t.prototype),n?.debug?.(`@smithy/property-provider ${o?"->":"(!)"} ${e}`)}static from(e,r=!0){return Object.assign(new this(e.message,r),e)}}});var Zu,OWe=O(()=>{Dz();Zu=class t extends xM{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,t.prototype)}}});var EWe=O(()=>{Dz()});var PWe=O(()=>{Dz()});var TWe=O(()=>{});var AWe,IWe=O(()=>{AWe=(t,e,r)=>{let n,o,i,a=!1,s=async()=>{o||(o=t());try{n=await o,i=!0,a=!1}finally{o=void 0}return n};return e===void 0?async u=>((!i||u?.forceRefresh)&&(n=await s()),n):async u=>((!i||u?.forceRefresh)&&(n=await s()),a?n:r&&!r(n)?(a=!0,n):(e(n)&&await s(),n))}});var Ex=O(()=>{OWe();Dz();EWe();PWe();TWe();IWe()});function VK(t){return Promise.all(Object.keys(t).reduce((e,r)=>{let n=t[r];return typeof n=="string"?e.push([r,n]):e.push(n().then(o=>[r,o])),e},[])).then(e=>e.reduce((r,[n,o])=>(r[n]=o,r),{}))}var sme=O(()=>{});var MWe=O(()=>{});var RWe=O(()=>{MWe()});var jWe=O(()=>{});var DWe,NWe=O(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(DWe||(DWe={}))});var ume,LWe=O(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(ume||(ume={}))});var FWe=O(()=>{});var kWe=O(()=>{});var BWe=O(()=>{});var $We=O(()=>{});var qWe=O(()=>{NWe();LWe();FWe();kWe();BWe();$We()});var UWe=O(()=>{});var zWe=O(()=>{});var HWe=O(()=>{});var VWe=O(()=>{});var WWe=O(()=>{});var KWe=O(()=>{});var JWe=O(()=>{});var GWe=O(()=>{WWe();KWe();JWe()});var YWe=O(()=>{});var ZWe=O(()=>{});var kN,XWe=O(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(kN||(kN={}))});var QWe=O(()=>{});var eKe=O(()=>{});var tKe=O(()=>{});var rKe=O(()=>{});var nKe=O(()=>{});var oKe=O(()=>{QWe();eKe();tKe();rKe();nKe()});var iKe=O(()=>{});var BN,lme=O(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(BN||(BN={}))});var aKe=O(()=>{lme()});var sKe=O(()=>{});var uKe=O(()=>{aKe();sKe();lme()});var Dp,lKe=O(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Dp||(Dp={}))});var cKe=O(()=>{});var dKe=O(()=>{});var fKe=O(()=>{});var pKe=O(()=>{});var mKe=O(()=>{});var hKe=O(()=>{dKe();fKe();pKe();mKe()});var gKe=O(()=>{});var $N,yKe=O(()=>{$N="__smithy_context"});var bKe=O(()=>{});var _Ke,vKe=O(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(_Ke||(_Ke={}))});var wKe=O(()=>{});var SKe=O(()=>{});var xKe=O(()=>{});var CKe=O(()=>{});var OKe=O(()=>{});var EKe=O(()=>{});var PKe=O(()=>{});var TKe=O(()=>{});var AKe=O(()=>{});var IKe,MKe=O(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(IKe||(IKe={}))});var RKe=O(()=>{});var jKe=O(()=>{});var DKe=O(()=>{});var NKe=O(()=>{});var LKe=O(()=>{});var FKe=O(()=>{});var hs=O(()=>{jWe();qWe();UWe();zWe();HWe();VWe();GWe();YWe();ZWe();XWe();oKe();iKe();uKe();lKe();cKe();hKe();gKe();yKe();bKe();vKe();wKe();SKe();xKe();CKe();OKe();EKe();PKe();TKe();AKe();MKe();RKe();jKe();DKe();NKe();LKe();FKe()});var kKe=O(()=>{hs()});var BKe=O(()=>{});var $Ke=O(()=>{});function Ner(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var WK,qKe=O(()=>{WK=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Ner(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var UKe=O(()=>{});var zKe=O(()=>{});var HKe=O(()=>{});var VKe=O(()=>{RWe();kKe();BKe();$Ke();qKe();UKe();zKe();HKe()});var Ler,Fer,KK,cme=O(()=>{VKe();Ler=t=>e=>async r=>{if(!WK.isInstance(r.request))return e(r);let{request:n}=r,{handlerProtocol:o=""}=t.requestHandler.metadata||{};if(o.indexOf("h2")>=0&&!n.headers[":authority"])delete n.headers.host,n.headers[":authority"]=n.hostname+(n.port?":"+n.port:"");else if(!n.headers.host){let i=n.hostname;n.port!=null&&(i+=`:${n.port}`),n.headers.host=i}return e(r)},Fer={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},KK=t=>({applyToStack:e=>{e.add(Ler(t),Fer)}})});var ker,Ber,JK,WKe=O(()=>{ker=()=>(t,e)=>async r=>{try{let n=await t(r),{clientName:o,commandName:i,logger:a,dynamoDbDocumentClientOptions:s={}}=e,{overrideInputFilterSensitiveLog:u,overrideOutputFilterSensitiveLog:l}=s,c=u??e.inputFilterSensitiveLog,d=l??e.outputFilterSensitiveLog,{$metadata:f,...p}=n.output;return a?.info?.({clientName:o,commandName:i,input:c(r.input),output:d(p),metadata:f}),n}catch(n){let{clientName:o,commandName:i,logger:a,dynamoDbDocumentClientOptions:s={}}=e,{overrideInputFilterSensitiveLog:u}=s,l=u??e.inputFilterSensitiveLog;throw a?.error?.({clientName:o,commandName:i,input:l(r.input),error:n,metadata:n.$metadata}),n}},Ber={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},JK=t=>({applyToStack:e=>{e.add(ker(),Ber)}})});var dme=O(()=>{WKe()});var KKe=O(()=>{});var JKe=O(()=>{KKe()});var GKe=O(()=>{hs()});var YKe=O(()=>{});var ZKe=O(()=>{});function $er(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var GK,XKe=O(()=>{GK=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=$er(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var QKe=O(()=>{});var eJe=O(()=>{});var tJe=O(()=>{});var rJe=O(()=>{JKe();GKe();YKe();ZKe();XKe();QKe();eJe();tJe()});var nJe,qer,Uer,zer,Her,YK,fme=O(()=>{rJe();nJe="X-Amzn-Trace-Id",qer="AWS_LAMBDA_FUNCTION_NAME",Uer="_X_AMZN_TRACE_ID",zer=t=>e=>async r=>{let{request:n}=r;if(!GK.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(nJe))return e(r);let o=process.env[qer],i=process.env[Uer],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[nJe]=i),e({...r,request:n})},Her={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},YK=t=>({applyToStack:e=>{e.add(zer(t),Her)}})});function ZK(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var oJe=O(()=>{});var Ver,Nz,pme=O(()=>{Ver=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),Nz=t=>Ver.test(t)||t.startsWith("[")&&t.endsWith("]")});var Wer,Lz,mme=O(()=>{Wer=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Lz=(t,e=!1)=>{if(!e)return Wer.test(t);let r=t.split(".");for(let n of r)if(!Lz(n))return!1;return!0}});var Px,XK=O(()=>{Px={}});var Tx,iJe=O(()=>{Tx="endpoints"});function Um(t){return typeof t!="object"||t==null?t:"ref"in t?`$${Um(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(Um).join(", ")})`:JSON.stringify(t,null,2)}var aJe=O(()=>{});var Fz=O(()=>{iJe();aJe()});var bi,sJe=O(()=>{bi=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var uJe=O(()=>{});var lJe=O(()=>{});var cJe=O(()=>{});var dJe=O(()=>{});var fJe=O(()=>{});var pJe=O(()=>{});var zm=O(()=>{sJe();uJe();lJe();cJe();dJe();fJe();pJe()});var mJe,hJe=O(()=>{mJe=(t,e)=>t===e});var gJe,yJe=O(()=>{zm();gJe=t=>{let e=t.split("."),r=[];for(let n of e){let o=n.indexOf("[");if(o!==-1){if(n.indexOf("]")!==n.length-1)throw new bi(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new bi(`Invalid array index: '${i}' in path: '${t}'`);o!==0&&r.push(n.slice(0,o)),r.push(i)}else r.push(n)}return r}});var QK,bJe=O(()=>{zm();yJe();QK=(t,e)=>gJe(e).reduce((r,n)=>{if(typeof r!="object")throw new bi(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var _Je,vJe=O(()=>{_Je=t=>t!=null});var wJe,SJe=O(()=>{wJe=t=>!t});var hme,xJe,CJe=O(()=>{hs();pme();hme={[kN.HTTP]:80,[kN.HTTPS]:443},xJe=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:m="",path:h="",query:v={}}=t,g=new URL(`${m}//${f}${p?`:${p}`:""}${h}`);return g.search=Object.entries(v).map(([_,w])=>`${_}=${w}`).join("&"),g}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:n,hostname:o,pathname:i,protocol:a,search:s}=e;if(s)return null;let u=a.slice(0,-1);if(!Object.values(kN).includes(u))return null;let l=Nz(o),c=r.includes(`${n}:${hme[u]}`)||typeof t=="string"&&t.includes(`${n}:${hme[u]}`),d=`${n}${c?`:${hme[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var OJe,EJe=O(()=>{OJe=(t,e)=>t===e});var PJe,TJe=O(()=>{PJe=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var AJe,IJe=O(()=>{AJe=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var gme=O(()=>{hJe();bJe();vJe();mme();SJe();CJe();EJe();TJe();IJe()});var MJe,RJe=O(()=>{gme();MJe={booleanEquals:mJe,getAttr:QK,isSet:_Je,isValidHostLabel:Lz,not:wJe,parseURL:xJe,stringEquals:OJe,substring:PJe,uriEncode:AJe}});var eJ,yme=O(()=>{gme();eJ=(t,e)=>{let r=[],n={...e.endpointParams,...e.referenceRecord},o=0;for(;o<t.length;){let i=t.indexOf("{",o);if(i===-1){r.push(t.slice(o));break}r.push(t.slice(o,i));let a=t.indexOf("}",i);if(a===-1){r.push(t.slice(i));break}t[i+1]==="{"&&t[a+1]==="}"&&(r.push(t.slice(i+1,a)),o=a+2);let s=t.substring(i+1,a);if(s.includes("#")){let[u,l]=s.split("#");r.push(QK(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var jJe,DJe=O(()=>{jJe=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var qE,kz=O(()=>{zm();bme();yme();DJe();qE=(t,e,r)=>{if(typeof t=="string")return eJ(t,r);if(t.fn)return tJ(t,r);if(t.ref)return jJe(t,r);throw new bi(`'${e}': ${String(t)} is not a string, function or reference.`)}});var tJ,bme=O(()=>{XK();RJe();kz();tJ=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:qE(i,"arg",r)),o=t.split(".");return o[0]in Px&&o[1]!=null?Px[o[0]][o[1]](...n):MJe[t](...n)}});var NJe,LJe=O(()=>{Fz();zm();bme();NJe=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new bi(`'${t}' is already defined in Reference Record.`);let n=tJ(e,r);return r.logger?.debug?.(`${Tx} evaluateCondition: ${Um(e)} = ${Um(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var qN,rJ=O(()=>{Fz();LJe();qN=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=NJe(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${Tx} assign: ${i.name} := ${Um(i.value)}`))}return{result:!0,referenceRecord:r}}});var FJe,kJe=O(()=>{zm();kz();FJe=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=qE(i,"Header value entry",e);if(typeof a!="string")throw new bi(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var _me,BJe=O(()=>{zm();yme();vme();_me=(t,e)=>{if(Array.isArray(t))return t.map(r=>_me(r,e));switch(typeof t){case"string":return eJ(t,e);case"object":if(t===null)throw new bi(`Unexpected endpoint property: ${t}`);return nJ(t,e);case"boolean":return t;default:throw new bi(`Unexpected endpoint property type: ${typeof t}`)}}});var nJ,vme=O(()=>{BJe();nJ=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:_me(o,e)}),{})});var $Je,qJe=O(()=>{zm();kz();$Je=(t,e)=>{let r=qE(t,"Endpoint URL",e);if(typeof r=="string")try{return new URL(r)}catch(n){throw console.error(`Failed to construct URL with ${r}`,n),n}throw new bi(`Endpoint URL must be a string, got ${typeof r}`)}});var UJe,zJe=O(()=>{Fz();rJ();kJe();vme();qJe();UJe=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=qN(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${Tx} Resolving endpoint from template: ${Um(n)}`),{...l!=null&&{headers:FJe(l,a)},...u!=null&&{properties:nJ(u,a)},url:$Je(s,a)}}});var HJe,VJe=O(()=>{zm();rJ();kz();HJe=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=qN(r,e);if(o)throw new bi(qE(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var WJe,KJe=O(()=>{rJ();wme();WJe=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=qN(r,e);if(o)return oJ(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var oJ,wme=O(()=>{zm();zJe();VJe();KJe();oJ=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=UJe(r,e);if(n)return n}else if(r.type==="error")HJe(r,e);else if(r.type==="tree"){let n=WJe(r,e);if(n)return n}else throw new bi(`Unknown endpoint rule: ${r}`);throw new bi("Rules evaluation failed")}});var JJe=O(()=>{XK();wme()});var Bz,GJe=O(()=>{Fz();zm();JJe();Bz=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${Tx} Initial EndpointParams: ${Um(r)}`);let a=Object.entries(o).filter(([,l])=>l.default!=null).map(([l,c])=>[l,c.default]);if(a.length>0)for(let[l,c]of a)r[l]=r[l]??c;let s=Object.entries(o).filter(([,l])=>l.required).map(([l])=>l);for(let l of s)if(r[l]==null)throw new bi(`Missing required parameter: '${l}'`);let u=oJ(i,{endpointParams:r,logger:n,referenceRecord:{}});if(e.endpointParams?.Endpoint)try{let l=new URL(e.endpointParams.Endpoint),{protocol:c,port:d}=l;u.url.protocol=c,u.url.port=d}catch{}return e.logger?.debug?.(`${Tx} Resolved endpoint: ${Um(u)}`),u}});var UE=O(()=>{pme();mme();XK();GJe();zm()});var Sme=O(()=>{UE()});var xme,YJe=O(()=>{UE();Sme();xme=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!xme(r))return!1;return!0}return!(!Lz(t)||t.length<3||t.length>63||t!==t.toLowerCase()||Nz(t))}});var ZJe,Ker,XJe,QJe=O(()=>{ZJe=":",Ker="/",XJe=t=>{let e=t.split(ZJe);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(ZJe)==="")return null;let u=s.map(l=>l.split(Ker)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var tGe,eGe=O(()=>{tGe={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],version:"1.1"}});var Ger,Yer,rGe,nGe,Cme=O(()=>{eGe();Ger=tGe,Yer="",rGe=t=>{let{partitions:e}=Ger;for(let n of e){let{regions:o,outputs:i}=n;for(let[a,s]of Object.entries(o))if(a===t)return{...i,...s}}for(let n of e){let{regionRegex:o,outputs:i}=n;if(new RegExp(o).test(t))return{...i}}let r=e.find(n=>n.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}},nGe=()=>Yer});var $z,oGe=O(()=>{UE();YJe();QJe();Cme();$z={isVirtualHostableS3Bucket:xme,parseArn:XJe,partition:rGe};Px.aws=$z});var iGe=O(()=>{UE()});var aGe=O(()=>{UE()});var sGe=O(()=>{});var uGe=O(()=>{});var lGe=O(()=>{});var cGe=O(()=>{});var dGe=O(()=>{});var fGe=O(()=>{aGe();sGe();uGe();lGe();cGe();dGe()});var iJ=O(()=>{oGe();Cme();Sme();iGe();fGe()});var pGe=O(()=>{});var mGe=O(()=>{pGe()});var hGe=O(()=>{hs()});var gGe=O(()=>{});var yGe=O(()=>{});function Zer(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var aJ,bGe=O(()=>{aJ=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Zer(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var _Ge=O(()=>{});var vGe=O(()=>{});var wGe=O(()=>{});var SGe=O(()=>{mGe();hGe();gGe();yGe();bGe();_Ge();vGe();wGe()});var Ome,sJ,Eme,uJ,xGe,CGe,Pme,OGe=O(()=>{Ome="user-agent",sJ="x-amz-user-agent",Eme=" ",uJ="/",xGe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,CGe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,Pme="-"});var Xer,Tme,Qer,lJ,EGe=O(()=>{iJ();SGe();OGe();Xer=t=>(e,r)=>async n=>{let{request:o}=n;if(!aJ.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(Tme)||[],s=(await t.defaultUserAgentProvider()).map(Tme),u=t?.customUserAgent?.map(Tme)||[],l=nGe(),c=(l?[l]:[]).concat([...s,...a,...u]).join(Eme),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(Eme);return t.runtime!=="browser"?(d&&(i[sJ]=i[sJ]?`${i[Ome]} ${d}`:d),i[Ome]=c):i[sJ]=c,e({...n,request:o})},Tme=t=>{let e=t[0].split(uJ).map(a=>a.replace(xGe,Pme)).join(uJ),r=t[1]?.replace(CGe,Pme),n=e.indexOf(uJ),o=e.substring(0,n),i=e.substring(n+1);return o==="api"&&(i=i.toLowerCase()),[o,i,r].filter(a=>a&&a.length>0).reduce((a,s,u)=>{switch(u){case 0:return s;case 1:return`${a}/${s}`;default:return`${a}#${s}`}},"")},Qer={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},lJ=t=>({applyToStack:e=>{e.add(Xer(t),Qer)}})});var Ame=O(()=>{oJe();EGe()});var PGe=O(()=>{});var TGe=O(()=>{});var cJ,AGe=O(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(cJ||(cJ={}))});var Ime=O(()=>{PGe();TGe();AGe()});var dJ,IGe=O(()=>{Ime();dJ=!1});var fJ,MGe=O(()=>{Ime();fJ=!1});var ib,RGe=O(()=>{hs();ib=t=>t[$N]||(t[$N]={})});var rd,jGe=O(()=>{rd=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var Sg=O(()=>{RGe();jGe()});var DGe=O(()=>{Sg()});var NGe=O(()=>{});var LGe=O(()=>{Sg();NGe()});var FGe=O(()=>{IGe();MGe();DGe();LGe()});var kGe=O(()=>{});var pJ,Mme=O(()=>{pJ=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var Rme,BGe=O(()=>{Mme();Rme=t=>pJ(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var mJ,$Ge=O(()=>{BGe();Mme();mJ=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return Rme(e);let n=await e();return Rme(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return pJ(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var qGe=O(()=>{kGe();$Ge()});var UGe=O(()=>{});var zGe=O(()=>{});var HGe=O(()=>{});var VGe=O(()=>{});var WGe=O(()=>{});var KGe=O(()=>{});var JGe=O(()=>{HGe();VGe();WGe();KGe()});var GGe=O(()=>{UGe();zGe();JGe()});var qz=O(()=>{FGe();qGe();GGe()});function ttr(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var jme,hJ=O(()=>{hs();Sg();jme=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=ttr(t.httpAuthSchemes),s=ib(n),u=[];for(let l of i){let c=a.get(l.schemeId);if(!c){u.push(`HttpAuthScheme \`${l.schemeId}\` was not enabled for this service.`);continue}let d=c.identityProvider(await e.identityProviderConfigProvider(t));if(!d){u.push(`HttpAuthScheme \`${l.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:f={},signingProperties:p={}}=l.propertiesExtractor?.(t,n)||{};l.identityProperties=Object.assign(l.identityProperties||{},f),l.signingProperties=Object.assign(l.signingProperties||{},p),s.selectedHttpAuthScheme={httpAuthOption:l,identity:await d(l.identityProperties),signer:c.signer};break}if(!s.selectedHttpAuthScheme)throw new Error(u.join(`
`));return r(o)}});var YGe,rtr,ntr,otr,itr,atr,ZGe=O(()=>{YGe=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),atr(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!itr(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},rtr=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,ntr=/(\d+\.){3}\d+/,otr=/\.\./,itr=t=>rtr.test(t)&&!ntr.test(t)&&!otr.test(t),atr=t=>{let[e,r,n,,,o]=t.split(":"),i=e==="arn"&&t.split(":").length>=6,a=!!(i&&r&&n&&o);if(i&&!a)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return a}});var XGe=O(()=>{ZGe()});var QGe,e7e=O(()=>{QGe=(t,e,r)=>{let n=async()=>{let o=r[t]??r[e];return typeof o=="function"?o():o};return t==="credentialScope"||e==="CredentialScope"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.credentialScope??o?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.accountId??o?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{let o=await n();if(o&&typeof o=="object"){if("url"in o)return o.url.href;if("hostname"in o){let{protocol:i,hostname:a,port:s,path:u}=o;return`${i}//${a}${s?":"+s:""}${u}`}}return o}:n}});var t7e,r7e=O(()=>{t7e=async t=>{}});function n7e(t){let e={};if(t=t.replace(/^\?/,""),t)for(let r of t.split("&")){let[n,o=null]=r.split("=");n=decodeURIComponent(n),o&&(o=decodeURIComponent(o)),n in e?Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]:e[n]=o}return e}var o7e=O(()=>{});var zE,gJ=O(()=>{o7e();zE=t=>{if(typeof t=="string")return zE(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=n7e(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var yJ,bJ=O(()=>{gJ();yJ=t=>typeof t=="object"?"url"in t?zE(t.url):t:zE(t)});var i7e,str,Dme=O(()=>{XGe();e7e();r7e();bJ();i7e=async(t,e,r,n)=>{if(!r.endpoint){let a=await t7e(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(yJ(a)))}let o=await str(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},str=async(t,e,r)=>{let n={},o=e?.getEndpointParameterInstructions?.()||{};for(let[i,a]of Object.entries(o))switch(a.type){case"staticContextParams":n[i]=a.value;break;case"contextParams":n[i]=t[a.name];break;case"clientContextParams":case"builtInParams":n[i]=await QGe(a.name,i,r)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(a))}return Object.keys(o).length===0&&Object.assign(n,r),String(r.serviceId).toLowerCase()==="s3"&&await YGe(n),n}});var a7e=O(()=>{Dme();bJ()});var s7e,Nme=O(()=>{Sg();Dme();s7e=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await i7e(o.input,{getEndpointParameterInstructions(){return e}},{...t},n);n.endpointV2=i,n.authSchemes=i.properties?.authSchemes;let a=n.authSchemes?.[0];if(a){n.signing_region=a.signingRegion,n.signing_service=a.signingName;let u=ib(n)?.selectedHttpAuthScheme?.httpAuthOption;u&&(u.signingProperties=Object.assign(u.signingProperties||{},{signing_region:a.signingRegion,signingRegion:a.signingRegion,signing_service:a.signingName,signingName:a.signingName,signingRegionSet:a.signingRegionSet},a.properties))}return r({...o})}});var u7e,Lme=O(()=>{u7e=(t,e)=>r=>async n=>{let{response:o}=await r(n);try{let i=await e(o,t);return{response:o,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:o}),!("$metadata"in i)){let a="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";i.message+=`
`+a,typeof i.$responseBodyText<"u"&&i.$response&&(i.$response.body=i.$responseBodyText)}throw i}}});var l7e,Fme=O(()=>{l7e=(t,e)=>(r,n)=>async o=>{let i=n.endpointV2?.url&&t.urlParser?async()=>t.urlParser(n.endpointV2.url):t.endpoint;if(!i)throw new Error("No valid endpoint provider available.");let a=await e(o.input,{...t,endpoint:i});return r({...o,request:a})}});function vt(t,e,r){return{applyToStack:n=>{n.add(u7e(t,r),utr),n.add(l7e(t,e),Uz)}}}var utr,Uz,c7e=O(()=>{Lme();Fme();utr={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Uz={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var Rn=O(()=>{Lme();c7e();Fme()});var kme,wt,d7e=O(()=>{Rn();Nme();kme={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Uz.name},wt=(t,e)=>({applyToStack:r=>{r.addRelativeTo(s7e({config:t,instructions:e}),kme)}})});var _J,f7e=O(()=>{Sg();bJ();_J=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>yJ(await rd(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:rd(t.useDualstackEndpoint??!1),useFipsEndpoint:rd(t.useFipsEndpoint??!1)}}});var p7e=O(()=>{});var Cn=O(()=>{a7e();Nme();d7e();f7e();p7e()});var ltr,vJ,m7e=O(()=>{Cn();hJ();ltr={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:kme.name},vJ=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(jme(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),ltr)}})});var e2n,h7e=O(()=>{Rn();hJ();e2n={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Uz.name}});var g7e=O(()=>{hJ();m7e();h7e()});var y7e=O(()=>{});var b7e=O(()=>{y7e()});var _7e=O(()=>{hs()});var v7e=O(()=>{});var w7e=O(()=>{});function ctr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var CM,S7e=O(()=>{CM=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=ctr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var x7e=O(()=>{});var C7e=O(()=>{});var O7e=O(()=>{});var zz=O(()=>{b7e();_7e();v7e();w7e();S7e();x7e();C7e();O7e()});var dtr,ftr,E7e,Bme=O(()=>{zz();hs();Sg();dtr=t=>e=>{throw e},ftr=(t,e)=>{},E7e=t=>(e,r)=>async n=>{if(!CM.isInstance(n.request))return e(n);let i=ib(r).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:a={}},identity:s,signer:u}=i,l=await e({...n,request:await u.sign(n.request,s,a)}).catch((u.errorHandler||dtr)(a));return(u.successHandler||ftr)(l.response,a),l}});var xg,ab,Hz,wJ=O(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(xg||(xg={}));ab=3,Hz=xg.STANDARD});var P7e,T7e,A7e,I7e,M7e=O(()=>{P7e=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],T7e=["TimeoutError","RequestTimeout","RequestTimeoutException"],A7e=[500,502,503,504],I7e=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var ptr,UN,SJ,R7e,Vz=O(()=>{M7e();ptr=t=>t.$metadata?.clockSkewCorrected,UN=t=>t.$metadata?.httpStatusCode===429||P7e.includes(t.name)||t.$retryable?.throttling==!0,SJ=t=>ptr(t)||T7e.includes(t.name)||I7e.includes(t?.code||"")||A7e.includes(t.$metadata?.httpStatusCode||0),R7e=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!SJ(t)}return!1}});var Wz,$me=O(()=>{Vz();Wz=class{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;let r=this.getCurrentTimeInSeconds();this.lastThrottleTime=r,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){let r=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(n=>setTimeout(n,r))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let r=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=e}updateClientSendingRate(e){let r;if(this.updateMeasuredRate(),UN(e)){let o=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=o,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(o),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());let n=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){let n=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(n*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}});var xJ,CJ,zN=O(()=>{xJ="amz-sdk-invocation-id",CJ="amz-sdk-request"});var j7e,D7e=O(()=>{zN();j7e=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var qme,N7e=O(()=>{zN();qme=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var OM,EJ=O(()=>{wJ();zN();D7e();N7e();OM=class{constructor(e){this.maxAttempts=e,this.mode=xg.STANDARD,this.capacity=500,this.retryBackoffStrategy=j7e(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return qme({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(e,r){let n=await this.getMaxAttempts();if(this.shouldRetry(e,r,n)){let o=r.errorType;this.retryBackoffStrategy.setDelayBase(o==="THROTTLING"?500:100);let i=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),a=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,i):i,s=this.getCapacityCost(o);return this.capacity-=s,qme({retryDelay:a,retryCount:e.getRetryCount()+1,retryCost:s})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${ab}`),ab}}shouldRetry(e,r,n){return e.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?10:5}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}});var PJ,$7e=O(()=>{wJ();$me();EJ();PJ=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=xg.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new Wz,this.standardRetryStrategy=new OM(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,r){return this.rateLimiter.updateClientSendingRate(r),this.standardRetryStrategy.refreshRetryTokenForRetry(e,r)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}});var q7e=O(()=>{zN();EJ()});var U7e=O(()=>{});var sb=O(()=>{$7e();q7e();$me();EJ();wJ();zN();U7e()});var z7e=O(()=>{});var H7e=O(()=>{z7e()});var V7e=O(()=>{hs()});var W7e=O(()=>{});var K7e=O(()=>{});function mtr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var VN,J7e=O(()=>{VN=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=mtr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var Kz,G7e=O(()=>{Kz=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var Y7e=O(()=>{});var Z7e=O(()=>{});var TJ=O(()=>{H7e();V7e();W7e();K7e();J7e();G7e();Y7e();Z7e()});var X7e=O(()=>{sb()});var zme=O(()=>{sb()});var Hme=O(()=>{Vz()});var Vme,Wme=O(()=>{Vme=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error(`AWS SDK error wrapper for ${t}`)});var Kme=O(()=>{TJ();Vz();sb();X7e();zme();Hme();Wme()});var Q7e=O(()=>{sb();Kme()});var AJ,eYe=O(()=>{Sg();sb();AJ=t=>{let{retryStrategy:e}=t,r=rd(t.maxAttempts??ab);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await rd(t.retryMode)()===xg.ADAPTIVE?new PJ(r):new OM(r))}}});var tYe=O(()=>{TJ();sb()});var HE,rYe=O(()=>{HE=class{trace(){}debug(){}info(){}warn(){}error(){}}});var EM,VE,WN,nYe,oYe,iYe=O(()=>{EM=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},VE=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,WN=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>nYe[p.step]-nYe[f.step]||oYe[p.priority||"normal"]-oYe[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=EM(m.name,m.aliases);if(h.includes(d)){f=!0;for(let v of h)n.delete(v);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},a=d=>{let f=!1,p=m=>{if(m.middleware===d){f=!0;for(let h of EM(m.name,m.aliases))n.delete(h);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},s=d=>(t.forEach(f=>{d.add(f.middleware,{...f})}),e.forEach(f=>{d.addRelativeTo(f.middleware,{...f})}),d.identifyOnResolve?.(c.identifyOnResolve()),d),u=d=>{let f=[];return d.before.forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f.push(d),d.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f},l=(d=!1)=>{let f=[],p=[],m={};return t.forEach(v=>{let g={...v,before:[],after:[]};for(let _ of EM(g.name,g.aliases))m[_]=g;f.push(g)}),e.forEach(v=>{let g={...v,before:[],after:[]};for(let _ of EM(g.name,g.aliases))m[_]=g;p.push(g)}),p.forEach(v=>{if(v.toMiddleware){let g=m[v.toMiddleware];if(g===void 0){if(d)return;throw new Error(`${v.toMiddleware} is not found when adding ${VE(v.name,v.aliases)} middleware ${v.relation} ${v.toMiddleware}`)}v.relation==="after"&&g.after.push(v),v.relation==="before"&&g.before.push(v)}}),o(f).map(u).reduce((v,g)=>(v.push(...g),v),[])},c={add:(d,f={})=>{let{name:p,override:m,aliases:h}=f,v={step:"initialize",priority:"normal",middleware:d,...f},g=EM(p,h);if(g.length>0){if(g.some(_=>n.has(_))){if(!m)throw new Error(`Duplicate middleware name '${VE(p,h)}'`);for(let _ of g){let w=t.findIndex(C=>C.name===_||C.aliases?.some(P=>P===_));if(w===-1)continue;let x=t[w];if(x.step!==v.step||v.priority!==x.priority)throw new Error(`"${VE(x.name,x.aliases)}" middleware with ${x.priority} priority in ${x.step} step cannot be overridden by "${VE(p,h)}" middleware with ${v.priority} priority in ${v.step} step.`);t.splice(w,1)}}for(let _ of g)n.add(_)}t.push(v)},addRelativeTo:(d,f)=>{let{name:p,override:m,aliases:h}=f,v={middleware:d,...f},g=EM(p,h);if(g.length>0){if(g.some(_=>n.has(_))){if(!m)throw new Error(`Duplicate middleware name '${VE(p,h)}'`);for(let _ of g){let w=e.findIndex(C=>C.name===_||C.aliases?.some(P=>P===_));if(w===-1)continue;let x=e[w];if(x.toMiddleware!==v.toMiddleware||x.relation!==v.relation)throw new Error(`"${VE(x.name,x.aliases)}" middleware ${x.relation} "${x.toMiddleware}" middleware cannot be overridden by "${VE(p,h)}" middleware ${v.relation} "${v.toMiddleware}" middleware.`);e.splice(w,1)}}for(let _ of g)n.add(_)}e.push(v)},clone:()=>s(WN()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?i(d):a(d),removeByTag:d=>{let f=!1,p=m=>{let{tags:h,name:v,aliases:g}=m;if(h&&h.includes(d)){let _=EM(v,g);for(let w of _)n.delete(w);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{let f=s(WN());return f.use(d),f.identifyOnResolve(r||f.identifyOnResolve()||(d.identifyOnResolve?.()??!1)),f},applyToStack:s,identify:()=>l(!0).map(d=>{let f=d.step??d.relation+" "+d.toMiddleware;return VE(d.name,d.aliases)+" - "+f}),identifyOnResolve(d){return typeof d=="boolean"&&(r=d),r},resolve:(d,f)=>{for(let p of l().map(m=>m.middleware).reverse())d=p(d,f);return r&&console.log(c.identify()),d}};return c},nYe={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},oYe={high:3,normal:2,low:1}});var Jme=O(()=>{iYe()});var PM,aYe=O(()=>{Jme();PM=class{constructor(e){this.middlewareStack=WN(),this.config=e}send(e,r,n){let o=typeof r!="function"?r:void 0,i=typeof r=="function"?r:n,a=e.resolveMiddleware(this.middlewareStack,this.config,o);if(i)a(e).then(s=>i(null,s.output),s=>i(s)).catch(()=>{});else return a(e).then(s=>s.output)}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}});var Ax,TM,WE,AM,sYe,Gme=O(()=>{Ax={},TM=new Array(64);for(let t=0,e=65,r=90;t+e<=r;t++){let n=String.fromCharCode(t+e);Ax[n]=t,TM[t]=n}for(let t=0,e=97,r=122;t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;Ax[n]=o,TM[o]=n}for(let t=0;t<10;t++){Ax[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;Ax[e]=r,TM[r]=e}Ax["+"]=62;TM[62]="+";Ax["/"]=63;TM[63]="/";WE=6,AM=8,sYe=63});var KE,uYe=O(()=>{Gme();KE=t=>{let e=t.length/4*3;t.slice(-2)==="=="?e-=2:t.slice(-1)==="="&&e--;let r=new ArrayBuffer(e),n=new DataView(r);for(let o=0;o<t.length;o+=4){let i=0,a=0;for(let l=o,c=o+3;l<=c;l++)if(t[l]!=="="){if(!(t[l]in Ax))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=Ax[t[l]]<<(c-l)*WE,a+=WE}else i>>=WE;let s=o/4*3;i>>=a%AM;let u=Math.floor(a/AM);for(let l=0;l<u;l++){let c=(u-l-1)*AM;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var Yme,Zme=O(()=>{Yme=t=>new TextEncoder().encode(t)});var lYe=O(()=>{Zme()});var cYe=O(()=>{});var dYe=O(()=>{Zme();lYe();cYe()});function JE(t){let e;typeof t=="string"?e=Yme(t):e=t;let r=typeof e=="object"&&typeof e.length=="number",n=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let o="";for(let i=0;i<e.length;i+=3){let a=0,s=0;for(let l=i,c=Math.min(i+3,e.length);l<c;l++)a|=e[l]<<(c-l-1)*AM,s+=AM;let u=Math.ceil(s/WE);a<<=u*WE-s;for(let l=1;l<=u;l++){let c=(u-l)*WE;o+=TM[(a&sYe<<c)>>c]}o+="==".slice(0,4-u)}return o}var fYe=O(()=>{dYe();Gme()});var KN=O(()=>{uYe();fYe()});var Xme,Qme=O(()=>{Xme=t=>new TextEncoder().encode(t)});var pYe=O(()=>{Qme()});var IJ,mYe=O(()=>{IJ=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var ehe=O(()=>{Qme();pYe();mYe()});function hYe(t,e="utf-8"){return e==="base64"?JE(t):IJ(t)}function gYe(t,e){return e==="base64"?Ix.mutate(KE(t)):Ix.mutate(Xme(t))}var yYe=O(()=>{KN();ehe();the()});var Ix,the=O(()=>{yYe();Ix=class t extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return gYe(e,r);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,t.prototype),e}transformToString(e="utf-8"){return hYe(this,e)}}});var bYe=O(()=>{});var _Ye=O(()=>{});var vYe=O(()=>{_Ye()});var wYe=O(()=>{hs()});var SYe=O(()=>{});var xYe=O(()=>{});var CYe=O(()=>{});var Jz,OYe=O(()=>{Jz=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var EYe=O(()=>{});var PYe=O(()=>{});var TYe=O(()=>{vYe();wYe();SYe();xYe();CYe();OYe();EYe();PYe()});var Hm,htr,rhe=O(()=>{Hm=t=>encodeURIComponent(t).replace(/[!'()*]/g,htr),htr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var AYe=O(()=>{rhe()});var MJ=O(()=>{rhe();AYe()});function IYe(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=Hm(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${Hm(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${Hm(n)}`),e.push(o)}}return e.join("&")}var MYe=O(()=>{MJ()});function RYe(t=0){return new Promise((e,r)=>{t&&setTimeout(()=>{let n=new Error(`Request did not complete within ${t} ms`);n.name="TimeoutError",r(n)},t)})}var jYe=O(()=>{});var nhe,GE,DYe=O(()=>{TYe();MYe();jYe();nhe={supported:void 0},GE=class t{static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),nhe.supported===void 0&&(nhe.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){this.config||(this.config=await this.configProvider);let n=this.config.requestTimeout,o=this.config.keepAlive===!0,i=this.config.credentials;if(r?.aborted){let g=new Error("Request aborted");return g.name="AbortError",Promise.reject(g)}let a=e.path,s=IYe(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){let g=e.username??"",_=e.password??"";u=`${g}:${_}@`}let{port:l,method:c}=e,d=`${e.protocol}//${u}${e.hostname}${l?`:${l}`:""}${a}`,f=c==="GET"||c==="HEAD"?void 0:e.body,p={body:f,headers:new Headers(e.headers),method:c,credentials:i};f&&(p.duplex="half"),typeof AbortController<"u"&&(p.signal=r),nhe.supported&&(p.keepalive=o);let m=()=>{},h=new Request(d,p),v=[fetch(h).then(g=>{let _=g.headers,w={};for(let C of _.entries())w[C[0]]=C[1];return g.body!=null?{response:new Jz({headers:w,reason:g.statusText,statusCode:g.status,body:g.body})}:g.blob().then(C=>({response:new Jz({headers:w,reason:g.statusText,statusCode:g.status,body:C})}))}),RYe(n)];return r&&v.push(new Promise((g,_)=>{let w=()=>{let x=new Error("Request aborted");x.name="AbortError",_(x)};if(typeof r.addEventListener=="function"){let x=r;x.addEventListener("abort",w,{once:!0}),m=()=>x.removeEventListener("abort",w)}else r.onabort=w})),Promise.race(v).finally(m)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function gtr(t){let e=await btr(t),r=KE(e);return new Uint8Array(r)}async function ytr(t){let e=[],r=t.getReader(),n=!1,o=0;for(;!n;){let{done:s,value:u}=await r.read();u&&(e.push(u),o+=u.length),n=s}let i=new Uint8Array(o),a=0;for(let s of e)i.set(s,a),a+=s.length;return i}function btr(t){return new Promise((e,r)=>{let n=new FileReader;n.onloadend=()=>{if(n.readyState!==2)return r(new Error("Reader aborted too early"));let o=n.result??"",i=o.indexOf(","),a=i>-1?i+1:o.length;e(o.substring(a))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}var JN,NYe=O(()=>{KN();JN=t=>typeof Blob=="function"&&t instanceof Blob?gtr(t):ytr(t)});var Gz=O(()=>{DYe();NYe()});function FYe(t){let e="";for(let r=0;r<t.byteLength;r++)e+=LYe[t[r]];return e}var LYe,_tr,kYe=O(()=>{LYe={},_tr={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),LYe[t]=e,_tr[e]=t}});var ohe,ihe=O(()=>{ohe=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var BYe,qYe,$Ye,UYe=O(()=>{Gz();KN();kYe();ehe();ihe();BYe="The stream has already been transformed.",qYe=t=>{if(!$Ye(t)&&!ohe(t)){let o=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${o}`)}let e=!1,r=async()=>{if(e)throw new Error(BYe);return e=!0,await JN(t)},n=o=>{if(typeof o.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return o.stream()};return Object.assign(t,{transformToByteArray:r,transformToString:async o=>{let i=await r();if(o==="base64")return JE(i);if(o==="hex")return FYe(i);if(o===void 0||o==="utf8"||o==="utf-8")return IJ(i);if(typeof TextDecoder=="function")return new TextDecoder(o).decode(i);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(e)throw new Error(BYe);if(e=!0,$Ye(t))return n(t);if(ohe(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},$Ye=t=>typeof Blob=="function"&&t instanceof Blob});var zYe=O(()=>{});var HYe=O(()=>{});var ahe=O(()=>{the();bYe();UYe();zYe();HYe();ihe()});var YE,VYe=O(()=>{ahe();YE=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return Ix.mutate(t);if(!t)return Ix.mutate(new Uint8Array);let r=e.streamCollector(t);return Ix.mutate(await r)}});var pt,she,WYe=O(()=>{Jme();hs();pt=class{constructor(){this.middlewareStack=WN()}static classBuilder(){return new she}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let v of o.bind(this)(d,e,r,n))this.middlewareStack.use(v);let f=e.concat(this.middlewareStack),{logger:p}=r,m={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[$N]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(v=>h.handle(v.request,n||{}),m)}},she=class{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,n={}){return this._smithyContext={service:e,operation:r,...n},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=n=>n,r=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){let e=this,r;return r=class extends pt{static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=n??{},e._init(this)}resolveMiddleware(n,o,i){return this.resolveMiddlewareWithContext(n,o,i,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}});var RJ,KYe=O(()=>{RJ="***SensitiveInformation***"});var jJ,JYe=O(()=>{jJ=(t,e)=>{for(let r of Object.keys(t)){let n=t[r],o=async function(a,s,u){let l=new n(a);if(typeof s=="function")this.send(l,s);else if(typeof u=="function"){if(typeof s!="object")throw new Error(`Expected http options but got ${typeof s}`);this.send(l,s||{},u)}else return this.send(l,s)},i=(r[0].toLowerCase()+r.slice(1)).replace(/Command$/,"");e.prototype[i]=o}}});var IM,vtr,GYe,wtr,YYe,ZYe,XYe,uhe,Str,GN,Jr,QYe,eZe,xtr,Yz,Zz,lhe,tZe,rZe,nZe,che=O(()=>{IM=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&nZe.warn(rZe(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},vtr=Math.ceil(34028234663852886e22),GYe=t=>{let e=IM(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>vtr)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},wtr=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},YYe=t=>uhe(t,32),ZYe=t=>uhe(t,16),XYe=t=>uhe(t,8),uhe=(t,e)=>{let r=wtr(t);if(r!==void 0&&Str(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},Str=(t,e)=>{switch(e){case 32:return Int32Array.of(t)[0];case 16:return Int16Array.of(t)[0];case 8:return Int8Array.of(t)[0]}},GN=(t,e)=>{if(t==null)throw e?new TypeError(`Expected a non-null value for ${e}`):new TypeError("Expected a non-null value");return t},Jr=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return nZe.warn(rZe(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},QYe=t=>IM(typeof t=="string"?Yz(t):t),eZe=t=>GYe(typeof t=="string"?Yz(t):t),xtr=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Yz=t=>{let e=t.match(xtr);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},Zz=t=>YYe(typeof t=="string"?Yz(t):t),lhe=t=>ZYe(typeof t=="string"?Yz(t):t),tZe=t=>XYe(typeof t=="string"?Yz(t):t),rZe=t=>String(new TypeError(t).stack||t).split(`
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
`),nZe={warn:console.warn}});var Ctr,Otr,oZe,Etr,iZe,JHn,GHn,YHn,DJ,aZe,ZHn,Ptr,Ttr,Atr,MM,Itr,Mtr,dhe,sZe=O(()=>{che();Ctr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Otr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),oZe=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Otr.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=lhe(dhe(n)),d=MM(o,"month",1,12),f=MM(i,"day",1,31);return aZe(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},Etr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),iZe=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Etr.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l,c]=e,d=lhe(dhe(n)),f=MM(o,"month",1,12),p=MM(i,"day",1,31),m=aZe(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-Mtr(c)),m},JHn=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),GHn=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),YHn=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),DJ=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=QYe(t);else if(typeof t=="object"&&t.tag===1)e=t.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},aZe=(t,e,r,n)=>{let o=e-1;return Ttr(t,o,r),new Date(Date.UTC(t,o,r,MM(n.hours,"hour",0,23),MM(n.minutes,"minute",0,59),MM(n.seconds,"seconds",0,60),Itr(n.fractionalMilliseconds)))},ZHn=50*365*24*60*60*1e3,Ptr=[31,28,31,30,31,30,31,31,30,31,30,31],Ttr=(t,e,r)=>{let n=Ptr[e];if(e===1&&Atr(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${Ctr[e]} in ${t}: ${r}`)},Atr=t=>t%4===0&&(t%100!==0||t%400===0),MM=(t,e,r,n)=>{let o=tZe(dhe(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},Itr=t=>t==null?0:eZe("0."+t)*1e3,Mtr=t=>{let e=t[0],r=1;if(e=="+")r=1;else if(e=="-")r=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);let n=Number(t.substring(1,3)),o=Number(t.substring(4,6));return r*(n*60+o)*60*1e3},dhe=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var YN,da,fhe=O(()=>{YN=class t extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,t.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}},da=(t,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,o])=>{(t[n]==null||t[n]==="")&&(t[n]=o)});let r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t}});var Rtr,NJ,jtr,uZe=O(()=>{fhe();Rtr=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=jtr(t),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw da(a,e)},NJ=t=>({output:e,parsedBody:r,errorCode:n})=>{Rtr({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},jtr=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]})});var LJ,lZe=O(()=>{LJ=t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}}});var cZe=O(()=>{});var dZe,fZe,pZe=O(()=>{hs();dZe=t=>{let e=[];for(let r in BN){let n=BN[r];t[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>t[n]})}return{_checksumAlgorithms:e,addChecksumAlgorithm(r){this._checksumAlgorithms.push(r)},checksumAlgorithms(){return this._checksumAlgorithms}}},fZe=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var mZe,hZe,gZe=O(()=>{mZe=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},hZe=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var FJ,kJ,yZe=O(()=>{pZe();gZe();FJ=t=>({...dZe(t),...mZe(t)}),kJ=t=>({...fZe(t),...hZe(t)})});var bZe=O(()=>{yZe()});function BJ(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var phe=O(()=>{});var _Ze=O(()=>{});var mhe,vZe=O(()=>{mhe=t=>{let e="#text";for(let r in t)t.hasOwnProperty(r)&&t[r][e]!==void 0?t[r]=t[r][e]:typeof t[r]=="object"&&t[r]!==null&&(t[r]=mhe(t[r]));return t}});var hhe,wZe=O(()=>{hhe=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};hhe.prototype=Object.create(String.prototype,{constructor:{value:hhe,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(hhe,String)});var Xz,Dtr,Ntr,Ltr,SZe=O(()=>{Xz=(t,e)=>{let r={};for(let n in e)Dtr(r,t,e,n);return r},Dtr=(t,e,r,n)=>{if(e!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=Ntr,u=Ltr,l=n]=a;(typeof s=="function"&&s(e[l])||typeof s!="function"&&s)&&(t[n]=u(e[l]));return}let[o,i]=r[n];if(typeof i=="function"){let a,s=o===void 0&&(a=i())!=null,u=typeof o=="function"&&!!o(void 0)||typeof o!="function"&&!!o;s?t[n]=a:u&&(t[n]=i())}else{let a=o===void 0&&i!=null,s=typeof o=="function"&&!!o(i)||typeof o!="function"&&!!o;(a||s)&&(t[n]=i)}},Ntr=t=>t!=null,Ltr=t=>t});var xZe=O(()=>{phe()});var CZe=O(()=>{});var Ut,OZe=O(()=>{Ut=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(Ut);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=Ut(t[r]));return e}return t}});var EZe=O(()=>{});var zt=O(()=>{rYe();aYe();VYe();WYe();KYe();JYe();sZe();uZe();lZe();cZe();bZe();fhe();phe();_Ze();vZe();wZe();SZe();che();xZe();CZe();OZe();EZe()});var PZe,TZe=O(()=>{PZe=t=>t?.body instanceof ReadableStream});var Ftr,ktr,Btr,$tr,ghe,$J,qtr,AZe=O(()=>{TJ();Vz();zt();sb();w6();TZe();Wme();Ftr=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(ktr(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=VN.isInstance(c);for(d&&(c.headers[xJ]=tI());;)try{d&&(c.headers[CJ]=`attempt=${u+1}; max=${i}`);let{response:f,output:p}=await e(n);return o.recordSuccess(a),p.$metadata.attempts=u+1,p.$metadata.totalRetryDelay=l,{response:f,output:p}}catch(f){let p=Btr(f);if(s=Vme(f),d&&PZe(c))throw(r.logger instanceof HE?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),s;try{a=await o.refreshRetryTokenForRetry(a,p)}catch{throw s.$metadata||(s.$metadata={}),s.$metadata.attempts=u+1,s.$metadata.totalRetryDelay=l,s}u=a.getRetryCount();let m=a.getRetryDelay();l+=m,await new Promise(h=>setTimeout(h,m))}}else return o=o,o?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",o.mode]]),o.retry(e,n)},ktr=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",Btr=t=>{let e={error:t,errorType:$tr(t)},r=qtr(t.$response);return r&&(e.retryAfterHint=r),e},$tr=t=>UN(t)?"THROTTLING":SJ(t)?"TRANSIENT":R7e(t)?"SERVER_ERROR":"CLIENT_ERROR",ghe={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},$J=t=>({applyToStack:e=>{e.add(Ftr(t),ghe)}}),qtr=t=>{if(!Kz.isInstance(t))return;let e=Object.keys(t.headers).find(i=>i.toLowerCase()==="retry-after");if(!e)return;let r=t.headers[e],n=Number(r);return Number.isNaN(n)?new Date(r):new Date(n*1e3)}});var qJ=O(()=>{Q7e();Kme();eYe();zme();tYe();Hme();AZe()});var Utr,UJ,IZe=O(()=>{qJ();Bme();Utr={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:ghe.name},UJ=t=>({applyToStack:e=>{e.addRelativeTo(E7e(t),Utr)}})});var MZe=O(()=>{Bme();IZe()});var ZN,RZe=O(()=>{ZN=class{constructor(e){this.authSchemes=new Map;for(let[r,n]of Object.entries(e))n!==void 0&&this.authSchemes.set(r,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}});var jZe=O(()=>{zz();hs()});var DZe=O(()=>{zz()});var XN,NZe=O(()=>{XN=class{async sign(e,r,n){return e}}});var LZe=O(()=>{jZe();DZe();NZe()});var ztr,FZe,yhe,kZe,BZe=O(()=>{ztr=t=>e=>yhe(e)&&e.expiration.getTime()-Date.now()<t,FZe=ztr(3e5),yhe=t=>t.expiration!==void 0,kZe=(t,e,r)=>{if(t===void 0)return;let n=typeof t!="function"?async()=>Promise.resolve(t):t,o,i,a,s=!1,u=async l=>{i||(i=n(l));try{o=await i,a=!0,s=!1}finally{i=void 0}return o};return e===void 0?async l=>((!a||l?.forceRefresh)&&(o=await u(l)),o):async l=>((!a||l?.forceRefresh)&&(o=await u(l)),s?o:r(o)?(e(o)&&await u(l),o):(s=!0,o))}});var $Ze=O(()=>{RZe();LZe();BZe()});var qZe=O(()=>{hs()});var QN,UZe=O(()=>{QN=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var zZe=O(()=>{zz();zt()});function bhe(t,e,r,n,o){return async function*(a,s,...u){let l=a.startingToken||void 0,c=!0,d;for(;c;){if(s[r]=l,o&&(s[o]=s[o]??a.pageSize),a.client instanceof t)d=await Htr(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=Vtr(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var Htr,Vtr,HZe=O(()=>{Htr=async(t,e,r,...n)=>await e.send(new t(r),...n);Vtr=(t,e)=>{let r=t,n=e.split(".");for(let o of n){if(!r||typeof r!="object")return;r=r[o]}return r}});var ZE=O(()=>{g7e();MZe();$Ze();qZe();UZe();zZe();HZe()});var VZe=O(()=>{});var WZe=O(()=>{VZe()});var KZe=O(()=>{hs()});var JZe=O(()=>{});var GZe=O(()=>{});function Wtr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var zJ,YZe=O(()=>{zJ=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Wtr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var ZZe=O(()=>{});var XZe=O(()=>{});var QZe=O(()=>{});var eXe=O(()=>{WZe();KZe();JZe();GZe();YZe();ZZe();XZe();QZe()});function Ktr(t){return e=>async r=>{let n=r.request;if(zJ.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(tXe)===-1)try{let a=t(o);n.headers={...n.headers,[tXe]:String(a)}}catch{}}return e({...r,request:n})}}var tXe,Jtr,HJ,_he=O(()=>{eXe();tXe="content-length";Jtr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},HJ=t=>({applyToStack:e=>{e.add(Ktr(t.bodyLengthChecker),Jtr)}})});var rXe=O(()=>{});var nXe=O(()=>{rXe()});var oXe=O(()=>{});var iXe=O(()=>{oXe()});var aXe=O(()=>{hs()});var sXe=O(()=>{});var uXe=O(()=>{});function Gtr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var XE,lXe=O(()=>{XE=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Gtr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var VJ,cXe=O(()=>{VJ=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var dXe=O(()=>{});var fXe=O(()=>{});var Qz=O(()=>{iXe();aXe();sXe();uXe();lXe();cXe();dXe();fXe()});var vhe,pXe=O(()=>{Qz();vhe=t=>VJ.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var WJ,whe=O(()=>{WJ=t=>new Date(Date.now()+t)});var mXe,hXe=O(()=>{whe();mXe=(t,e)=>Math.abs(WJ(e).getTime()-t)>=3e5});var She,gXe=O(()=>{hXe();She=(t,e)=>{let r=Date.parse(t);return mXe(r,e)?r-Date.now():e}});var yXe=O(()=>{pXe();whe();gXe()});var e2,bXe,RM,_Xe=O(()=>{Qz();yXe();e2=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},bXe=async t=>{let e=e2("context",t.context),r=e2("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await e2("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},RM=class{async sign(e,r,n){if(!XE.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await bXe(n),{config:i,signer:a}=o,{signingRegion:s,signingName:u}=o,l=n.context;if(l?.authSchemes?.length??!1){let[d,f]=l.authSchemes;d?.name==="sigv4a"&&f?.name==="sigv4"&&(s=f?.signingRegion??s,u=f?.signingName??u)}return await a.sign(e,{signingDate:WJ(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??vhe(r.$response);if(n){let o=e2("config",e.config),i=o.systemClockOffset;o.systemClockOffset=She(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=vhe(e);if(n){let o=e2("config",r.config);o.systemClockOffset=She(n,o.systemClockOffset)}}}});var vXe=O(()=>{ZE();Ex()});function SXe(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let n=t.slice(r,r+2).toLowerCase();if(n in xhe)e[r/2]=xhe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function Cg(t){let e="";for(let r=0;r<t.byteLength;r++)e+=wXe[t[r]];return e}var wXe,xhe,t2=O(()=>{wXe={},xhe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),wXe[t]=e,xhe[e]=t}});var r2,Che=O(()=>{r2=t=>new TextEncoder().encode(t)});var QE,xXe=O(()=>{Che();QE=t=>typeof t=="string"?r2(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var CXe=O(()=>{});var n2=O(()=>{Che();xXe();CXe()});var OXe,EXe,Ohe,PXe,TXe,Ehe,Phe,The,Ahe,Ytr,AXe,IXe,o2,MXe,RXe,jXe,DXe,KJ,NXe,LXe,FXe,Ihe,kXe,jM=O(()=>{OXe="X-Amz-Algorithm",EXe="X-Amz-Credential",Ohe="X-Amz-Date",PXe="X-Amz-SignedHeaders",TXe="X-Amz-Expires",Ehe="X-Amz-Signature",Phe="X-Amz-Security-Token",The="authorization",Ahe=Ohe.toLowerCase(),Ytr="date",AXe=[The,Ahe,Ytr],IXe=Ehe.toLowerCase(),o2="x-amz-content-sha256",MXe=Phe.toLowerCase(),RXe={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},jXe=/^proxy-/,DXe=/^sec-/,KJ="AWS4-HMAC-SHA256",NXe="AWS4-HMAC-SHA256-PAYLOAD",LXe="UNSIGNED-PAYLOAD",FXe=50,Ihe="aws4_request",kXe=60*60*24*7});var JJ,Mhe,GJ,$Xe,BXe,Rhe=O(()=>{t2();n2();jM();JJ={},Mhe=[],GJ=(t,e,r)=>`${t}/${e}/${r}/${Ihe}`,$Xe=async(t,e,r,n,o)=>{let i=await BXe(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${Cg(i)}:${e.sessionToken}`;if(a in JJ)return JJ[a];for(Mhe.push(a);Mhe.length>FXe;)delete JJ[Mhe.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,Ihe])s=await BXe(t,s,u);return JJ[a]=s},BXe=(t,e,r)=>{let n=new t(e);return n.update(QE(r)),n.digest()}});var YJ,jhe=O(()=>{jM();YJ=({headers:t},e,r)=>{let n={};for(let o of Object.keys(t).sort()){if(t[o]==null)continue;let i=o.toLowerCase();(i in RXe||e?.has(i)||jXe.test(i)||DXe.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var Dhe,Nhe=O(()=>{MJ();jM();Dhe=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===IXe)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${Hm(n)}=${Hm(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${Hm(n)}=${Hm(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var qXe,UXe=O(()=>{qXe=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var i2,Lhe=O(()=>{UXe();t2();n2();jM();i2=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===o2)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||qXe(e)){let n=new r;return n.update(QE(e)),Cg(await n.digest())}return LXe}});function HXe(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var ZJ,zXe,Ztr,Fhe,VXe=O(()=>{t2();n2();ZJ=class{format(e){let r=[];for(let i of Object.keys(e)){let a=r2(i);r.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[i]))}let n=new Uint8Array(r.reduce((i,a)=>i+a.byteLength,0)),o=0;for(let i of r)n.set(i,o),o+=i.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":let o=new Uint8Array(9);return o[0]=5,o.set(e.value.bytes,1),o;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case"string":let s=r2(e.value),u=new DataView(new ArrayBuffer(3+s.byteLength));u.setUint8(0,7),u.setUint16(1,s.byteLength,!1);let l=new Uint8Array(u.buffer);return l.set(s,3),l;case"timestamp":let c=new Uint8Array(9);return c[0]=8,c.set(Fhe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!Ztr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(SXe(e.value.replace(/\-/g,"")),1),d}}};(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(zXe||(zXe={}));Ztr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Fhe=class t{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,o=Math.abs(Math.round(e));n>-1&&o>0;n--,o/=256)r[n]=o;return e<0&&HXe(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&HXe(e),parseInt(Cg(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var WXe,KXe=O(()=>{WXe=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var khe,Bhe=O(()=>{Qz();khe=(t,e={})=>{let{headers:r,query:n={}}=XE.clone(t);for(let o of Object.keys(r)){let i=o.toLowerCase();i.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(i)&&(n[o]=r[o],delete r[o])}return{...t,headers:r,query:n}}});var XJ,$he=O(()=>{Qz();jM();XJ=t=>{t=XE.clone(t);for(let e of Object.keys(t.headers))AXe.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var JXe,Xtr,GXe=O(()=>{JXe=t=>Xtr(t).toISOString().replace(/\.\d{3}Z$/,"Z"),Xtr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var a2,QJ,YXe,ZXe=O(()=>{t2();Sg();MJ();n2();jM();Rhe();jhe();Nhe();Lhe();VXe();KXe();Bhe();$he();GXe();a2=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new ZJ,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=rd(n),this.credentialProvider=rd(r)}async presign(e,r={}){let{signingDate:n=new Date,expiresIn:o=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:s,signingRegion:u,signingService:l}=r,c=await this.credentialProvider();this.validateResolvedCredentials(c);let d=u??await this.regionProvider(),{longDate:f,shortDate:p}=QJ(n);if(o>kXe)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=GJ(p,d,l??this.service),h=khe(XJ(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[Phe]=c.sessionToken),h.query[OXe]=KJ,h.query[EXe]=`${c.accessKeyId}/${m}`,h.query[Ohe]=f,h.query[TXe]=o.toString(10);let v=YJ(h,i,s);return h.query[PXe]=YXe(v),h.query[Ehe]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,v,await i2(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=QJ(n),c=GJ(u,s,a??this.service),d=await i2({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=Cg(await f.digest()),m=[NXe,l,c,o,p,d].join(`
`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=QJ(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(QE(e)),Cg(await u.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:n,unsignableHeaders:o,signingRegion:i,signingService:a}={}){let s=await this.credentialProvider();this.validateResolvedCredentials(s);let u=i??await this.regionProvider(),l=XJ(e),{longDate:c,shortDate:d}=QJ(r),f=GJ(d,u,a??this.service);l.headers[Ahe]=c,s.sessionToken&&(l.headers[MXe]=s.sessionToken);let p=await i2(l,this.sha256);!WXe(o2,l.headers)&&this.applyChecksum&&(l.headers[o2]=p);let m=YJ(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[The]=`${KJ} Credential=${s.accessKeyId}/${f}, SignedHeaders=${YXe(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${Dhe(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(QE(n));let i=await o.digest();return`${KJ}
${e}
${r}
${Cg(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let r=[];for(let i of e.split("/"))i?.length!==0&&i!=="."&&(i===".."?r.pop():r.push(i));let n=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return Hm(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,o){let i=await this.createStringToSign(e,r,o),a=new this.sha256(await n);return a.update(QE(i)),Cg(await a.digest())}getSigningKey(e,r,n,o){return $Xe(this.sha256,e,n,r,o||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}},QJ=t=>{let e=JXe(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},YXe=t=>Object.keys(t).sort().join(";")});var XXe=O(()=>{ZXe();jhe();Nhe();Lhe();Bhe();$he();Rhe()});var eG,QXe=O(()=>{ZE();XXe();eG=t=>{let e;t.credentials&&(e=kZe(t.credentials,FZe,yhe)),e||(t.credentialDefaultProvider?e=QN(t.credentialDefaultProvider(Object.assign({},t,{parentClientConfig:t}))):e=async()=>{throw new Error("`credentials` is missing")});let{signingEscapePath:r=!0,systemClockOffset:n=t.systemClockOffset||0,sha256:o}=t,i;return t.signer?i=QN(t.signer):t.regionInfoProvider?i=()=>QN(t.region)().then(async a=>[await t.regionInfoProvider(a,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},a]).then(([a,s])=>{let{signingRegion:u,signingService:l}=a;t.signingRegion=t.signingRegion||u||s,t.signingName=t.signingName||l||t.serviceId;let c={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:o,uriEscapePath:r},d=t.signerConstructor||a2;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await QN(t.region)(),properties:{}},a);let s=a.signingRegion,u=a.signingName;t.signingRegion=t.signingRegion||s,t.signingName=t.signingName||u||t.serviceId;let l={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:o,uriEscapePath:r},c=t.signerConstructor||a2;return new c(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}}});var eQe=O(()=>{_Xe();vXe();QXe()});var tQe=O(()=>{eQe()});var rQe=O(()=>{});var nQe=O(()=>{zt()});var tG,qhe=O(()=>{zt();tG=(t,e)=>YE(t,e).then(r=>e.utf8Encoder(r))});var Qa,oQe,iQe,aQe=O(()=>{qhe();Qa=(t,e)=>tG(t,e).then(r=>{if(r.length)try{return JSON.parse(r)}catch(n){throw n?.name==="SyntaxError"&&Object.defineProperty(n,"$responseBodyText",{value:r}),n}return{}}),oQe=async(t,e)=>{let r=await Qa(t,e);return r.message=r.message??r.Message,r},iQe=(t,e)=>{let r=(i,a)=>Object.keys(i).find(s=>s.toLowerCase()===a.toLowerCase()),n=i=>{let a=i;return typeof a=="number"&&(a=a.toString()),a.indexOf(",")>=0&&(a=a.split(",")[0]),a.indexOf(":")>=0&&(a=a.split(":")[0]),a.indexOf("#")>=0&&(a=a.split("#")[1]),a},o=r(t.headers,"x-amzn-errortype");if(o!==void 0)return n(t.headers[o]);if(e.code!==void 0)return n(e.code);if(e.__type!==void 0)return n(e.__type)}});var rG=b(Mx=>{"use strict";var sQe=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Qtr=sQe+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",uQe="["+sQe+"]["+Qtr+"]*",err=new RegExp("^"+uQe+"$"),trr=function(t,e){let r=[],n=e.exec(t);for(;n;){let o=[];o.startIndex=e.lastIndex-n[0].length;let i=n.length;for(let a=0;a<i;a++)o.push(n[a]);r.push(o),n=e.exec(t)}return r},rrr=function(t){let e=err.exec(t);return!(e===null||typeof e>"u")};Mx.isExist=function(t){return typeof t<"u"};Mx.isEmptyObject=function(t){return Object.keys(t).length===0};Mx.merge=function(t,e,r){if(e){let n=Object.keys(e),o=n.length;for(let i=0;i<o;i++)r==="strict"?t[n[i]]=[e[n[i]]]:t[n[i]]=e[n[i]]}};Mx.getValue=function(t){return Mx.isExist(t)?t:""};Mx.isName=rrr;Mx.getAllMatches=trr;Mx.nameRegexp=uQe});var zhe=b(pQe=>{"use strict";var Uhe=rG(),nrr={allowBooleanAttributes:!1,unpairedTags:[]};pQe.validate=function(t,e){e=Object.assign({},nrr,e);let r=[],n=!1,o=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let i=0;i<t.length;i++)if(t[i]==="<"&&t[i+1]==="?"){if(i+=2,i=cQe(t,i),i.err)return i}else if(t[i]==="<"){let a=i;if(i++,t[i]==="!"){i=dQe(t,i);continue}else{let s=!1;t[i]==="/"&&(s=!0,i++);let u="";for(;i<t.length&&t[i]!==">"&&t[i]!==" "&&t[i]!==" "&&t[i]!==`
`&&t[i]!=="\r";i++)u+=t[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!drr(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",es("InvalidTag",d,Vd(t,i))}let l=arr(t,i);if(l===!1)return es("InvalidAttr","Attributes for '"+u+"' have open quote.",Vd(t,i));let c=l.value;if(i=l.index,c[c.length-1]==="/"){let d=i-c.length;c=c.substring(0,c.length-1);let f=fQe(c,e);if(f===!0)n=!0;else return es(f.err.code,f.err.msg,Vd(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return es("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",Vd(t,a));if(r.length===0)return es("InvalidTag","Closing tag '"+u+"' has not been opened.",Vd(t,a));{let d=r.pop();if(u!==d.tagName){let f=Vd(t,d.tagStartPos);return es("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",Vd(t,a))}r.length==0&&(o=!0)}}else return es("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",Vd(t,i));else{let d=fQe(c,e);if(d!==!0)return es(d.err.code,d.err.msg,Vd(t,i-c.length+d.err.line));if(o===!0)return es("InvalidXml","Multiple possible root nodes found.",Vd(t,i));e.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:a}),n=!0}for(i++;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="!"){i++,i=dQe(t,i);continue}else if(t[i+1]==="?"){if(i=cQe(t,++i),i.err)return i}else break;else if(t[i]==="&"){let d=lrr(t,i);if(d==-1)return es("InvalidChar","char '&' is not expected.",Vd(t,i));i=d}else if(o===!0&&!lQe(t[i]))return es("InvalidXml","Extra text at the end",Vd(t,i));t[i]==="<"&&i--}}else{if(lQe(t[i]))continue;return es("InvalidChar","char '"+t[i]+"' is not expected.",Vd(t,i))}if(n){if(r.length==1)return es("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Vd(t,r[0].tagStartPos));if(r.length>0)return es("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return es("InvalidXml","Start tag expected.",1);return!0};function lQe(t){return t===" "||t===" "||t===`
`||t==="\r"}function cQe(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let n=t.substr(r,e-r);if(e>5&&n==="xml")return es("InvalidXml","XML declaration allowed only at the start of the document.",Vd(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function dQe(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var orr='"',irr="'";function arr(t,e){let r="",n="",o=!1;for(;e<t.length;e++){if(t[e]===orr||t[e]===irr)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){o=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:o}}var srr=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function fQe(t,e){let r=Uhe.getAllMatches(t,srr),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return es("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",s2(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return es("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",s2(r[o]));if(r[o][3]===void 0&&!e.allowBooleanAttributes)return es("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",s2(r[o]));let i=r[o][2];if(!crr(i))return es("InvalidAttr","Attribute '"+i+"' is an invalid name.",s2(r[o]));if(!n.hasOwnProperty(i))n[i]=1;else return es("InvalidAttr","Attribute '"+i+"' is repeated.",s2(r[o]))}return!0}function urr(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function lrr(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,urr(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function es(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function crr(t){return Uhe.isName(t)}function drr(t){return Uhe.isName(t)}function Vd(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function s2(t){return t.startIndex+t[1].length}});var hQe=b(Hhe=>{var mQe={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}},frr=function(t){return Object.assign({},mQe,t)};Hhe.buildOptions=frr;Hhe.defaultOptions=mQe});var yQe=b((w9n,gQe)=>{"use strict";var Vhe=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};gQe.exports=Vhe});var _Qe=b((S9n,bQe)=>{var prr=rG();function mrr(t,e){let r={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let n=1,o=!1,i=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!i){if(o&&yrr(t,e))e+=7,[entityName,val,e]=hrr(t,e+1),val.indexOf("&")===-1&&(r[wrr(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(o&&brr(t,e))e+=8;else if(o&&_rr(t,e))e+=8;else if(o&&vrr(t,e))e+=9;else if(grr)i=!0;else throw new Error("Invalid DOCTYPE");n++,a=""}else if(t[e]===">"){if(i?t[e-1]==="-"&&t[e-2]==="-"&&(i=!1,n--):n--,n===0)break}else t[e]==="["?o=!0:a+=t[e];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:e}}function hrr(t,e){let r="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)r+=t[e];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");let n=t[e++],o="";for(;e<t.length&&t[e]!==n;e++)o+=t[e];return[r,o,e]}function grr(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function yrr(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function brr(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function _rr(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function vrr(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function wrr(t){if(prr.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}bQe.exports=mrr});var wQe=b((x9n,vQe)=>{var Srr=/^[-+]?0x[a-fA-F0-9]+$/,xrr=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var Crr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Orr(t,e={}){if(e=Object.assign({},Crr,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(e.hex&&Srr.test(r))return Number.parseInt(r,16);{let n=xrr.exec(r);if(n){let o=n[1],i=n[2],a=Err(n[3]),s=n[4]||n[6];if(!e.leadingZeros&&i.length>0&&o&&r[2]!==".")return t;if(!e.leadingZeros&&i.length>0&&!o&&r[1]!==".")return t;{let u=Number(r),l=""+u;return l.search(/[eE]/)!==-1||s?e.eNotation?u:t:r.indexOf(".")!==-1?l==="0"&&a===""||l===a||o&&l==="-"+a?u:t:i?a===l||o+a===l?u:t:r===l||r===o+l?u:t}}else return t}}function Err(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}vQe.exports=Orr});var CQe=b((C9n,xQe)=>{"use strict";var SQe=rG(),u2=yQe(),Prr=_Qe(),Trr=wQe(),Whe=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,16))}},this.addExternalEntities=Arr,this.parseXml=Drr,this.parseTextData=Irr,this.resolveNameSpace=Mrr,this.buildAttributesMap=jrr,this.isItStopNode=krr,this.replaceEntitiesValue=Lrr,this.readStopNodeData=$rr,this.saveTextToParentTag=Frr,this.addChild=Nrr}};function Arr(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:t[n]}}}function Irr(t,e,r,n,o,i,a){if(t!==void 0&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));let s=this.options.tagValueProcessor(e,t,r,o,i);return s==null?t:typeof s!=typeof t||s!==t?s:this.options.trimValues?Jhe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Jhe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Mrr(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var Rrr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function jrr(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=SQe.getAllMatches(t,Rrr),o=n.length,i={};for(let a=0;a<o;a++){let s=this.resolveNameSpace(n[a][1]),u=n[a][4],l=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u);let c=this.options.attributeValueProcessor(s,u,e);c==null?i[l]=u:typeof c!=typeof u||c!==u?i[l]=c:i[l]=Jhe(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let a={};return a[this.options.attributesGroupName]=i,a}return i}}var Drr=function(t){t=t.replace(/\r\n?/g,`
`);let e=new u2("!xml"),r=e,n="",o="";for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let s=DM(t,">",i,"Closing Tag is not closed."),u=t.substring(i+2,s).trim();if(this.options.removeNSPrefix){let d=u.indexOf(":");d!==-1&&(u=u.substr(d+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&(n=this.saveTextToParentTag(n,r,o));let l=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let c=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(c=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=o.lastIndexOf("."),o=o.substring(0,c),r=this.tagsNodeStack.pop(),n="",i=s}else if(t[i+1]==="?"){let s=Khe(t,i,!1,"?>");if(!s)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,o),!(this.options.ignoreDeclaration&&s.tagName==="?xml"||this.options.ignorePiTags)){let u=new u2(s.tagName);u.add(this.options.textNodeName,""),s.tagName!==s.tagExp&&s.attrExpPresent&&(u[":@"]=this.buildAttributesMap(s.tagExp,o,s.tagName)),this.addChild(r,u,o)}i=s.closeIndex+1}else if(t.substr(i+1,3)==="!--"){let s=DM(t,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let u=t.substring(i+4,s-2);n=this.saveTextToParentTag(n,r,o),r.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=s}else if(t.substr(i+1,2)==="!D"){let s=Prr(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=DM(t,"]]>",i,"CDATA is not closed.")-2,u=t.substring(i+9,s);n=this.saveTextToParentTag(n,r,o);let l=this.parseTextData(u,r.tagname,o,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):r.add(this.options.textNodeName,l),i=s+2}else{let s=Khe(t,i,this.options.removeNSPrefix),u=s.tagName,l=s.rawTagName,c=s.tagExp,d=s.attrExpPresent,f=s.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,o,!1));let p=r;if(p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==e.tagname&&(o+=o?"."+u:u),this.isItStopNode(this.options.stopNodes,o,u)){let m="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=s.closeIndex;else{let v=this.readStopNodeData(t,l,f+1);if(!v)throw new Error(`Unexpected end of ${l}`);i=v.i,m=v.tagContent}let h=new u2(u);u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),m&&(m=this.parseTextData(m,u,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),h.add(this.options.textNodeName,m),this.addChild(r,h,o)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let m=new u2(u);u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),o=o.substr(0,o.lastIndexOf("."))}else{let m=new u2(u);this.tagsNodeStack.push(r),u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),r=m}n="",i=f}}else n+=t[i];return e.child};function Nrr(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var Lrr=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){let r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(let e in this.lastEntities){let r=this.lastEntities[e];t=t.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let r=this.htmlEntities[e];t=t.replace(r.regex,r.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function Frr(t,e,r,n){return t&&(n===void 0&&(n=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function krr(t,e,r){let n="*."+r;for(let o in t){let i=t[o];if(n===i||e===i)return!0}return!1}function Brr(t,e,r=">"){let n,o="";for(let i=e;i<t.length;i++){let a=t[i];if(n)a===n&&(n="");else if(a==='"'||a==="'")n=a;else if(a===r[0])if(r[1]){if(t[i+1]===r[1])return{data:o,index:i}}else return{data:o,index:i};else a===" "&&(a=" ");o+=a}}function DM(t,e,r,n){let o=t.indexOf(e,r);if(o===-1)throw new Error(n);return o+e.length-1}function Khe(t,e,r,n=">"){let o=Brr(t,e+1,n);if(!o)return;let i=o.data,a=o.index,s=i.search(/\s/),u=i,l=!0;s!==-1&&(u=i.substring(0,s),i=i.substring(s+1).trimStart());let c=u;if(r){let d=u.indexOf(":");d!==-1&&(u=u.substr(d+1),l=u!==o.data.substr(d+1))}return{tagName:u,tagExp:i,closeIndex:a,attrExpPresent:l,rawTagName:c}}function $rr(t,e,r){let n=r,o=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let i=DM(t,">",r,`${e} is not closed`);if(t.substring(r+2,i).trim()===e&&(o--,o===0))return{tagContent:t.substring(n,r),i};r=i}else if(t[r+1]==="?")r=DM(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=DM(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=DM(t,"]]>",r,"StopNode is not closed.")-2;else{let i=Khe(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function Jhe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:Trr(t,r)}else return SQe.isExist(t)?t:""}xQe.exports=Whe});var PQe=b(EQe=>{"use strict";function qrr(t,e){return OQe(t,e)}function OQe(t,e,r){let n,o={};for(let i=0;i<t.length;i++){let a=t[i],s=Urr(a),u="";if(r===void 0?u=s:u=r+"."+s,s===e.textNodeName)n===void 0?n=a[s]:n+=""+a[s];else{if(s===void 0)continue;if(a[s]){let l=OQe(a[s],e,u),c=Hrr(l,e);a[":@"]?zrr(l,a[":@"],u,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),o[s]!==void 0&&o.hasOwnProperty(s)?(Array.isArray(o[s])||(o[s]=[o[s]]),o[s].push(l)):e.isArray(s,u,c)?o[s]=[l]:o[s]=l}}}return typeof n=="string"?n.length>0&&(o[e.textNodeName]=n):n!==void 0&&(o[e.textNodeName]=n),o}function Urr(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function zrr(t,e,r,n){if(e){let o=Object.keys(e),i=o.length;for(let a=0;a<i;a++){let s=o[a];n.isArray(s,r+"."+s,!0,!0)?t[s]=[e[s]]:t[s]=e[s]}}}function Hrr(t,e){let{textNodeName:r}=e,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}EQe.prettify=qrr});var AQe=b((E9n,TQe)=>{var{buildOptions:Vrr}=hQe(),Wrr=CQe(),{prettify:Krr}=PQe(),Jrr=zhe(),Ghe=class{constructor(e){this.externalEntities={},this.options=Vrr(e)}parse(e,r){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let i=Jrr.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new Wrr(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:Krr(o,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};TQe.exports=Ghe});var DQe=b((P9n,jQe)=>{var Grr=`
`;function Yrr(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=Grr),MQe(t,e,"",r)}function MQe(t,e,r,n){let o="",i=!1;for(let a=0;a<t.length;a++){let s=t[a],u=Zrr(s);if(u===void 0)continue;let l="";if(r.length===0?l=u:l=`${r}.${u}`,u===e.textNodeName){let m=s[u];Xrr(l,e)||(m=e.tagValueProcessor(u,m),m=RQe(m,e)),i&&(o+=n),o+=m,i=!1;continue}else if(u===e.cdataPropName){i&&(o+=n),o+=`<![CDATA[${s[u][0][e.textNodeName]}]]>`,i=!1;continue}else if(u===e.commentPropName){o+=n+`<!--${s[u][0][e.textNodeName]}-->`,i=!0;continue}else if(u[0]==="?"){let m=IQe(s[":@"],e),h=u==="?xml"?"":n,v=s[u][0][e.textNodeName];v=v.length!==0?" "+v:"",o+=h+`<${u}${v}${m}?>`,i=!0;continue}let c=n;c!==""&&(c+=e.indentBy);let d=IQe(s[":@"],e),f=n+`<${u}${d}`,p=MQe(s[u],e,l,c);e.unpairedTags.indexOf(u)!==-1?e.suppressUnpairedNode?o+=f+">":o+=f+"/>":(!p||p.length===0)&&e.suppressEmptyNode?o+=f+"/>":p&&p.endsWith(">")?o+=f+`>${p}${n}</${u}>`:(o+=f+">",p&&n!==""&&(p.includes("/>")||p.includes("</"))?o+=n+e.indentBy+p+n:o+=p,o+=`</${u}>`),i=!0}return o}function Zrr(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(t.hasOwnProperty(n)&&n!==":@")return n}}function IQe(t,e){let r="";if(t&&!e.ignoreAttributes)for(let n in t){if(!t.hasOwnProperty(n))continue;let o=e.attributeValueProcessor(n,t[n]);o=RQe(o,e),o===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${o}"`}return r}function Xrr(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let r=t.substr(t.lastIndexOf(".")+1);for(let n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+r)return!0;return!1}function RQe(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){let n=e.entities[r];t=t.replace(n.regex,n.val)}return t}jQe.exports=Yrr});var LQe=b((T9n,NQe)=>{"use strict";var Qrr=DQe(),enr={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function eP(t){this.options=Object.assign({},enr,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=nnr),this.processTextOrObjNode=tnr,this.options.format?(this.indentate=rnr,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}eP.prototype.build=function(t){return this.options.preserveOrder?Qrr(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};eP.prototype.j2x=function(t,e){let r="",n="";for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o))if(typeof t[o]>"u")this.isAttribute(o)&&(n+="");else if(t[o]===null)this.isAttribute(o)?n+="":o[0]==="?"?n+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(t[o]instanceof Date)n+=this.buildTextValNode(t[o],o,"",e);else if(typeof t[o]!="object"){let i=this.isAttribute(o);if(i)r+=this.buildAttrPairStr(i,""+t[o]);else if(o===this.options.textNodeName){let a=this.options.tagValueProcessor(o,""+t[o]);n+=this.replaceEntitiesValue(a)}else n+=this.buildTextValNode(t[o],o,"",e)}else if(Array.isArray(t[o])){let i=t[o].length,a="",s="";for(let u=0;u<i;u++){let l=t[o][u];if(!(typeof l>"u"))if(l===null)o[0]==="?"?n+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){let c=this.j2x(l,e+1);a+=c.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(s+=c.attrStr)}else a+=this.processTextOrObjNode(l,o,e);else if(this.options.oneListGroup){let c=this.options.tagValueProcessor(o,l);c=this.replaceEntitiesValue(c),a+=c}else a+=this.buildTextValNode(l,o,"",e)}this.options.oneListGroup&&(a=this.buildObjectNode(a,o,s,e)),n+=a}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){let i=Object.keys(t[o]),a=i.length;for(let s=0;s<a;s++)r+=this.buildAttrPairStr(i[s],""+t[o][i[s]])}else n+=this.processTextOrObjNode(t[o],o,e);return{attrStr:r,val:n}};eP.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function tnr(t,e,r){let n=this.j2x(t,r+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}eP.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let o="</"+e+this.tagEndChar,i="";return e[0]==="?"&&(i="?",o=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+i+">"+t+o:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(n)+`<!--${t}-->`+this.newLine:this.indentate(n)+"<"+e+r+i+this.tagEndChar+t+this.indentate(n)+o}};eP.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};eP.prototype.buildTextValNode=function(t,e,r,n){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(e,t);return o=this.replaceEntitiesValue(o),o===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+o+"</"+e+this.tagEndChar}};eP.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function rnr(t){return this.options.indentBy.repeat(t)}function nnr(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}NQe.exports=eP});var kQe=b((A9n,FQe)=>{"use strict";var onr=zhe(),inr=AQe(),anr=LQe();FQe.exports={XMLParser:inr,XMLValidator:onr,XMLBuilder:anr}});var BQe,ub,$Qe,qQe=O(()=>{zt();BQe=B(kQe());qhe();ub=(t,e)=>tG(t,e).then(r=>{if(r.length){let n=new BQe.XMLParser({attributeNamePrefix:"",htmlEntities:!0,ignoreAttributes:!1,ignoreDeclaration:!0,parseTagValue:!1,trimValues:!1,tagValueProcessor:(u,l)=>l.trim()===""&&l.includes(`
`)?"":void 0});n.addEntity("#xD","\r"),n.addEntity("#10",`
`);let o;try{o=n.parse(r,!0)}catch(u){throw u&&typeof u=="object"&&Object.defineProperty(u,"$responseBodyText",{value:r}),u}let i="#text",a=Object.keys(o)[0],s=o[a];return s[i]&&(s[a]=s[i],delete s[i]),mhe(s)}return{}}),$Qe=async(t,e)=>{let r=await ub(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var UQe=O(()=>{rQe();nQe();aQe();qQe()});var NM=O(()=>{nXe();tQe();UQe()});function snr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function nG(t){return{schemeId:"smithy.api#noAuth"}}var zQe,HQe,VQe,Yhe=O(()=>{NM();Sg();zQe=async(t,e,r)=>({operation:ib(e).operation,region:await rd(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});HQe=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(nG(t));break}case"GetId":{e.push(nG(t));break}case"GetOpenIdToken":{e.push(nG(t));break}case"UnlinkIdentity":{e.push(nG(t));break}default:e.push(snr(t))}return e},VQe=t=>({...eG(t)})});var WQe,sr,Mi=O(()=>{WQe=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),sr={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var JQe,KQe=O(()=>{JQe={name:"@aws-sdk/client-cognito-identity",description:"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native",version:"3.645.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-cognito-identity","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo cognito-identity","test:e2e":"ts-mocha test/**/*.ispec.ts && karma start karma.conf.js"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.645.0","@aws-sdk/client-sts":"3.645.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.645.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.645.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.645.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/client-iam":"3.645.0","@tsconfig/node16":"16.1.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-cognito-identity"}}});var Zhe,Xhe,GQe,YQe=O(()=>{Zhe={name:"SHA-256"},Xhe={name:"HMAC",hash:Zhe},GQe=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])});function eL(){return typeof window<"u"?window:typeof self<"u"?self:lnr}var lnr,Qhe=O(()=>{lnr={}});var tL,ege,tge=O(()=>{tL=B(qK());YQe();Qhe();ege=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,tL.isEmptyData)(e)){var r=(0,tL.convertToBuffer)(e),n=new Uint8Array(this.toHash.byteLength+r.byteLength);n.set(this.toHash,0),n.set(r,this.toHash.byteLength),this.toHash=n}},t.prototype.digest=function(){var e=this;return this.key?this.key.then(function(r){return eL().crypto.subtle.sign(Xhe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,tL.isEmptyData)(this.toHash)?Promise.resolve(GQe):Promise.resolve().then(function(){return eL().crypto.subtle.digest(Zhe,e.toHash)}).then(function(r){return Promise.resolve(new Uint8Array(r))})},t.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(r,n){eL().crypto.subtle.importKey("raw",(0,tL.convertToBuffer)(e.secret),Xhe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function ZQe(t){if(dnr(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return fnr(e)}return!1}function dnr(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function fnr(t){return t&&cnr.every(function(e){return typeof t[e]=="function"})}var cnr,XQe=O(()=>{cnr=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var QQe=O(()=>{XQe()});var eet,tet,oG,ret=O(()=>{tge();eet=B(ame());QQe();Qhe();tet=B(qK()),oG=function(){function t(e){ZQe(eL())?this.hash=new ege(e):this.hash=new eet.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,tet.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var rge=O(()=>{ret();tge()});var oge=b((l2,nge)=>{(function(t,e){typeof l2=="object"&&typeof nge=="object"?nge.exports=e():typeof define=="function"&&define.amd?define([],e):typeof l2=="object"?l2.bowser=e():t.bowser=e()})(l2,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(n,o,i){r.o(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:i})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,o){if(1&o&&(n=r(n)),8&o||4&o&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&o&&typeof n!="string")for(var a in n)r.d(i,a,function(s){return n[s]}.bind(null,a));return i},r.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(o,"a",o),o},r.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},r.p="",r(r.s=90)}({17:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=r(18),o=function(){function i(){}return i.getFirstMatch=function(a,s){var u=s.match(a);return u&&u.length>0&&u[1]||""},i.getSecondMatch=function(a,s){var u=s.match(a);return u&&u.length>1&&u[2]||""},i.matchAndReturnConst=function(a,s,u){if(a.test(s))return u},i.getWindowsVersionName=function(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},i.getVersionPrecision=function(a){return a.split(".").length},i.compareVersions=function(a,s,u){u===void 0&&(u=!1);var l=i.getVersionPrecision(a),c=i.getVersionPrecision(s),d=Math.max(l,c),f=0,p=i.map([a,s],function(m){var h=d-i.getVersionPrecision(m),v=m+new Array(h+1).join(".0");return i.map(v.split("."),function(g){return new Array(20-g.length).join("0")+g}).reverse()});for(u&&(f=d-Math.min(l,c)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]<p[1][d])return-1}},i.map=function(a,s){var u,l=[];if(Array.prototype.map)return Array.prototype.map.call(a,s);for(u=0;u<a.length;u+=1)l.push(s(a[u]));return l},i.find=function(a,s){var u,l;if(Array.prototype.find)return Array.prototype.find.call(a,s);for(u=0,l=a.length;u<l;u+=1){var c=a[u];if(s(c,u))return c}},i.assign=function(a){for(var s,u,l=a,c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];if(Object.assign)return Object.assign.apply(Object,[a].concat(d));var p=function(){var m=d[s];typeof m=="object"&&m!==null&&Object.keys(m).forEach(function(h){l[h]=m[h]})};for(s=0,u=d.length;s<u;s+=1)p();return a},i.getBrowserAlias=function(a){return n.BROWSER_ALIASES_MAP[a]},i.getBrowserTypeByAlias=function(a){return n.BROWSER_MAP[a]||""},i}();e.default=o,t.exports=e.default},18:function(t,e,r){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(91))&&n.__esModule?n:{default:n},i=r(18);function a(u,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(u,d.key,d)}}var s=function(){function u(){}var l,c,d;return u.getParser=function(f,p){if(p===void 0&&(p=!1),typeof f!="string")throw new Error("UserAgent should be a string");return new o.default(f,p)},u.parse=function(f){return new o.default(f).getResult()},l=u,d=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(c=null)&&a(l.prototype,c),d&&a(l,d),u}();e.default=s,t.exports=e.default},91:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=u(r(92)),o=u(r(93)),i=u(r(94)),a=u(r(95)),s=u(r(17));function u(c){return c&&c.__esModule?c:{default:c}}var l=function(){function c(f,p){if(p===void 0&&(p=!1),f==null||f==="")throw new Error("UserAgent parameter can't be empty");this._ua=f,this.parsedResult={},p!==!0&&this.parse()}var d=c.prototype;return d.getUA=function(){return this._ua},d.test=function(f){return f.test(this._ua)},d.parseBrowser=function(){var f=this;this.parsedResult.browser={};var p=s.default.find(n.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.browser=p.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(f){return f?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var f=this;this.parsedResult.os={};var p=s.default.find(o.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.os=p.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(f){var p=this.getOS().name;return f?String(p).toLowerCase()||"":p||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(f){f===void 0&&(f=!1);var p=this.getPlatform().type;return f?String(p).toLowerCase()||"":p||""},d.parsePlatform=function(){var f=this;this.parsedResult.platform={};var p=s.default.find(i.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.platform=p.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(f){return f?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var f=this;this.parsedResult.engine={};var p=s.default.find(a.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.engine=p.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return s.default.assign({},this.parsedResult)},d.satisfies=function(f){var p=this,m={},h=0,v={},g=0;if(Object.keys(f).forEach(function(M){var R=f[M];typeof R=="string"?(v[M]=R,g+=1):typeof R=="object"&&(m[M]=R,h+=1)}),h>0){var _=Object.keys(m),w=s.default.find(_,function(M){return p.isOS(M)});if(w){var x=this.satisfies(m[w]);if(x!==void 0)return x}var C=s.default.find(_,function(M){return p.isPlatform(M)});if(C){var P=this.satisfies(m[C]);if(P!==void 0)return P}}if(g>0){var E=Object.keys(v),A=s.default.find(E,function(M){return p.isBrowser(M,!0)});if(A!==void 0)return this.compareVersion(v[A])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var m=this.getBrowserName().toLowerCase(),h=f.toLowerCase(),v=s.default.getBrowserTypeByAlias(h);return p&&v&&(h=v.toLowerCase()),h===m},d.compareVersion=function(f){var p=[0],m=f,h=!1,v=this.getBrowserVersion();if(typeof v=="string")return f[0]===">"||f[0]==="<"?(m=f.substr(1),f[1]==="="?(h=!0,m=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?m=f.substr(1):f[0]==="~"&&(h=!0,m=f.substr(1)),p.indexOf(s.default.compareVersions(v,m,h))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some(function(m){return p.is(m)})},c}();e.default=l,t.exports=e.default},92:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(s){var u={name:"Googlebot"},l=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/opera/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opr\/|opios/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/SamsungBrowser/i],describe:function(s){var u={name:"Samsung Internet for Android"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Whale/i],describe:function(s){var u={name:"NAVER Whale Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MZBrowser/i],describe:function(s){var u={name:"MZ Browser"},l=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/focus/i],describe:function(s){var u={name:"Focus"},l=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/swing/i],describe:function(s){var u={name:"Swing"},l=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/coast/i],describe:function(s){var u={name:"Opera Coast"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var u={name:"Opera Touch"},l=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/yabrowser/i],describe:function(s){var u={name:"Yandex Browser"},l=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/ucbrowser/i],describe:function(s){var u={name:"UC Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Maxthon|mxios/i],describe:function(s){var u={name:"Maxthon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/epiphany/i],describe:function(s){var u={name:"Epiphany"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/puffin/i],describe:function(s){var u={name:"Puffin"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sleipnir/i],describe:function(s){var u={name:"Sleipnir"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/k-meleon/i],describe:function(s){var u={name:"K-Meleon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/micromessenger/i],describe:function(s){var u={name:"WeChat"},l=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qqbrowser/i],describe:function(s){var u={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/msie|trident/i],describe:function(s){var u={name:"Internet Explorer"},l=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/\sedg\//i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/edg([ea]|ios)/i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/vivaldi/i],describe:function(s){var u={name:"Vivaldi"},l=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/seamonkey/i],describe:function(s){var u={name:"SeaMonkey"},l=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sailfish/i],describe:function(s){var u={name:"Sailfish"},l=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(u.version=l),u}},{test:[/silk/i],describe:function(s){var u={name:"Amazon Silk"},l=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/phantom/i],describe:function(s){var u={name:"PhantomJS"},l=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/slimerjs/i],describe:function(s){var u={name:"SlimerJS"},l=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u={name:"BlackBerry"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u={name:"WebOS Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/bada/i],describe:function(s){var u={name:"Bada"},l=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/tizen/i],describe:function(s){var u={name:"Tizen"},l=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qupzilla/i],describe:function(s){var u={name:"QupZilla"},l=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var u={name:"Firefox"},l=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/electron/i],describe:function(s){var u={name:"Electron"},l=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MiuiBrowser/i],describe:function(s){var u={name:"Miui"},l=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/chromium/i],describe:function(s){var u={name:"Chromium"},l=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/chrome|crios|crmo/i],describe:function(s){var u={name:"Chrome"},l=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/GSA/i],describe:function(s){var u={name:"Google Search"},l=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u={name:"Android Browser"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/playstation 4/i],describe:function(s){var u={name:"PlayStation 4"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/safari|applewebkit/i],describe:function(s){var u={name:"Safari"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/.*/i],describe:function(s){var u=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(u,s),version:o.default.getSecondMatch(u,s)}}}];e.default=a,t.exports=e.default},93:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/Roku\/DVP/],describe:function(s){var u=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:i.OS_MAP.Roku,version:u}}},{test:[/windows phone/i],describe:function(s){var u=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.WindowsPhone,version:u}}},{test:[/windows /i],describe:function(s){var u=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=o.default.getWindowsVersionName(u);return{name:i.OS_MAP.Windows,version:u,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var u={name:i.OS_MAP.iOS},l=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(u.version=l),u}},{test:[/macintosh/i],describe:function(s){var u=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=o.default.getMacOSVersionName(u),c={name:i.OS_MAP.MacOS,version:u};return l&&(c.versionName=l),c}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var u=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:u}}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=o.default.getAndroidVersionName(u),c={name:i.OS_MAP.Android,version:u};return l&&(c.versionName=l),c}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:i.OS_MAP.WebOS};return u&&u.length&&(l.version=u),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||o.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:i.OS_MAP.BlackBerry,version:u}}},{test:[/bada/i],describe:function(s){var u=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Bada,version:u}}},{test:[/tizen/i],describe:function(s){var u=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Tizen,version:u}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var u=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.PlayStation4,version:u}}}];e.default=a,t.exports=e.default},94:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var u=o.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return u&&(l.model=u),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){var u=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return u&&!l},describe:function(s){var u=o.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:u}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var u=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&u>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];e.default=a,t.exports=e.default},95:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:i.ENGINE_MAP.Blink};var u=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:i.ENGINE_MAP.EdgeHTML,version:u}}},{test:[/trident/i],describe:function(s){var u={name:i.ENGINE_MAP.Trident},l=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){return s.test(/presto/i)},describe:function(s){var u={name:i.ENGINE_MAP.Presto},l=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=s.test(/gecko/i),l=s.test(/like gecko/i);return u&&!l},describe:function(s){var u={name:i.ENGINE_MAP.Gecko},l=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var u={name:i.ENGINE_MAP.WebKit},l=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}}];e.default=a,t.exports=e.default}})})});var net,iG,ige=O(()=>{net=B(oge()),iG=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?net.default.parse(window.navigator.userAgent):void 0,n=[["aws-sdk-js",e],["ua","2.0"],[`os/${r?.os?.name||"other"}`,r?.os?.version],["lang/js"],["md/browser",`${r?.browser?.name??"unknown"}_${r?.browser?.version??"unknown"}`]];return t&&n.push([`api/${t}`,e]),n}});var oet=O(()=>{});var aG,iet=O(()=>{aG=t=>()=>Promise.reject(t)});var age=O(()=>{oet();iet()});var aet,sG,set=O(()=>{aet=typeof TextEncoder=="function"?new TextEncoder:null,sG=t=>{if(typeof t=="string"){if(aet)return aet.encode(t).byteLength;let e=t.length;for(let r=e-1;r>=0;r--){let n=t.charCodeAt(r);n>127&&n<=2047?e++:n>2047&&n<=65535&&(e+=2),n>=56320&&n<=57343&&r--}return e}else{if(typeof t.byteLength=="number")return t.byteLength;if(typeof t.size=="number")return t.size}throw new Error(`Body Length computation failed for ${t}`)}});var sge=O(()=>{set()});var uge,lge=O(()=>{uge=t=>new TextEncoder().encode(t)});var uet=O(()=>{lge()});var cet,det=O(()=>{cet=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var fet=O(()=>{lge();uet();det()});var xet,cb,db,nL,pet,d2,rL,c2,Rx,cge,met,het,get,Cet,Oet,lb,yet,bet,_et,vet,wet,pnr,Eet,Pet=O(()=>{xet="required",cb="fn",db="argv",nL="ref",pet="isSet",d2="booleanEquals",rL="error",c2="endpoint",Rx="tree",cge="PartitionResult",met={[xet]:!1,type:"String"},het={[xet]:!0,default:!1,type:"Boolean"},get={[nL]:"Endpoint"},Cet={[cb]:d2,[db]:[{[nL]:"UseFIPS"},!0]},Oet={[cb]:d2,[db]:[{[nL]:"UseDualStack"},!0]},lb={},yet={[cb]:"getAttr",[db]:[{[nL]:cge},"supportsFIPS"]},bet={[cb]:d2,[db]:[!0,{[cb]:"getAttr",[db]:[{[nL]:cge},"supportsDualStack"]}]},_et=[Cet],vet=[Oet],wet=[{[nL]:"Region"}],pnr={version:"1.0",parameters:{Region:met,UseDualStack:het,UseFIPS:het,Endpoint:met},rules:[{conditions:[{[cb]:pet,[db]:[get]}],rules:[{conditions:_et,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:rL},{conditions:vet,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:rL},{endpoint:{url:get,properties:lb,headers:lb},type:c2}],type:Rx},{conditions:[{[cb]:pet,[db]:wet}],rules:[{conditions:[{[cb]:"aws.partition",[db]:wet,assign:cge}],rules:[{conditions:[Cet,Oet],rules:[{conditions:[{[cb]:d2,[db]:[!0,yet]},bet],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:lb,headers:lb},type:c2}],type:Rx},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:rL}],type:Rx},{conditions:_et,rules:[{conditions:[{[cb]:d2,[db]:[yet,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:lb,headers:lb},type:c2}],type:Rx},{error:"FIPS is enabled but this partition does not support FIPS",type:rL}],type:Rx},{conditions:vet,rules:[{conditions:[bet],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:lb,headers:lb},type:c2}],type:Rx},{error:"DualStack is enabled but this partition does not support DualStack",type:rL}],type:Rx},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:lb,headers:lb},type:c2}],type:Rx}],type:Rx},{error:"Invalid Configuration: Missing Region",type:rL}]},Eet=pnr});var Tet,Aet=O(()=>{iJ();UE();Pet();Tet=(t,e={})=>Bz(Eet,{endpointParams:t,logger:e.logger});Px.aws=$z});var Iet,Met=O(()=>{NM();ZE();zt();gJ();KN();fet();Yhe();Aet();Iet=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??KE,base64Encoder:t?.base64Encoder??JE,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??Tet,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??HQe,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new RM},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new XN}],logger:t?.logger??new HE,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??zE,utf8Decoder:t?.utf8Decoder??uge,utf8Encoder:t?.utf8Encoder??cet})});var Ret,jet=O(()=>{Ret=["in-region","cross-region","mobile","standard","legacy"]});var Det,uG,mnr,Net=O(()=>{Ex();Det=B(oge());jet();uG=({defaultsMode:t}={})=>AWe(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(mnr()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Ret.join(", ")}, got ${e}`)}}),mnr=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?Det.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var dge=O(()=>{Net()});var Let,Fet=O(()=>{KQe();rge();ige();qz();Gz();age();sge();sb();Met();zt();dge();Let=t=>{let e=uG(t),r=()=>e().then(LJ),n=Iet(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??sG,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??iG({serviceId:n.serviceId,clientVersion:JQe.version}),maxAttempts:t?.maxAttempts??ab,region:t?.region??aG("Region is missing"),requestHandler:GE.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||Hz),sha256:t?.sha256??oG,streamCollector:t?.streamCollector??JN,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(dJ)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(fJ))}}});var lG,cG,ket=O(()=>{lG=t=>{let e=async()=>{if(t.region===void 0)throw new Error("Region is missing from runtimeConfig");let r=t.region;return typeof r=="string"?r:r()};return{setRegion(r){e=r},region(){return e}}},cG=t=>({region:t.region()})});var Bet=O(()=>{});var fge=O(()=>{});var $et=O(()=>{fge()});var qet=O(()=>{$et();fge()});var Uet=O(()=>{Bet();qet()});var pge=O(()=>{ket();Uet()});var zet,Het,Vet=O(()=>{zet=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},Het=t=>({httpHandler:t.httpHandler()})});var Wet=O(()=>{Vet()});var Ket=O(()=>{hs()});var Jet=O(()=>{});var Get=O(()=>{});function gnr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var dG,Yet=O(()=>{dG=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=gnr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var Zet=O(()=>{});var Xet=O(()=>{});var Qet=O(()=>{});var mge=O(()=>{Wet();Ket();Jet();Get();Yet();Zet();Xet();Qet()});var ett,ttt,rtt=O(()=>{ett=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,n=t.credentials;return{setHttpAuthScheme(o){let i=e.findIndex(a=>a.schemeId===o.schemeId);i===-1?e.push(o):e.splice(i,1,o)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(o){r=o},httpAuthSchemeProvider(){return r},setCredentials(o){n=o},credentials(){return n}}},ttt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var fG,ntt,ott=O(()=>{pge();mge();zt();rtt();fG=t=>t,ntt=(t,e)=>{let r={...fG(lG(t)),...fG(FJ(t)),...fG(zet(t)),...fG(ett(t))};return e.forEach(n=>n.configure(r)),{...t,...cG(r),...kJ(r),...Het(r),...ttt(r)}}});var tP,pG=O(()=>{cme();dme();fme();Ame();qz();ZE();_he();Cn();qJ();zt();Yhe();Mi();Fet();ott();tP=class extends PM{constructor(...[e]){let r=Let(e||{}),n=WQe(r),o=ZK(n),i=AJ(o),a=mJ(i),s=a,u=_J(s),l=VQe(u),c=ntt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(lJ(this.config)),this.middlewareStack.use($J(this.config)),this.middlewareStack.use(HJ(this.config)),this.middlewareStack.use(KK(this.config)),this.middlewareStack.use(JK(this.config)),this.middlewareStack.use(YK(this.config)),this.middlewareStack.use(vJ(this.config,{httpAuthSchemeParametersProvider:zQe,identityProviderConfigProvider:async d=>new ZN({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(UJ(this.config))}destroy(){super.destroy()}}});var nd,hge=O(()=>{zt();nd=class t extends YN{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var mG,hG,gG,yG,bG,_G,vG,wG,SG,xG,CG,gge=O(()=>{hge();mG=class t extends nd{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,t.prototype)}},hG=class t extends nd{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gG=class t extends nd{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yG=class t extends nd{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bG=class t extends nd{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_G=class t extends nd{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},vG=class t extends nd{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},wG=class t extends nd{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},SG=class t extends nd{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},xG=class t extends nd{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},CG=class t extends nd{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}}});function ma(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var itt,att,stt,utt,ltt,ctt,dtt,ftt,ptt,mtt,htt,gtt,ytt,btt,_tt,vtt,wtt,Stt,xtt,Ctt,Ott,Ett,Ptt,Ttt,Att,Itt,Mtt,Rtt,jtt,Dtt,Ntt,Ltt,Ftt,ktt,Btt,$tt,qtt,Utt,ztt,Htt,Vtt,Wtt,Ktt,Jtt,Gtt,Ytt,fa,bnr,_nr,vnr,wnr,Snr,xnr,Cnr,Onr,Enr,Pnr,Tnr,Anr,Inr,Mnr,Ztt,Rnr,jn,jnr,pa,Ki=O(()=>{NM();mge();zt();hge();gge();itt=async(t,e)=>{let r=ma("CreateIdentityPool"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},att=async(t,e)=>{let r=ma("DeleteIdentities"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},stt=async(t,e)=>{let r=ma("DeleteIdentityPool"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},utt=async(t,e)=>{let r=ma("DescribeIdentity"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},ltt=async(t,e)=>{let r=ma("DescribeIdentityPool"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},ctt=async(t,e)=>{let r=ma("GetCredentialsForIdentity"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},dtt=async(t,e)=>{let r=ma("GetId"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},ftt=async(t,e)=>{let r=ma("GetIdentityPoolRoles"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},ptt=async(t,e)=>{let r=ma("GetOpenIdToken"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},mtt=async(t,e)=>{let r=ma("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},htt=async(t,e)=>{let r=ma("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},gtt=async(t,e)=>{let r=ma("ListIdentities"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},ytt=async(t,e)=>{let r=ma("ListIdentityPools"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},btt=async(t,e)=>{let r=ma("ListTagsForResource"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},_tt=async(t,e)=>{let r=ma("LookupDeveloperIdentity"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},vtt=async(t,e)=>{let r=ma("MergeDeveloperIdentities"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},wtt=async(t,e)=>{let r=ma("SetIdentityPoolRoles"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},Stt=async(t,e)=>{let r=ma("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},xtt=async(t,e)=>{let r=ma("TagResource"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},Ctt=async(t,e)=>{let r=ma("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},Ott=async(t,e)=>{let r=ma("UnlinkIdentity"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},Ett=async(t,e)=>{let r=ma("UntagResource"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},Ptt=async(t,e)=>{let r=ma("UpdateIdentityPool"),n;return n=JSON.stringify(Ut(t)),pa(e,r,"/",void 0,n)},Ttt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Att=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Itt=async(t,e)=>t.statusCode>=300?fa(t,e):(await YE(t.body,e),{$metadata:jn(t)}),Mtt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ztt(r,e),{$metadata:jn(t),...n}},Rtt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},jtt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Inr(r,e),{$metadata:jn(t),...n}},Dtt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Ntt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Ltt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Ftt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},ktt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Btt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Rnr(r,e),{$metadata:jn(t),...n}},$tt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},qtt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Utt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},ztt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Htt=async(t,e)=>t.statusCode>=300?fa(t,e):(await YE(t.body,e),{$metadata:jn(t)}),Vtt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Wtt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Ktt=async(t,e)=>t.statusCode>=300?fa(t,e):(await YE(t.body,e),{$metadata:jn(t)}),Jtt=async(t,e)=>t.statusCode>=300?fa(t,e):(await YE(t.body,e),{$metadata:jn(t)}),Gtt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},Ytt=async(t,e)=>{if(t.statusCode>=300)return fa(t,e);let r=await Qa(t.body,e),n={};return n=Ut(r),{$metadata:jn(t),...n}},fa=async(t,e)=>{let r={...t,body:await oQe(t.body,e)},n=iQe(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await wnr(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await xnr(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await Cnr(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await Onr(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await Enr(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await Tnr(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await Pnr(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await vnr(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await Snr(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await _nr(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await bnr(r,e);default:let o=r.body;return jnr({output:t,parsedBody:o,errorCode:n})}},bnr=async(t,e)=>{let r=t.body,n=Ut(r),o=new CG({$metadata:jn(t),...n});return da(o,r)},_nr=async(t,e)=>{let r=t.body,n=Ut(r),o=new xG({$metadata:jn(t),...n});return da(o,r)},vnr=async(t,e)=>{let r=t.body,n=Ut(r),o=new wG({$metadata:jn(t),...n});return da(o,r)},wnr=async(t,e)=>{let r=t.body,n=Ut(r),o=new mG({$metadata:jn(t),...n});return da(o,r)},Snr=async(t,e)=>{let r=t.body,n=Ut(r),o=new SG({$metadata:jn(t),...n});return da(o,r)},xnr=async(t,e)=>{let r=t.body,n=Ut(r),o=new hG({$metadata:jn(t),...n});return da(o,r)},Cnr=async(t,e)=>{let r=t.body,n=Ut(r),o=new gG({$metadata:jn(t),...n});return da(o,r)},Onr=async(t,e)=>{let r=t.body,n=Ut(r),o=new yG({$metadata:jn(t),...n});return da(o,r)},Enr=async(t,e)=>{let r=t.body,n=Ut(r),o=new bG({$metadata:jn(t),...n});return da(o,r)},Pnr=async(t,e)=>{let r=t.body,n=Ut(r),o=new vG({$metadata:jn(t),...n});return da(o,r)},Tnr=async(t,e)=>{let r=t.body,n=Ut(r),o=new _G({$metadata:jn(t),...n});return da(o,r)},Anr=(t,e)=>Xz(t,{AccessKeyId:Jr,Expiration:r=>GN(DJ(IM(r))),SecretKey:Jr,SessionToken:Jr}),Inr=(t,e)=>Xz(t,{Credentials:r=>Anr(r,e),IdentityId:Jr}),Mnr=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>Ztt(n,e)),Ztt=(t,e)=>Xz(t,{CreationDate:r=>GN(DJ(IM(r))),IdentityId:Jr,LastModifiedDate:r=>GN(DJ(IM(r))),Logins:Ut}),Rnr=(t,e)=>Xz(t,{Identities:r=>Mnr(r,e),IdentityPoolId:Jr,NextToken:Jr}),jn=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),jnr=NJ(nd),pa=async(t,e,r,n,o)=>{let{hostname:i,protocol:a="https",port:s,path:u}=await t.endpoint(),l={protocol:a,hostname:i,port:s,method:"POST",path:u.endsWith("/")?u.slice(0,-1)+r:u+r,headers:e};return n!==void 0&&(l.hostname=n),o!==void 0&&(l.body=o),new dG(l)}});var OG,yge=O(()=>{Cn();Rn();zt();Mi();Ki();OG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(itt).de(Ttt).build(){}});var EG,bge=O(()=>{Cn();Rn();zt();Mi();Ki();EG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(att).de(Att).build(){}});var PG,_ge=O(()=>{Cn();Rn();zt();Mi();Ki();PG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(stt).de(Itt).build(){}});var TG,vge=O(()=>{Cn();Rn();zt();Mi();Ki();TG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(utt).de(Mtt).build(){}});var AG,wge=O(()=>{Cn();Rn();zt();Mi();Ki();AG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(ltt).de(Rtt).build(){}});var oL,Sge=O(()=>{Cn();Rn();zt();Mi();Ki();oL=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(ctt).de(jtt).build(){}});var iL,xge=O(()=>{Cn();Rn();zt();Mi();Ki();iL=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(dtt).de(Dtt).build(){}});var IG,Cge=O(()=>{Cn();Rn();zt();Mi();Ki();IG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(ftt).de(Ntt).build(){}});var MG,Oge=O(()=>{Cn();Rn();zt();Mi();Ki();MG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(ptt).de(Ltt).build(){}});var RG,Ege=O(()=>{Cn();Rn();zt();Mi();Ki();RG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(mtt).de(Ftt).build(){}});var jG,Pge=O(()=>{Cn();Rn();zt();Mi();Ki();jG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(htt).de(ktt).build(){}});var DG,Tge=O(()=>{Cn();Rn();zt();Mi();Ki();DG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser(gtt).de(Btt).build(){}});var aL,NG=O(()=>{Cn();Rn();zt();Mi();Ki();aL=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(ytt).de($tt).build(){}});var LG,Age=O(()=>{Cn();Rn();zt();Mi();Ki();LG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(btt).de(qtt).build(){}});var FG,Ige=O(()=>{Cn();Rn();zt();Mi();Ki();FG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(_tt).de(Utt).build(){}});var kG,Mge=O(()=>{Cn();Rn();zt();Mi();Ki();kG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(vtt).de(ztt).build(){}});var BG,Rge=O(()=>{Cn();Rn();zt();Mi();Ki();BG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(wtt).de(Htt).build(){}});var $G,jge=O(()=>{Cn();Rn();zt();Mi();Ki();$G=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(Stt).de(Vtt).build(){}});var qG,Dge=O(()=>{Cn();Rn();zt();Mi();Ki();qG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(xtt).de(Wtt).build(){}});var UG,Nge=O(()=>{Cn();Rn();zt();Mi();Ki();UG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(Ctt).de(Ktt).build(){}});var zG,Lge=O(()=>{Cn();Rn();zt();Mi();Ki();zG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(Ott).de(Jtt).build(){}});var HG,Fge=O(()=>{Cn();Rn();zt();Mi();Ki();HG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(Ett).de(Gtt).build(){}});var VG,kge=O(()=>{Cn();Rn();zt();Mi();Ki();VG=class extends pt.classBuilder().ep({...sr}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(Ptt).de(Ytt).build(){}});var Dnr,Bge,Xtt=O(()=>{zt();pG();yge();bge();_ge();vge();wge();Sge();xge();Cge();Oge();Ege();Pge();Tge();NG();Age();Ige();Mge();Rge();jge();Dge();Nge();Lge();Fge();kge();Dnr={CreateIdentityPoolCommand:OG,DeleteIdentitiesCommand:EG,DeleteIdentityPoolCommand:PG,DescribeIdentityCommand:TG,DescribeIdentityPoolCommand:AG,GetCredentialsForIdentityCommand:oL,GetIdCommand:iL,GetIdentityPoolRolesCommand:IG,GetOpenIdTokenCommand:MG,GetOpenIdTokenForDeveloperIdentityCommand:RG,GetPrincipalTagAttributeMapCommand:jG,ListIdentitiesCommand:DG,ListIdentityPoolsCommand:aL,ListTagsForResourceCommand:LG,LookupDeveloperIdentityCommand:FG,MergeDeveloperIdentitiesCommand:kG,SetIdentityPoolRolesCommand:BG,SetPrincipalTagAttributeMapCommand:$G,TagResourceCommand:qG,UnlinkDeveloperIdentityCommand:UG,UnlinkIdentityCommand:zG,UntagResourceCommand:HG,UpdateIdentityPoolCommand:VG},Bge=class extends tP{};jJ(Dnr,Bge)});var Qtt=O(()=>{yge();bge();_ge();vge();wge();Sge();xge();Cge();Oge();Ege();Pge();Tge();NG();Age();Ige();Mge();Rge();jge();Dge();Nge();Lge();Fge();kge()});var ert=O(()=>{});var UYn,trt=O(()=>{ZE();pG();NG();UYn=bhe(tP,aL,"NextToken","NextToken","MaxResults")});var rrt=O(()=>{ert();trt()});var nrt=O(()=>{gge()});var ort=O(()=>{pG();Xtt();Qtt();rrt();nrt()});var $ge={};ff($ge,{CognitoIdentityClient:()=>tP,GetCredentialsForIdentityCommand:()=>oL,GetIdCommand:()=>iL});var qge=O(()=>{ort()});function WG(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(qge(),$ge)),{Credentials:{AccessKeyId:n=Nnr(t.logger),Expiration:o,SecretKey:i=Fnr(t.logger),SessionToken:a}=Lnr(t.logger)}=await(t.client??new r(Object.assign({},t.clientConfig??{},{region:t.clientConfig?.region??t.parentClientConfig?.region}))).send(new e({CustomRoleArn:t.customRoleArn,IdentityId:t.identityId,Logins:t.logins?await VK(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function Nnr(t){throw new Zu("Response from Amazon Cognito contained no access key ID",{logger:t})}function Lnr(t){throw new Zu("Response from Amazon Cognito contained no credentials",{logger:t})}function Fnr(t){throw new Zu("Response from Amazon Cognito contained no secret key",{logger:t})}var Uge=O(()=>{Ex();sme()});var zge,KG,irt=O(()=>{zge="IdentityIds",KG=class{constructor(e="aws:cognito-identity-ids"){this.dbName=e}getItem(e){return this.withObjectStore("readonly",r=>{let n=r.get(e);return new Promise(o=>{n.onerror=()=>o(null),n.onsuccess=()=>o(n.result?n.result.value:null)})}).catch(()=>null)}removeItem(e){return this.withObjectStore("readwrite",r=>{let n=r.delete(e);return new Promise((o,i)=>{n.onerror=()=>i(n.error),n.onsuccess=()=>o()})})}setItem(e,r){return this.withObjectStore("readwrite",n=>{let o=n.put({id:e,value:r});return new Promise((i,a)=>{o.onerror=()=>a(o.error),o.onsuccess=()=>i()})})}getDb(){let e=self.indexedDB.open(this.dbName,1);return new Promise((r,n)=>{e.onsuccess=()=>{r(e.result)},e.onerror=()=>{n(e.error)},e.onblocked=()=>{n(new Error("Unable to access DB"))},e.onupgradeneeded=()=>{let o=e.result;o.onerror=()=>{n(new Error("Failed to create object store"))},o.createObjectStore(zge,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(zge,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(zge)))}).catch(i=>{throw n.close(),i})})}}});var JG,art=O(()=>{JG=class{constructor(e={}){this.store=e}getItem(e){return e in this.store?this.store[e]:null}removeItem(e){delete this.store[e]}setItem(e,r){this.store[e]=r}}});function srt(){return typeof self=="object"&&self.indexedDB?new KG:typeof window=="object"&&window.localStorage?window.localStorage:knr}var knr,urt=O(()=>{irt();art();knr=new JG});function lrt({accountId:t,cache:e=srt(),client:r,clientConfig:n,customRoleArn:o,identityPoolId:i,logins:a,userIdentifier:s=!a||Object.keys(a).length===0?"ANONYMOUS":void 0,logger:u,parentClientConfig:l}){u?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let c=s?`aws:cognito-identity-credentials:${i}:${s}`:void 0,d=async()=>{let{GetIdCommand:f,CognitoIdentityClient:p}=await Promise.resolve().then(()=>(qge(),$ge)),m=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),h=c&&await e.getItem(c);if(!h){let{IdentityId:v=Bnr(u)}=await m.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await VK(a):void 0}));h=v,c&&Promise.resolve(e.setItem(c,h)).catch(()=>{})}return d=WG({client:m,customRoleArn:o,logins:a,identityId:h}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function Bnr(t){throw new Zu("Response from Amazon Cognito contained no identity ID",{logger:t})}var crt=O(()=>{Ex();Uge();urt();sme()});var Hge=O(()=>{SWe();xWe();CWe();Uge();crt()});var $nr,drt=O(()=>{Hge();$nr=t=>WG({...t})});var qnr,frt=O(()=>{Hge();qnr=t=>lrt({...t})});var Unr,znr,Hnr,prt,mrt=O(()=>{Ex();Unr="169.254.170.2",znr="169.254.170.23",Hnr="[fd00:ec2::23]",prt=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===Unr||t.hostname===znr||t.hostname===Hnr)){if(t.hostname.includes("[")){if(t.hostname==="[::1]"||t.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]")return}else{if(t.hostname==="localhost")return;let r=t.hostname.split("."),n=o=>{let i=parseInt(o,10);return 0<=i&&i<=255};if(r[0]==="127"&&n(r[1])&&n(r[2])&&n(r[3])&&r.length===4)return}throw new Zu(`URL not accepted. It must either be HTTPS or match one of the following:
- loopback CIDR 127.0.0.0/8 or [::1/128]
- ECS container host 169.254.170.2
- EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:e})}}});var hrt=O(()=>{});var grt=O(()=>{hrt()});var yrt=O(()=>{hs()});var brt=O(()=>{});var _rt=O(()=>{});function Vnr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var GG,vrt=O(()=>{GG=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Vnr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var wrt=O(()=>{});var Srt=O(()=>{});var xrt=O(()=>{});var Crt=O(()=>{grt();yrt();brt();_rt();vrt();wrt();Srt();xrt()});function Ort(t){return new GG({protocol:t.protocol,hostname:t.hostname,port:Number(t.port),path:t.pathname,query:Array.from(t.searchParams.entries()).reduce((e,[r,n])=>(e[r]=n,e),{}),fragment:t.hash})}async function Ert(t,e){let n=await qYe(t.body).transformToString();if(t.statusCode===200){let o=JSON.parse(n);if(typeof o.AccessKeyId!="string"||typeof o.SecretAccessKey!="string"||typeof o.Token!="string"||typeof o.Expiration!="string")throw new Zu("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:e});return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.Token,expiration:oZe(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new Zu(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new Zu(`Server responded with status: ${t.statusCode}`,{logger:e})}var Prt=O(()=>{Ex();Crt();zt();ahe()});var Trt,Art=O(()=>{Trt=(t,e,r)=>async()=>{for(let n=0;n<e;++n)try{return await t()}catch{await new Promise(i=>setTimeout(i,r))}return await t()}});var Vge,Irt=O(()=>{Gz();Ex();mrt();Prt();Art();Vge=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new Zu("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);prt(n,t.logger);let o=new GE;return Trt(async()=>{let i=Ort(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return Ert(a.response)},t.maxRetries??3,t.timeout??1e3)}});var Mrt=O(()=>{Irt()});function Wnr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function Rrt(t){return{schemeId:"smithy.api#noAuth"}}var jrt,Drt,Knr,Nrt,Wge=O(()=>{NM();Sg();f2();jrt=async(t,e,r)=>({operation:ib(e).operation,region:await rd(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});Drt=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(Rrt(t));break}case"AssumeRoleWithWebIdentity":{e.push(Rrt(t));break}default:e.push(Wnr(t))}return e},Knr=t=>({...t,stsClientCtor:Vm}),Nrt=t=>{let e=Knr(t);return{...eG(e)}}});var Lrt,od,fb=O(()=>{Lrt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),od={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var krt,Frt=O(()=>{krt={name:"@aws-sdk/client-sts",description:"AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native",version:"3.645.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-sts","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"rimraf ./dist-types tsconfig.types.tsbuildinfo && tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo sts",test:"yarn test:unit","test:unit":"jest"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.645.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.645.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.645.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.645.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},devDependencies:{"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sts",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-sts"}}});var Kge,Jge=O(()=>{Kge=t=>new TextEncoder().encode(t)});var Brt=O(()=>{Jge()});var $rt,qrt=O(()=>{$rt=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});var Urt=O(()=>{Jge();Brt();qrt()});var Qrt,Br,Qn,eo,nP,rP,oc,ent,tnt,rnt,Ji,zrt,pb,sL,Yge,Hrt,Gge,nnt,Vrt,ic,Wrt,ont,int,id,Np,Krt,ant,snt,Jrt,unt,Grt,Yrt,Zrt,Xrt,Gnr,lnt,cnt=O(()=>{Qrt="required",Br="type",Qn="fn",eo="argv",nP="ref",rP="booleanEquals",oc="stringEquals",ent="sigv4",tnt="sts",rnt="us-east-1",Ji="endpoint",zrt="https://sts.{Region}.{PartitionResult#dnsSuffix}",pb="tree",sL="error",Yge="getAttr",Hrt={[Qrt]:!1,[Br]:"String"},Gge={[Qrt]:!0,default:!1,[Br]:"Boolean"},nnt={[nP]:"Endpoint"},Vrt={[Qn]:"isSet",[eo]:[{[nP]:"Region"}]},ic={[nP]:"Region"},Wrt={[Qn]:"aws.partition",[eo]:[ic],assign:"PartitionResult"},ont={[nP]:"UseFIPS"},int={[nP]:"UseDualStack"},id={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:ent,signingName:tnt,signingRegion:rnt}]},headers:{}},Np={},Krt={conditions:[{[Qn]:oc,[eo]:[ic,"aws-global"]}],[Ji]:id,[Br]:Ji},ant={[Qn]:rP,[eo]:[ont,!0]},snt={[Qn]:rP,[eo]:[int,!0]},Jrt={[Qn]:Yge,[eo]:[{[nP]:"PartitionResult"},"supportsFIPS"]},unt={[nP]:"PartitionResult"},Grt={[Qn]:rP,[eo]:[!0,{[Qn]:Yge,[eo]:[unt,"supportsDualStack"]}]},Yrt=[{[Qn]:"isSet",[eo]:[nnt]}],Zrt=[ant],Xrt=[snt],Gnr={version:"1.0",parameters:{Region:Hrt,UseDualStack:Gge,UseFIPS:Gge,Endpoint:Hrt,UseGlobalEndpoint:Gge},rules:[{conditions:[{[Qn]:rP,[eo]:[{[nP]:"UseGlobalEndpoint"},!0]},{[Qn]:"not",[eo]:Yrt},Vrt,Wrt,{[Qn]:rP,[eo]:[ont,!1]},{[Qn]:rP,[eo]:[int,!1]}],rules:[{conditions:[{[Qn]:oc,[eo]:[ic,"ap-northeast-1"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"ap-south-1"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"ap-southeast-1"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"ap-southeast-2"]}],endpoint:id,[Br]:Ji},Krt,{conditions:[{[Qn]:oc,[eo]:[ic,"ca-central-1"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"eu-central-1"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"eu-north-1"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"eu-west-1"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"eu-west-2"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"eu-west-3"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"sa-east-1"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,rnt]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"us-east-2"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"us-west-1"]}],endpoint:id,[Br]:Ji},{conditions:[{[Qn]:oc,[eo]:[ic,"us-west-2"]}],endpoint:id,[Br]:Ji},{endpoint:{url:zrt,properties:{authSchemes:[{name:ent,signingName:tnt,signingRegion:"{Region}"}]},headers:Np},[Br]:Ji}],[Br]:pb},{conditions:Yrt,rules:[{conditions:Zrt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Br]:sL},{conditions:Xrt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Br]:sL},{endpoint:{url:nnt,properties:Np,headers:Np},[Br]:Ji}],[Br]:pb},{conditions:[Vrt],rules:[{conditions:[Wrt],rules:[{conditions:[ant,snt],rules:[{conditions:[{[Qn]:rP,[eo]:[!0,Jrt]},Grt],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Np,headers:Np},[Br]:Ji}],[Br]:pb},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Br]:sL}],[Br]:pb},{conditions:Zrt,rules:[{conditions:[{[Qn]:rP,[eo]:[Jrt,!0]}],rules:[{conditions:[{[Qn]:oc,[eo]:[{[Qn]:Yge,[eo]:[unt,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Np,headers:Np},[Br]:Ji},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Np,headers:Np},[Br]:Ji}],[Br]:pb},{error:"FIPS is enabled but this partition does not support FIPS",[Br]:sL}],[Br]:pb},{conditions:Xrt,rules:[{conditions:[Grt],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Np,headers:Np},[Br]:Ji}],[Br]:pb},{error:"DualStack is enabled but this partition does not support DualStack",[Br]:sL}],[Br]:pb},Krt,{endpoint:{url:zrt,properties:Np,headers:Np},[Br]:Ji}],[Br]:pb}],[Br]:pb},{error:"Invalid Configuration: Missing Region",[Br]:sL}]},lnt=Gnr});var dnt,fnt=O(()=>{iJ();UE();cnt();dnt=(t,e={})=>Bz(lnt,{endpointParams:t,logger:e.logger});Px.aws=$z});var pnt,mnt=O(()=>{NM();ZE();zt();gJ();KN();Urt();Wge();fnt();pnt=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??KE,base64Encoder:t?.base64Encoder??JE,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??dnt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Drt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new RM},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new XN}],logger:t?.logger??new HE,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??zE,utf8Decoder:t?.utf8Decoder??Kge,utf8Encoder:t?.utf8Encoder??$rt})});var hnt,gnt=O(()=>{Frt();rge();ige();qz();Gz();age();sge();sb();mnt();zt();dge();hnt=t=>{let e=uG(t),r=()=>e().then(LJ),n=pnt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??sG,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??iG({serviceId:n.serviceId,clientVersion:krt.version}),maxAttempts:t?.maxAttempts??ab,region:t?.region??aG("Region is missing"),requestHandler:GE.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||Hz),sha256:t?.sha256??oG,streamCollector:t?.streamCollector??JN,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(dJ)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(fJ))}}});var ynt,bnt,_nt=O(()=>{ynt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},bnt=t=>({httpHandler:t.httpHandler()})});var vnt=O(()=>{_nt()});var wnt=O(()=>{hs()});var Snt=O(()=>{});var xnt=O(()=>{});function Ynr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var YG,Cnt=O(()=>{YG=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Ynr(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var Ont=O(()=>{});var Ent=O(()=>{});var Pnt=O(()=>{});var Zge=O(()=>{vnt();wnt();Snt();xnt();Cnt();Ont();Ent();Pnt()});var Tnt,Ant,Int=O(()=>{Tnt=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,n=t.credentials;return{setHttpAuthScheme(o){let i=e.findIndex(a=>a.schemeId===o.schemeId);i===-1?e.push(o):e.splice(i,1,o)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(o){r=o},httpAuthSchemeProvider(){return r},setCredentials(o){n=o},credentials(){return n}}},Ant=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var ZG,Mnt,Rnt=O(()=>{pge();Zge();zt();Int();ZG=t=>t,Mnt=(t,e)=>{let r={...ZG(lG(t)),...ZG(FJ(t)),...ZG(ynt(t)),...ZG(Tnt(t))};return e.forEach(n=>n.configure(r)),{...t,...cG(r),...kJ(r),...bnt(r),...Ant(r)}}});var Vm,f2=O(()=>{cme();dme();fme();Ame();qz();ZE();_he();Cn();qJ();zt();Wge();fb();gnt();Rnt();Vm=class extends PM{constructor(...[e]){let r=hnt(e||{}),n=Lrt(r),o=ZK(n),i=AJ(o),a=mJ(i),s=a,u=_J(s),l=Nrt(u),c=Mnt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(lJ(this.config)),this.middlewareStack.use($J(this.config)),this.middlewareStack.use(HJ(this.config)),this.middlewareStack.use(KK(this.config)),this.middlewareStack.use(JK(this.config)),this.middlewareStack.use(YK(this.config)),this.middlewareStack.use(vJ(this.config,{httpAuthSchemeParametersProvider:jrt,identityProviderConfigProvider:async d=>new ZN({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(UJ(this.config))}destroy(){super.destroy()}}});var Wd,XG=O(()=>{zt();Wd=class t extends YN{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var p2,m2,h2,g2,y2,b2,_2,v2,uL,Xge,Qge,eye,tye,rye,nye,oye,oP=O(()=>{zt();XG();p2=class t extends Wd{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},m2=class t extends Wd{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},h2=class t extends Wd{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},g2=class t extends Wd{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},y2=class t extends Wd{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},b2=class t extends Wd{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_2=class t extends Wd{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},v2=class t extends Wd{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},uL=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:RJ}}),Xge=t=>({...t,...t.Credentials&&{Credentials:uL(t.Credentials)}}),Qge=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:RJ}}),eye=t=>({...t,...t.Credentials&&{Credentials:uL(t.Credentials)}}),tye=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:RJ}}),rye=t=>({...t,...t.Credentials&&{Credentials:uL(t.Credentials)}}),nye=t=>({...t,...t.Credentials&&{Credentials:uL(t.Credentials)}}),oye=t=>({...t,...t.Credentials&&{Credentials:uL(t.Credentials)}})});var jnt,Dnt,Nnt,Lnt,Fnt,knt,Bnt,$nt,qnt,Unt,znt,Hnt,Vnt,Wnt,Knt,Jnt,iP,Znr,Xnr,Qnr,eor,tor,ror,nor,oor,ior,aor,sor,uor,lor,cor,dor,por,QG,mor,hor,gor,yor,bor,Gnt,jye,_or,vor,wor,w2,Sor,xor,Cor,Oor,Eor,Por,Tor,Aor,Ior,Mor,Ror,jor,Dor,Nor,ad,Lor,aP,sP,uP,lP,lL,For,iye,jx,kor,Bor,cL,Dx,dL,Kd,aye,$or,sye,Jd,uye,lye,cye,dye,fye,qor,Uor,zor,Hor,pye,mye,hye,gye,Wm,Km,yye,bye,_ye,vye,Jm,wye,Nx,fL,Sye,xye,Cye,Oye,Gm,pL,Eye,Pye,mL,hL,Tye,Aye,cP,Iye,Mye,Rye,Gi,dP,Vor,Lx=O(()=>{NM();Zge();zt();oP();XG();jnt=async(t,e)=>{let r=sP,n;return n=dP({...ior(t,e),[lP]:For,[cP]:uP}),aP(e,r,"/",void 0,n)},Dnt=async(t,e)=>{let r=sP,n;return n=dP({...aor(t,e),[lP]:kor,[cP]:uP}),aP(e,r,"/",void 0,n)},Nnt=async(t,e)=>{let r=sP,n;return n=dP({...sor(t,e),[lP]:Bor,[cP]:uP}),aP(e,r,"/",void 0,n)},Lnt=async(t,e)=>{let r=sP,n;return n=dP({...uor(t,e),[lP]:$or,[cP]:uP}),aP(e,r,"/",void 0,n)},Fnt=async(t,e)=>{let r=sP,n;return n=dP({...lor(t,e),[lP]:qor,[cP]:uP}),aP(e,r,"/",void 0,n)},knt=async(t,e)=>{let r=sP,n;return n=dP({...cor(t,e),[lP]:Uor,[cP]:uP}),aP(e,r,"/",void 0,n)},Bnt=async(t,e)=>{let r=sP,n;return n=dP({...dor(t,e),[lP]:zor,[cP]:uP}),aP(e,r,"/",void 0,n)},$nt=async(t,e)=>{let r=sP,n;return n=dP({...por(t,e),[lP]:Hor,[cP]:uP}),aP(e,r,"/",void 0,n)},qnt=async(t,e)=>{if(t.statusCode>=300)return iP(t,e);let r=await ub(t.body,e),n={};return n=_or(r.AssumeRoleResult,e),{$metadata:ad(t),...n}},Unt=async(t,e)=>{if(t.statusCode>=300)return iP(t,e);let r=await ub(t.body,e),n={};return n=vor(r.AssumeRoleWithSAMLResult,e),{$metadata:ad(t),...n}},znt=async(t,e)=>{if(t.statusCode>=300)return iP(t,e);let r=await ub(t.body,e),n={};return n=wor(r.AssumeRoleWithWebIdentityResult,e),{$metadata:ad(t),...n}},Hnt=async(t,e)=>{if(t.statusCode>=300)return iP(t,e);let r=await ub(t.body,e),n={};return n=Sor(r.DecodeAuthorizationMessageResult,e),{$metadata:ad(t),...n}},Vnt=async(t,e)=>{if(t.statusCode>=300)return iP(t,e);let r=await ub(t.body,e),n={};return n=Oor(r.GetAccessKeyInfoResult,e),{$metadata:ad(t),...n}},Wnt=async(t,e)=>{if(t.statusCode>=300)return iP(t,e);let r=await ub(t.body,e),n={};return n=Eor(r.GetCallerIdentityResult,e),{$metadata:ad(t),...n}},Knt=async(t,e)=>{if(t.statusCode>=300)return iP(t,e);let r=await ub(t.body,e),n={};return n=Por(r.GetFederationTokenResult,e),{$metadata:ad(t),...n}},Jnt=async(t,e)=>{if(t.statusCode>=300)return iP(t,e);let r=await ub(t.body,e),n={};return n=Tor(r.GetSessionTokenResult,e),{$metadata:ad(t),...n}},iP=async(t,e)=>{let r={...t,body:await $Qe(t.body,e)},n=Vor(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await Znr(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await ror(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await nor(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await oor(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await Qnr(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await tor(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await Xnr(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await eor(r,e);default:let o=r.body;return Lor({output:t,parsedBody:o.Error,errorCode:n})}},Znr=async(t,e)=>{let r=t.body,n=xor(r.Error,e),o=new p2({$metadata:ad(t),...n});return da(o,r)},Xnr=async(t,e)=>{let r=t.body,n=Aor(r.Error,e),o=new _2({$metadata:ad(t),...n});return da(o,r)},Qnr=async(t,e)=>{let r=t.body,n=Ior(r.Error,e),o=new y2({$metadata:ad(t),...n});return da(o,r)},eor=async(t,e)=>{let r=t.body,n=Mor(r.Error,e),o=new v2({$metadata:ad(t),...n});return da(o,r)},tor=async(t,e)=>{let r=t.body,n=Ror(r.Error,e),o=new b2({$metadata:ad(t),...n});return da(o,r)},ror=async(t,e)=>{let r=t.body,n=jor(r.Error,e),o=new m2({$metadata:ad(t),...n});return da(o,r)},nor=async(t,e)=>{let r=t.body,n=Dor(r.Error,e),o=new h2({$metadata:ad(t),...n});return da(o,r)},oor=async(t,e)=>{let r=t.body,n=Nor(r.Error,e),o=new g2({$metadata:ad(t),...n});return da(o,r)},ior=(t,e)=>{let r={};if(t[Nx]!=null&&(r[Nx]=t[Nx]),t[fL]!=null&&(r[fL]=t[fL]),t[Km]!=null){let n=QG(t[Km],e);t[Km]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Wm]!=null&&(r[Wm]=t[Wm]),t[Jd]!=null&&(r[Jd]=t[Jd]),t[mL]!=null){let n=Gnt(t[mL],e);t[mL]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[Tye]!=null){let n=bor(t[Tye],e);t[Tye]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[lye]!=null&&(r[lye]=t[lye]),t[pL]!=null&&(r[pL]=t[pL]),t[hL]!=null&&(r[hL]=t[hL]),t[Gm]!=null&&(r[Gm]=t[Gm]),t[_ye]!=null){let n=gor(t[_ye],e);t[_ye]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},aor=(t,e)=>{let r={};if(t[Nx]!=null&&(r[Nx]=t[Nx]),t[yye]!=null&&(r[yye]=t[yye]),t[Cye]!=null&&(r[Cye]=t[Cye]),t[Km]!=null){let n=QG(t[Km],e);t[Km]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Wm]!=null&&(r[Wm]=t[Wm]),t[Jd]!=null&&(r[Jd]=t[Jd]),r},sor=(t,e)=>{let r={};if(t[Nx]!=null&&(r[Nx]=t[Nx]),t[fL]!=null&&(r[fL]=t[fL]),t[Mye]!=null&&(r[Mye]=t[Mye]),t[vye]!=null&&(r[vye]=t[vye]),t[Km]!=null){let n=QG(t[Km],e);t[Km]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Wm]!=null&&(r[Wm]=t[Wm]),t[Jd]!=null&&(r[Jd]=t[Jd]),r},uor=(t,e)=>{let r={};return t[cye]!=null&&(r[cye]=t[cye]),r},lor=(t,e)=>{let r={};return t[lL]!=null&&(r[lL]=t[lL]),r},cor=(t,e)=>({}),dor=(t,e)=>{let r={};if(t[hye]!=null&&(r[hye]=t[hye]),t[Wm]!=null&&(r[Wm]=t[Wm]),t[Km]!=null){let n=QG(t[Km],e);t[Km]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Jd]!=null&&(r[Jd]=t[Jd]),t[mL]!=null){let n=Gnt(t[mL],e);t[mL]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},por=(t,e)=>{let r={};return t[Jd]!=null&&(r[Jd]=t[Jd]),t[pL]!=null&&(r[pL]=t[pL]),t[hL]!=null&&(r[hL]=t[hL]),r},QG=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=mor(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},mor=(t,e)=>{let r={};return t[Rye]!=null&&(r[Rye]=t[Rye]),r},hor=(t,e)=>{let r={};return t[bye]!=null&&(r[bye]=t[bye]),t[aye]!=null&&(r[aye]=t[aye]),r},gor=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=hor(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},yor=(t,e)=>{let r={};return t[mye]!=null&&(r[mye]=t[mye]),t[Iye]!=null&&(r[Iye]=t[Iye]),r},bor=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},Gnt=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=yor(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},jye=(t,e)=>{let r={};return t[iye]!=null&&(r[iye]=Jr(t[iye])),t[Dx]!=null&&(r[Dx]=Jr(t[Dx])),r},_or=(t,e)=>{let r={};return t[Kd]!=null&&(r[Kd]=w2(t[Kd],e)),t[jx]!=null&&(r[jx]=jye(t[jx],e)),t[Jm]!=null&&(r[Jm]=Zz(t[Jm])),t[Gm]!=null&&(r[Gm]=Jr(t[Gm])),r},vor=(t,e)=>{let r={};return t[Kd]!=null&&(r[Kd]=w2(t[Kd],e)),t[jx]!=null&&(r[jx]=jye(t[jx],e)),t[Jm]!=null&&(r[Jm]=Zz(t[Jm])),t[Sye]!=null&&(r[Sye]=Jr(t[Sye])),t[Eye]!=null&&(r[Eye]=Jr(t[Eye])),t[pye]!=null&&(r[pye]=Jr(t[pye])),t[dL]!=null&&(r[dL]=Jr(t[dL])),t[gye]!=null&&(r[gye]=Jr(t[gye])),t[Gm]!=null&&(r[Gm]=Jr(t[Gm])),r},wor=(t,e)=>{let r={};return t[Kd]!=null&&(r[Kd]=w2(t[Kd],e)),t[Oye]!=null&&(r[Oye]=Jr(t[Oye])),t[jx]!=null&&(r[jx]=jye(t[jx],e)),t[Jm]!=null&&(r[Jm]=Zz(t[Jm])),t[wye]!=null&&(r[wye]=Jr(t[wye])),t[dL]!=null&&(r[dL]=Jr(t[dL])),t[Gm]!=null&&(r[Gm]=Jr(t[Gm])),r},w2=(t,e)=>{let r={};return t[lL]!=null&&(r[lL]=Jr(t[lL])),t[xye]!=null&&(r[xye]=Jr(t[xye])),t[Pye]!=null&&(r[Pye]=Jr(t[Pye])),t[uye]!=null&&(r[uye]=GN(iZe(t[uye]))),r},Sor=(t,e)=>{let r={};return t[sye]!=null&&(r[sye]=Jr(t[sye])),r},xor=(t,e)=>{let r={};return t[Gi]!=null&&(r[Gi]=Jr(t[Gi])),r},Cor=(t,e)=>{let r={};return t[fye]!=null&&(r[fye]=Jr(t[fye])),t[Dx]!=null&&(r[Dx]=Jr(t[Dx])),r},Oor=(t,e)=>{let r={};return t[cL]!=null&&(r[cL]=Jr(t[cL])),r},Eor=(t,e)=>{let r={};return t[Aye]!=null&&(r[Aye]=Jr(t[Aye])),t[cL]!=null&&(r[cL]=Jr(t[cL])),t[Dx]!=null&&(r[Dx]=Jr(t[Dx])),r},Por=(t,e)=>{let r={};return t[Kd]!=null&&(r[Kd]=w2(t[Kd],e)),t[dye]!=null&&(r[dye]=Cor(t[dye],e)),t[Jm]!=null&&(r[Jm]=Zz(t[Jm])),r},Tor=(t,e)=>{let r={};return t[Kd]!=null&&(r[Kd]=w2(t[Kd],e)),r},Aor=(t,e)=>{let r={};return t[Gi]!=null&&(r[Gi]=Jr(t[Gi])),r},Ior=(t,e)=>{let r={};return t[Gi]!=null&&(r[Gi]=Jr(t[Gi])),r},Mor=(t,e)=>{let r={};return t[Gi]!=null&&(r[Gi]=Jr(t[Gi])),r},Ror=(t,e)=>{let r={};return t[Gi]!=null&&(r[Gi]=Jr(t[Gi])),r},jor=(t,e)=>{let r={};return t[Gi]!=null&&(r[Gi]=Jr(t[Gi])),r},Dor=(t,e)=>{let r={};return t[Gi]!=null&&(r[Gi]=Jr(t[Gi])),r},Nor=(t,e)=>{let r={};return t[Gi]!=null&&(r[Gi]=Jr(t[Gi])),r},ad=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),Lor=NJ(Wd),aP=async(t,e,r,n,o)=>{let{hostname:i,protocol:a="https",port:s,path:u}=await t.endpoint(),l={protocol:a,hostname:i,port:s,method:"POST",path:u.endsWith("/")?u.slice(0,-1)+r:u+r,headers:e};return n!==void 0&&(l.hostname=n),o!==void 0&&(l.body=o),new YG(l)},sP={"content-type":"application/x-www-form-urlencoded"},uP="2011-06-15",lP="Action",lL="AccessKeyId",For="AssumeRole",iye="AssumedRoleId",jx="AssumedRoleUser",kor="AssumeRoleWithSAML",Bor="AssumeRoleWithWebIdentity",cL="Account",Dx="Arn",dL="Audience",Kd="Credentials",aye="ContextAssertion",$or="DecodeAuthorizationMessage",sye="DecodedMessage",Jd="DurationSeconds",uye="Expiration",lye="ExternalId",cye="EncodedMessage",dye="FederatedUser",fye="FederatedUserId",qor="GetAccessKeyInfo",Uor="GetCallerIdentity",zor="GetFederationToken",Hor="GetSessionToken",pye="Issuer",mye="Key",hye="Name",gye="NameQualifier",Wm="Policy",Km="PolicyArns",yye="PrincipalArn",bye="ProviderArn",_ye="ProvidedContexts",vye="ProviderId",Jm="PackedPolicySize",wye="Provider",Nx="RoleArn",fL="RoleSessionName",Sye="Subject",xye="SecretAccessKey",Cye="SAMLAssertion",Oye="SubjectFromWebIdentityToken",Gm="SourceIdentity",pL="SerialNumber",Eye="SubjectType",Pye="SessionToken",mL="Tags",hL="TokenCode",Tye="TransitiveTagKeys",Aye="UserId",cP="Version",Iye="Value",Mye="WebIdentityToken",Rye="arn",Gi="message",dP=t=>Object.entries(t).map(([e,r])=>BJ(e)+"="+BJ(r)).join("&"),Vor=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var Fx,e7=O(()=>{Cn();Rn();zt();fb();oP();Lx();Fx=class extends pt.classBuilder().ep({...od}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,Xge).ser(jnt).de(qnt).build(){}});var S2,Dye=O(()=>{Cn();Rn();zt();fb();oP();Lx();S2=class extends pt.classBuilder().ep({...od}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(Qge,eye).ser(Dnt).de(Unt).build(){}});var LM,t7=O(()=>{Cn();Rn();zt();fb();oP();Lx();LM=class extends pt.classBuilder().ep({...od}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(tye,rye).ser(Nnt).de(znt).build(){}});var x2,Nye=O(()=>{Cn();Rn();zt();fb();Lx();x2=class extends pt.classBuilder().ep({...od}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(Lnt).de(Hnt).build(){}});var C2,Lye=O(()=>{Cn();Rn();zt();fb();Lx();C2=class extends pt.classBuilder().ep({...od}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(Fnt).de(Vnt).build(){}});var O2,Fye=O(()=>{Cn();Rn();zt();fb();Lx();O2=class extends pt.classBuilder().ep({...od}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(knt).de(Wnt).build(){}});var E2,kye=O(()=>{Cn();Rn();zt();fb();oP();Lx();E2=class extends pt.classBuilder().ep({...od}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,nye).ser(Bnt).de(Knt).build(){}});var P2,Bye=O(()=>{Cn();Rn();zt();fb();oP();Lx();P2=class extends pt.classBuilder().ep({...od}).m(function(e,r,n,o){return[vt(n,this.serialize,this.deserialize),wt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,oye).ser($nt).de(Jnt).build(){}});var Wor,r7,Ynt=O(()=>{zt();e7();Dye();t7();Nye();Lye();Fye();kye();Bye();f2();Wor={AssumeRoleCommand:Fx,AssumeRoleWithSAMLCommand:S2,AssumeRoleWithWebIdentityCommand:LM,DecodeAuthorizationMessageCommand:x2,GetAccessKeyInfoCommand:C2,GetCallerIdentityCommand:O2,GetFederationTokenCommand:E2,GetSessionTokenCommand:P2},r7=class extends Vm{};jJ(Wor,r7)});var Znt=O(()=>{e7();Dye();t7();Nye();Lye();Fye();kye();Bye()});var Xnt=O(()=>{oP()});var Qnt,eot,tot,rot,not,oot,iot=O(()=>{e7();t7();Qnt="us-east-1",eot=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},tot=async(t,e,r)=>{let n=typeof t=="function"?await t():t,o=typeof e=="function"?await e():e;return r?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${n} (provider)`,`${o} (parent client)`,`${Qnt} (STS default)`),n??o??Qnt},rot=(t,e)=>{let r,n;return async(o,i)=>{if(n=o,!r){let{logger:l=t?.parentClientConfig?.logger,region:c,requestHandler:d=t?.parentClientConfig?.requestHandler,credentialProviderLogger:f}=t,p=await tot(c,t?.parentClientConfig?.region,f),m=!oot(d);r=new e({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:m?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new Fx(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=eot(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},not=(t,e)=>{let r;return async n=>{if(!r){let{logger:s=t?.parentClientConfig?.logger,region:u,requestHandler:l=t?.parentClientConfig?.requestHandler,credentialProviderLogger:c}=t,d=await tot(u,t?.parentClientConfig?.region,c),f=!oot(l);r=new e({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new LM(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=eot(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},oot=t=>t?.metadata?.handlerProtocol==="h2"});var aot,sot,uot,Kor,lot=O(()=>{iot();f2();aot=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,sot=(t={},e)=>rot(t,aot(Vm,e)),uot=(t={},e)=>not(t,aot(Vm,e)),Kor=t=>e=>t({roleAssumer:sot(e),roleAssumerWithWebIdentity:uot(e),...e})});var cot={};ff(cot,{$Command:()=>pt,AssumeRoleCommand:()=>Fx,AssumeRoleResponseFilterSensitiveLog:()=>Xge,AssumeRoleWithSAMLCommand:()=>S2,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>Qge,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>eye,AssumeRoleWithWebIdentityCommand:()=>LM,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>tye,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>rye,CredentialsFilterSensitiveLog:()=>uL,DecodeAuthorizationMessageCommand:()=>x2,ExpiredTokenException:()=>p2,GetAccessKeyInfoCommand:()=>C2,GetCallerIdentityCommand:()=>O2,GetFederationTokenCommand:()=>E2,GetFederationTokenResponseFilterSensitiveLog:()=>nye,GetSessionTokenCommand:()=>P2,GetSessionTokenResponseFilterSensitiveLog:()=>oye,IDPCommunicationErrorException:()=>_2,IDPRejectedClaimException:()=>y2,InvalidAuthorizationMessageException:()=>v2,InvalidIdentityTokenException:()=>b2,MalformedPolicyDocumentException:()=>m2,PackedPolicyTooLargeException:()=>h2,RegionDisabledException:()=>g2,STS:()=>r7,STSClient:()=>Vm,STSServiceException:()=>Wd,__Client:()=>PM,decorateDefaultCredentialProvider:()=>Kor,getDefaultRoleAssumer:()=>sot,getDefaultRoleAssumerWithWebIdentity:()=>uot});var $ye=O(()=>{f2();Ynt();Znt();Xnt();lot();XG()});var dot={};ff(dot,{AssumeRoleCommand:()=>Fx,STSClient:()=>Vm});var fot=O(()=>{$ye()});var Jor,pot=O(()=>{Ex();Jor=t=>{let e;return async()=>{t.logger?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");let r={...t.params,RoleSessionName:t.params.RoleSessionName??"aws-sdk-js-"+Date.now()};if(r?.SerialNumber){if(!t.mfaCodeProvider)throw new Zu("Temporary credential requires multi-factor authentication, but no MFA code callback was provided.",{tryNextLink:!1,logger:t.logger});r.TokenCode=await t.mfaCodeProvider(r?.SerialNumber)}let{AssumeRoleCommand:n,STSClient:o}=await Promise.resolve().then(()=>(fot(),dot));if(e||(e=new o({...t.clientConfig,credentials:t.masterCredentials})),t.clientPlugins)for(let a of t.clientPlugins)e.middlewareStack.use(a);let{Credentials:i}=await e.send(new n(r));if(!i||!i.AccessKeyId||!i.SecretAccessKey)throw new Zu(`Invalid response from STS.assumeRole call with role ${r.RoleArn}`,{logger:t.logger});return{accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,sessionToken:i.SessionToken,expiration:i.Expiration,credentialScope:i.CredentialScope}}}});var mot=O(()=>{});var hot,got=O(()=>{hot=t=>async()=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:e,roleSessionName:r,webIdentityToken:n,providerId:o,policyArns:i,policy:a,durationSeconds:s}=t,{roleAssumerWithWebIdentity:u}=t;if(!u){let{getDefaultRoleAssumerWithWebIdentity:l}=await Promise.resolve().then(()=>($ye(),cot));u=l({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:t.parentClientConfig},t.clientPlugins)}return u({RoleArn:e,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:n,ProviderId:o,PolicyArns:i,Policy:a,DurationSeconds:s})}});var yot=O(()=>{mot();got()});var Gor,bot=O(()=>{yot();Gor=t=>hot({...t})});var _ot={};ff(_ot,{fromCognitoIdentity:()=>$nr,fromCognitoIdentityPool:()=>qnr,fromHttp:()=>Vge,fromTemporaryCredentials:()=>Jor,fromWebToken:()=>Gor});var vot=O(()=>{drt();frt();Mrt();pot();bot()});var FM={};ff(FM,{__addDisposableResource:()=>qot,__assign:()=>n7,__asyncDelegator:()=>jot,__asyncGenerator:()=>Rot,__asyncValues:()=>Dot,__await:()=>gL,__awaiter:()=>Eot,__classPrivateFieldGet:()=>kot,__classPrivateFieldIn:()=>$ot,__classPrivateFieldSet:()=>Bot,__createBinding:()=>i7,__decorate:()=>xot,__disposeResources:()=>Uot,__esDecorate:()=>Yor,__exportStar:()=>Tot,__extends:()=>wot,__generator:()=>Pot,__importDefault:()=>Fot,__importStar:()=>Lot,__makeTemplateObject:()=>Not,__metadata:()=>Oot,__param:()=>Cot,__propKey:()=>Xor,__read:()=>Uye,__rest:()=>Sot,__runInitializers:()=>Zor,__setFunctionName:()=>Qor,__spread:()=>Aot,__spreadArray:()=>Mot,__spreadArrays:()=>Iot,__values:()=>o7,default:()=>rir});function wot(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");qye(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Sot(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function xot(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function Cot(t,e){return function(r,n){e(r,n,t)}}function Yor(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var v=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(d=a(v.get))&&(c.get=d),(d=a(v.set))&&(c.set=d),(d=a(v.init))&&o.unshift(d)}else(d=a(v))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function Zor(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function Xor(t){return typeof t=="symbol"?t:"".concat(t)}function Qor(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Oot(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Eot(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function Pot(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Tot(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&i7(e,t,r)}function o7(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Uye(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Aot(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Uye(arguments[e]));return t}function Iot(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function Mot(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function gL(t){return this instanceof gL?(this.v=t,this):new gL(t)}function Rot(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(v,g){i.push([p,h,v,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof gL?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function jot(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:gL(t[o](a)),done:!1}:i?i(a):a}:i}}function Dot(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof o7=="function"?o7(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function Not(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Lot(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&i7(e,t,r);return eir(e,t),e}function Fot(t){return t&&t.__esModule?t:{default:t}}function kot(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function Bot(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function $ot(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function qot(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function Uot(t){function e(i){t.error=t.hasError?new tir(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}var qye,n7,i7,eir,tir,rir,kM=O(()=>{qye=function(t,e){return qye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},qye(t,e)};n7=function(){return n7=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},n7.apply(this,arguments)};i7=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};eir=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};tir=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};rir={__extends:wot,__assign:n7,__rest:Sot,__decorate:xot,__param:Cot,__metadata:Oot,__awaiter:Eot,__generator:Pot,__createBinding:i7,__exportStar:Tot,__values:o7,__read:Uye,__spread:Aot,__spreadArrays:Iot,__spreadArray:Mot,__await:gL,__asyncGenerator:Rot,__asyncDelegator:jot,__asyncValues:Dot,__makeTemplateObject:Not,__importStar:Lot,__importDefault:Fot,__classPrivateFieldGet:kot,__classPrivateFieldSet:Bot,__classPrivateFieldIn:$ot,__addDisposableResource:qot,__disposeResources:Uot}});var Hot=b(zot=>{"use strict";Object.defineProperty(zot,"__esModule",{value:!0})});var Vot=b(T2=>{"use strict";Object.defineProperty(T2,"__esModule",{value:!0});T2.HttpAuthLocation=void 0;var nir;(function(t){t.HEADER="header",t.QUERY="query"})(nir=T2.HttpAuthLocation||(T2.HttpAuthLocation={}))});var Kot=b(Wot=>{"use strict";Object.defineProperty(Wot,"__esModule",{value:!0})});var Got=b(Jot=>{"use strict";Object.defineProperty(Jot,"__esModule",{value:!0})});var Zot=b(Yot=>{"use strict";Object.defineProperty(Yot,"__esModule",{value:!0})});var Qot=b(Xot=>{"use strict";Object.defineProperty(Xot,"__esModule",{value:!0})});var tit=b(eit=>{"use strict";Object.defineProperty(eit,"__esModule",{value:!0})});var nit=b(rit=>{"use strict";Object.defineProperty(rit,"__esModule",{value:!0})});var iit=b(oit=>{"use strict";Object.defineProperty(oit,"__esModule",{value:!0})});var ait=b(A2=>{"use strict";Object.defineProperty(A2,"__esModule",{value:!0});var zye=(kM(),gl(FM));zye.__exportStar(tit(),A2);zye.__exportStar(nit(),A2);zye.__exportStar(iit(),A2)});var uit=b(sit=>{"use strict";Object.defineProperty(sit,"__esModule",{value:!0})});var cit=b(lit=>{"use strict";Object.defineProperty(lit,"__esModule",{value:!0})});var dit=b(I2=>{"use strict";Object.defineProperty(I2,"__esModule",{value:!0});I2.EndpointURLScheme=void 0;var oir;(function(t){t.HTTP="http",t.HTTPS="https"})(oir=I2.EndpointURLScheme||(I2.EndpointURLScheme={}))});var pit=b(fit=>{"use strict";Object.defineProperty(fit,"__esModule",{value:!0})});var hit=b(mit=>{"use strict";Object.defineProperty(mit,"__esModule",{value:!0})});var yit=b(git=>{"use strict";Object.defineProperty(git,"__esModule",{value:!0})});var _it=b(bit=>{"use strict";Object.defineProperty(bit,"__esModule",{value:!0})});var wit=b(vit=>{"use strict";Object.defineProperty(vit,"__esModule",{value:!0})});var Sit=b(BM=>{"use strict";Object.defineProperty(BM,"__esModule",{value:!0});var M2=(kM(),gl(FM));M2.__exportStar(pit(),BM);M2.__exportStar(hit(),BM);M2.__exportStar(yit(),BM);M2.__exportStar(_it(),BM);M2.__exportStar(wit(),BM)});var Cit=b(xit=>{"use strict";Object.defineProperty(xit,"__esModule",{value:!0})});var Oit=b(R2=>{"use strict";Object.defineProperty(R2,"__esModule",{value:!0});R2.FieldPosition=void 0;var iir;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(iir=R2.FieldPosition||(R2.FieldPosition={}))});var Pit=b(Eit=>{"use strict";Object.defineProperty(Eit,"__esModule",{value:!0})});var Ait=b(Tit=>{"use strict";Object.defineProperty(Tit,"__esModule",{value:!0})});var Mit=b(a7=>{"use strict";Object.defineProperty(a7,"__esModule",{value:!0});var Iit=(kM(),gl(FM));Iit.__exportStar(Pit(),a7);Iit.__exportStar(Ait(),a7)});var jit=b(Rit=>{"use strict";Object.defineProperty(Rit,"__esModule",{value:!0})});var Nit=b(Dit=>{"use strict";Object.defineProperty(Dit,"__esModule",{value:!0})});var Fit=b(Lit=>{"use strict";Object.defineProperty(Lit,"__esModule",{value:!0})});var Bit=b(kit=>{"use strict";Object.defineProperty(kit,"__esModule",{value:!0})});var qit=b($it=>{"use strict";Object.defineProperty($it,"__esModule",{value:!0})});var zit=b(Uit=>{"use strict";Object.defineProperty(Uit,"__esModule",{value:!0})});var Vit=b(Hit=>{"use strict";Object.defineProperty(Hit,"__esModule",{value:!0})});var Kit=b(Wit=>{"use strict";Object.defineProperty(Wit,"__esModule",{value:!0})});var Git=b(Jit=>{"use strict";Object.defineProperty(Jit,"__esModule",{value:!0})});var Zit=b(Yit=>{"use strict";Object.defineProperty(Yit,"__esModule",{value:!0})});var Qit=b(Xit=>{"use strict";Object.defineProperty(Xit,"__esModule",{value:!0})});var tat=b(eat=>{"use strict";Object.defineProperty(eat,"__esModule",{value:!0})});var nat=b(rat=>{"use strict";Object.defineProperty(rat,"__esModule",{value:!0})});var oat=b(j2=>{"use strict";Object.defineProperty(j2,"__esModule",{value:!0});j2.RequestHandlerProtocol=void 0;var air;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(air=j2.RequestHandlerProtocol||(j2.RequestHandlerProtocol={}))});var aat=b(iat=>{"use strict";Object.defineProperty(iat,"__esModule",{value:!0})});var uat=b(sat=>{"use strict";Object.defineProperty(sat,"__esModule",{value:!0})});var cat=b(lat=>{"use strict";Object.defineProperty(lat,"__esModule",{value:!0})});var fat=b(dat=>{"use strict";Object.defineProperty(dat,"__esModule",{value:!0})});var mat=b(pat=>{"use strict";Object.defineProperty(pat,"__esModule",{value:!0})});var hat=b(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});var Gn=(kM(),gl(FM));Gn.__exportStar(Hot(),On);Gn.__exportStar(Vot(),On);Gn.__exportStar(Kot(),On);Gn.__exportStar(Got(),On);Gn.__exportStar(Zot(),On);Gn.__exportStar(Qot(),On);Gn.__exportStar(ait(),On);Gn.__exportStar(uit(),On);Gn.__exportStar(cit(),On);Gn.__exportStar(dit(),On);Gn.__exportStar(Sit(),On);Gn.__exportStar(Cit(),On);Gn.__exportStar(Oit(),On);Gn.__exportStar(Mit(),On);Gn.__exportStar(jit(),On);Gn.__exportStar(Nit(),On);Gn.__exportStar(Fit(),On);Gn.__exportStar(Bit(),On);Gn.__exportStar(qit(),On);Gn.__exportStar(zit(),On);Gn.__exportStar(Vit(),On);Gn.__exportStar(Kit(),On);Gn.__exportStar(Git(),On);Gn.__exportStar(Zit(),On);Gn.__exportStar(Qit(),On);Gn.__exportStar(tat(),On);Gn.__exportStar(nat(),On);Gn.__exportStar(oat(),On);Gn.__exportStar(aat(),On);Gn.__exportStar(uat(),On);Gn.__exportStar(cat(),On);Gn.__exportStar(fat(),On);Gn.__exportStar(mat(),On)});var gat=b(s7=>{"use strict";Object.defineProperty(s7,"__esModule",{value:!0});s7.Field=void 0;var sir=hat(),Hye=class{constructor({name:e,kind:r=sir.FieldPosition.HEADER,values:n=[]}){this.name=e,this.kind=r,this.values=n}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}};s7.Field=Hye});var yat=b(u7=>{"use strict";Object.defineProperty(u7,"__esModule",{value:!0});u7.Fields=void 0;var Vye=class{constructor({fields:e=[],encoding:r="utf-8"}){this.entries={},e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}};u7.Fields=Vye});var _at=b(bat=>{"use strict";Object.defineProperty(bat,"__esModule",{value:!0})});var vat=b(l7=>{"use strict";Object.defineProperty(l7,"__esModule",{value:!0});l7.HttpRequest=void 0;var Wye=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){let e=new t({...this,headers:{...this.headers}});return e.query&&(e.query=uir(e.query)),e}};l7.HttpRequest=Wye;function uir(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}});var wat=b(c7=>{"use strict";Object.defineProperty(c7,"__esModule",{value:!0});c7.HttpResponse=void 0;var Kye=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};c7.HttpResponse=Kye});var Sat=b(d7=>{"use strict";Object.defineProperty(d7,"__esModule",{value:!0});d7.isValidHostname=void 0;function lir(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}d7.isValidHostname=lir});var Cat=b(xat=>{"use strict";Object.defineProperty(xat,"__esModule",{value:!0})});var Oat=b(kx=>{"use strict";Object.defineProperty(kx,"__esModule",{value:!0});var $M=(kM(),gl(FM));$M.__exportStar(gat(),kx);$M.__exportStar(yat(),kx);$M.__exportStar(_at(),kx);$M.__exportStar(vat(),kx);$M.__exportStar(wat(),kx);$M.__exportStar(Sat(),kx);$M.__exportStar(Cat(),kx)});var Eat=b(Jye=>{"use strict";Object.defineProperty(Jye,"__esModule",{value:!0});var cir=(kM(),gl(FM));cir.__exportStar(Oat(),Jye)});var qM={};ff(qM,{__addDisposableResource:()=>Kat,__assign:()=>f7,__asyncDelegator:()=>Bat,__asyncGenerator:()=>kat,__asyncValues:()=>$at,__await:()=>yL,__awaiter:()=>Rat,__classPrivateFieldGet:()=>Hat,__classPrivateFieldIn:()=>Wat,__classPrivateFieldSet:()=>Vat,__createBinding:()=>m7,__decorate:()=>Aat,__disposeResources:()=>Jat,__esDecorate:()=>dir,__exportStar:()=>Dat,__extends:()=>Pat,__generator:()=>jat,__importDefault:()=>zat,__importStar:()=>Uat,__makeTemplateObject:()=>qat,__metadata:()=>Mat,__param:()=>Iat,__propKey:()=>pir,__read:()=>Yye,__rest:()=>Tat,__runInitializers:()=>fir,__setFunctionName:()=>mir,__spread:()=>Nat,__spreadArray:()=>Fat,__spreadArrays:()=>Lat,__values:()=>p7,default:()=>yir});function Pat(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Gye(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Tat(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function Aat(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function Iat(t,e){return function(r,n){e(r,n,t)}}function dir(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var v=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(d=a(v.get))&&(c.get=d),(d=a(v.set))&&(c.set=d),(d=a(v.init))&&o.unshift(d)}else(d=a(v))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function fir(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function pir(t){return typeof t=="symbol"?t:"".concat(t)}function mir(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Mat(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Rat(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function jat(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(r=0)),r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Dat(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&m7(e,t,r)}function p7(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Yye(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Nat(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Yye(arguments[e]));return t}function Lat(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function Fat(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function yL(t){return this instanceof yL?(this.v=t,this):new yL(t)}function kat(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(v,g){i.push([p,h,v,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof yL?Promise.resolve(p.value.v).then(c,d):f(i[0][2],p)}function c(p){u("next",p)}function d(p){u("throw",p)}function f(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function Bat(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:yL(t[o](a)),done:!1}:i?i(a):a}:i}}function $at(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof p7=="function"?p7(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function qat(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Uat(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&m7(e,t,r);return hir(e,t),e}function zat(t){return t&&t.__esModule?t:{default:t}}function Hat(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function Vat(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function Wat(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Kat(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function Jat(t){function e(i){t.error=t.hasError?new gir(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}var Gye,f7,m7,hir,gir,yir,UM=O(()=>{Gye=function(t,e){return Gye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Gye(t,e)};f7=function(){return f7=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},f7.apply(this,arguments)};m7=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};hir=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};gir=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};yir={__extends:Pat,__assign:f7,__rest:Tat,__decorate:Aat,__param:Iat,__metadata:Mat,__awaiter:Rat,__generator:jat,__createBinding:m7,__exportStar:Dat,__values:p7,__read:Yye,__spread:Nat,__spreadArrays:Lat,__spreadArray:Fat,__await:yL,__asyncGenerator:kat,__asyncDelegator:Bat,__asyncValues:$at,__makeTemplateObject:qat,__importStar:Uat,__importDefault:zat,__classPrivateFieldGet:Hat,__classPrivateFieldSet:Vat,__classPrivateFieldIn:Wat,__addDisposableResource:Kat,__disposeResources:Jat}});var ebe={};ff(ebe,{__assign:()=>Xye,__asyncDelegator:()=>Iir,__asyncGenerator:()=>Air,__asyncValues:()=>Mir,__await:()=>D2,__awaiter:()=>xir,__classPrivateFieldGet:()=>Nir,__classPrivateFieldSet:()=>Lir,__createBinding:()=>Oir,__decorate:()=>vir,__exportStar:()=>Eir,__extends:()=>bir,__generator:()=>Cir,__importDefault:()=>Dir,__importStar:()=>jir,__makeTemplateObject:()=>Rir,__metadata:()=>Sir,__param:()=>wir,__read:()=>Gat,__rest:()=>_ir,__spread:()=>Pir,__spreadArrays:()=>Tir,__values:()=>Qye});function bir(t,e){Zye(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function _ir(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function vir(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function wir(t,e){return function(r,n){e(r,n,t)}}function Sir(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function xir(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}function Cir(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(c){return u([l,c])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,o=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],o=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Oir(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Eir(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Qye(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gat(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Pir(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Gat(arguments[e]));return t}function Tir(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function D2(t){return this instanceof D2?(this.v=t,this):new D2(t)}function Air(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof D2?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){s("next",f)}function c(f){s("throw",f)}function d(f,p){f(p),i.shift(),i.length&&s(i[0][0],i[0][1])}}function Iir(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:D2(t[o](a)),done:o==="return"}:i?i(a):a}:i}}function Mir(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Qye=="function"?Qye(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}}function Rir(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function jir(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function Dir(t){return t&&t.__esModule?t:{default:t}}function Nir(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Lir(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var Zye,Xye,tbe=O(()=>{Zye=function(t,e){return Zye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)n.hasOwnProperty(o)&&(r[o]=n[o])},Zye(t,e)};Xye=function(){return Xye=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Xye.apply(this,arguments)}});var Yat=b(bL=>{"use strict";Object.defineProperty(bL,"__esModule",{value:!0});bL.toUtf8=bL.fromUtf8=void 0;var Fir=t=>{let e=[];for(let r=0,n=t.length;r<n;r++){let o=t.charCodeAt(r);if(o<128)e.push(o);else if(o<2048)e.push(o>>6|192,o&63|128);else if(r+1<t.length&&(o&64512)===55296&&(t.charCodeAt(r+1)&64512)===56320){let i=65536+((o&1023)<<10)+(t.charCodeAt(++r)&1023);e.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else e.push(o>>12|224,o>>6&63|128,o&63|128)}return Uint8Array.from(e)};bL.fromUtf8=Fir;var kir=t=>{let e="";for(let r=0,n=t.length;r<n;r++){let o=t[r];if(o<128)e+=String.fromCharCode(o);else if(192<=o&&o<224){let i=t[++r];e+=String.fromCharCode((o&31)<<6|i&63)}else if(240<=o&&o<365){let a="%"+[o,t[++r],t[++r],t[++r]].map(s=>s.toString(16)).join("%");e+=decodeURIComponent(a)}else e+=String.fromCharCode((o&15)<<12|(t[++r]&63)<<6|t[++r]&63)}return e};bL.toUtf8=kir});var Zat=b(_L=>{"use strict";Object.defineProperty(_L,"__esModule",{value:!0});_L.toUtf8=_L.fromUtf8=void 0;function Bir(t){return new TextEncoder().encode(t)}_L.fromUtf8=Bir;function $ir(t){return new TextDecoder("utf-8").decode(t)}_L.toUtf8=$ir});var est=b(vL=>{"use strict";Object.defineProperty(vL,"__esModule",{value:!0});vL.toUtf8=vL.fromUtf8=void 0;var Xat=Yat(),Qat=Zat(),qir=t=>typeof TextEncoder=="function"?(0,Qat.fromUtf8)(t):(0,Xat.fromUtf8)(t);vL.fromUtf8=qir;var Uir=t=>typeof TextDecoder=="function"?(0,Qat.toUtf8)(t):(0,Xat.toUtf8)(t);vL.toUtf8=Uir});var tst=b(h7=>{"use strict";Object.defineProperty(h7,"__esModule",{value:!0});h7.convertToBuffer=void 0;var zir=est(),Hir=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:zir.fromUtf8;function Vir(t){return t instanceof Uint8Array?t:typeof t=="string"?Hir(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}h7.convertToBuffer=Vir});var rst=b(g7=>{"use strict";Object.defineProperty(g7,"__esModule",{value:!0});g7.isEmptyData=void 0;function Wir(t){return typeof t=="string"?t.length===0:t.byteLength===0}g7.isEmptyData=Wir});var nst=b(y7=>{"use strict";Object.defineProperty(y7,"__esModule",{value:!0});y7.numToUint8=void 0;function Kir(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}y7.numToUint8=Kir});var ost=b(b7=>{"use strict";Object.defineProperty(b7,"__esModule",{value:!0});b7.uint32ArrayFrom=void 0;function Jir(t){if(!Uint32Array.from){for(var e=new Uint32Array(t.length),r=0;r<t.length;)e[r]=t[r],r+=1;return e}return Uint32Array.from(t)}b7.uint32ArrayFrom=Jir});var rbe=b(mb=>{"use strict";Object.defineProperty(mb,"__esModule",{value:!0});mb.uint32ArrayFrom=mb.numToUint8=mb.isEmptyData=mb.convertToBuffer=void 0;var Gir=tst();Object.defineProperty(mb,"convertToBuffer",{enumerable:!0,get:function(){return Gir.convertToBuffer}});var Yir=rst();Object.defineProperty(mb,"isEmptyData",{enumerable:!0,get:function(){return Yir.isEmptyData}});var Zir=nst();Object.defineProperty(mb,"numToUint8",{enumerable:!0,get:function(){return Zir.numToUint8}});var Xir=ost();Object.defineProperty(mb,"uint32ArrayFrom",{enumerable:!0,get:function(){return Xir.uint32ArrayFrom}})});var sst=b(_7=>{"use strict";Object.defineProperty(_7,"__esModule",{value:!0});_7.AwsCrc32=void 0;var ist=(tbe(),gl(ebe)),nbe=rbe(),ast=v7(),Qir=function(){function t(){this.crc32=new ast.Crc32}return t.prototype.update=function(e){(0,nbe.isEmptyData)(e)||this.crc32.update((0,nbe.convertToBuffer)(e))},t.prototype.digest=function(){return ist.__awaiter(this,void 0,void 0,function(){return ist.__generator(this,function(e){return[2,(0,nbe.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new ast.Crc32},t}();_7.AwsCrc32=Qir});var v7=b(fP=>{"use strict";Object.defineProperty(fP,"__esModule",{value:!0});fP.AwsCrc32=fP.Crc32=fP.crc32=void 0;var ear=(tbe(),gl(ebe)),tar=rbe();function rar(t){return new ust().update(t).digest()}fP.crc32=rar;var ust=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=ear.__values(e),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^oar[(this.checksum^a)&255]}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return this},t.prototype.digest=function(){return(this.checksum^4294967295)>>>0},t}();fP.Crc32=ust;var nar=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],oar=(0,tar.uint32ArrayFrom)(nar),iar=sst();Object.defineProperty(fP,"AwsCrc32",{enumerable:!0,get:function(){return iar.AwsCrc32}})});var SL=b(wL=>{"use strict";Object.defineProperty(wL,"__esModule",{value:!0});wL.toHex=wL.fromHex=void 0;var lst={},obe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),lst[t]=e,obe[e]=t}function aar(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let n=t.slice(r,r+2).toLowerCase();if(n in obe)e[r/2]=obe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}wL.fromHex=aar;function sar(t){let e="";for(let r=0;r<t.byteLength;r++)e+=lst[t[r]];return e}wL.toHex=sar});var abe=b(w7=>{"use strict";Object.defineProperty(w7,"__esModule",{value:!0});w7.Int64=void 0;var uar=SL(),ibe=class t{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,o=Math.abs(Math.round(e));n>-1&&o>0;n--,o/=256)r[n]=o;return e<0&&cst(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&cst(e),parseInt((0,uar.toHex)(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};w7.Int64=ibe;function cst(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}});var lbe=b(S7=>{"use strict";Object.defineProperty(S7,"__esModule",{value:!0});S7.HeaderMarshaller=void 0;var xL=SL(),sbe=abe(),ube=class{constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){let r=[];for(let i of Object.keys(e)){let a=this.fromUtf8(i);r.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(e[i]))}let n=new Uint8Array(r.reduce((i,a)=>i+a.byteLength,0)),o=0;for(let i of r)n.set(i,o),o+=i.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":let o=new Uint8Array(9);return o[0]=5,o.set(e.value.bytes,1),o;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case"string":let s=this.fromUtf8(e.value),u=new DataView(new ArrayBuffer(3+s.byteLength));u.setUint8(0,7),u.setUint16(1,s.byteLength,!1);let l=new Uint8Array(u.buffer);return l.set(s,3),l;case"timestamp":let c=new Uint8Array(9);return c[0]=8,c.set(sbe.Int64.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!yar.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,xL.fromHex)(e.value.replace(/\-/g,"")),1),d}}parse(e){let r={},n=0;for(;n<e.byteLength;){let o=e.getUint8(n++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,o));switch(n+=o,e.getUint8(n++)){case 0:r[i]={type:fst,value:!0};break;case 1:r[i]={type:fst,value:!1};break;case 2:r[i]={type:lar,value:e.getInt8(n++)};break;case 3:r[i]={type:car,value:e.getInt16(n,!1)},n+=2;break;case 4:r[i]={type:dar,value:e.getInt32(n,!1)},n+=4;break;case 5:r[i]={type:far,value:new sbe.Int64(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:let a=e.getUint16(n,!1);n+=2,r[i]={type:par,value:new Uint8Array(e.buffer,e.byteOffset+n,a)},n+=a;break;case 7:let s=e.getUint16(n,!1);n+=2,r[i]={type:mar,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,s))},n+=s;break;case 8:r[i]={type:har,value:new Date(new sbe.Int64(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let u=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,r[i]={type:gar,value:`${(0,xL.toHex)(u.subarray(0,4))}-${(0,xL.toHex)(u.subarray(4,6))}-${(0,xL.toHex)(u.subarray(6,8))}-${(0,xL.toHex)(u.subarray(8,10))}-${(0,xL.toHex)(u.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};S7.HeaderMarshaller=ube;var dst;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(dst||(dst={}));var fst="boolean",lar="byte",car="short",dar="integer",far="long",par="binary",mar="string",har="timestamp",gar="uuid",yar=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});var mst=b(x7=>{"use strict";Object.defineProperty(x7,"__esModule",{value:!0});x7.splitMessage=void 0;var bar=v7(),pst=4,pP=pst*2,zM=4,_ar=pP+zM*2;function war({byteLength:t,byteOffset:e,buffer:r}){if(t<_ar)throw new Error("Provided message too short to accommodate event stream message overhead");let n=new DataView(r,e,t),o=n.getUint32(0,!1);if(t!==o)throw new Error("Reported message length does not match received message length");let i=n.getUint32(pst,!1),a=n.getUint32(pP,!1),s=n.getUint32(t-zM,!1),u=new bar.Crc32().update(new Uint8Array(r,e,pP));if(a!==u.digest())throw new Error(`The prelude checksum specified in the message (${a}) does not match the calculated CRC32 checksum (${u.digest()})`);if(u.update(new Uint8Array(r,e+pP,t-(pP+zM))),s!==u.digest())throw new Error(`The message checksum (${u.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(r,e+pP+zM,i),body:new Uint8Array(r,e+pP+zM+i,o-i-(pP+zM+zM))}}x7.splitMessage=war});var hst=b(C7=>{"use strict";Object.defineProperty(C7,"__esModule",{value:!0});C7.EventStreamCodec=void 0;var Sar=v7(),xar=lbe(),Car=mst(),cbe=class{constructor(e,r){this.headerMarshaller=new xar.HeaderMarshaller(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let n=this.headerMarshaller.format(e),o=n.byteLength+r.byteLength+16,i=new Uint8Array(o),a=new DataView(i.buffer,i.byteOffset,i.byteLength),s=new Sar.Crc32;return a.setUint32(0,o,!1),a.setUint32(4,n.byteLength,!1),a.setUint32(8,s.update(i.subarray(0,8)).digest(),!1),i.set(n,12),i.set(r,n.byteLength+12),a.setUint32(o-4,s.update(i.subarray(8,o-4)).digest(),!1),i}decode(e){let{headers:r,body:n}=(0,Car.splitMessage)(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}};C7.EventStreamCodec=cbe});var yst=b(gst=>{"use strict";Object.defineProperty(gst,"__esModule",{value:!0})});var bst=b(O7=>{"use strict";Object.defineProperty(O7,"__esModule",{value:!0});O7.MessageDecoderStream=void 0;var dbe=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}};O7.MessageDecoderStream=dbe});var _st=b(E7=>{"use strict";Object.defineProperty(E7,"__esModule",{value:!0});E7.MessageEncoderStream=void 0;var fbe=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}};E7.MessageEncoderStream=fbe});var vst=b(P7=>{"use strict";Object.defineProperty(P7,"__esModule",{value:!0});P7.SmithyMessageDecoderStream=void 0;var pbe=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let r=await this.options.deserializer(e);r!==void 0&&(yield r)}}};P7.SmithyMessageDecoderStream=pbe});var wst=b(T7=>{"use strict";Object.defineProperty(T7,"__esModule",{value:!0});T7.SmithyMessageEncoderStream=void 0;var mbe=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}};T7.SmithyMessageEncoderStream=mbe});var Sst=b(hb=>{"use strict";Object.defineProperty(hb,"__esModule",{value:!0});var mP=(UM(),gl(qM));mP.__exportStar(hst(),hb);mP.__exportStar(lbe(),hb);mP.__exportStar(abe(),hb);mP.__exportStar(yst(),hb);mP.__exportStar(bst(),hb);mP.__exportStar(_st(),hb);mP.__exportStar(vst(),hb);mP.__exportStar(wst(),hb)});var xst=b(A7=>{"use strict";Object.defineProperty(A7,"__esModule",{value:!0});A7.normalizeProvider=void 0;var Oar=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};A7.normalizeProvider=Oar});var Cst=b(hbe=>{"use strict";Object.defineProperty(hbe,"__esModule",{value:!0});var Ear=(UM(),gl(qM));Ear.__exportStar(xst(),hbe)});var gbe=b(I7=>{"use strict";Object.defineProperty(I7,"__esModule",{value:!0});I7.isArrayBuffer=void 0;var Par=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";I7.isArrayBuffer=Par});var bbe=b(CL=>{"use strict";Object.defineProperty(CL,"__esModule",{value:!0});CL.fromString=CL.fromArrayBuffer=void 0;var Tar=gbe(),ybe=Tf(),Aar=(t,e=0,r=t.byteLength-e)=>{if(!(0,Tar.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return ybe.Buffer.from(t,e,r)};CL.fromArrayBuffer=Aar;var Iar=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?ybe.Buffer.from(t,e):ybe.Buffer.from(t)};CL.fromString=Iar});var _be=b(M7=>{"use strict";Object.defineProperty(M7,"__esModule",{value:!0});M7.fromUtf8=void 0;var Mar=bbe(),Rar=t=>{let e=(0,Mar.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};M7.fromUtf8=Rar});var Ost=b(R7=>{"use strict";Object.defineProperty(R7,"__esModule",{value:!0});R7.toUint8Array=void 0;var jar=_be(),Dar=t=>typeof t=="string"?(0,jar.fromUtf8)(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);R7.toUint8Array=Dar});var Est=b(j7=>{"use strict";Object.defineProperty(j7,"__esModule",{value:!0});j7.toUtf8=void 0;var Nar=bbe(),Lar=t=>(0,Nar.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8");j7.toUtf8=Lar});var D7=b(N2=>{"use strict";Object.defineProperty(N2,"__esModule",{value:!0});var vbe=(UM(),gl(qM));vbe.__exportStar(_be(),N2);vbe.__exportStar(Ost(),N2);vbe.__exportStar(Est(),N2)});var HM=b(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.MAX_PRESIGNED_TTL=St.KEY_TYPE_IDENTIFIER=St.MAX_CACHE_SIZE=St.UNSIGNED_PAYLOAD=St.EVENT_ALGORITHM_IDENTIFIER=St.ALGORITHM_IDENTIFIER_V4A=St.ALGORITHM_IDENTIFIER=St.UNSIGNABLE_PATTERNS=St.SEC_HEADER_PATTERN=St.PROXY_HEADER_PATTERN=St.ALWAYS_UNSIGNABLE_HEADERS=St.HOST_HEADER=St.TOKEN_HEADER=St.SHA256_HEADER=St.SIGNATURE_HEADER=St.GENERATED_HEADERS=St.DATE_HEADER=St.AMZ_DATE_HEADER=St.AUTH_HEADER=St.REGION_SET_PARAM=St.TOKEN_QUERY_PARAM=St.SIGNATURE_QUERY_PARAM=St.EXPIRES_QUERY_PARAM=St.SIGNED_HEADERS_QUERY_PARAM=St.AMZ_DATE_QUERY_PARAM=St.CREDENTIAL_QUERY_PARAM=St.ALGORITHM_QUERY_PARAM=void 0;St.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";St.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";St.AMZ_DATE_QUERY_PARAM="X-Amz-Date";St.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";St.EXPIRES_QUERY_PARAM="X-Amz-Expires";St.SIGNATURE_QUERY_PARAM="X-Amz-Signature";St.TOKEN_QUERY_PARAM="X-Amz-Security-Token";St.REGION_SET_PARAM="X-Amz-Region-Set";St.AUTH_HEADER="authorization";St.AMZ_DATE_HEADER=St.AMZ_DATE_QUERY_PARAM.toLowerCase();St.DATE_HEADER="date";St.GENERATED_HEADERS=[St.AUTH_HEADER,St.AMZ_DATE_HEADER,St.DATE_HEADER];St.SIGNATURE_HEADER=St.SIGNATURE_QUERY_PARAM.toLowerCase();St.SHA256_HEADER="x-amz-content-sha256";St.TOKEN_HEADER=St.TOKEN_QUERY_PARAM.toLowerCase();St.HOST_HEADER="host";St.ALWAYS_UNSIGNABLE_HEADERS={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0};St.PROXY_HEADER_PATTERN=/^proxy-/;St.SEC_HEADER_PATTERN=/^sec-/;St.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];St.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";St.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";St.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";St.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";St.MAX_CACHE_SIZE=50;St.KEY_TYPE_IDENTIFIER="aws4_request";St.MAX_PRESIGNED_TTL=60*60*24*7});var Sbe=b(hP=>{"use strict";Object.defineProperty(hP,"__esModule",{value:!0});hP.clearCredentialCache=hP.getSigningKey=hP.createScope=void 0;var Far=SL(),kar=D7(),wbe=HM(),OL={},N7=[],Bar=(t,e,r)=>`${t}/${e}/${r}/${wbe.KEY_TYPE_IDENTIFIER}`;hP.createScope=Bar;var $ar=async(t,e,r,n,o)=>{let i=await Pst(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${(0,Far.toHex)(i)}:${e.sessionToken}`;if(a in OL)return OL[a];for(N7.push(a);N7.length>wbe.MAX_CACHE_SIZE;)delete OL[N7.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,wbe.KEY_TYPE_IDENTIFIER])s=await Pst(t,s,u);return OL[a]=s};hP.getSigningKey=$ar;var qar=()=>{N7.length=0,Object.keys(OL).forEach(t=>{delete OL[t]})};hP.clearCredentialCache=qar;var Pst=(t,e,r)=>{let n=new t(e);return n.update((0,kar.toUint8Array)(r)),n.digest()}});var Cbe=b(L7=>{"use strict";Object.defineProperty(L7,"__esModule",{value:!0});L7.getCanonicalHeaders=void 0;var xbe=HM(),Uar=({headers:t},e,r)=>{let n={};for(let o of Object.keys(t).sort()){if(t[o]==null)continue;let i=o.toLowerCase();(i in xbe.ALWAYS_UNSIGNABLE_HEADERS||e?.has(i)||xbe.PROXY_HEADER_PATTERN.test(i)||xbe.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n};L7.getCanonicalHeaders=Uar});var Obe=b(F7=>{"use strict";Object.defineProperty(F7,"__esModule",{value:!0});F7.escapeUri=void 0;var zar=t=>encodeURIComponent(t).replace(/[!'()*]/g,Har);F7.escapeUri=zar;var Har=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var Tst=b(k7=>{"use strict";Object.defineProperty(k7,"__esModule",{value:!0});k7.escapeUriPath=void 0;var Var=Obe(),War=t=>t.split("/").map(Var.escapeUri).join("/");k7.escapeUriPath=War});var Ist=b(B7=>{"use strict";Object.defineProperty(B7,"__esModule",{value:!0});var Ast=(UM(),gl(qM));Ast.__exportStar(Obe(),B7);Ast.__exportStar(Tst(),B7)});var Ebe=b(q7=>{"use strict";Object.defineProperty(q7,"__esModule",{value:!0});q7.getCanonicalQuery=void 0;var $7=Ist(),Kar=HM(),Jar=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===Kar.SIGNATURE_HEADER)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${(0,$7.escapeUri)(n)}=${(0,$7.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,$7.escapeUri)(n)}=${(0,$7.escapeUri)(a)}`]),[]).join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")};q7.getCanonicalQuery=Jar});var Pbe=b(U7=>{"use strict";Object.defineProperty(U7,"__esModule",{value:!0});U7.getPayloadHash=void 0;var Gar=gbe(),Yar=SL(),Zar=D7(),Mst=HM(),Xar=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===Mst.SHA256_HEADER)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||(0,Gar.isArrayBuffer)(e)){let n=new r;return n.update((0,Zar.toUint8Array)(e)),(0,Yar.toHex)(await n.digest())}return Mst.UNSIGNED_PAYLOAD};U7.getPayloadHash=Xar});var Rst=b(gP=>{"use strict";Object.defineProperty(gP,"__esModule",{value:!0});gP.deleteHeader=gP.getHeaderValue=gP.hasHeader=void 0;var Qar=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1};gP.hasHeader=Qar;var esr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return e[r]};gP.getHeaderValue=esr;var tsr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))t===r.toLowerCase()&&delete e[r]};gP.deleteHeader=tsr});var Tbe=b(VM=>{"use strict";Object.defineProperty(VM,"__esModule",{value:!0});VM.cloneQuery=VM.cloneRequest=void 0;var rsr=({headers:t,query:e,...r})=>({...r,headers:{...t},query:e?(0,VM.cloneQuery)(e):void 0});VM.cloneRequest=rsr;var nsr=t=>Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{});VM.cloneQuery=nsr});var Abe=b(z7=>{"use strict";Object.defineProperty(z7,"__esModule",{value:!0});z7.moveHeadersToQuery=void 0;var osr=Tbe(),isr=(t,e={})=>{var r;let{headers:n,query:o={}}=typeof t.clone=="function"?t.clone():(0,osr.cloneRequest)(t);for(let i of Object.keys(n)){let a=i.toLowerCase();a.slice(0,6)==="x-amz-"&&!(!((r=e.unhoistableHeaders)===null||r===void 0)&&r.has(a))&&(o[i]=n[i],delete n[i])}return{...t,headers:n,query:o}};z7.moveHeadersToQuery=isr});var Ibe=b(H7=>{"use strict";Object.defineProperty(H7,"__esModule",{value:!0});H7.prepareRequest=void 0;var asr=Tbe(),ssr=HM(),usr=t=>{t=typeof t.clone=="function"?t.clone():(0,asr.cloneRequest)(t);for(let e of Object.keys(t.headers))ssr.GENERATED_HEADERS.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};H7.prepareRequest=usr});var jst=b(WM=>{"use strict";Object.defineProperty(WM,"__esModule",{value:!0});WM.toDate=WM.iso8601=void 0;var lsr=t=>(0,WM.toDate)(t).toISOString().replace(/\.\d{3}Z$/,"Z");WM.iso8601=lsr;var csr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;WM.toDate=csr});var kst=b(J7=>{"use strict";Object.defineProperty(J7,"__esModule",{value:!0});J7.SignatureV4=void 0;var dsr=Sst(),V7=SL(),Dst=Cst(),L2=D7(),ac=HM(),W7=Sbe(),Nst=Cbe(),fsr=Ebe(),Mbe=Pbe(),psr=Rst(),msr=Abe(),Lst=Ibe(),hsr=jst(),Rbe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new dsr.HeaderMarshaller(L2.toUtf8,L2.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,Dst.normalizeProvider)(n),this.credentialProvider=(0,Dst.normalizeProvider)(r)}async presign(e,r={}){let{signingDate:n=new Date,expiresIn:o=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:s,signingRegion:u,signingService:l}=r,c=await this.credentialProvider();this.validateResolvedCredentials(c);let d=u??await this.regionProvider(),{longDate:f,shortDate:p}=K7(n);if(o>ac.MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=(0,W7.createScope)(p,d,l??this.service),h=(0,msr.moveHeadersToQuery)((0,Lst.prepareRequest)(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[ac.TOKEN_QUERY_PARAM]=c.sessionToken),h.query[ac.ALGORITHM_QUERY_PARAM]=ac.ALGORITHM_IDENTIFIER,h.query[ac.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${m}`,h.query[ac.AMZ_DATE_QUERY_PARAM]=f,h.query[ac.EXPIRES_QUERY_PARAM]=o.toString(10);let v=(0,Nst.getCanonicalHeaders)(h,i,s);return h.query[ac.SIGNED_HEADERS_QUERY_PARAM]=Fst(v),h.query[ac.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,v,await(0,Mbe.getPayloadHash)(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=K7(n),c=(0,W7.createScope)(u,s,a??this.service),d=await(0,Mbe.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=(0,V7.toHex)(await f.digest()),m=[ac.EVENT_ALGORITHM_IDENTIFIER,l,c,o,p,d].join(`
`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerMarshaller.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=K7(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,L2.toUint8Array)(e)),(0,V7.toHex)(await u.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:n,unsignableHeaders:o,signingRegion:i,signingService:a}={}){let s=await this.credentialProvider();this.validateResolvedCredentials(s);let u=i??await this.regionProvider(),l=(0,Lst.prepareRequest)(e),{longDate:c,shortDate:d}=K7(r),f=(0,W7.createScope)(d,u,a??this.service);l.headers[ac.AMZ_DATE_HEADER]=c,s.sessionToken&&(l.headers[ac.TOKEN_HEADER]=s.sessionToken);let p=await(0,Mbe.getPayloadHash)(l,this.sha256);!(0,psr.hasHeader)(ac.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[ac.SHA256_HEADER]=p);let m=(0,Nst.getCanonicalHeaders)(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[ac.AUTH_HEADER]=`${ac.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${Fst(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${(0,fsr.getCanonicalQuery)(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update((0,L2.toUint8Array)(n));let i=await o.digest();return`${ac.ALGORITHM_IDENTIFIER}
${e}
${r}
${(0,V7.toHex)(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let r=[];for(let i of e.split("/"))i?.length!==0&&i!=="."&&(i===".."?r.pop():r.push(i));let n=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return encodeURIComponent(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,o){let i=await this.createStringToSign(e,r,o),a=new this.sha256(await n);return a.update((0,L2.toUint8Array)(i)),(0,V7.toHex)(await a.digest())}getSigningKey(e,r,n,o){return(0,W7.getSigningKey)(this.sha256,e,n,r,o||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}};J7.SignatureV4=Rbe;var K7=t=>{let e=(0,hsr.iso8601)(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},Fst=t=>Object.keys(t).sort().join(";")});var $st=b(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.prepareRequest=Lf.moveHeadersToQuery=Lf.getPayloadHash=Lf.getCanonicalQuery=Lf.getCanonicalHeaders=void 0;var Bst=(UM(),gl(qM));Bst.__exportStar(kst(),Lf);var gsr=Cbe();Object.defineProperty(Lf,"getCanonicalHeaders",{enumerable:!0,get:function(){return gsr.getCanonicalHeaders}});var ysr=Ebe();Object.defineProperty(Lf,"getCanonicalQuery",{enumerable:!0,get:function(){return ysr.getCanonicalQuery}});var bsr=Pbe();Object.defineProperty(Lf,"getPayloadHash",{enumerable:!0,get:function(){return bsr.getPayloadHash}});var _sr=Abe();Object.defineProperty(Lf,"moveHeadersToQuery",{enumerable:!0,get:function(){return _sr.moveHeadersToQuery}});var vsr=Ibe();Object.defineProperty(Lf,"prepareRequest",{enumerable:!0,get:function(){return vsr.prepareRequest}});Bst.__exportStar(Sbe(),Lf)});var qst=b(jbe=>{"use strict";Object.defineProperty(jbe,"__esModule",{value:!0});var wsr=(UM(),gl(qM));wsr.__exportStar($st(),jbe)});var ha=b((Ono,Ust)=>{"use strict";Ust.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var EL=b((Eno,G7)=>{"use strict";var{AbortController:zst,AbortSignal:Ssr}=typeof self<"u"?self:typeof window<"u"?window:void 0;G7.exports=zst;G7.exports.AbortSignal=Ssr;G7.exports.default=zst});var F2=b((Pno,Dbe)=>{"use strict";var PL=typeof Reflect=="object"?Reflect:null,Hst=PL&&typeof PL.apply=="function"?PL.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Y7;PL&&typeof PL.ownKeys=="function"?Y7=PL.ownKeys:Object.getOwnPropertySymbols?Y7=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Y7=function(e){return Object.getOwnPropertyNames(e)};function xsr(t){console&&console.warn&&console.warn(t)}var Wst=Number.isNaN||function(e){return e!==e};function ni(){ni.init.call(this)}Dbe.exports=ni;Dbe.exports.once=Psr;ni.EventEmitter=ni;ni.prototype._events=void 0;ni.prototype._eventsCount=0;ni.prototype._maxListeners=void 0;var Vst=10;function Z7(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ni,"defaultMaxListeners",{enumerable:!0,get:function(){return Vst},set:function(t){if(typeof t!="number"||t<0||Wst(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Vst=t}});ni.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ni.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Wst(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Kst(t){return t._maxListeners===void 0?ni.defaultMaxListeners:t._maxListeners}ni.prototype.getMaxListeners=function(){return Kst(this)};ni.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var o=e==="error",i=this._events;if(i!==void 0)o=o&&i.error===void 0;else if(!o)return!1;if(o){var a;if(r.length>0&&(a=r[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[e];if(u===void 0)return!1;if(typeof u=="function")Hst(u,this,r);else for(var l=u.length,c=Xst(u,l),n=0;n<l;++n)Hst(c[n],this,r);return!0};function Jst(t,e,r,n){var o,i,a;if(Z7(r),i=t._events,i===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),a=i[e]),a===void 0)a=i[e]=r,++t._eventsCount;else if(typeof a=="function"?a=i[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),o=Kst(t),o>0&&a.length>o&&!a.warned){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=a.length,xsr(s)}return t}ni.prototype.addListener=function(e,r){return Jst(this,e,r,!1)};ni.prototype.on=ni.prototype.addListener;ni.prototype.prependListener=function(e,r){return Jst(this,e,r,!0)};function Csr(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Gst(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=Csr.bind(n);return o.listener=r,n.wrapFn=o,o}ni.prototype.once=function(e,r){return Z7(r),this.on(e,Gst(this,e,r)),this};ni.prototype.prependOnceListener=function(e,r){return Z7(r),this.prependListener(e,Gst(this,e,r)),this};ni.prototype.removeListener=function(e,r){var n,o,i,a,s;if(Z7(r),o=this._events,o===void 0)return this;if(n=o[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===r||n[a].listener===r){s=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():Osr(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};ni.prototype.off=ni.prototype.removeListener;ni.prototype.removeAllListeners=function(e){var r,n,o;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(o=0;o<i.length;++o)a=i[o],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(o=r.length-1;o>=0;o--)this.removeListener(e,r[o]);return this};function Yst(t,e,r){var n=t._events;if(n===void 0)return[];var o=n[e];return o===void 0?[]:typeof o=="function"?r?[o.listener||o]:[o]:r?Esr(o):Xst(o,o.length)}ni.prototype.listeners=function(e){return Yst(this,e,!0)};ni.prototype.rawListeners=function(e){return Yst(this,e,!1)};ni.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Zst.call(t,e)};ni.prototype.listenerCount=Zst;function Zst(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ni.prototype.eventNames=function(){return this._eventsCount>0?Y7(this._events):[]};function Xst(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Osr(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Esr(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Psr(t,e){return new Promise(function(r,n){function o(a){t.removeListener(e,i),n(a)}function i(){typeof t.removeListener=="function"&&t.removeListener("error",o),r([].slice.call(arguments))}Qst(t,e,i,{once:!0}),e!=="error"&&Tsr(t,o,{once:!0})})}function Tsr(t,e,r){typeof t.on=="function"&&Qst(t,"error",e,r)}function Qst(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function o(i){n.once&&t.removeEventListener(e,o),r(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var sd=b((Tno,Lbe)=>{"use strict";var Asr=Tf(),{kResistStopPropagation:Isr,SymbolDispose:Msr}=ha(),Rsr=globalThis.AbortSignal||EL().AbortSignal,jsr=globalThis.AbortController||EL().AbortController,Dsr=Object.getPrototypeOf(async function(){}).constructor,eut=globalThis.Blob||Asr.Blob,Nsr=typeof eut<"u"?function(e){return e instanceof eut}:function(e){return!1},tut=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},Lsr=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},Nbe=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let n=0;n<e.length;n++)r+=` ${e[n].stack}
`;super(r),this.name="AggregateError",this.errors=e}};Lbe.exports={AggregateError:Nbe,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((n,o)=>{t=n,e=o}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...o)=>n?r(n):e(...o))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let o=e.shift();return n==="f"?o.toFixed(6):n==="j"?JSON.stringify(o):n==="s"&&typeof o=="object"?`${o.constructor!==Object?o.constructor.name:""} {}`.trim():o.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof Dsr},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Nsr,deprecate(t,e){return t},addAbortListener:F2().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);tut(e,"signal"),Lsr(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Isr]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Msr](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:Rsr.any||function(e){if(e.length===1)return e[0];let r=new jsr,n=()=>r.abort();return e.forEach(o=>{tut(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};Lbe.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Gd=b((Ano,out)=>{"use strict";var{format:Fsr,inspect:X7,AggregateError:ksr}=sd(),Bsr=globalThis.AggregateError||ksr,$sr=Symbol("kIsNodeError"),qsr=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Usr=/^([A-Z][a-z0-9]*)+$/,zsr="__node_internal_",Q7={};function KM(t,e){if(!t)throw new Q7.ERR_INTERNAL_ASSERTION(e)}function rut(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Hsr(t,e,r){if(typeof e=="function")return KM(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return KM(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Fsr(e,...r)}function sc(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(Hsr(t,e,i))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[$sr]=!0,Q7[t]=n}function nut(t){let e=zsr+t.name;return Object.defineProperty(t,"name",{value:e}),t}function Vsr(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Bsr([e,t],e.message);return r.code=e.code,r}return t||e}var Fbe=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Q7.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};sc("ERR_ASSERTION","%s",Error);sc("ERR_INVALID_ARG_TYPE",(t,e,r)=>{KM(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let o=[],i=[],a=[];for(let u of e)KM(typeof u=="string","All expected entries have to be of type string"),qsr.includes(u)?o.push(u.toLowerCase()):Usr.test(u)?i.push(u):(KM(u!=="object",'The value "object" should be written as "Object"'),a.push(u));if(i.length>0){let u=o.indexOf("object");u!==-1&&(o.splice(o,u,1),i.push("Object"))}if(o.length>0){switch(o.length){case 1:n+=`of type ${o[0]}`;break;case 2:n+=`one of type ${o[0]} or ${o[1]}`;break;default:{let u=o.pop();n+=`one of type ${o.join(", ")}, or ${u}`}}(i.length>0||a.length>0)&&(n+=" or ")}if(i.length>0){switch(i.length){case 1:n+=`an instance of ${i[0]}`;break;case 2:n+=`an instance of ${i[0]} or ${i[1]}`;break;default:{let u=i.pop();n+=`an instance of ${i.join(", ")}, or ${u}`}}a.length>0&&(n+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(n+="an "),n+=`${a[0]}`;break;case 2:n+=`one of ${a[0]} or ${a[1]}`;break;default:{let u=a.pop();n+=`one of ${a.join(", ")}, or ${u}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var s;if((s=r.constructor)!==null&&s!==void 0&&s.name)n+=`. Received an instance of ${r.constructor.name}`;else{let u=X7(r,{depth:-1});n+=`. Received ${u}`}}else{let u=X7(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);sc("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=X7(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);sc("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let o=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${o}.`},TypeError);sc("ERR_MISSING_ARGS",(...t)=>{KM(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);sc("ERR_OUT_OF_RANGE",(t,e,r)=>{KM(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=rut(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=rut(n)),n+="n"):n=X7(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);sc("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);sc("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);sc("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);sc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);sc("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);sc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);sc("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);sc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);sc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);sc("ERR_STREAM_WRITE_AFTER_END","write after end",Error);sc("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);out.exports={AbortError:Fbe,aggregateTwoErrors:nut(Vsr),hideStackFrames:nut,codes:Q7}});var AL=b((Ino,mut)=>{"use strict";var{ArrayIsArray:Bbe,ArrayPrototypeIncludes:uut,ArrayPrototypeJoin:lut,ArrayPrototypeMap:Wsr,NumberIsInteger:$be,NumberIsNaN:Ksr,NumberMAX_SAFE_INTEGER:Jsr,NumberMIN_SAFE_INTEGER:Gsr,NumberParseInt:Ysr,ObjectPrototypeHasOwnProperty:Zsr,RegExpPrototypeExec:cut,String:Xsr,StringPrototypeToUpperCase:Qsr,StringPrototypeTrim:eur}=ha(),{hideStackFrames:Ym,codes:{ERR_SOCKET_BAD_PORT:tur,ERR_INVALID_ARG_TYPE:ud,ERR_INVALID_ARG_VALUE:TL,ERR_OUT_OF_RANGE:JM,ERR_UNKNOWN_SIGNAL:iut}}=Gd(),{normalizeEncoding:rur}=sd(),{isAsyncFunction:nur,isArrayBufferView:our}=sd().types,aut={};function iur(t){return t===(t|0)}function aur(t){return t===t>>>0}var sur=/^[0-7]+$/,uur="must be a 32-bit unsigned integer or an octal string";function lur(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(cut(sur,t)===null)throw new TL(e,t,uur);t=Ysr(t,8)}return dut(t,e),t}var cur=Ym((t,e,r=Gsr,n=Jsr)=>{if(typeof t!="number")throw new ud(e,"number",t);if(!$be(t))throw new JM(e,"an integer",t);if(t<r||t>n)throw new JM(e,`>= ${r} && <= ${n}`,t)}),dur=Ym((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new ud(e,"number",t);if(!$be(t))throw new JM(e,"an integer",t);if(t<r||t>n)throw new JM(e,`>= ${r} && <= ${n}`,t)}),dut=Ym((t,e,r=!1)=>{if(typeof t!="number")throw new ud(e,"number",t);if(!$be(t))throw new JM(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new JM(e,`>= ${n} && <= ${o}`,t)});function qbe(t,e){if(typeof t!="string")throw new ud(e,"string",t)}function fur(t,e,r=void 0,n){if(typeof t!="number")throw new ud(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&Ksr(t))throw new JM(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var pur=Ym((t,e,r)=>{if(!uut(r,t)){let o="must be one of: "+lut(Wsr(r,i=>typeof i=="string"?`'${i}'`:Xsr(i)),", ");throw new TL(e,t,o)}});function fut(t,e){if(typeof t!="boolean")throw new ud(e,"boolean",t)}function kbe(t,e,r){return t==null||!Zsr(t,e)?r:t[e]}var mur=Ym((t,e,r=null)=>{let n=kbe(r,"allowArray",!1),o=kbe(r,"allowFunction",!1);if(!kbe(r,"nullable",!1)&&t===null||!n&&Bbe(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new ud(e,"Object",t)}),hur=Ym((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new ud(e,"a dictionary",t)}),eY=Ym((t,e,r=0)=>{if(!Bbe(t))throw new ud(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new TL(e,t,n)}});function gur(t,e){eY(t,e);for(let r=0;r<t.length;r++)qbe(t[r],`${e}[${r}]`)}function yur(t,e){eY(t,e);for(let r=0;r<t.length;r++)fut(t[r],`${e}[${r}]`)}function bur(t,e){eY(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new ud(o,"AbortSignal",n);put(n,o)}}function _ur(t,e="signal"){if(qbe(t,e),aut[t]===void 0)throw aut[Qsr(t)]!==void 0?new iut(t+" (signals must use all capital letters)"):new iut(t)}var vur=Ym((t,e="buffer")=>{if(!our(t))throw new ud(e,["Buffer","TypedArray","DataView"],t)});function wur(t,e){let r=rur(e),n=t.length;if(r==="hex"&&n%2!==0)throw new TL("encoding",e,`is invalid for data of length ${n}`)}function Sur(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&eur(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new tur(e,t,r);return t|0}var put=Ym((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ud(e,"AbortSignal",t)}),xur=Ym((t,e)=>{if(typeof t!="function")throw new ud(e,"Function",t)}),Cur=Ym((t,e)=>{if(typeof t!="function"||nur(t))throw new ud(e,"Function",t)}),Our=Ym((t,e)=>{if(t!==void 0)throw new ud(e,"undefined",t)});function Eur(t,e,r){if(!uut(r,t))throw new ud(e,`('${lut(r,"|")}')`,t)}var Pur=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function sut(t,e){if(typeof t>"u"||!cut(Pur,t))throw new TL(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Tur(t){if(typeof t=="string")return sut(t,"hints"),t;if(Bbe(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];sut(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new TL("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}mut.exports={isInt32:iur,isUint32:aur,parseFileMode:lur,validateArray:eY,validateStringArray:gur,validateBooleanArray:yur,validateAbortSignalArray:bur,validateBoolean:fut,validateBuffer:vur,validateDictionary:hur,validateEncoding:wur,validateFunction:xur,validateInt32:dur,validateInteger:cur,validateNumber:fur,validateObject:mur,validateOneOf:pur,validatePlainFunction:Cur,validatePort:Sur,validateSignalName:_ur,validateString:qbe,validateUint32:dut,validateUndefined:Our,validateUnion:Eur,validateAbortSignal:put,validateLinkHeaderValue:Tur}});var yP=b((Mno,but)=>{var ts=but.exports={},gb,yb;function Ube(){throw new Error("setTimeout has not been defined")}function zbe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?gb=setTimeout:gb=Ube}catch{gb=Ube}try{typeof clearTimeout=="function"?yb=clearTimeout:yb=zbe}catch{yb=zbe}})();function hut(t){if(gb===setTimeout)return setTimeout(t,0);if((gb===Ube||!gb)&&setTimeout)return gb=setTimeout,setTimeout(t,0);try{return gb(t,0)}catch{try{return gb.call(null,t,0)}catch{return gb.call(this,t,0)}}}function Aur(t){if(yb===clearTimeout)return clearTimeout(t);if((yb===zbe||!yb)&&clearTimeout)return yb=clearTimeout,clearTimeout(t);try{return yb(t)}catch{try{return yb.call(null,t)}catch{return yb.call(this,t)}}}var Bx=[],IL=!1,GM,tY=-1;function Iur(){!IL||!GM||(IL=!1,GM.length?Bx=GM.concat(Bx):tY=-1,Bx.length&&gut())}function gut(){if(!IL){var t=hut(Iur);IL=!0;for(var e=Bx.length;e;){for(GM=Bx,Bx=[];++tY<e;)GM&&GM[tY].run();tY=-1,e=Bx.length}GM=null,IL=!1,Aur(t)}}ts.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Bx.push(new yut(t,e)),Bx.length===1&&!IL&&hut(gut)};function yut(t,e){this.fun=t,this.array=e}yut.prototype.run=function(){this.fun.apply(null,this.array)};ts.title="browser";ts.browser=!0;ts.env={};ts.argv=[];ts.version="";ts.versions={};function $x(){}ts.on=$x;ts.addListener=$x;ts.once=$x;ts.off=$x;ts.removeListener=$x;ts.removeAllListeners=$x;ts.emit=$x;ts.prependListener=$x;ts.prependOnceListener=$x;ts.listeners=function(t){return[]};ts.binding=function(t){throw new Error("process.binding is not supported")};ts.cwd=function(){return"/"};ts.chdir=function(t){throw new Error("process.chdir is not supported")};ts.umask=function(){return 0}});var _b=b((Rno,jut)=>{"use strict";var{SymbolAsyncIterator:_ut,SymbolIterator:vut,SymbolFor:YM}=ha(),wut=YM("nodejs.stream.destroyed"),Sut=YM("nodejs.stream.errored"),Hbe=YM("nodejs.stream.readable"),Vbe=YM("nodejs.stream.writable"),xut=YM("nodejs.stream.disturbed"),Mur=YM("nodejs.webstream.isClosedPromise"),Rur=YM("nodejs.webstream.controllerErrorFunction");function rY(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function nY(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function jur(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function bb(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Cut(t){return!!(t&&!bb(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Out(t){return!!(t&&!bb(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Eut(t){return!!(t&&!bb(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Dur(t){return Cut(t)||Out(t)||Eut(t)}function Nur(t,e){return t==null?!1:e===!0?typeof t[_ut]=="function":e===!1?typeof t[vut]=="function":typeof t[_ut]=="function"||typeof t[vut]=="function"}function oY(t){if(!bb(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[wut]||n!=null&&n.destroyed)}function Put(t){if(!nY(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Lur(t,e){if(!nY(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Fur(t){if(!rY(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Tut(t,e){if(!rY(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Aut(t){return t&&t[Hbe]!=null?t[Hbe]:typeof t?.readable!="boolean"?null:oY(t)?!1:rY(t)&&t.readable&&!Tut(t)}function Iut(t){return t&&t[Vbe]!=null?t[Vbe]:typeof t?.writable!="boolean"?null:oY(t)?!1:nY(t)&&t.writable&&!Put(t)}function kur(t,e){return bb(t)?oY(t)?!0:!(e?.readable!==!1&&Aut(t)||e?.writable!==!1&&Iut(t)):null}function Bur(t){var e,r;return bb(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function $ur(t){var e,r;return bb(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function qur(t){if(!bb(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Mut(t)?t._closed:null}function Mut(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Rut(t){return typeof t._sent100=="boolean"&&Mut(t)}function Uur(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function zur(t){if(!bb(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Rut(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Hur(t){var e;return!!(t&&((e=t[xut])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Vur(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[Sut])!==null&&a!==void 0?a:t.readableErrored)!==null&&i!==void 0?i:t.writableErrored)!==null&&o!==void 0?o:(s=t._readableState)===null||s===void 0?void 0:s.errorEmitted)!==null&&n!==void 0?n:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&r!==void 0?r:(l=t._readableState)===null||l===void 0?void 0:l.errored)!==null&&e!==void 0?e:!((c=t._writableState)===null||c===void 0)&&c.errored))}jut.exports={isDestroyed:oY,kIsDestroyed:wut,isDisturbed:Hur,kIsDisturbed:xut,isErrored:Vur,kIsErrored:Sut,isReadable:Aut,kIsReadable:Hbe,kIsClosedPromise:Mur,kControllerErrorFunction:Rur,kIsWritable:Vbe,isClosed:qur,isDuplexNodeStream:jur,isFinished:kur,isIterable:Nur,isReadableNodeStream:rY,isReadableStream:Cut,isReadableEnded:Fur,isReadableFinished:Tut,isReadableErrored:$ur,isNodeStream:bb,isWebStream:Dur,isWritable:Iut,isWritableNodeStream:nY,isWritableStream:Out,isWritableEnded:Put,isWritableFinished:Lur,isWritableErrored:Bur,isServerRequest:Uur,isServerResponse:Rut,willEmitClose:zur,isTransformStream:Eut}});var qx=b((jno,Ybe)=>{var bP=yP(),{AbortError:Uut,codes:Wur}=Gd(),{ERR_INVALID_ARG_TYPE:Kur,ERR_STREAM_PREMATURE_CLOSE:Dut}=Wur,{kEmptyObject:Kbe,once:Jbe}=sd(),{validateAbortSignal:Jur,validateFunction:Gur,validateObject:Yur,validateBoolean:Zur}=AL(),{Promise:Xur,PromisePrototypeThen:Qur,SymbolDispose:zut}=ha(),{isClosed:elr,isReadable:Nut,isReadableNodeStream:Wbe,isReadableStream:tlr,isReadableFinished:Lut,isReadableErrored:Fut,isWritable:kut,isWritableNodeStream:But,isWritableStream:rlr,isWritableFinished:$ut,isWritableErrored:qut,isNodeStream:nlr,willEmitClose:olr,kIsClosedPromise:ilr}=_b(),ML;function alr(t){return t.setHeader&&typeof t.abort=="function"}var Gbe=()=>{};function Hut(t,e,r){var n,o;if(arguments.length===2?(r=e,e=Kbe):e==null?e=Kbe:Yur(e,"options"),Gur(r,"callback"),Jur(e.signal,"options.signal"),r=Jbe(r),tlr(t)||rlr(t))return slr(t,e,r);if(!nlr(t))throw new Kur("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:Wbe(t),a=(o=e.writable)!==null&&o!==void 0?o:But(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=olr(t)&&Wbe(t)===i&&But(t)===a,d=$ut(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=Lut(t,!1),m=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},h=C=>{r.call(t,C)},v=elr(t),g=()=>{v=!0;let C=qut(t)||Fut(t);if(C&&typeof C!="boolean")return r.call(t,C);if(i&&!p&&Wbe(t,!0)&&!Lut(t,!1))return r.call(t,new Dut);if(a&&!d&&!$ut(t,!1))return r.call(t,new Dut);r.call(t)},_=()=>{v=!0;let C=qut(t)||Fut(t);if(C&&typeof C!="boolean")return r.call(t,C);r.call(t)},w=()=>{t.req.on("finish",f)};alr(t)?(t.on("complete",f),c||t.on("abort",g),t.req?w():t.on("request",w)):a&&!s&&(t.on("end",l),t.on("close",l)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",m),t.on("finish",f),e.error!==!1&&t.on("error",h),t.on("close",g),v?bP.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||bP.nextTick(_):(!i&&(!c||Nut(t))&&(d||kut(t)===!1)||!a&&(!c||kut(t))&&(p||Nut(t)===!1)||u&&t.req&&t.aborted)&&bP.nextTick(_);let x=()=>{r=Gbe,t.removeListener("aborted",g),t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",w),t.req&&t.req.removeListener("finish",f),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",f),t.removeListener("end",m),t.removeListener("error",h),t.removeListener("close",g)};if(e.signal&&!v){let C=()=>{let P=r;x(),P.call(t,new Uut(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)bP.nextTick(C);else{ML=ML||sd().addAbortListener;let P=ML(e.signal,C),E=r;r=Jbe((...A)=>{P[zut](),E.apply(t,A)})}}return x}function slr(t,e,r){let n=!1,o=Gbe;if(e.signal)if(o=()=>{n=!0,r.call(t,new Uut(void 0,{cause:e.signal.reason}))},e.signal.aborted)bP.nextTick(o);else{ML=ML||sd().addAbortListener;let a=ML(e.signal,o),s=r;r=Jbe((...u)=>{a[zut](),s.apply(t,u)})}let i=(...a)=>{n||bP.nextTick(()=>r.apply(t,a))};return Qur(t[ilr].promise,i,i),Gbe}function ulr(t,e){var r;let n=!1;return e===null&&(e=Kbe),(r=e)!==null&&r!==void 0&&r.cleanup&&(Zur(e.cleanup,"cleanup"),n=e.cleanup),new Xur((o,i)=>{let a=Hut(t,e,s=>{n&&a(),s?i(s):o()})})}Ybe.exports=Hut;Ybe.exports.finished=ulr});var ZM=b((Dno,Xut)=>{"use strict";var vb=yP(),{aggregateTwoErrors:llr,codes:{ERR_MULTIPLE_CALLBACK:clr},AbortError:dlr}=Gd(),{Symbol:Kut}=ha(),{kIsDestroyed:flr,isDestroyed:plr,isFinished:mlr,isServerRequest:hlr}=_b(),Jut=Kut("kDestroy"),Zbe=Kut("kConstruct");function Gut(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function glr(t,e){let r=this._readableState,n=this._writableState,o=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(Gut(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?Vut(this,t,e):this.once(Jut,function(i){Vut(this,llr(i,t),e)}),this)}function Vut(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;Gut(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?vb.nextTick(ylr,t,i):vb.nextTick(Yut,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function ylr(t,e){Xbe(t,e),Yut(t)}function Yut(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function Xbe(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function blr(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function Qbe(t,e,r){let n=t._readableState,o=t._writableState;if(o!=null&&o.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||o!=null&&o.autoDestroy?t.destroy(e):e&&(e.stack,o&&!o.errored&&(o.errored=e),n&&!n.errored&&(n.errored=e),r?vb.nextTick(Xbe,t,e):Xbe(t,e))}function _lr(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(Zbe,e),!(t.listenerCount(Zbe)>1)&&vb.nextTick(vlr,t)}function vlr(t){let e=!1;function r(n){if(e){Qbe(t,n??new clr);return}e=!0;let o=t._readableState,i=t._writableState,a=i||o;o&&(o.constructed=!0),i&&(i.constructed=!0),a.destroyed?t.emit(Jut,n):n?Qbe(t,n,!0):vb.nextTick(wlr,t)}try{t._construct(n=>{vb.nextTick(r,n)})}catch(n){vb.nextTick(r,n)}}function wlr(t){t.emit(Zbe)}function Wut(t){return t?.setHeader&&typeof t.abort=="function"}function Zut(t){t.emit("close")}function Slr(t,e){t.emit("error",e),vb.nextTick(Zut,t)}function xlr(t,e){!t||plr(t)||(!e&&!mlr(t)&&(e=new dlr),hlr(t)?(t.socket=null,t.destroy(e)):Wut(t)?t.abort():Wut(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?vb.nextTick(Slr,t,e):vb.nextTick(Zut,t),t.destroyed||(t[flr]=!0))}Xut.exports={construct:_lr,destroyer:xlr,destroy:glr,undestroy:blr,errorOrDestroy:Qbe}});var sY=b((Nno,elt)=>{"use strict";var{ArrayIsArray:Clr,ObjectSetPrototypeOf:Qut}=ha(),{EventEmitter:iY}=F2();function aY(t){iY.call(this,t)}Qut(aY.prototype,iY.prototype);Qut(aY,iY);aY.prototype.pipe=function(t,e){let r=this;function n(c){t.writable&&t.write(c)===!1&&r.pause&&r.pause()}r.on("data",n);function o(){r.readable&&r.resume&&r.resume()}t.on("drain",o),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",a),r.on("close",s));let i=!1;function a(){i||(i=!0,t.end())}function s(){i||(i=!0,typeof t.destroy=="function"&&t.destroy())}function u(c){l(),iY.listenerCount(this,"error")===0&&this.emit("error",c)}e_e(r,"error",u),e_e(t,"error",u);function l(){r.removeListener("data",n),t.removeListener("drain",o),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",l),r.removeListener("close",l),t.removeListener("close",l)}return r.on("end",l),r.on("close",l),t.on("close",l),t.emit("pipe",r),t};function e_e(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Clr(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}elt.exports={Stream:aY,prependListener:e_e}});var k2=b((Lno,uY)=>{"use strict";var{SymbolDispose:Olr}=ha(),{AbortError:tlt,codes:Elr}=Gd(),{isNodeStream:rlt,isWebStream:Plr,kControllerErrorFunction:Tlr}=_b(),Alr=qx(),{ERR_INVALID_ARG_TYPE:nlt}=Elr,t_e,Ilr=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new nlt(e,"AbortSignal",t)};uY.exports.addAbortSignal=function(e,r){if(Ilr(e,"signal"),!rlt(r)&&!Plr(r))throw new nlt("stream",["ReadableStream","WritableStream","Stream"],r);return uY.exports.addAbortSignalNoValidate(e,r)};uY.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=rlt(e)?()=>{e.destroy(new tlt(void 0,{cause:t.reason}))}:()=>{e[Tlr](new tlt(void 0,{cause:t.reason}))};if(t.aborted)r();else{t_e=t_e||sd().addAbortListener;let n=t_e(t,r);Alr(e,n[Olr])}return e}});var alt=b((kno,ilt)=>{"use strict";var{StringPrototypeSlice:olt,SymbolIterator:Mlr,TypedArrayPrototypeSet:lY,Uint8Array:Rlr}=ha(),{Buffer:r_e}=Tf(),{inspect:jlr}=sd();ilt.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return r_e.alloc(0);let r=r_e.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)lY(r,n.data,o),o+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let o=n.slice(0,e);return this.head.data=n.slice(e),o}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Mlr](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,o=0;do{let i=n.data;if(e>i.length)r+=i,e-=i.length;else{e===i.length?(r+=i,++o,n.next?this.head=n.next:this.head=this.tail=null):(r+=olt(i,0,e),this.head=n,n.data=olt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=r_e.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)lY(r,a,n-e),e-=a.length;else{e===a.length?(lY(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(lY(r,new Rlr(a.buffer,a.byteOffset,e),n-e),this.head=o,o.data=a.slice(e));break}++i}while((o=o.next)!==null);return this.length-=i,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return jlr(this,{...r,depth:0,customInspect:!1})}}});var B2=b((Bno,clt)=>{"use strict";var{MathFloor:Dlr,NumberIsInteger:Nlr}=ha(),{validateInteger:Llr}=AL(),{ERR_INVALID_ARG_VALUE:Flr}=Gd().codes,slt=16*1024,ult=16;function klr(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function llt(t){return t?ult:slt}function Blr(t,e){Llr(e,"value",0),t?ult=e:slt=e}function $lr(t,e,r,n){let o=klr(e,n,r);if(o!=null){if(!Nlr(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new Flr(i,o)}return Dlr(o)}return llt(t.objectMode)}clt.exports={getHighWaterMark:$lr,getDefaultHighWaterMark:llt,setDefaultHighWaterMark:Blr}});var plt=b((n_e,flt)=>{var cY=Tf(),wb=cY.Buffer;function dlt(t,e){for(var r in t)e[r]=t[r]}wb.from&&wb.alloc&&wb.allocUnsafe&&wb.allocUnsafeSlow?flt.exports=cY:(dlt(cY,n_e),n_e.Buffer=XM);function XM(t,e,r){return wb(t,e,r)}XM.prototype=Object.create(wb.prototype);dlt(wb,XM);XM.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return wb(t,e,r)};XM.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=wb(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};XM.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return wb(t)};XM.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return cY.SlowBuffer(t)}});var glt=b(hlt=>{"use strict";var i_e=plt().Buffer,mlt=i_e.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function qlr(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function Ulr(t){var e=qlr(t);if(typeof e!="string"&&(i_e.isEncoding===mlt||!mlt(t)))throw new Error("Unknown encoding: "+t);return e||t}hlt.StringDecoder=$2;function $2(t){this.encoding=Ulr(t);var e;switch(this.encoding){case"utf16le":this.text=Jlr,this.end=Glr,e=4;break;case"utf8":this.fillLast=Vlr,e=4;break;case"base64":this.text=Ylr,this.end=Zlr,e=3;break;default:this.write=Xlr,this.end=Qlr;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=i_e.allocUnsafe(e)}$2.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};$2.prototype.end=Klr;$2.prototype.text=Wlr;$2.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function o_e(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function zlr(t,e,r){var n=e.length-1;if(n<r)return 0;var o=o_e(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=o_e(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=o_e(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function Hlr(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Vlr(t){var e=this.lastTotal-this.lastNeed,r=Hlr(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Wlr(t,e){var r=zlr(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Klr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Jlr(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Glr(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Ylr(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Zlr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Xlr(t){return t.toString(this.encoding)}function Qlr(t){return t&&t.length?this.write(t):""}});var a_e=b((qno,vlt)=>{"use strict";var ylt=yP(),{PromisePrototypeThen:ecr,SymbolAsyncIterator:blt,SymbolIterator:_lt}=ha(),{Buffer:tcr}=Tf(),{ERR_INVALID_ARG_TYPE:rcr,ERR_STREAM_NULL_VALUES:ncr}=Gd().codes;function ocr(t,e,r){let n;if(typeof e=="string"||e instanceof tcr)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[blt])o=!0,n=e[blt]();else if(e&&e[_lt])o=!1,n=e[_lt]();else throw new rcr("iterable",["Iterable"],e);let i=new t({objectMode:!0,highWaterMark:1,...r}),a=!1;i._read=function(){a||(a=!0,u())},i._destroy=function(l,c){ecr(s(l),()=>ylt.nextTick(c,l),d=>ylt.nextTick(c,d||l))};async function s(l){let c=l!=null,d=typeof n.throw=="function";if(c&&d){let{value:f,done:p}=await n.throw(l);if(await f,p)return}if(typeof n.return=="function"){let{value:f}=await n.return();await f}}async function u(){for(;;){try{let{value:l,done:c}=o?await n.next():n.next();if(c)i.push(null);else{let d=l&&typeof l.then=="function"?await l:l;if(d===null)throw a=!1,new ncr;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}vlt.exports=ocr});var U2=b((Uno,klt)=>{var Og=yP(),{ArrayPrototypeIndexOf:icr,NumberIsInteger:acr,NumberIsNaN:scr,NumberParseInt:ucr,ObjectDefineProperties:m_e,ObjectKeys:lcr,ObjectSetPrototypeOf:xlt,Promise:Clt,SafeSet:ccr,SymbolAsyncDispose:dcr,SymbolAsyncIterator:fcr,Symbol:pcr}=ha();klt.exports=Gr;Gr.ReadableState=mY;var{EventEmitter:mcr}=F2(),{Stream:_P,prependListener:hcr}=sY(),{Buffer:s_e}=Tf(),{addAbortSignal:gcr}=k2(),Olt=qx(),dn=sd().debuglog("stream",t=>{dn=t}),ycr=alt(),DL=ZM(),{getHighWaterMark:bcr,getDefaultHighWaterMark:_cr}=B2(),{aggregateTwoErrors:wlt,codes:{ERR_INVALID_ARG_TYPE:vcr,ERR_METHOD_NOT_IMPLEMENTED:wcr,ERR_OUT_OF_RANGE:Scr,ERR_STREAM_PUSH_AFTER_EOF:xcr,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Ccr},AbortError:Ocr}=Gd(),{validateObject:Ecr}=AL(),QM=pcr("kPaused"),{StringDecoder:Elt}=glt(),Pcr=a_e();xlt(Gr.prototype,_P.prototype);xlt(Gr,_P);var u_e=()=>{},{errorOrDestroy:RL}=DL,jL=1,Tcr=2,Plt=4,q2=8,Tlt=16,dY=32,fY=64,Alt=128,Acr=256,Icr=512,Mcr=1024,f_e=2048,p_e=4096,Rcr=8192,jcr=16384,Dcr=32768,Ilt=65536,Ncr=1<<17,Lcr=1<<18;function Xu(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}m_e(mY.prototype,{objectMode:Xu(jL),ended:Xu(Tcr),endEmitted:Xu(Plt),reading:Xu(q2),constructed:Xu(Tlt),sync:Xu(dY),needReadable:Xu(fY),emittedReadable:Xu(Alt),readableListening:Xu(Acr),resumeScheduled:Xu(Icr),errorEmitted:Xu(Mcr),emitClose:Xu(f_e),autoDestroy:Xu(p_e),destroyed:Xu(Rcr),closed:Xu(jcr),closeEmitted:Xu(Dcr),multiAwaitDrain:Xu(Ilt),readingMore:Xu(Ncr),dataEmitted:Xu(Lcr)});function mY(t,e,r){typeof r!="boolean"&&(r=e instanceof Sb()),this.state=f_e|p_e|Tlt|dY,t&&t.objectMode&&(this.state|=jL),r&&t&&t.readableObjectMode&&(this.state|=jL),this.highWaterMark=t?bcr(this,t,"readableHighWaterMark",r):_cr(!1),this.buffer=new ycr,this.length=0,this.pipes=[],this.flowing=null,this[QM]=null,t&&t.emitClose===!1&&(this.state&=~f_e),t&&t.autoDestroy===!1&&(this.state&=~p_e),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Elt(t.encoding),this.encoding=t.encoding)}function Gr(t){if(!(this instanceof Gr))return new Gr(t);let e=this instanceof Sb();this._readableState=new mY(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&gcr(t.signal,this)),_P.call(this,t),DL.construct(this,()=>{this._readableState.needReadable&&pY(this,this._readableState)})}Gr.prototype.destroy=DL.destroy;Gr.prototype._undestroy=DL.undestroy;Gr.prototype._destroy=function(t,e){e(t)};Gr.prototype[mcr.captureRejectionSymbol]=function(t){this.destroy(t)};Gr.prototype[dcr]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Ocr,this.destroy(t)),new Clt((e,r)=>Olt(this,n=>n&&n!==t?r(n):e(null)))};Gr.prototype.push=function(t,e){return Mlt(this,t,e,!1)};Gr.prototype.unshift=function(t,e){return Mlt(this,t,e,!0)};function Mlt(t,e,r,n){dn("readableAddChunk",e);let o=t._readableState,i;if((o.state&jL)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=s_e.from(e,r).toString(o.encoding):(e=s_e.from(e,r),r=""))):e instanceof s_e?r="":_P._isUint8Array(e)?(e=_P._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new vcr("chunk",["string","Buffer","Uint8Array"],e))),i)RL(t,i);else if(e===null)o.state&=~q2,Bcr(t,o);else if((o.state&jL)!==0||e&&e.length>0)if(n)if((o.state&Plt)!==0)RL(t,new Ccr);else{if(o.destroyed||o.errored)return!1;l_e(t,o,e,!0)}else if(o.ended)RL(t,new xcr);else{if(o.destroyed||o.errored)return!1;o.state&=~q2,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?l_e(t,o,e,!1):pY(t,o)):l_e(t,o,e,!1)}else n||(o.state&=~q2,pY(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function l_e(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&Ilt)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),(e.state&fY)!==0&&hY(t)),pY(t,e)}Gr.prototype.isPaused=function(){let t=this._readableState;return t[QM]===!0||t.flowing===!1};Gr.prototype.setEncoding=function(t){let e=new Elt(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let o of r)n+=e.write(o);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var Fcr=1073741824;function kcr(t){if(t>Fcr)throw new Scr("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Slt(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&jL)!==0?1:scr(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}Gr.prototype.read=function(t){dn("read",t),t===void 0?t=NaN:acr(t)||(t=ucr(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=kcr(t)),t!==0&&(e.state&=~Alt),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return dn("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?c_e(this):hY(this),null;if(t=Slt(t,e),t===0&&e.ended)return e.length===0&&c_e(this),null;let n=(e.state&fY)!==0;if(dn("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,dn("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,dn("reading, ended or constructing",n);else if(n){dn("do read"),e.state|=q2|dY,e.length===0&&(e.state|=fY);try{this._read(e.highWaterMark)}catch(i){RL(this,i)}e.state&=~dY,e.reading||(t=Slt(r,e))}let o;return t>0?o=Llt(t,e):o=null,o===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&c_e(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function Bcr(t,e){if(dn("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?hY(t):(e.needReadable=!1,e.emittedReadable=!0,Rlt(t))}}function hY(t){let e=t._readableState;dn("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(dn("emitReadable",e.flowing),e.emittedReadable=!0,Og.nextTick(Rlt,t))}function Rlt(t){let e=t._readableState;dn("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Dlt(t)}function pY(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Og.nextTick($cr,t,e))}function $cr(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(dn("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Gr.prototype._read=function(t){throw new wcr("_read()")};Gr.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new ccr(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),dn("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==Og.stdout&&t!==Og.stderr?s:v;n.endEmitted?Og.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(g,_){dn("onunpipe"),g===r&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,c())}function s(){dn("onend"),t.end()}let u,l=!1;function c(){dn("cleanup"),t.removeListener("close",m),t.removeListener("finish",h),u&&t.removeListener("drain",u),t.removeListener("error",p),t.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",v),r.removeListener("data",f),l=!0,u&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}function d(){l||(n.pipes.length===1&&n.pipes[0]===t?(dn("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(dn("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=qcr(r,t),t.on("drain",u))}r.on("data",f);function f(g){dn("ondata");let _=t.write(g);dn("dest.write",_),_===!1&&d()}function p(g){if(dn("onerror",g),v(),t.removeListener("error",p),t.listenerCount("error")===0){let _=t._writableState||t._readableState;_&&!_.errorEmitted?RL(t,g):t.emit("error",g)}}hcr(t,"error",p);function m(){t.removeListener("finish",h),v()}t.once("close",m);function h(){dn("onfinish"),t.removeListener("close",m),v()}t.once("finish",h);function v(){dn("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(dn("pipe resume"),r.resume()),t};function qcr(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(dn("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(dn("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}Gr.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let o=e.pipes;e.pipes=[],this.pause();for(let i=0;i<o.length;i++)o[i].emit("unpipe",this,{hasUnpiped:!1});return this}let n=icr(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};Gr.prototype.on=function(t,e){let r=_P.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,dn("on readable",n.length,n.reading),n.length?hY(this):n.reading||Og.nextTick(Ucr,this)),r};Gr.prototype.addListener=Gr.prototype.on;Gr.prototype.removeListener=function(t,e){let r=_P.prototype.removeListener.call(this,t,e);return t==="readable"&&Og.nextTick(jlt,this),r};Gr.prototype.off=Gr.prototype.removeListener;Gr.prototype.removeAllListeners=function(t){let e=_P.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Og.nextTick(jlt,this),e};function jlt(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[QM]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function Ucr(t){dn("readable nexttick read 0"),t.read(0)}Gr.prototype.resume=function(){let t=this._readableState;return t.flowing||(dn("resume"),t.flowing=!t.readableListening,zcr(this,t)),t[QM]=!1,this};function zcr(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Og.nextTick(Hcr,t,e))}function Hcr(t,e){dn("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Dlt(t),e.flowing&&!e.reading&&t.read(0)}Gr.prototype.pause=function(){return dn("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(dn("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[QM]=!0,this};function Dlt(t){let e=t._readableState;for(dn("flow",e.flowing);e.flowing&&t.read()!==null;);}Gr.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{RL(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=lcr(t);for(let n=1;n<r.length;n++){let o=r[n];this[o]===void 0&&typeof t[o]=="function"&&(this[o]=t[o].bind(t))}return this};Gr.prototype[fcr]=function(){return Nlt(this)};Gr.prototype.iterator=function(t){return t!==void 0&&Ecr(t,"options"),Nlt(this,t)};function Nlt(t,e){typeof t.read!="function"&&(t=Gr.wrap(t,{objectMode:!0}));let r=Vcr(t,e);return r.stream=t,r}async function*Vcr(t,e){let r=u_e;function n(a){this===t?(r(),r=u_e):r=a}t.on("readable",n);let o,i=Olt(t,{writable:!1},a=>{o=a?wlt(o,a):null,r(),r=u_e});try{for(;;){let a=t.destroyed?null:t.read();if(a!==null)yield a;else{if(o)throw o;if(o===null)return;await new Clt(n)}}}catch(a){throw o=wlt(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?DL.destroyer(t,null):(t.off("readable",n),i())}}m_e(Gr.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});m_e(mY.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[QM]!==!1},set(t){this[QM]=!!t}}});Gr._fromList=Llt;function Llt(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function c_e(t){let e=t._readableState;dn("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Og.nextTick(Wcr,e,t))}function Wcr(t,e){if(dn("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)Og.nextTick(Kcr,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Kcr(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}Gr.from=function(t,e){return Pcr(Gr,t,e)};var d_e;function Flt(){return d_e===void 0&&(d_e={}),d_e}Gr.fromWeb=function(t,e){return Flt().newStreamReadableFromReadableStream(t,e)};Gr.toWeb=function(t,e){return Flt().newReadableStreamFromStreamReadable(t,e)};Gr.wrap=function(t,e){var r,n;return new Gr({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){DL.destroyer(t,o),i(o)}}).wrap(t)}});var vY=b((zno,Ylt)=>{var eR=yP(),{ArrayPrototypeSlice:qlt,Error:Jcr,FunctionPrototypeSymbolHasInstance:Ult,ObjectDefineProperty:zlt,ObjectDefineProperties:Gcr,ObjectSetPrototypeOf:Hlt,StringPrototypeToLowerCase:Ycr,Symbol:Zcr,SymbolHasInstance:Xcr}=ha();Ylt.exports=ga;ga.WritableState=V2;var{EventEmitter:Qcr}=F2(),z2=sY().Stream,{Buffer:gY}=Tf(),_Y=ZM(),{addAbortSignal:edr}=k2(),{getHighWaterMark:tdr,getDefaultHighWaterMark:rdr}=B2(),{ERR_INVALID_ARG_TYPE:ndr,ERR_METHOD_NOT_IMPLEMENTED:odr,ERR_MULTIPLE_CALLBACK:Vlt,ERR_STREAM_CANNOT_PIPE:idr,ERR_STREAM_DESTROYED:H2,ERR_STREAM_ALREADY_FINISHED:adr,ERR_STREAM_NULL_VALUES:sdr,ERR_STREAM_WRITE_AFTER_END:udr,ERR_UNKNOWN_ENCODING:Wlt}=Gd().codes,{errorOrDestroy:NL}=_Y;Hlt(ga.prototype,z2.prototype);Hlt(ga,z2);function y_e(){}var LL=Zcr("kOnFinished");function V2(t,e,r){typeof r!="boolean"&&(r=e instanceof Sb()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?tdr(this,t,"writableHighWaterMark",r):rdr(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=cdr.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,bY(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[LL]=[]}function bY(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}V2.prototype.getBuffer=function(){return qlt(this.buffered,this.bufferedIndex)};zlt(V2.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ga(t){let e=this instanceof Sb();if(!e&&!Ult(ga,this))return new ga(t);this._writableState=new V2(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&edr(t.signal,this)),z2.call(this,t),_Y.construct(this,()=>{let r=this._writableState;r.writing||__e(this,r),v_e(this,r)})}zlt(ga,Xcr,{__proto__:null,value:function(t){return Ult(this,t)?!0:this!==ga?!1:t&&t._writableState instanceof V2}});ga.prototype.pipe=function(){NL(this,new idr)};function Klt(t,e,r,n){let o=t._writableState;if(typeof r=="function")n=r,r=o.defaultEncoding;else{if(!r)r=o.defaultEncoding;else if(r!=="buffer"&&!gY.isEncoding(r))throw new Wlt(r);typeof n!="function"&&(n=y_e)}if(e===null)throw new sdr;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=gY.from(e,r),r="buffer");else if(e instanceof gY)r="buffer";else if(z2._isUint8Array(e))e=z2._uint8ArrayToBuffer(e),r="buffer";else throw new ndr("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new udr:o.destroyed&&(i=new H2("write")),i?(eR.nextTick(n,i),NL(t,i,!0),i):(o.pendingcb++,ldr(t,o,e,r,n))}ga.prototype.write=function(t,e,r){return Klt(this,t,e,r)===!0};ga.prototype.cork=function(){this._writableState.corked++};ga.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||__e(this,t))};ga.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=Ycr(e)),!gY.isEncoding(e))throw new Wlt(e);return this._writableState.defaultEncoding=e,this};function ldr(t,e,r,n,o){let i=e.objectMode?1:r.length;e.length+=i;let a=e.length<e.highWaterMark;return a||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:n,callback:o}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&o!==y_e&&(e.allNoop=!1)):(e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),a&&!e.errored&&!e.destroyed}function Blt(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new H2("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function $lt(t,e,r,n){--e.pendingcb,n(r),b_e(e),NL(t,r)}function cdr(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){NL(t,new Vlt);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),n?eR.nextTick($lt,t,r,e,o):$lt(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&__e(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},eR.nextTick(ddr,r.afterWriteTickInfo)):Jlt(t,r,1,o))}function ddr({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,Jlt(t,e,r,n)}function Jlt(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&b_e(e),v_e(t,e)}function b_e(t){if(t.writing)return;for(let o=t.bufferedIndex;o<t.buffered.length;++o){var e;let{chunk:i,callback:a}=t.buffered[o],s=t.objectMode?1:i.length;t.length-=s,a((e=t.errored)!==null&&e!==void 0?e:new H2("write"))}let r=t[LL].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new H2("end"))}bY(t)}function __e(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:o}=e,i=r.length-n;if(!i)return;let a=n;if(e.bufferProcessing=!0,i>1&&t._writev){e.pendingcb-=i-1;let s=e.allNoop?y_e:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:qlt(r,a);u.allBuffers=e.allBuffers,Blt(t,e,!0,e.length,u,"",s),bY(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;Blt(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?bY(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}ga.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new odr("_write()")};ga.prototype._writev=null;ga.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let o;if(t!=null){let i=Klt(this,t,e);i instanceof Jcr&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,v_e(this,n,!0),n.ended=!0):n.finished?o=new adr("end"):n.destroyed&&(o=new H2("end"))),typeof r=="function"&&(o||n.finished?eR.nextTick(r,o):n[LL].push(r)),this};function yY(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function fdr(t,e){let r=!1;function n(o){if(r){NL(t,o??Vlt());return}if(r=!0,e.pendingcb--,o){let i=e[LL].splice(0);for(let a=0;a<i.length;a++)i[a](o);NL(t,o,e.sync)}else yY(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,eR.nextTick(g_e,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function pdr(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,fdr(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function v_e(t,e,r){yY(e)&&(pdr(t,e),e.pendingcb===0&&(r?(e.pendingcb++,eR.nextTick((n,o)=>{yY(o)?g_e(n,o):o.pendingcb--},t,e)):yY(e)&&(e.pendingcb++,g_e(t,e))))}function g_e(t,e){e.pendingcb--,e.finished=!0;let r=e[LL].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}Gcr(ga.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var mdr=_Y.destroy;ga.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[LL].length)&&eR.nextTick(b_e,r),mdr.call(this,t,e),this};ga.prototype._undestroy=_Y.undestroy;ga.prototype._destroy=function(t,e){e(t)};ga.prototype[Qcr.captureRejectionSymbol]=function(t){this.destroy(t)};var h_e;function Glt(){return h_e===void 0&&(h_e={}),h_e}ga.fromWeb=function(t,e){return Glt().newStreamWritableFromWritableStream(t,e)};ga.toWeb=function(t){return Glt().newWritableStreamFromStreamWritable(t)}});var dct=b((Hno,cct)=>{var w_e=yP(),hdr=Tf(),{isReadable:gdr,isWritable:ydr,isIterable:Zlt,isNodeStream:bdr,isReadableNodeStream:Xlt,isWritableNodeStream:Qlt,isDuplexNodeStream:_dr,isReadableStream:ect,isWritableStream:tct}=_b(),rct=qx(),{AbortError:uct,codes:{ERR_INVALID_ARG_TYPE:vdr,ERR_INVALID_RETURN_VALUE:nct}}=Gd(),{destroyer:kL}=ZM(),wdr=Sb(),lct=U2(),Sdr=vY(),{createDeferredPromise:oct}=sd(),ict=a_e(),act=globalThis.Blob||hdr.Blob,xdr=typeof act<"u"?function(e){return e instanceof act}:function(e){return!1},Cdr=globalThis.AbortController||EL().AbortController,{FunctionPrototypeCall:sct}=ha(),vP=class extends wdr{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};cct.exports=function t(e,r){if(_dr(e))return e;if(Xlt(e))return FL({readable:e});if(Qlt(e))return FL({writable:e});if(bdr(e))return FL({writable:!1,readable:!1});if(ect(e))return FL({readable:lct.fromWeb(e)});if(tct(e))return FL({writable:Sdr.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=Odr(e);if(Zlt(o))return ict(vP,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=sct(u,o,d=>{if(d!=null)throw new nct("nully","body",d)},d=>{kL(l,d)});return l=new vP({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,w_e.nextTick(d,null)}catch(f){w_e.nextTick(d,f)}})},destroy:s})}throw new nct("Iterable, AsyncIterable or AsyncFunction",r,o)}if(xdr(e))return t(e.arrayBuffer());if(Zlt(e))return ict(vP,e,{objectMode:!0,writable:!1});if(ect(e?.readable)&&tct(e?.writable))return vP.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?Xlt(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?Qlt(e?.writable)?e?.writable:t(e.writable):void 0;return FL({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return sct(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{kL(o,i)}),o=new vP({objectMode:!0,writable:!1,read(){}})}throw new vdr(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function Odr(t){let{promise:e,resolve:r}=oct(),n=new Cdr,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(w_e.nextTick(l),u)return;if(o.aborted)throw new uct(void 0,{cause:o.reason});({promise:e,resolve:r}=oct()),yield s}}(),{signal:o}),write(a,s,u){let l=r;r=null,l({chunk:a,done:!1,cb:u})},final(a){let s=r;r=null,s({done:!0,cb:a})},destroy(a,s){n.abort(),s(a)}}}function FL(t){let e=t.readable&&typeof t.readable.read!="function"?lct.wrap(t.readable):t.readable,r=t.writable,n=!!gdr(e),o=!!ydr(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new vP({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(rct(r,d=>{o=!1,d&&kL(e,d),c(d)}),l._write=function(d,f,p){r.write(d,f)?p():i=p},l._final=function(d){r.end(),a=d},r.on("drain",function(){if(i){let d=i;i=null,d()}}),r.on("finish",function(){if(a){let d=a;a=null,d()}})),n&&(rct(e,d=>{n=!1,d&&kL(e,d),c(d)}),e.on("readable",function(){if(s){let d=s;s=null,d()}}),e.on("end",function(){l.push(null)}),l._read=function(){for(;;){let d=e.read();if(d===null){s=l._read;return}if(!l.push(d))return}}),l._destroy=function(d,f){!d&&u!==null&&(d=new uct),s=null,i=null,a=null,u===null?f(d):(u=f,kL(r,d),kL(e,d))},l}});var Sb=b((Vno,mct)=>{"use strict";var{ObjectDefineProperties:Edr,ObjectGetOwnPropertyDescriptor:Ux,ObjectKeys:Pdr,ObjectSetPrototypeOf:fct}=ha();mct.exports=Eg;var C_e=U2(),Zm=vY();fct(Eg.prototype,C_e.prototype);fct(Eg,C_e);{let t=Pdr(Zm.prototype);for(let e=0;e<t.length;e++){let r=t[e];Eg.prototype[r]||(Eg.prototype[r]=Zm.prototype[r])}}function Eg(t){if(!(this instanceof Eg))return new Eg(t);C_e.call(this,t),Zm.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}Edr(Eg.prototype,{writable:{__proto__:null,...Ux(Zm.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Ux(Zm.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Ux(Zm.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Ux(Zm.prototype,"writableBuffer")},writableLength:{__proto__:null,...Ux(Zm.prototype,"writableLength")},writableFinished:{__proto__:null,...Ux(Zm.prototype,"writableFinished")},writableCorked:{__proto__:null,...Ux(Zm.prototype,"writableCorked")},writableEnded:{__proto__:null,...Ux(Zm.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Ux(Zm.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var S_e;function pct(){return S_e===void 0&&(S_e={}),S_e}Eg.fromWeb=function(t,e){return pct().newStreamDuplexFromReadableWritablePair(t,e)};Eg.toWeb=function(t){return pct().newReadableWritablePairFromDuplex(t)};var x_e;Eg.from=function(t){return x_e||(x_e=dct()),x_e(t,"body")}});var P_e=b((Wno,gct)=>{"use strict";var{ObjectSetPrototypeOf:hct,Symbol:Tdr}=ha();gct.exports=zx;var{ERR_METHOD_NOT_IMPLEMENTED:Adr}=Gd().codes,E_e=Sb(),{getHighWaterMark:Idr}=B2();hct(zx.prototype,E_e.prototype);hct(zx,E_e);var W2=Tdr("kCallback");function zx(t){if(!(this instanceof zx))return new zx(t);let e=t?Idr(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),E_e.call(this,t),this._readableState.sync=!1,this[W2]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Mdr)}function O_e(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function Mdr(){this._final!==O_e&&O_e.call(this)}zx.prototype._final=O_e;zx.prototype._transform=function(t,e,r){throw new Adr("_transform()")};zx.prototype._write=function(t,e,r){let n=this._readableState,o=this._writableState,i=n.length;this._transform(t,e,(a,s)=>{if(a){r(a);return}s!=null&&this.push(s),o.ended||i===n.length||n.length<n.highWaterMark?r():this[W2]=r})};zx.prototype._read=function(){if(this[W2]){let t=this[W2];this[W2]=null,t()}}});var A_e=b((Kno,bct)=>{"use strict";var{ObjectSetPrototypeOf:yct}=ha();bct.exports=BL;var T_e=P_e();yct(BL.prototype,T_e.prototype);yct(BL,T_e);function BL(t){if(!(this instanceof BL))return new BL(t);T_e.call(this,t)}BL.prototype._transform=function(t,e,r){r(null,t)}});var CY=b((Jno,xct)=>{var K2=yP(),{ArrayIsArray:Rdr,Promise:jdr,SymbolAsyncIterator:Ddr,SymbolDispose:Ndr}=ha(),xY=qx(),{once:Ldr}=sd(),Fdr=ZM(),_ct=Sb(),{aggregateTwoErrors:kdr,codes:{ERR_INVALID_ARG_TYPE:k_e,ERR_INVALID_RETURN_VALUE:I_e,ERR_MISSING_ARGS:Bdr,ERR_STREAM_DESTROYED:$dr,ERR_STREAM_PREMATURE_CLOSE:qdr},AbortError:Udr}=Gd(),{validateFunction:zdr,validateAbortSignal:Hdr}=AL(),{isIterable:tR,isReadable:M_e,isReadableNodeStream:SY,isNodeStream:vct,isTransformStream:$L,isWebStream:Vdr,isReadableStream:R_e,isReadableFinished:Wdr}=_b(),Kdr=globalThis.AbortController||EL().AbortController,j_e,D_e,N_e;function wct(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=xY(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,Fdr.destroyer(t,i||new $dr("pipe")))},cleanup:o}}function Jdr(t){return zdr(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function L_e(t){if(tR(t))return t;if(SY(t))return Gdr(t);throw new k_e("val",["Readable","Iterable","AsyncIterable"],t)}async function*Gdr(t){D_e||(D_e=U2()),yield*D_e.prototype[Ddr].call(t)}async function wY(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new jdr((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=xY(e,{readable:!1},a);try{e.writableNeedDrain&&await s();for await(let l of t)e.write(l)||await s();n&&(e.end(),await s()),r()}catch(l){r(o!==l?kdr(o,l):l)}finally{u(),e.off("drain",a)}}async function F_e(t,e,r,{end:n}){$L(e)&&(e=e.writable);let o=e.getWriter();try{for await(let i of t)await o.ready,o.write(i).catch(()=>{});await o.ready,n&&await o.close(),r()}catch(i){try{await o.abort(i),r(i)}catch(a){r(a)}}}function Ydr(...t){return Sct(t,Ldr(Jdr(t)))}function Sct(t,e,r){if(t.length===1&&Rdr(t[0])&&(t=t[0]),t.length<2)throw new Bdr("streams");let n=new Kdr,o=n.signal,i=r?.signal,a=[];Hdr(i,"options.signal");function s(){m(new Udr)}N_e=N_e||sd().addAbortListener;let u;i&&(u=N_e(i,s));let l,c,d=[],f=0;function p(w){m(w,--f===0)}function m(w,x){var C;if(w&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=w),!(!l&&!x)){for(;d.length;)d.shift()(l);(C=u)===null||C===void 0||C[Ndr](),n.abort(),x&&(l||a.forEach(P=>P()),K2.nextTick(e,l,c))}}let h;for(let w=0;w<t.length;w++){let x=t[w],C=w<t.length-1,P=w>0,E=C||r?.end!==!1,A=w===t.length-1;if(vct(x)){let M=function(R){R&&R.name!=="AbortError"&&R.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(R)};var _=M;if(E){let{destroy:R,cleanup:N}=wct(x,C,P);d.push(R),M_e(x)&&A&&a.push(N)}x.on("error",M),M_e(x)&&A&&a.push(()=>{x.removeListener("error",M)})}if(w===0)if(typeof x=="function"){if(h=x({signal:o}),!tR(h))throw new I_e("Iterable, AsyncIterable or Stream","source",h)}else tR(x)||SY(x)||$L(x)?h=x:h=_ct.from(x);else if(typeof x=="function"){if($L(h)){var v;h=L_e((v=h)===null||v===void 0?void 0:v.readable)}else h=L_e(h);if(h=x(h,{signal:o}),C){if(!tR(h,!0))throw new I_e("AsyncIterable",`transform[${w-1}]`,h)}else{var g;j_e||(j_e=A_e());let M=new j_e({objectMode:!0}),R=(g=h)===null||g===void 0?void 0:g.then;if(typeof R=="function")f++,R.call(h,k=>{c=k,k!=null&&M.write(k),E&&M.end(),K2.nextTick(p)},k=>{M.destroy(k),K2.nextTick(p,k)});else if(tR(h,!0))f++,wY(h,M,p,{end:E});else if(R_e(h)||$L(h)){let k=h.readable||h;f++,wY(k,M,p,{end:E})}else throw new I_e("AsyncIterable or Promise","destination",h);h=M;let{destroy:N,cleanup:L}=wct(h,!1,!0);d.push(N),A&&a.push(L)}}else if(vct(x)){if(SY(h)){f+=2;let M=Zdr(h,x,p,{end:E});M_e(x)&&A&&a.push(M)}else if($L(h)||R_e(h)){let M=h.readable||h;f++,wY(M,x,p,{end:E})}else if(tR(h))f++,wY(h,x,p,{end:E});else throw new k_e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=x}else if(Vdr(x)){if(SY(h))f++,F_e(L_e(h),x,p,{end:E});else if(R_e(h)||tR(h))f++,F_e(h,x,p,{end:E});else if($L(h))f++,F_e(h.readable,x,p,{end:E});else throw new k_e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=x}else h=_ct.from(x)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&K2.nextTick(s),h}function Zdr(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new qdr)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;Wdr(t)?K2.nextTick(a):t.once("end",a)}else r();return xY(t,{readable:!0,writable:!1},a=>{let s=t._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&s&&s.ended&&!s.errored&&!s.errorEmitted?t.once("end",r).once("error",r):r(a)}),xY(e,{readable:!1,writable:!0},r)}xct.exports={pipelineImpl:Sct,pipeline:Ydr}});var $_e=b((Gno,Act)=>{"use strict";var{pipeline:Xdr}=CY(),OY=Sb(),{destroyer:Qdr}=ZM(),{isNodeStream:EY,isReadable:Cct,isWritable:Oct,isWebStream:B_e,isTransformStream:rR,isWritableStream:Ect,isReadableStream:Pct}=_b(),{AbortError:efr,codes:{ERR_INVALID_ARG_VALUE:Tct,ERR_MISSING_ARGS:tfr}}=Gd(),rfr=qx();Act.exports=function(...e){if(e.length===0)throw new tfr("streams");if(e.length===1)return OY.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=OY.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=OY.from(e[p])}for(let p=0;p<e.length;++p)if(!(!EY(e[p])&&!B_e(e[p]))){if(p<e.length-1&&!(Cct(e[p])||Pct(e[p])||rR(e[p])))throw new Tct(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(Oct(e[p])||Ect(e[p])||rR(e[p])))throw new Tct(`streams[${p}]`,r[p],"must be writable")}let n,o,i,a,s;function u(p){let m=a;a=null,m?m(p):p?s.destroy(p):!f&&!d&&s.destroy()}let l=e[0],c=Xdr(e,u),d=!!(Oct(l)||Ect(l)||rR(l)),f=!!(Cct(c)||Pct(c)||rR(c));if(s=new OY({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(EY(l))s._write=function(m,h,v){l.write(m,h)?v():n=v},s._final=function(m){l.end(),o=m},l.on("drain",function(){if(n){let m=n;n=null,m()}});else if(B_e(l)){let h=(rR(l)?l.writable:l).getWriter();s._write=async function(v,g,_){try{await h.ready,h.write(v).catch(()=>{}),_()}catch(w){_(w)}},s._final=async function(v){try{await h.ready,h.close().catch(()=>{}),o=v}catch(g){v(g)}}}let p=rR(c)?c.readable:c;rfr(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(EY(c))c.on("readable",function(){if(i){let p=i;i=null,p()}}),c.on("end",function(){s.push(null)}),s._read=function(){for(;;){let p=c.read();if(p===null){i=s._read;return}if(!s.push(p))return}};else if(B_e(c)){let m=(rR(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:h,done:v}=await m.read();if(!s.push(h))return;if(v){s.push(null);return}}catch{return}}}}return s._destroy=function(p,m){!p&&a!==null&&(p=new efr),i=null,n=null,o=null,a===null?m(p):(a=m,EY(c)&&Qdr(c,p))},s}});var Bct=b((Yno,z_e)=>{"use strict";var nfr=globalThis.AbortController||EL().AbortController,{codes:{ERR_INVALID_ARG_VALUE:ofr,ERR_INVALID_ARG_TYPE:J2,ERR_MISSING_ARGS:ifr,ERR_OUT_OF_RANGE:afr},AbortError:xb}=Gd(),{validateAbortSignal:nR,validateInteger:Ict,validateObject:oR}=AL(),sfr=ha().Symbol("kWeak"),ufr=ha().Symbol("kResistStopPropagation"),{finished:lfr}=qx(),cfr=$_e(),{addAbortSignalNoValidate:dfr}=k2(),{isWritable:ffr,isNodeStream:pfr}=_b(),{deprecate:mfr}=sd(),{ArrayPrototypePush:hfr,Boolean:gfr,MathFloor:Mct,Number:yfr,NumberIsNaN:bfr,Promise:Rct,PromiseReject:jct,PromiseResolve:_fr,PromisePrototypeThen:Dct,Symbol:Lct}=ha(),PY=Lct("kEmpty"),Nct=Lct("kEof");function vfr(t,e){if(e!=null&&oR(e,"options"),e?.signal!=null&&nR(e.signal,"options.signal"),pfr(t)&&!ffr(t))throw new ofr("stream",t,"must be writable");let r=cfr(this,t);return e!=null&&e.signal&&dfr(e.signal,r),r}function TY(t,e){if(typeof t!="function")throw new J2("fn",["Function","AsyncFunction"],t);e!=null&&oR(e,"options"),e?.signal!=null&&nR(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Mct(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Mct(e.highWaterMark)),Ict(r,"options.concurrency",1),Ict(n,"options.highWaterMark",0),n+=r,async function*(){let i=sd().AbortSignalAny([e?.signal].filter(gfr)),a=this,s=[],u={signal:i},l,c,d=!1,f=0;function p(){d=!0,m()}function m(){f-=1,h()}function h(){c&&!d&&f<r&&s.length<n&&(c(),c=null)}async function v(){try{for await(let g of a){if(d)return;if(i.aborted)throw new xb;try{if(g=t(g,u),g===PY)continue;g=_fr(g)}catch(_){g=jct(_)}f+=1,Dct(g,m,p),s.push(g),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new Rct(_=>{c=_})}s.push(Nct)}catch(g){let _=jct(g);Dct(_,m,p),s.push(_)}finally{d=!0,l&&(l(),l=null)}}v();try{for(;;){for(;s.length>0;){let g=await s[0];if(g===Nct)return;if(i.aborted)throw new xb;g!==PY&&(yield g),s.shift(),h()}await new Rct(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function wfr(t=void 0){return t!=null&&oR(t,"options"),t?.signal!=null&&nR(t.signal,"options.signal"),async function*(){let r=0;for await(let o of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new xb({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function Fct(t,e=void 0){for await(let r of U_e.call(this,t,e))return!0;return!1}async function Sfr(t,e=void 0){if(typeof t!="function")throw new J2("fn",["Function","AsyncFunction"],t);return!await Fct.call(this,async(...r)=>!await t(...r),e)}async function xfr(t,e){for await(let r of U_e.call(this,t,e))return r}async function Cfr(t,e){if(typeof t!="function")throw new J2("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),PY}for await(let n of TY.call(this,r,e));}function U_e(t,e){if(typeof t!="function")throw new J2("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:PY}return TY.call(this,r,e)}var q_e=class extends ifr{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function Ofr(t,e,r){var n;if(typeof t!="function")throw new J2("reducer",["Function","AsyncFunction"],t);r!=null&&oR(r,"options"),r?.signal!=null&&nR(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new xb(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await lfr(this.destroy(l)),l}let i=new nfr,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[sfr]:this,[ufr]:!0};r.signal.addEventListener("abort",()=>i.abort(),l)}let s=!1;try{for await(let l of this){var u;if(s=!0,r!=null&&(u=r.signal)!==null&&u!==void 0&&u.aborted)throw new xb;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new q_e}finally{i.abort()}return e}async function Efr(t){t!=null&&oR(t,"options"),t?.signal!=null&&nR(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new xb(void 0,{cause:t.signal.reason});hfr(e,n)}return e}function Pfr(t,e){let r=TY.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function kct(t){if(t=yfr(t),bfr(t))return 0;if(t<0)throw new afr("number",">= 0",t);return t}function Tfr(t,e=void 0){return e!=null&&oR(e,"options"),e?.signal!=null&&nR(e.signal,"options.signal"),t=kct(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new xb;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new xb;t--<=0&&(yield i)}}.call(this)}function Afr(t,e=void 0){return e!=null&&oR(e,"options"),e?.signal!=null&&nR(e.signal,"options.signal"),t=kct(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new xb;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new xb;if(t-- >0&&(yield i),t<=0)return}}.call(this)}z_e.exports.streamReturningOperators={asIndexedPairs:mfr(wfr,"readable.asIndexedPairs will be removed in a future version."),drop:Tfr,filter:U_e,flatMap:Pfr,map:TY,take:Afr,compose:vfr};z_e.exports.promiseReturningOperators={every:Sfr,forEach:Cfr,reduce:Ofr,toArray:Efr,some:Fct,find:xfr}});var H_e=b((Zno,$ct)=>{"use strict";var{ArrayPrototypePop:Ifr,Promise:Mfr}=ha(),{isIterable:Rfr,isNodeStream:jfr,isWebStream:Dfr}=_b(),{pipelineImpl:Nfr}=CY(),{finished:Lfr}=qx();V_e();function Ffr(...t){return new Mfr((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!jfr(i)&&!Rfr(i)&&!Dfr(i)){let a=Ifr(t);n=a.signal,o=a.end}Nfr(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}$ct.exports={finished:Lfr,pipeline:Ffr}});var V_e=b((Xno,Gct)=>{var{Buffer:kfr}=Tf(),{ObjectDefineProperty:Hx,ObjectKeys:zct,ReflectApply:Hct}=ha(),{promisify:{custom:Vct}}=sd(),{streamReturningOperators:qct,promiseReturningOperators:Uct}=Bct(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Wct}}=Gd(),Bfr=$_e(),{setDefaultHighWaterMark:$fr,getDefaultHighWaterMark:qfr}=B2(),{pipeline:Kct}=CY(),{destroyer:Ufr}=ZM(),Jct=qx(),W_e=H_e(),G2=_b(),Ri=Gct.exports=sY().Stream;Ri.isDestroyed=G2.isDestroyed;Ri.isDisturbed=G2.isDisturbed;Ri.isErrored=G2.isErrored;Ri.isReadable=G2.isReadable;Ri.isWritable=G2.isWritable;Ri.Readable=U2();for(let t of zct(qct)){let r=function(...n){if(new.target)throw Wct();return Ri.Readable.from(Hct(e,this,n))};K_e=r;let e=qct[t];Hx(r,"name",{__proto__:null,value:e.name}),Hx(r,"length",{__proto__:null,value:e.length}),Hx(Ri.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var K_e;for(let t of zct(Uct)){let r=function(...o){if(new.target)throw Wct();return Hct(e,this,o)};K_e=r;let e=Uct[t];Hx(r,"name",{__proto__:null,value:e.name}),Hx(r,"length",{__proto__:null,value:e.length}),Hx(Ri.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var K_e;Ri.Writable=vY();Ri.Duplex=Sb();Ri.Transform=P_e();Ri.PassThrough=A_e();Ri.pipeline=Kct;var{addAbortSignal:zfr}=k2();Ri.addAbortSignal=zfr;Ri.finished=Jct;Ri.destroy=Ufr;Ri.compose=Bfr;Ri.setDefaultHighWaterMark=$fr;Ri.getDefaultHighWaterMark=qfr;Hx(Ri,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return W_e}});Hx(Kct,Vct,{__proto__:null,enumerable:!0,get(){return W_e.pipeline}});Hx(Jct,Vct,{__proto__:null,enumerable:!0,get(){return W_e.finished}});Ri.Stream=Ri;Ri._isUint8Array=function(e){return e instanceof Uint8Array};Ri._uint8ArrayToBuffer=function(e){return kfr.from(e.buffer,e.byteOffset,e.byteLength)}});var Y2=b((Qno,rs)=>{"use strict";var Qu=V_e(),Hfr=H_e(),Vfr=Qu.Readable.destroy;rs.exports=Qu.Readable;rs.exports._uint8ArrayToBuffer=Qu._uint8ArrayToBuffer;rs.exports._isUint8Array=Qu._isUint8Array;rs.exports.isDisturbed=Qu.isDisturbed;rs.exports.isErrored=Qu.isErrored;rs.exports.isReadable=Qu.isReadable;rs.exports.Readable=Qu.Readable;rs.exports.Writable=Qu.Writable;rs.exports.Duplex=Qu.Duplex;rs.exports.Transform=Qu.Transform;rs.exports.PassThrough=Qu.PassThrough;rs.exports.addAbortSignal=Qu.addAbortSignal;rs.exports.finished=Qu.finished;rs.exports.destroy=Qu.destroy;rs.exports.destroy=Vfr;rs.exports.pipeline=Qu.pipeline;rs.exports.compose=Qu.compose;Object.defineProperty(Qu,"promises",{configurable:!0,enumerable:!0,get(){return Hfr}});rs.exports.Stream=Qu.Stream;rs.exports.default=rs.exports});var iR=b((eoo,Yct)=>{"use strict";Yct.exports=TypeError});var Zct=b(()=>{});var e4=b((noo,ydt)=>{var nve=typeof Map=="function"&&Map.prototype,J_e=Object.getOwnPropertyDescriptor&&nve?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,IY=nve&&J_e&&typeof J_e.get=="function"?J_e.get:null,Xct=nve&&Map.prototype.forEach,ove=typeof Set=="function"&&Set.prototype,G_e=Object.getOwnPropertyDescriptor&&ove?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,MY=ove&&G_e&&typeof G_e.get=="function"?G_e.get:null,Qct=ove&&Set.prototype.forEach,Wfr=typeof WeakMap=="function"&&WeakMap.prototype,X2=Wfr?WeakMap.prototype.has:null,Kfr=typeof WeakSet=="function"&&WeakSet.prototype,Q2=Kfr?WeakSet.prototype.has:null,Jfr=typeof WeakRef=="function"&&WeakRef.prototype,edt=Jfr?WeakRef.prototype.deref:null,Gfr=Boolean.prototype.valueOf,Yfr=Object.prototype.toString,Zfr=Function.prototype.toString,Xfr=String.prototype.match,ive=String.prototype.slice,wP=String.prototype.replace,Qfr=String.prototype.toUpperCase,tdt=String.prototype.toLowerCase,cdt=RegExp.prototype.test,rdt=Array.prototype.concat,Cb=Array.prototype.join,epr=Array.prototype.slice,ndt=Math.floor,X_e=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Y_e=Object.getOwnPropertySymbols,Q_e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,qL=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ld=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===qL||!0)?Symbol.toStringTag:null,ddt=Object.prototype.propertyIsEnumerable,odt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function idt(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||cdt.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-ndt(-t):ndt(t);if(n!==t){var o=String(n),i=ive.call(e,o.length+1);return wP.call(o,r,"$&_")+"."+wP.call(wP.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return wP.call(e,r,"$&_")}var eve=Zct(),adt=eve.custom,sdt=mdt(adt)?adt:null,fdt={__proto__:null,double:'"',single:"'"},tpr={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};ydt.exports=function t(e,r,n,o){var i=r||{};if(Vx(i,"quoteStyle")&&!Vx(fdt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Vx(i,"maxStringLength")&&(typeof i.maxStringLength=="number"?i.maxStringLength<0&&i.maxStringLength!==1/0:i.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=Vx(i,"customInspect")?i.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Vx(i,"indent")&&i.indent!==null&&i.indent!==" "&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Vx(i,"numericSeparator")&&typeof i.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var s=i.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return gdt(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?idt(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?idt(e,l):l}var c=typeof i.depth>"u"?5:i.depth;if(typeof n>"u"&&(n=0),n>=c&&c>0&&typeof e=="object")return tve(e)?"[Array]":"[Object]";var d=_pr(i,n);if(typeof o>"u")o=[];else if(hdt(o,e)>=0)return"[Circular]";function f(k,F,$){if(F&&(o=epr.call(o),o.push(F)),$){var U={depth:i.depth};return Vx(i,"quoteStyle")&&(U.quoteStyle=i.quoteStyle),t(k,U,n+1,o)}return t(k,i,n+1,o)}if(typeof e=="function"&&!udt(e)){var p=cpr(e),m=AY(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+Cb.call(m,", ")+" }":"")}if(mdt(e)){var h=qL?wP.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Q_e.call(e);return typeof e=="object"&&!qL?Z2(h):h}if(gpr(e)){for(var v="<"+tdt.call(String(e.nodeName)),g=e.attributes||[],_=0;_<g.length;_++)v+=" "+g[_].name+"="+pdt(rpr(g[_].value),"double",i);return v+=">",e.childNodes&&e.childNodes.length&&(v+="..."),v+="</"+tdt.call(String(e.nodeName))+">",v}if(tve(e)){if(e.length===0)return"[]";var w=AY(e,f);return d&&!bpr(w)?"["+rve(w,d)+"]":"[ "+Cb.call(w,", ")+" ]"}if(opr(e)){var x=AY(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!ddt.call(e,"cause")?"{ ["+String(e)+"] "+Cb.call(rdt.call("[cause]: "+f(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Cb.call(x,", ")+" }"}if(typeof e=="object"&&a){if(sdt&&typeof e[sdt]=="function"&&eve)return eve(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(dpr(e)){var C=[];return Xct&&Xct.call(e,function(k,F){C.push(f(F,e,!0)+" => "+f(k,e))}),ldt("Map",IY.call(e),C,d)}if(mpr(e)){var P=[];return Qct&&Qct.call(e,function(k){P.push(f(k,e))}),ldt("Set",MY.call(e),P,d)}if(fpr(e))return Z_e("WeakMap");if(hpr(e))return Z_e("WeakSet");if(ppr(e))return Z_e("WeakRef");if(apr(e))return Z2(f(Number(e)));if(upr(e))return Z2(f(X_e.call(e)));if(spr(e))return Z2(Gfr.call(e));if(ipr(e))return Z2(f(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof window<"u"&&e===window)return"{ [object globalThis] }";if(!npr(e)&&!udt(e)){var E=AY(e,f),A=odt?odt(e)===Object.prototype:e instanceof Object||e.constructor===Object,M=e instanceof Object?"":"null prototype",R=!A&&ld&&Object(e)===e&&ld in e?ive.call(SP(e),8,-1):M?"Object":"",N=A||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",L=N+(R||M?"["+Cb.call(rdt.call([],R||[],M||[]),": ")+"] ":"");return E.length===0?L+"{}":d?L+"{"+rve(E,d)+"}":L+"{ "+Cb.call(E,", ")+" }"}return String(e)};function pdt(t,e,r){var n=r.quoteStyle||e,o=fdt[n];return o+t+o}function rpr(t){return wP.call(String(t),/"/g,"&quot;")}function tve(t){return SP(t)==="[object Array]"&&(!ld||!(typeof t=="object"&&ld in t))}function npr(t){return SP(t)==="[object Date]"&&(!ld||!(typeof t=="object"&&ld in t))}function udt(t){return SP(t)==="[object RegExp]"&&(!ld||!(typeof t=="object"&&ld in t))}function opr(t){return SP(t)==="[object Error]"&&(!ld||!(typeof t=="object"&&ld in t))}function ipr(t){return SP(t)==="[object String]"&&(!ld||!(typeof t=="object"&&ld in t))}function apr(t){return SP(t)==="[object Number]"&&(!ld||!(typeof t=="object"&&ld in t))}function spr(t){return SP(t)==="[object Boolean]"&&(!ld||!(typeof t=="object"&&ld in t))}function mdt(t){if(qL)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Q_e)return!1;try{return Q_e.call(t),!0}catch{}return!1}function upr(t){if(!t||typeof t!="object"||!X_e)return!1;try{return X_e.call(t),!0}catch{}return!1}var lpr=Object.prototype.hasOwnProperty||function(t){return t in this};function Vx(t,e){return lpr.call(t,e)}function SP(t){return Yfr.call(t)}function cpr(t){if(t.name)return t.name;var e=Xfr.call(Zfr.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function hdt(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function dpr(t){if(!IY||!t||typeof t!="object")return!1;try{IY.call(t);try{MY.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function fpr(t){if(!X2||!t||typeof t!="object")return!1;try{X2.call(t,X2);try{Q2.call(t,Q2)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function ppr(t){if(!edt||!t||typeof t!="object")return!1;try{return edt.call(t),!0}catch{}return!1}function mpr(t){if(!MY||!t||typeof t!="object")return!1;try{MY.call(t);try{IY.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function hpr(t){if(!Q2||!t||typeof t!="object")return!1;try{Q2.call(t,Q2);try{X2.call(t,X2)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function gpr(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function gdt(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return gdt(ive.call(t,0,e.maxStringLength),e)+n}var o=tpr[e.quoteStyle||"single"];o.lastIndex=0;var i=wP.call(wP.call(t,o,"\\$1"),/[\x00-\x1f]/g,ypr);return pdt(i,"single",e)}function ypr(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Qfr.call(e.toString(16))}function Z2(t){return"Object("+t+")"}function Z_e(t){return t+" { ? }"}function ldt(t,e,r,n){var o=n?rve(r,n):Cb.call(r,", ");return t+" ("+e+") {"+o+"}"}function bpr(t){for(var e=0;e<t.length;e++)if(hdt(t[e],`
`)>=0)return!1;return!0}function _pr(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Cb.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Cb.call(Array(e+1),r)}}function rve(t,e){if(t.length===0)return"";var r=`
`+e.prev+e.base;return r+Cb.call(t,","+r)+`
`+e.prev}function AY(t,e){var r=tve(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=Vx(t,o)?e(t[o],t):""}var i=typeof Y_e=="function"?Y_e(t):[],a;if(qL){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)Vx(t,u)&&(r&&String(Number(u))===u&&u<t.length||qL&&a["$"+u]instanceof Symbol||(cdt.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof Y_e=="function")for(var l=0;l<i.length;l++)ddt.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var _dt=b((ooo,bdt)=>{"use strict";var vpr=e4(),wpr=iR(),RY=function(t,e,r){for(var n=t,o;(o=n.next)!=null;n=o)if(o.key===e)return n.next=o.next,r||(o.next=t.next,t.next=o),o},Spr=function(t,e){if(t){var r=RY(t,e);return r&&r.value}},xpr=function(t,e,r){var n=RY(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Cpr=function(t,e){return t?!!RY(t,e):!1},Opr=function(t,e){if(t)return RY(t,e,!0)};bdt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new wpr("Side channel does not contain "+vpr(n))},delete:function(n){var o=e&&e.next,i=Opr(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return Spr(e,n)},has:function(n){return Cpr(e,n)},set:function(n,o){e||(e={next:void 0}),xpr(e,n,o)}};return r}});var ave=b((ioo,vdt)=>{"use strict";vdt.exports=Object});var Sdt=b((aoo,wdt)=>{"use strict";wdt.exports=Error});var Cdt=b((soo,xdt)=>{"use strict";xdt.exports=EvalError});var Edt=b((uoo,Odt)=>{"use strict";Odt.exports=RangeError});var Tdt=b((loo,Pdt)=>{"use strict";Pdt.exports=ReferenceError});var Idt=b((coo,Adt)=>{"use strict";Adt.exports=SyntaxError});var Rdt=b((doo,Mdt)=>{"use strict";Mdt.exports=URIError});var Ddt=b((foo,jdt)=>{"use strict";jdt.exports=Math.abs});var Ldt=b((poo,Ndt)=>{"use strict";Ndt.exports=Math.floor});var kdt=b((moo,Fdt)=>{"use strict";Fdt.exports=Math.max});var $dt=b((hoo,Bdt)=>{"use strict";Bdt.exports=Math.min});var Udt=b((goo,qdt)=>{"use strict";qdt.exports=Math.pow});var Hdt=b((yoo,zdt)=>{"use strict";zdt.exports=Math.round});var Wdt=b((boo,Vdt)=>{"use strict";Vdt.exports=Number.isNaN||function(e){return e!==e}});var Jdt=b((_oo,Kdt)=>{"use strict";var Epr=Wdt();Kdt.exports=function(e){return Epr(e)||e===0?e:e<0?-1:1}});var Ydt=b((voo,Gdt)=>{"use strict";Gdt.exports=Object.getOwnPropertyDescriptor});var sve=b((woo,Zdt)=>{"use strict";var jY=Ydt();if(jY)try{jY([],"length")}catch{jY=null}Zdt.exports=jY});var Qdt=b((Soo,Xdt)=>{"use strict";var DY=Object.defineProperty||!1;if(DY)try{DY({},"a",{value:1})}catch{DY=!1}Xdt.exports=DY});var tft=b((xoo,eft)=>{"use strict";eft.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;e[r]=o;for(var i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,r);if(s.value!==o||s.enumerable!==!0)return!1}return!0}});var oft=b((Coo,nft)=>{"use strict";var rft=typeof Symbol<"u"&&Symbol,Ppr=tft();nft.exports=function(){return typeof rft!="function"||typeof Symbol!="function"||typeof rft("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Ppr()}});var uve=b((Ooo,ift)=>{"use strict";ift.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var lve=b((Eoo,aft)=>{"use strict";var Tpr=ave();aft.exports=Tpr.getPrototypeOf||null});var lft=b((Poo,uft)=>{"use strict";var Apr="Function.prototype.bind called on incompatible ",Ipr=Object.prototype.toString,Mpr=Math.max,Rpr="[object Function]",sft=function(e,r){for(var n=[],o=0;o<e.length;o+=1)n[o]=e[o];for(var i=0;i<r.length;i+=1)n[i+e.length]=r[i];return n},jpr=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},Dpr=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};uft.exports=function(e){var r=this;if(typeof r!="function"||Ipr.apply(r)!==Rpr)throw new TypeError(Apr+r);for(var n=jpr(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,sft(n,arguments));return Object(c)===c?c:this}return r.apply(e,sft(n,arguments))},a=Mpr(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+Dpr(s,",")+"){ return binder.apply(this,arguments); }")(i),r.prototype){var l=function(){};l.prototype=r.prototype,o.prototype=new l,l.prototype=null}return o}});var t4=b((Too,cft)=>{"use strict";var Npr=lft();cft.exports=Function.prototype.bind||Npr});var NY=b((Aoo,dft)=>{"use strict";dft.exports=Function.prototype.call});var cve=b((Ioo,fft)=>{"use strict";fft.exports=Function.prototype.apply});var mft=b((Moo,pft)=>{"use strict";pft.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var gft=b((Roo,hft)=>{"use strict";var Lpr=t4(),Fpr=cve(),kpr=NY(),Bpr=mft();hft.exports=Bpr||Lpr.call(kpr,Fpr)});var dve=b((joo,yft)=>{"use strict";var $pr=t4(),qpr=iR(),Upr=NY(),zpr=gft();yft.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new qpr("a function is required");return zpr($pr,Upr,e)}});var xft=b((Doo,Sft)=>{"use strict";var Hpr=dve(),bft=sve(),vft;try{vft=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var fve=!!vft&&bft&&bft(Object.prototype,"__proto__"),wft=Object,_ft=wft.getPrototypeOf;Sft.exports=fve&&typeof fve.get=="function"?Hpr([fve.get]):typeof _ft=="function"?function(e){return _ft(e==null?e:wft(e))}:!1});var Tft=b((Noo,Pft)=>{"use strict";var Cft=uve(),Oft=lve(),Eft=xft();Pft.exports=Cft?function(e){return Cft(e)}:Oft?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Oft(e)}:Eft?function(e){return Eft(e)}:null});var Ift=b((Loo,Aft)=>{"use strict";var Vpr=Function.prototype.call,Wpr=Object.prototype.hasOwnProperty,Kpr=t4();Aft.exports=Kpr.call(Vpr,Wpr)});var kY=b((Foo,Lft)=>{"use strict";var fn,Jpr=ave(),Gpr=Sdt(),Ypr=Cdt(),Zpr=Edt(),Xpr=Tdt(),VL=Idt(),HL=iR(),Qpr=Rdt(),emr=Ddt(),tmr=Ldt(),rmr=kdt(),nmr=$dt(),omr=Udt(),imr=Hdt(),amr=Jdt(),Dft=Function,pve=function(t){try{return Dft('"use strict"; return ('+t+").constructor;")()}catch{}},r4=sve(),smr=Qdt(),mve=function(){throw new HL},umr=r4?function(){try{return arguments.callee,mve}catch{try{return r4(arguments,"callee").get}catch{return mve}}}():mve,UL=oft()(),Ol=Tft(),lmr=lve(),cmr=uve(),Nft=cve(),n4=NY(),zL={},dmr=typeof Uint8Array>"u"||!Ol?fn:Ol(Uint8Array),aR={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?fn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?fn:ArrayBuffer,"%ArrayIteratorPrototype%":UL&&Ol?Ol([][Symbol.iterator]()):fn,"%AsyncFromSyncIteratorPrototype%":fn,"%AsyncFunction%":zL,"%AsyncGenerator%":zL,"%AsyncGeneratorFunction%":zL,"%AsyncIteratorPrototype%":zL,"%Atomics%":typeof Atomics>"u"?fn:Atomics,"%BigInt%":typeof BigInt>"u"?fn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?fn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?fn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?fn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Gpr,"%eval%":eval,"%EvalError%":Ypr,"%Float32Array%":typeof Float32Array>"u"?fn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?fn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?fn:FinalizationRegistry,"%Function%":Dft,"%GeneratorFunction%":zL,"%Int8Array%":typeof Int8Array>"u"?fn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?fn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?fn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":UL&&Ol?Ol(Ol([][Symbol.iterator]())):fn,"%JSON%":typeof JSON=="object"?JSON:fn,"%Map%":typeof Map>"u"?fn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!UL||!Ol?fn:Ol(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Jpr,"%Object.getOwnPropertyDescriptor%":r4,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?fn:Promise,"%Proxy%":typeof Proxy>"u"?fn:Proxy,"%RangeError%":Zpr,"%ReferenceError%":Xpr,"%Reflect%":typeof Reflect>"u"?fn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?fn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!UL||!Ol?fn:Ol(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?fn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":UL&&Ol?Ol(""[Symbol.iterator]()):fn,"%Symbol%":UL?Symbol:fn,"%SyntaxError%":VL,"%ThrowTypeError%":umr,"%TypedArray%":dmr,"%TypeError%":HL,"%Uint8Array%":typeof Uint8Array>"u"?fn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?fn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?fn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?fn:Uint32Array,"%URIError%":Qpr,"%WeakMap%":typeof WeakMap>"u"?fn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?fn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?fn:WeakSet,"%Function.prototype.call%":n4,"%Function.prototype.apply%":Nft,"%Object.defineProperty%":smr,"%Object.getPrototypeOf%":lmr,"%Math.abs%":emr,"%Math.floor%":tmr,"%Math.max%":rmr,"%Math.min%":nmr,"%Math.pow%":omr,"%Math.round%":imr,"%Math.sign%":amr,"%Reflect.getPrototypeOf%":cmr};if(Ol)try{null.error}catch(t){Mft=Ol(Ol(t)),aR["%Error.prototype%"]=Mft}var Mft,fmr=function t(e){var r;if(e==="%AsyncFunction%")r=pve("async function () {}");else if(e==="%GeneratorFunction%")r=pve("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=pve("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&Ol&&(r=Ol(o.prototype))}return aR[e]=r,r},Rft={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},o4=t4(),LY=Ift(),pmr=o4.call(n4,Array.prototype.concat),mmr=o4.call(Nft,Array.prototype.splice),jft=o4.call(n4,String.prototype.replace),FY=o4.call(n4,String.prototype.slice),hmr=o4.call(n4,RegExp.prototype.exec),gmr=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ymr=/\\(\\)?/g,bmr=function(e){var r=FY(e,0,1),n=FY(e,-1);if(r==="%"&&n!=="%")throw new VL("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new VL("invalid intrinsic syntax, expected opening `%`");var o=[];return jft(e,gmr,function(i,a,s,u){o[o.length]=s?jft(u,ymr,"$1"):a||i}),o},_mr=function(e,r){var n=e,o;if(LY(Rft,n)&&(o=Rft[n],n="%"+o[0]+"%"),LY(aR,n)){var i=aR[n];if(i===zL&&(i=fmr(n)),typeof i>"u"&&!r)throw new HL("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new VL("intrinsic "+e+" does not exist!")};Lft.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new HL("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new HL('"allowMissing" argument must be a boolean');if(hmr(/^%?[^%]*%?$/,e)===null)throw new VL("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=bmr(e),o=n.length>0?n[0]:"",i=_mr("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],mmr(n,pmr([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=FY(f,0,1),m=FY(f,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new VL("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",LY(aR,a))s=aR[a];else if(s!=null){if(!(f in s)){if(!r)throw new HL("base intrinsic for "+e+" exists, but the property is not available.");return}if(r4&&c+1>=n.length){var h=r4(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=LY(s,f),s=s[f];d&&!u&&(aR[a]=s)}}return s}});var hve=b((koo,Bft)=>{"use strict";var Fft=kY(),kft=dve(),vmr=kft([Fft("%String.prototype.indexOf%")]);Bft.exports=function(e,r){var n=Fft(e,!!r);return typeof n=="function"&&vmr(e,".prototype.")>-1?kft([n]):n}});var gve=b((Boo,qft)=>{"use strict";var wmr=kY(),i4=hve(),Smr=e4(),xmr=iR(),$ft=wmr("%Map%",!0),Cmr=i4("Map.prototype.get",!0),Omr=i4("Map.prototype.set",!0),Emr=i4("Map.prototype.has",!0),Pmr=i4("Map.prototype.delete",!0),Tmr=i4("Map.prototype.size",!0);qft.exports=!!$ft&&function(){var e,r={assert:function(n){if(!r.has(n))throw new xmr("Side channel does not contain "+Smr(n))},delete:function(n){if(e){var o=Pmr(e,n);return Tmr(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return Cmr(e,n)},has:function(n){return e?Emr(e,n):!1},set:function(n,o){e||(e=new $ft),Omr(e,n,o)}};return r}});var zft=b(($oo,Uft)=>{"use strict";var Amr=kY(),$Y=hve(),Imr=e4(),BY=gve(),Mmr=iR(),WL=Amr("%WeakMap%",!0),Rmr=$Y("WeakMap.prototype.get",!0),jmr=$Y("WeakMap.prototype.set",!0),Dmr=$Y("WeakMap.prototype.has",!0),Nmr=$Y("WeakMap.prototype.delete",!0);Uft.exports=WL?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new Mmr("Side channel does not contain "+Imr(o))},delete:function(o){if(WL&&o&&(typeof o=="object"||typeof o=="function")){if(e)return Nmr(e,o)}else if(BY&&r)return r.delete(o);return!1},get:function(o){return WL&&o&&(typeof o=="object"||typeof o=="function")&&e?Rmr(e,o):r&&r.get(o)},has:function(o){return WL&&o&&(typeof o=="object"||typeof o=="function")&&e?Dmr(e,o):!!r&&r.has(o)},set:function(o,i){WL&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new WL),jmr(e,o,i)):BY&&(r||(r=BY()),r.set(o,i))}};return n}:BY});var Vft=b((qoo,Hft)=>{"use strict";var Lmr=iR(),Fmr=e4(),kmr=_dt(),Bmr=gve(),$mr=zft(),qmr=$mr||Bmr||kmr;Hft.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new Lmr("Side channel does not contain "+Fmr(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,o){e||(e=qmr()),e.set(n,o)}};return r}});var qY=b((Uoo,Wft)=>{"use strict";var Umr=String.prototype.replace,zmr=/%20/g,yve={RFC1738:"RFC1738",RFC3986:"RFC3986"};Wft.exports={default:yve.RFC3986,formatters:{RFC1738:function(t){return Umr.call(t,zmr,"+")},RFC3986:function(t){return String(t)}},RFC1738:yve.RFC1738,RFC3986:yve.RFC3986}});var _ve=b((zoo,Jft)=>{"use strict";var Hmr=qY(),bve=Object.prototype.hasOwnProperty,sR=Array.isArray,Ob=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Vmr=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(sR(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},Kft=function(e,r){for(var n=r&&r.plainObjects?Object.create(null):{},o=0;o<e.length;++o)typeof e[o]<"u"&&(n[o]=e[o]);return n},Wmr=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(sR(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!bve.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var o=e;return sR(e)&&!sR(r)&&(o=Kft(e,n)),sR(e)&&sR(r)?(r.forEach(function(i,a){if(bve.call(e,a)){var s=e[a];s&&typeof s=="object"&&i&&typeof i=="object"?e[a]=t(s,i,n):e.push(i)}else e[a]=i}),e):Object.keys(r).reduce(function(i,a){var s=r[a];return bve.call(i,a)?i[a]=t(i[a],s,n):i[a]=s,i},o)},Kmr=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},Jmr=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Gmr=function(e,r,n,o,i){if(e.length===0)return e;var a=e;if(typeof e=="symbol"?a=Symbol.prototype.toString.call(e):typeof e!="string"&&(a=String(e)),n==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var s="",u=0;u<a.length;++u){var l=a.charCodeAt(u);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||i===Hmr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+Ob[l];continue}if(l<2048){s=s+(Ob[192|l>>6]+Ob[128|l&63]);continue}if(l<55296||l>=57344){s=s+(Ob[224|l>>12]+Ob[128|l>>6&63]+Ob[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=Ob[240|l>>18]+Ob[128|l>>12&63]+Ob[128|l>>6&63]+Ob[128|l&63]}return s},Ymr=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],o=0;o<r.length;++o)for(var i=r[o],a=i.obj[i.prop],s=Object.keys(a),u=0;u<s.length;++u){var l=s[u],c=a[l];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(r.push({obj:a,prop:l}),n.push(c))}return Vmr(r),e},Zmr=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Xmr=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Qmr=function(e,r){return[].concat(e,r)},ehr=function(e,r){if(sR(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};Jft.exports={arrayToObject:Kft,assign:Kmr,combine:Qmr,compact:Ymr,decode:Jmr,encode:Gmr,isBuffer:Xmr,isRegExp:Zmr,maybeMap:ehr,merge:Wmr}});var ept=b((Hoo,Qft)=>{"use strict";var Zft=Vft(),UY=_ve(),a4=qY(),thr=Object.prototype.hasOwnProperty,Gft={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},Wx=Array.isArray,rhr=Array.prototype.push,Xft=function(t,e){rhr.apply(t,Wx(e)?e:[e])},nhr=Date.prototype.toISOString,Yft=a4.default,cd={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:UY.encode,encodeValuesOnly:!1,format:Yft,formatter:a4.formatters[Yft],indices:!1,serializeDate:function(e){return nhr.call(e)},skipNulls:!1,strictNullHandling:!1},ohr=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},vve={},ihr=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,v){for(var g=e,_=v,w=0,x=!1;(_=_.get(vve))!==void 0&&!x;){var C=_.get(e);if(w+=1,typeof C<"u"){if(C===w)throw new RangeError("Cyclic object value");x=!0}typeof _.get(vve)>"u"&&(w=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=d(g):n==="comma"&&Wx(g)&&(g=UY.maybeMap(g,function(U){return U instanceof Date?d(U):U})),g===null){if(i)return s&&!m?s(r,cd.encoder,h,"key",f):r;g=""}if(ohr(g)||UY.isBuffer(g)){if(s){var P=m?r:s(r,cd.encoder,h,"key",f);return[p(P)+"="+p(s(g,cd.encoder,h,"value",f))]}return[p(r)+"="+p(String(g))]}var E=[];if(typeof g>"u")return E;var A;if(n==="comma"&&Wx(g))m&&s&&(g=UY.maybeMap(g,s)),A=[{value:g.length>0?g.join(",")||null:void 0}];else if(Wx(u))A=u;else{var M=Object.keys(g);A=l?M.sort(l):M}for(var R=o&&Wx(g)&&g.length===1?r+"[]":r,N=0;N<A.length;++N){var L=A[N],k=typeof L=="object"&&typeof L.value<"u"?L.value:g[L];if(!(a&&k===null)){var F=Wx(g)?typeof n=="function"?n(R,L):R:R+(c?"."+L:"["+L+"]");v.set(e,w);var $=Zft();$.set(vve,v),Xft(E,t(k,F,n,o,i,a,n==="comma"&&m&&Wx(g)?null:s,u,l,c,d,f,p,m,h,$))}}return E},ahr=function(e){if(!e)return cd;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||cd.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=a4.default;if(typeof e.format<"u"){if(!thr.call(a4.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=a4.formatters[n],i=cd.filter;return(typeof e.filter=="function"||Wx(e.filter))&&(i=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:cd.addQueryPrefix,allowDots:typeof e.allowDots>"u"?cd.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:cd.charsetSentinel,delimiter:typeof e.delimiter>"u"?cd.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:cd.encode,encoder:typeof e.encoder=="function"?e.encoder:cd.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:cd.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:cd.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:cd.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:cd.strictNullHandling}};Qft.exports=function(t,e){var r=t,n=ahr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Wx(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;e&&e.arrayFormat in Gft?s=e.arrayFormat:e&&"indices"in e?s=e.indices?"indices":"repeat":s="indices";var u=Gft[s];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=u==="comma"&&e&&e.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);for(var c=Zft(),d=0;d<o.length;++d){var f=o[d];n.skipNulls&&r[f]===null||Xft(a,ihr(r[f],f,u,l,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,c))}var p=a.join(n.delimiter),m=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),p.length>0?m+p:""}});var npt=b((Voo,rpt)=>{"use strict";var KL=_ve(),wve=Object.prototype.hasOwnProperty,shr=Array.isArray,El={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:KL.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},uhr=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},tpt=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},lhr="utf8=%26%2310003%3B",chr="utf8=%E2%9C%93",dhr=function(e,r){var n={__proto__:null},o=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=r.parameterLimit===1/0?void 0:r.parameterLimit,a=o.split(r.delimiter,i),s=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u<a.length;++u)a[u].indexOf("utf8=")===0&&(a[u]===chr?l="utf-8":a[u]===lhr&&(l="iso-8859-1"),s=u,u=a.length);for(u=0;u<a.length;++u)if(u!==s){var c=a[u],d=c.indexOf("]="),f=d===-1?c.indexOf("="):d+1,p,m;f===-1?(p=r.decoder(c,El.decoder,l,"key"),m=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),El.decoder,l,"key"),m=KL.maybeMap(tpt(c.slice(f+1),r),function(h){return r.decoder(h,El.decoder,l,"value")})),m&&r.interpretNumericEntities&&l==="iso-8859-1"&&(m=uhr(m)),c.indexOf("[]=")>-1&&(m=shr(m)?[m]:m),wve.call(n,p)?n[p]=KL.combine(n[p],m):n[p]=m}return n},fhr=function(t,e,r,n){for(var o=n?e:tpt(e,r),i=t.length-1;i>=0;--i){var a,s=t[i];if(s==="[]"&&r.parseArrays)a=[].concat(o);else{a=r.plainObjects?Object.create(null):{};var u=s.charAt(0)==="["&&s.charAt(s.length-1)==="]"?s.slice(1,-1):s,l=parseInt(u,10);!r.parseArrays&&u===""?a={0:o}:!isNaN(l)&&s!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(a=[],a[l]=o):u!=="__proto__"&&(a[u]=o)}o=a}return o},phr=function(e,r,n,o){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,u=n.depth>0&&a.exec(i),l=u?i.slice(0,u.index):i,c=[];if(l){if(!n.plainObjects&&wve.call(Object.prototype,l)&&!n.allowPrototypes)return;c.push(l)}for(var d=0;n.depth>0&&(u=s.exec(i))!==null&&d<n.depth;){if(d+=1,!n.plainObjects&&wve.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(u[1])}return u&&c.push("["+i.slice(u.index)+"]"),fhr(c,r,n,o)}},mhr=function(e){if(!e)return El;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=typeof e.charset>"u"?El.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?El.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:El.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:El.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:El.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:El.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:El.comma,decoder:typeof e.decoder=="function"?e.decoder:El.decoder,delimiter:typeof e.delimiter=="string"||KL.isRegExp(e.delimiter)?e.delimiter:El.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:El.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:El.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:El.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:El.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:El.strictNullHandling}};rpt.exports=function(t,e){var r=mhr(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?dhr(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=phr(s,n[s],r,typeof t=="string");o=KL.merge(o,u,r)}return r.allowSparse===!0?o:KL.compact(o)}});var ipt=b((Woo,opt)=>{"use strict";var hhr=ept(),ghr=npt(),yhr=qY();opt.exports={formats:yhr,parse:ghr,stringify:hhr}});var apt=b(JL=>{"use strict";var bhr=JL&&JL.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(JL,"__esModule",{value:!0});JL.createRequestUrl=void 0;var _hr=bhr(ipt());function vhr(t,e){return Object.keys(e??{}).length>0?`${t}?${_hr.default.stringify(e,{arrayFormat:"repeat"})}`:t}JL.createRequestUrl=vhr});var lpt=b(zY=>{"use strict";var Sve,xve,Cve,Ove,Eve;Object.defineProperty(zY,"__esModule",{value:!0});zY.RUNTIME=void 0;var whr=typeof window<"u"&&typeof window.document<"u",Shr=typeof self=="object"&&typeof self?.importScripts=="function"&&(((Sve=self.constructor)===null||Sve===void 0?void 0:Sve.name)==="DedicatedWorkerGlobalScope"||((xve=self.constructor)===null||xve===void 0?void 0:xve.name)==="ServiceWorkerGlobalScope"||((Cve=self.constructor)===null||Cve===void 0?void 0:Cve.name)==="SharedWorkerGlobalScope"),spt=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",upt=typeof Bun<"u"&&typeof Bun.version<"u",xhr=typeof process<"u"&&!!process.version&&!!(!((Ove=process.versions)===null||Ove===void 0)&&Ove.node)&&!spt&&!upt,Chr=typeof navigator<"u"&&navigator?.product==="ReactNative",Ohr=typeof globalThis<"u"&&((Eve=globalThis?.navigator)===null||Eve===void 0?void 0:Eve.userAgent)==="Cloudflare-Workers";zY.RUNTIME=Ehr();function Ehr(){return whr?{type:"browser",version:window.navigator.userAgent}:Ohr?{type:"workerd"}:Shr?{type:"web-worker"}:spt?{type:"deno",version:Deno.version.deno}:upt?{type:"bun",version:Bun.version}:xhr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:Chr?{type:"react-native"}:{type:"unknown"}}});var GL=b(HY=>{"use strict";Object.defineProperty(HY,"__esModule",{value:!0});HY.RUNTIME=void 0;var Phr=lpt();Object.defineProperty(HY,"RUNTIME",{enumerable:!0,get:function(){return Phr.RUNTIME}})});var Pve=b((YL,cpt)=>{"use strict";var Thr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},uR=Thr();cpt.exports=YL=uR.fetch;uR.fetch&&(YL.default=uR.fetch.bind(uR));YL.Headers=uR.Headers;YL.Request=uR.Request;YL.Response=uR.Response});var fpt=b(Xm=>{"use strict";var Ahr=Xm&&Xm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ihr=Xm&&Xm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dpt=Xm&&Xm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ahr(e,t,r);return Ihr(e,t),e},Mhr=Xm&&Xm.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Xm,"__esModule",{value:!0});Xm.getFetchFn=void 0;var VY=GL();function Rhr(){return Mhr(this,void 0,void 0,function*(){return VY.RUNTIME.type==="node"&&VY.RUNTIME.parsedVersion!=null&&VY.RUNTIME.parsedVersion>=18?fetch:VY.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>dpt(Pve()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>dpt(Pve()))).default})}Xm.getFetchFn=Rhr});var ppt=b(ZL=>{"use strict";var jhr=ZL&&ZL.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(ZL,"__esModule",{value:!0});ZL.getRequestBody=void 0;function Dhr({body:t,type:e}){return jhr(this,void 0,void 0,function*(){return e.includes("json")?JSON.stringify(t):t})}ZL.getRequestBody=Dhr});var mpt=b(XL=>{"use strict";var Pg=XL&&XL.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(XL,"__esModule",{value:!0});XL.Node18UniversalStreamWrapper=void 0;var Tve=class t{constructor(e){this.readableStream=e,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(e,r){var n;(n=this.events[e])===null||n===void 0||n.push(r)}off(e,r){var n;this.events[e]=(n=this.events[e])===null||n===void 0?void 0:n.filter(o=>o!==r)}pipe(e){return this.on("data",r=>Pg(this,void 0,void 0,function*(){if(e instanceof t)e._write(r);else if(e instanceof WritableStream){let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}else e.write(r)})),this.on("end",()=>Pg(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>Pg(this,void 0,void 0,function*(){e instanceof t?e._error(r):e instanceof WritableStream?e.getWriter().abort(r):e.destroy(r)})),this._startReading(),e}pipeTo(e){return this.pipe(e)}unpipe(e){this.off("data",r=>Pg(this,void 0,void 0,function*(){if(e instanceof t)e._write(r);else if(e instanceof WritableStream){let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}else e.write(r)})),this.off("end",()=>Pg(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>Pg(this,void 0,void 0,function*(){e instanceof t?e._error(r):e instanceof WritableStream?e.getWriter().abort(r):e.destroy(r)}))}destroy(e){this.reader.cancel(e).then(()=>{this._emit("close")}).catch(r=>{this._emit("error",r)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}read(){return Pg(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(!e)return r})}setEncoding(e){this.encoding=e}text(){return Pg(this,void 0,void 0,function*(){let e=[];for(;;){let{done:n,value:o}=yield this.reader.read();if(n)break;o&&e.push(o)}return new TextDecoder(this.encoding||"utf-8").decode(yield new Blob(e).arrayBuffer())})}json(){return Pg(this,void 0,void 0,function*(){let e=yield this.text();return JSON.parse(e)})}_write(e){this._emit("data",e)}_end(){this._emit("end")}_error(e){this._emit("error",e)}_emit(e,r){if(this.events[e])for(let n of this.events[e]||[])n(r)}_startReading(){return Pg(this,void 0,void 0,function*(){try{for(this._emit("readable");;){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(e){this._emit("end"),this._emit("close");break}r&&this._emit("data",r)}}catch(e){this._emit("error",e)}})}[Symbol.asyncIterator](){return{next:()=>Pg(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();return e?{done:!0,value:void 0}:{done:!1,value:r}}),[Symbol.asyncIterator](){return this}}}};XL.Node18UniversalStreamWrapper=Tve});var hpt=b(QL=>{"use strict";var s4=QL&&QL.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(QL,"__esModule",{value:!0});QL.UndiciStreamWrapper=void 0;var Ave=class t{constructor(e){this.readableStream=e,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(e,r){var n;(n=this.events[e])===null||n===void 0||n.push(r)}off(e,r){var n;this.events[e]=(n=this.events[e])===null||n===void 0?void 0:n.filter(o=>o!==r)}pipe(e){return this.on("data",r=>{if(e instanceof t)e._write(r);else{let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}}),this.on("end",()=>{e instanceof t?e._end():e.getWriter().close()}),this.on("error",r=>{e instanceof t?e._error(r):e.getWriter().abort(r)}),this._startReading(),e}pipeTo(e){return this.pipe(e)}unpipe(e){this.off("data",r=>{if(e instanceof t)e._write(r);else{let n=e.getWriter();n.write(r).then(()=>n.releaseLock())}}),this.off("end",()=>{e instanceof t?e._end():e.getWriter().close()}),this.off("error",r=>{e instanceof t?e._error(r):e.getWriter().abort(r)})}destroy(e){this.reader.cancel(e).then(()=>{this._emit("close")}).catch(r=>{this._emit("error",r)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}read(){return s4(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(!e)return r})}setEncoding(e){this.encoding=e}text(){return s4(this,void 0,void 0,function*(){let e=[];for(;;){let{done:n,value:o}=yield this.reader.read();if(n)break;o&&e.push(o)}return new TextDecoder(this.encoding||"utf-8").decode(yield new Blob(e).arrayBuffer())})}json(){return s4(this,void 0,void 0,function*(){let e=yield this.text();return JSON.parse(e)})}_write(e){this._emit("data",e)}_end(){this._emit("end")}_error(e){this._emit("error",e)}_emit(e,r){if(this.events[e])for(let n of this.events[e]||[])n(r)}_startReading(){return s4(this,void 0,void 0,function*(){try{for(this._emit("readable");;){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();if(e){this._emit("end"),this._emit("close");break}r&&this._emit("data",r)}}catch(e){this._emit("error",e)}})}[Symbol.asyncIterator](){return{next:()=>s4(this,void 0,void 0,function*(){this.paused&&(yield new Promise(n=>{this.resumeCallback=n}));let{done:e,value:r}=yield this.reader.read();return e?{done:!0,value:void 0}:{done:!1,value:r}}),[Symbol.asyncIterator](){return this}}}};QL.UndiciStreamWrapper=Ave});var gpt=b(xP=>{"use strict";var WY=xP&&xP.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Nhr=xP&&xP.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}};Object.defineProperty(xP,"__esModule",{value:!0});xP.NodePre18StreamWrapper=void 0;var Ive=class{constructor(e){this.readableStream=e}on(e,r){this.readableStream.on(e,r)}off(e,r){this.readableStream.off(e,r)}pipe(e){return this.readableStream.pipe(e),e}pipeTo(e){return this.pipe(e)}unpipe(e){e?this.readableStream.unpipe(e):this.readableStream.unpipe()}destroy(e){this.readableStream.destroy(e)}pause(){this.readableStream.pause()}resume(){this.readableStream.resume()}get isPaused(){return this.readableStream.isPaused()}read(){return WY(this,void 0,void 0,function*(){return new Promise((e,r)=>{let n=this.readableStream.read();n?e(n):(this.readableStream.once("readable",()=>{let o=this.readableStream.read();e(o)}),this.readableStream.once("error",r))})})}setEncoding(e){this.readableStream.setEncoding(e),this.encoding=e}text(){var e,r;return WY(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=Nhr(this.readableStream),a;a=yield i.next(),!a.done;){let u=a.value;n.push(o.encode(u))}}catch(u){e={error:u}}finally{try{a&&!a.done&&(r=i.return)&&(yield r.call(i))}finally{if(e)throw e.error}}return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(n))})}json(){return WY(this,void 0,void 0,function*(){let e=yield this.text();return JSON.parse(e)})}[Symbol.asyncIterator](){let r=this.readableStream[Symbol.asyncIterator]();return{next(){return WY(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};xP.NodePre18StreamWrapper=Ive});var ypt=b(Qm=>{"use strict";var Lhr=Qm&&Qm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fhr=Qm&&Qm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mve=Qm&&Qm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lhr(e,t,r);return Fhr(e,t),e},khr=Qm&&Qm.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Qm,"__esModule",{value:!0});Qm.chooseStreamWrapper=void 0;var KY=GL();function Bhr(t){return khr(this,void 0,void 0,function*(){return KY.RUNTIME.type==="node"&&KY.RUNTIME.parsedVersion!=null&&KY.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>Mve(mpt()))).Node18UniversalStreamWrapper(t):KY.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>Mve(hpt()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>Mve(gpt()))).NodePre18StreamWrapper(t)})}Qm.chooseStreamWrapper=Bhr});var bpt=b(eF=>{"use strict";var $hr=eF&&eF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(eF,"__esModule",{value:!0});eF.getResponseBody=void 0;var qhr=ypt();function Uhr(t,e){return $hr(this,void 0,void 0,function*(){if(t.body!=null&&e==="blob")return yield t.blob();if(t.body!=null&&e==="sse")return t.body;if(t.body!=null&&e==="streaming")return(0,qhr.chooseStreamWrapper)(t.body);if(t.body!=null&&e==="text")return yield t.text();{let r=yield t.text();if(r.length>0)try{return JSON.parse(r)}catch{return{ok:!1,error:{reason:"non-json",statusCode:t.status,rawBody:r}}}else return}})}eF.getResponseBody=Uhr});var _pt=b(tF=>{"use strict";Object.defineProperty(tF,"__esModule",{value:!0});tF.anySignal=tF.getTimeoutSignal=void 0;var zhr="timeout";function Hhr(t){let e=new AbortController,r=setTimeout(()=>e.abort(zhr),t);return{signal:e.signal,abortId:r}}tF.getTimeoutSignal=Hhr;function Vhr(...t){let e=t.length===1&&Array.isArray(t[0])?t[0]:t,r=new AbortController;for(let n of e){if(n.aborted){r.abort(n?.reason);break}n.addEventListener("abort",()=>r.abort(n?.reason),{signal:r.signal})}return r.signal}tF.anySignal=Vhr});var wpt=b(rF=>{"use strict";var Whr=rF&&rF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(rF,"__esModule",{value:!0});rF.makeRequest=void 0;var vpt=_pt(),Khr=(t,e,r,n,o,i,a,s,u)=>Whr(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,vpt.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,vpt.anySignal)(l),f=yield t(e,{method:r,headers:n,body:o,signal:d,credentials:s?"include":void 0,duplex:u});return c!=null&&clearTimeout(c),f});rF.makeRequest=Khr});var Spt=b(nF=>{"use strict";var Jhr=nF&&nF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(nF,"__esModule",{value:!0});nF.requestWithRetries=void 0;var Ghr=1,Yhr=60,Zhr=2;function Xhr(t,e=Zhr){return Jhr(this,void 0,void 0,function*(){let r=yield t();for(let n=0;n<e&&([408,409,429].includes(r.status)||r.status>=500);++n){let o=Math.min(Ghr*Math.pow(2,n),Yhr);yield new Promise(i=>setTimeout(i,o)),r=yield t()}return r})}nF.requestWithRetries=Xhr});var Opt=b(CP=>{"use strict";var xpt=CP&&CP.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(CP,"__esModule",{value:!0});CP.fetcher=CP.fetcherImpl=void 0;var Qhr=apt(),egr=fpt(),tgr=ppt(),rgr=bpt(),ngr=wpt(),ogr=Spt();function Cpt(t){return xpt(this,void 0,void 0,function*(){let e={};if(t.body!==void 0&&t.contentType!=null&&(e["Content-Type"]=t.contentType),t.headers!=null)for(let[i,a]of Object.entries(t.headers))a!=null&&(e[i]=a);let r=(0,Qhr.createRequestUrl)(t.url,t.queryParameters),n=yield(0,tgr.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,egr.getFetchFn)();try{let i=yield(0,ogr.requestWithRetries)(()=>xpt(this,void 0,void 0,function*(){return(0,ngr.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,rgr.getResponseBody)(i,t.responseType);return i.status>=200&&i.status<400?{ok:!0,body:a,headers:i.headers}:{ok:!1,error:{reason:"status-code",statusCode:i.status,body:a}}}catch(i){return t.abortSignal!=null&&t.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"}}:i instanceof Error&&i.name==="AbortError"?{ok:!1,error:{reason:"timeout"}}:i instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:i.message}}:{ok:!1,error:{reason:"unknown",errorMessage:JSON.stringify(i)}}}})}CP.fetcherImpl=Cpt;CP.fetcher=Cpt});var Ept=b(JY=>{"use strict";Object.defineProperty(JY,"__esModule",{value:!0});JY.getHeader=void 0;function igr(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}JY.getHeader=igr});var Ppt=b(oF=>{"use strict";var agr=oF&&oF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(oF,"__esModule",{value:!0});oF.Supplier=void 0;oF.Supplier={get:t=>agr(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var Tpt=b(OP=>{"use strict";Object.defineProperty(OP,"__esModule",{value:!0});OP.Supplier=OP.getHeader=OP.fetcher=void 0;var sgr=Opt();Object.defineProperty(OP,"fetcher",{enumerable:!0,get:function(){return sgr.fetcher}});var ugr=Ept();Object.defineProperty(OP,"getHeader",{enumerable:!0,get:function(){return ugr.getHeader}});var lgr=Ppt();Object.defineProperty(OP,"Supplier",{enumerable:!0,get:function(){return lgr.Supplier}})});var Apt=b((Rve,jve)=>{(function(t,e){typeof Rve=="object"&&typeof jve<"u"?jve.exports=e():typeof define=="function"&&define.amd?define(e):function(){var r=t.Base64,n=e();n.noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n}()})(typeof self<"u"?self:typeof window<"u"||typeof window<"u"?window:Rve,function(){"use strict";var t="3.7.2",e=t,r=typeof atob=="function",n=typeof btoa=="function",o=typeof Buffer=="function",i=typeof TextDecoder=="function"?new TextDecoder:void 0,a=typeof TextEncoder=="function"?new TextEncoder:void 0,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=Array.prototype.slice.call(s),l=function(Y){var Q={};return Y.forEach(function(oe,Te){return Q[oe]=Te}),Q}(u),c=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,d=String.fromCharCode.bind(String),f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(Y,Q){return Q===void 0&&(Q=function(oe){return oe}),new Uint8Array(Array.prototype.slice.call(Y,0).map(Q))},p=function(Y){return Y.replace(/=/g,"").replace(/[+\/]/g,function(Q){return Q=="+"?"-":"_"})},m=function(Y){return Y.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(Y){for(var Q,oe,Te,bt,xe="",Z=Y.length%3,te=0;te<Y.length;){if((oe=Y.charCodeAt(te++))>255||(Te=Y.charCodeAt(te++))>255||(bt=Y.charCodeAt(te++))>255)throw new TypeError("invalid character found");Q=oe<<16|Te<<8|bt,xe+=u[Q>>18&63]+u[Q>>12&63]+u[Q>>6&63]+u[Q&63]}return Z?xe.slice(0,Z-3)+"===".substring(Z):xe},v=n?function(Y){return btoa(Y)}:o?function(Y){return Buffer.from(Y,"binary").toString("base64")}:h,g=o?function(Y){return Buffer.from(Y).toString("base64")}:function(Y){for(var Q=4096,oe=[],Te=0,bt=Y.length;Te<bt;Te+=Q)oe.push(d.apply(null,Y.subarray(Te,Te+Q)));return v(oe.join(""))},_=function(Y,Q){return Q===void 0&&(Q=!1),Q?p(g(Y)):g(Y)},w=function(Y){if(Y.length<2){var Q=Y.charCodeAt(0);return Q<128?Y:Q<2048?d(192|Q>>>6)+d(128|Q&63):d(224|Q>>>12&15)+d(128|Q>>>6&63)+d(128|Q&63)}else{var Q=65536+(Y.charCodeAt(0)-55296)*1024+(Y.charCodeAt(1)-56320);return d(240|Q>>>18&7)+d(128|Q>>>12&63)+d(128|Q>>>6&63)+d(128|Q&63)}},x=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,C=function(Y){return Y.replace(x,w)},P=o?function(Y){return Buffer.from(Y,"utf8").toString("base64")}:a?function(Y){return g(a.encode(Y))}:function(Y){return v(C(Y))},E=function(Y,Q){return Q===void 0&&(Q=!1),Q?p(P(Y)):P(Y)},A=function(Y){return E(Y,!0)},M=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,R=function(Y){switch(Y.length){case 4:var Q=(7&Y.charCodeAt(0))<<18|(63&Y.charCodeAt(1))<<12|(63&Y.charCodeAt(2))<<6|63&Y.charCodeAt(3),oe=Q-65536;return d((oe>>>10)+55296)+d((oe&1023)+56320);case 3:return d((15&Y.charCodeAt(0))<<12|(63&Y.charCodeAt(1))<<6|63&Y.charCodeAt(2));default:return d((31&Y.charCodeAt(0))<<6|63&Y.charCodeAt(1))}},N=function(Y){return Y.replace(M,R)},L=function(Y){if(Y=Y.replace(/\s+/g,""),!c.test(Y))throw new TypeError("malformed base64.");Y+="==".slice(2-(Y.length&3));for(var Q,oe="",Te,bt,xe=0;xe<Y.length;)Q=l[Y.charAt(xe++)]<<18|l[Y.charAt(xe++)]<<12|(Te=l[Y.charAt(xe++)])<<6|(bt=l[Y.charAt(xe++)]),oe+=Te===64?d(Q>>16&255):bt===64?d(Q>>16&255,Q>>8&255):d(Q>>16&255,Q>>8&255,Q&255);return oe},k=r?function(Y){return atob(m(Y))}:o?function(Y){return Buffer.from(Y,"base64").toString("binary")}:L,F=o?function(Y){return f(Buffer.from(Y,"base64"))}:function(Y){return f(k(Y),function(Q){return Q.charCodeAt(0)})},$=function(Y){return F(J(Y))},U=o?function(Y){return Buffer.from(Y,"base64").toString("utf8")}:i?function(Y){return i.decode(F(Y))}:function(Y){return N(k(Y))},J=function(Y){return m(Y.replace(/[-_]/g,function(Q){return Q=="-"?"+":"/"}))},V=function(Y){return U(J(Y))},j=function(Y){if(typeof Y!="string")return!1;var Q=Y.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(Q)||!/[^\s0-9a-zA-Z\-_]/.test(Q)},z=function(Y){return{value:Y,enumerable:!1,writable:!0,configurable:!0}},W=function(){var Y=function(Q,oe){return Object.defineProperty(String.prototype,Q,z(oe))};Y("fromBase64",function(){return V(this)}),Y("toBase64",function(Q){return E(this,Q)}),Y("toBase64URI",function(){return E(this,!0)}),Y("toBase64URL",function(){return E(this,!0)}),Y("toUint8Array",function(){return $(this)})},K=function(){var Y=function(Q,oe){return Object.defineProperty(Uint8Array.prototype,Q,z(oe))};Y("toBase64",function(Q){return _(this,Q)}),Y("toBase64URI",function(){return _(this,!0)}),Y("toBase64URL",function(){return _(this,!0)})},re=function(){W(),K()},De={version:t,VERSION:e,atob:k,atobPolyfill:L,btoa:v,btoaPolyfill:h,fromBase64:V,toBase64:E,encode:E,encodeURI:A,encodeURL:A,utob:C,btou:N,decode:V,isValid:j,fromUint8Array:_,toUint8Array:$,extendString:W,extendUint8Array:K,extendBuiltins:re};return De.Base64={},Object.keys(De).forEach(function(Y){return De.Base64[Y]=De[Y]}),De})});var Mpt=b(GY=>{"use strict";Object.defineProperty(GY,"__esModule",{value:!0});GY.BasicAuth=void 0;var Ipt=Apt(),cgr=/^Basic /i;GY.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${Ipt.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(cgr,""),r=Ipt.Base64.decode(e),[n,o]=r.split(":",2);if(n==null||o==null)throw new Error("Invalid basic auth");return{username:n,password:o}}}});var Rpt=b(YY=>{"use strict";Object.defineProperty(YY,"__esModule",{value:!0});YY.BearerToken=void 0;var dgr=/^Bearer /i;YY.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(dgr,"").trim()}});var jpt=b(iF=>{"use strict";Object.defineProperty(iF,"__esModule",{value:!0});iF.BearerToken=iF.BasicAuth=void 0;var fgr=Mpt();Object.defineProperty(iF,"BasicAuth",{enumerable:!0,get:function(){return fgr.BasicAuth}});var pgr=Rpt();Object.defineProperty(iF,"BearerToken",{enumerable:!0,get:function(){return pgr.BearerToken}})});var Nve=b(Ff=>{"use strict";var Dpt=Ff&&Ff.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Npt=Ff&&Ff.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}},Tg=Ff&&Ff.__await||function(t){return this instanceof Tg?(this.v=t,this):new Tg(t)},Lpt=Ff&&Ff.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof Tg?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){s("next",f)}function c(f){s("throw",f)}function d(f,p){f(p),i.shift(),i.length&&s(i[0][0],i[0][1])}};Object.defineProperty(Ff,"__esModule",{value:!0});Ff.readableStreamAsyncIterable=Ff.Stream=void 0;var mgr=GL(),hgr="data:",Dve=class{constructor({stream:e,parse:r,eventShape:n,signal:o}){this.controller=new AbortController,this.stream=e,this.parse=r,n.type==="sse"?(this.prefix=hgr,this.messageTerminator=`
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return Lpt(this,arguments,function*(){var r,n;this.controller.signal;let o=Fpt(this.stream),i="",a=!1;try{for(var s=Npt(o),u;u=yield Tg(s.next()),!u.done;){let l=u.value;i+=this.decodeChunk(l);let c;for(;(c=i.indexOf(this.messageTerminator))>=0;){let d=i.slice(0,c+1);if(i=i.slice(c+1),d.length===0)continue;if(!a&&this.prefix!=null){let p=d.indexOf(this.prefix);if(p===-1)continue;a=!0,d=d.slice(p+this.prefix.length)}if(this.streamTerminator!=null&&d.includes(this.streamTerminator))return yield Tg(void 0);let f=yield Tg(this.parse(JSON.parse(d)));yield yield Tg(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield Tg(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return Lpt(this,arguments,function*(){var r,n;try{for(var o=Npt(this.iterMessages()),i;i=yield Tg(o.next()),!i.done;){let a=i.value;yield yield Tg(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield Tg(n.call(o)))}finally{if(r)throw r.error}}})}decodeChunk(e){let r="";if(typeof TextDecoder<"u"){let n=new TextDecoder("utf8");r+=n.decode(e)}else mgr.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};Ff.Stream=Dve;function Fpt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return Dpt(this,void 0,void 0,function*(){try{let r=yield e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}})},return(){return Dpt(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Ff.readableStreamAsyncIterable=Fpt});var kpt=b(ZY=>{"use strict";Object.defineProperty(ZY,"__esModule",{value:!0});ZY.Stream=void 0;var ggr=Nve();Object.defineProperty(ZY,"Stream",{enumerable:!0,get:function(){return ggr.Stream}})});var qpt=b((hio,$pt)=>{"use strict";var Lve=Object.defineProperty,ygr=Object.getOwnPropertyDescriptor,bgr=Object.getOwnPropertyNames,_gr=Object.prototype.hasOwnProperty,vgr=(t,e)=>{for(var r in e)Lve(t,r,{get:e[r],enumerable:!0})},wgr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of bgr(e))!_gr.call(t,o)&&o!==r&&Lve(t,o,{get:()=>e[o],enumerable:!(n=ygr(e,o))||n.enumerable});return t},Sgr=t=>wgr(Lve({},"__esModule",{value:!0}),t),Bpt={};vgr(Bpt,{Blob:()=>Ogr,File:()=>Egr,FormData:()=>Cgr});$pt.exports=Sgr(Bpt);var xgr=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:Cgr,Blob:Ogr,File:Egr}=xgr});var emt=b((gio,Qpt)=>{"use strict";var Bve=Object.defineProperty,Pgr=Object.getOwnPropertyDescriptor,Tgr=Object.getOwnPropertyNames,Agr=Object.prototype.hasOwnProperty,Igr=(t,e)=>{for(var r in e)Bve(t,r,{get:e[r],enumerable:!0})},Mgr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Tgr(e))!Agr.call(t,o)&&o!==r&&Bve(t,o,{get:()=>e[o],enumerable:!(n=Pgr(e,o))||n.enumerable});return t},Rgr=t=>Mgr(Bve({},"__esModule",{value:!0}),t),$ve=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},La=(t,e,r)=>($ve(t,e,"read from private field"),r?r.call(t):e.get(t)),Eb=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},u4=(t,e,r,n)=>($ve(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),Fve=(t,e,r)=>($ve(t,e,"access private method"),r),Jpt={};Igr(Jpt,{FormDataEncoder:()=>$gr,isFile:()=>cR,isFormData:()=>Zpt});Qpt.exports=Rgr(Jpt);var Kx=t=>typeof t=="function",jgr=t=>Kx(t[Symbol.asyncIterator]),Upt=65536;function*Gpt(t){if(t.byteLength<=Upt){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,Upt),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*Dgr(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*zpt(t){for await(let e of t)yield*Gpt(e)}var Ngr=t=>{if(jgr(t))return zpt(t);if(Kx(t.getReader))return zpt(Dgr(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},Hpt="abcdefghijklmnopqrstuvwxyz0123456789";function Lgr(){let t=16,e="";for(;t--;)e+=Hpt[Math.random()*Hpt.length<<0];return e}var Ypt=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
`||e===`
`&&n[r-1]!=="\r"?`\r
`:e),Fgr=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function Vpt(t){if(Fgr(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function Wpt(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var kgr=t=>new Proxy(t,{get:(e,r)=>Wpt(e,r),has:(e,r)=>Wpt(e,r)!==void 0}),Zpt=t=>!!(t&&Kx(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&Kx(t.append)&&Kx(t.getAll)&&Kx(t.entries)&&Kx(t[Symbol.iterator])),Kpt=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),cR=t=>!!(t&&typeof t=="object"&&Kx(t.constructor)&&t[Symbol.toStringTag]==="File"&&Kx(t.stream)&&t.name!=null),Bgr={enableAdditionalHeaders:!1},XY={writable:!1,configurable:!1},EP,l4,QY,c4,lR,d4,f4,eZ,tZ,qve,kve,Xpt,$gr=class{constructor(t,e,r){if(Eb(this,tZ),Eb(this,kve),Eb(this,EP,`\r
`),Eb(this,l4,void 0),Eb(this,QY,void 0),Eb(this,c4,"-".repeat(2)),Eb(this,lR,new TextEncoder),Eb(this,d4,void 0),Eb(this,f4,void 0),Eb(this,eZ,void 0),!Zpt(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(Vpt(e)?r=e:n=e,n||(n=Lgr()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!Vpt(r))throw new TypeError("Expected options argument to be an object.");u4(this,f4,Array.from(t.entries())),u4(this,eZ,{...Bgr,...r}),u4(this,l4,La(this,lR).encode(La(this,EP))),u4(this,QY,La(this,l4).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,u4(this,d4,La(this,lR).encode(`${La(this,c4)}${this.boundary}${La(this,c4)}${La(this,EP).repeat(2)}`));let o={"Content-Type":this.contentType},i=Fve(this,kve,Xpt).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=kgr(Object.freeze(o)),Object.defineProperties(this,{boundary:XY,contentType:XY,contentLength:XY,headers:XY})}*values(){for(let[t,e]of La(this,f4)){let r=cR(e)?e:La(this,lR).encode(Ypt(e));yield Fve(this,tZ,qve).call(this,t,r),yield r,yield La(this,l4)}yield La(this,d4)}async*encode(){for(let t of this.values())cR(t)?yield*Ngr(t.stream()):yield*Gpt(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};EP=new WeakMap;l4=new WeakMap;QY=new WeakMap;c4=new WeakMap;lR=new WeakMap;d4=new WeakMap;f4=new WeakMap;eZ=new WeakMap;tZ=new WeakSet;qve=function(t,e){let r="";if(r+=`${La(this,c4)}${this.boundary}${La(this,EP)}`,r+=`Content-Disposition: form-data; name="${Kpt(t)}"`,cR(e)&&(r+=`; filename="${Kpt(e.name)}"${La(this,EP)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),La(this,eZ).enableAdditionalHeaders===!0){let n=cR(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${La(this,EP)}Content-Length: ${n}`)}return La(this,lR).encode(`${r}${La(this,EP).repeat(2)}`)};kve=new WeakSet;Xpt=function(){let t=0;for(let[e,r]of La(this,f4)){let n=cR(r)?r:La(this,lR).encode(Ypt(r)),o=cR(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=Fve(this,tZ,qve).call(this,e,n).byteLength,t+=o,t+=La(this,QY)}return String(t+La(this,d4).byteLength)}});var rmt=b((bio,tmt)=>{tmt.exports=typeof self=="object"?self.FormData:window.FormData});var nmt=b(Pl=>{"use strict";var qgr=Pl&&Pl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ugr=Pl&&Pl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aF=Pl&&Pl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qgr(e,t,r);return Ugr(e,t),e},PP=Pl&&Pl.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(Pl,"__esModule",{value:!0});Pl.WebFormData=Pl.Node16FormData=Pl.Node18FormData=Pl.newFormData=void 0;var rZ=GL();function Uve(t){return typeof t=="object"&&t!=null&&"name"in t}function zgr(){return PP(this,void 0,void 0,function*(){let t;return rZ.RUNTIME.type==="node"&&rZ.RUNTIME.parsedVersion!=null&&rZ.RUNTIME.parsedVersion>=18?t=new nZ:rZ.RUNTIME.type==="node"?t=new oZ:t=new iZ,yield t.setup(),t})}Pl.newFormData=zgr;var nZ=class{setup(){return PP(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>aF(qpt()))).FormData})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){var o,i;return PP(this,void 0,void 0,function*(){n==null&&Uve(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>aF(Y2()))).Readable?(o=this.fd)===null||o===void 0||o.append(e,{type:void 0,name:n,[Symbol.toStringTag]:"File",stream(){return r}}):(i=this.fd)===null||i===void 0||i.append(e,r,n)})}getRequest(){return PP(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>aF(emt()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>aF(Y2()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};Pl.Node18FormData=nZ;var oZ=class{setup(){return PP(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>aF(rmt()))).default})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){var o,i;return PP(this,void 0,void 0,function*(){n==null&&Uve(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>aF(Y2()))).Readable?a=r:a=Buffer.from(yield r.arrayBuffer()),n==null?(o=this.fd)===null||o===void 0||o.append(e,a):(i=this.fd)===null||i===void 0||i.append(e,a,{filename:n})})}getRequest(){return{body:this.fd,headers:this.fd?this.fd.getHeaders():{}}}};Pl.Node16FormData=oZ;var iZ=class{setup(){return PP(this,void 0,void 0,function*(){this.fd=new FormData})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){var o;return PP(this,void 0,void 0,function*(){n==null&&Uve(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};Pl.WebFormData=iZ});var omt=b(dR=>{"use strict";var Hgr=dR&&dR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vgr=dR&&dR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hgr(e,t,r)};Object.defineProperty(dR,"__esModule",{value:!0});Vgr(nmt(),dR)});var uc=b(aZ=>{"use strict";Object.defineProperty(aZ,"__esModule",{value:!0});aZ.SchemaType=void 0;aZ.SchemaType={DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"}});var kf=b(sZ=>{"use strict";Object.defineProperty(sZ,"__esModule",{value:!0});sZ.getErrorMessageForIncorrectType=void 0;function Wgr(t,e){return`Expected ${e}. Received ${Kgr(t)}.`}sZ.getErrorMessageForIncorrectType=Wgr;function Kgr(t){if(Array.isArray(t))return"list";if(t===null)return"null";switch(typeof t){case"string":return`"${t}"`;case"number":case"boolean":case"undefined":return`${t}`}return typeof t}});var Jx=b(uZ=>{"use strict";Object.defineProperty(uZ,"__esModule",{value:!0});uZ.maybeSkipValidation=void 0;function Jgr(t){return Object.assign(Object.assign({},t),{json:imt(t.json),parse:imt(t.parse)})}uZ.maybeSkipValidation=Jgr;function imt(t){return(e,r)=>{let n=t(e,r),{skipValidation:o=!1}=r??{};return!n.ok&&o?(console.warn(["Failed to validate.",...n.errors.map(i=>" - "+(i.path.length>0?`${i.path.join(".")}: ${i.message}`:i.message))].join(`
`)),{ok:!0,value:e}):n}}});var zve=b(lZ=>{"use strict";Object.defineProperty(lZ,"__esModule",{value:!0});lZ.stringifyValidationError=void 0;function Ggr(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}lZ.stringifyValidationError=Ggr});var Vve=b(cZ=>{"use strict";Object.defineProperty(cZ,"__esModule",{value:!0});cZ.JsonError=void 0;var Ygr=zve(),Hve=class t extends Error{constructor(e){super(e.map(Ygr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};cZ.JsonError=Hve});var Kve=b(dZ=>{"use strict";Object.defineProperty(dZ,"__esModule",{value:!0});dZ.ParseError=void 0;var Zgr=zve(),Wve=class t extends Error{constructor(e){super(e.map(Zgr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};dZ.ParseError=Wve});var umt=b(TP=>{"use strict";Object.defineProperty(TP,"__esModule",{value:!0});TP.transform=TP.optional=TP.getSchemaUtils=void 0;var Xgr=uc(),Qgr=Vve(),eyr=Kve();function Jve(t){return{optional:()=>amt(t),transform:e=>smt(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new eyr.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new Qgr.JsonError(n.errors)}}}TP.getSchemaUtils=Jve;function amt(t){let e={parse:(r,n)=>r==null?{ok:!0,value:void 0}:t.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:t.json(r,n),getType:()=>Xgr.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),Jve(e))}TP.optional=amt;function smt(t,e){let r={parse:(n,o)=>{let i=t.parse(n,o);return i.ok?{ok:!0,value:e.transform(i.value)}:i},json:(n,o)=>{let i=e.untransform(n);return t.json(i,o)},getType:()=>t.getType()};return Object.assign(Object.assign({},r),Jve(r))}TP.transform=smt});var Lp=b(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.ParseError=eh.JsonError=eh.transform=eh.optional=eh.getSchemaUtils=void 0;var Gve=umt();Object.defineProperty(eh,"getSchemaUtils",{enumerable:!0,get:function(){return Gve.getSchemaUtils}});Object.defineProperty(eh,"optional",{enumerable:!0,get:function(){return Gve.optional}});Object.defineProperty(eh,"transform",{enumerable:!0,get:function(){return Gve.transform}});var tyr=Vve();Object.defineProperty(eh,"JsonError",{enumerable:!0,get:function(){return tyr.JsonError}});var ryr=Kve();Object.defineProperty(eh,"ParseError",{enumerable:!0,get:function(){return ryr.ParseError}})});var lmt=b(fZ=>{"use strict";Object.defineProperty(fZ,"__esModule",{value:!0});fZ.date=void 0;var nyr=uc(),Yve=kf(),oyr=Jx(),iyr=Lp(),ayr=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function syr(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,Yve.getErrorMessageForIncorrectType)(e,"string")}]}:ayr.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,Yve.getErrorMessageForIncorrectType)(e,"ISO 8601 date string")}]},json:(e,{breadcrumbsPrefix:r=[]}={})=>e instanceof Date?{ok:!0,value:e.toISOString()}:{ok:!1,errors:[{path:r,message:(0,Yve.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>nyr.SchemaType.DATE};return Object.assign(Object.assign({},(0,oyr.maybeSkipValidation)(t)),(0,iyr.getSchemaUtils)(t))}fZ.date=syr});var cmt=b(pZ=>{"use strict";Object.defineProperty(pZ,"__esModule",{value:!0});pZ.date=void 0;var uyr=lmt();Object.defineProperty(pZ,"date",{enumerable:!0,get:function(){return uyr.date}})});var Gx=b(mZ=>{"use strict";Object.defineProperty(mZ,"__esModule",{value:!0});mZ.createIdentitySchemaCreator=void 0;var lyr=Lp(),cyr=Jx();function dyr(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,cyr.maybeSkipValidation)(r)),(0,lyr.getSchemaUtils)(r))}}mZ.createIdentitySchemaCreator=dyr});var fmt=b(hZ=>{"use strict";Object.defineProperty(hZ,"__esModule",{value:!0});hZ.enum_=void 0;var fyr=uc(),pyr=Gx(),dmt=kf();function myr(t){let e=new Set(t);return(0,pyr.createIdentitySchemaCreator)(fyr.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,dmt.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,dmt.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}hZ.enum_=myr});var Zve=b(gZ=>{"use strict";Object.defineProperty(gZ,"__esModule",{value:!0});gZ.enum_=void 0;var hyr=fmt();Object.defineProperty(gZ,"enum_",{enumerable:!0,get:function(){return hyr.enum_}})});var Xve=b(AP=>{"use strict";Object.defineProperty(AP,"__esModule",{value:!0});AP.getMemoizedSchema=AP.constructLazyBaseSchema=AP.lazy=void 0;var gyr=Lp();function yyr(t){let e=pmt(t);return Object.assign(Object.assign({},e),(0,gyr.getSchemaUtils)(e))}AP.lazy=yyr;function pmt(t){return{parse:(e,r)=>yZ(t).parse(e,r),json:(e,r)=>yZ(t).json(e,r),getType:()=>yZ(t).getType()}}AP.constructLazyBaseSchema=pmt;function yZ(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}AP.getMemoizedSchema=yZ});var Qve=b(bZ=>{"use strict";Object.defineProperty(bZ,"__esModule",{value:!0});bZ.entries=void 0;function byr(t){return Object.entries(t)}bZ.entries=byr});var e0e=b(_Z=>{"use strict";Object.defineProperty(_Z,"__esModule",{value:!0});_Z.filterObject=void 0;function _yr(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}_Z.filterObject=_yr});var p4=b(vZ=>{"use strict";Object.defineProperty(vZ,"__esModule",{value:!0});vZ.isPlainObject=void 0;function vyr(t){if(typeof t!="object"||t===null)return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}vZ.isPlainObject=vyr});var t0e=b(wZ=>{"use strict";Object.defineProperty(wZ,"__esModule",{value:!0});wZ.keys=void 0;function wyr(t){return Object.keys(t)}wZ.keys=wyr});var mmt=b(SZ=>{"use strict";Object.defineProperty(SZ,"__esModule",{value:!0});SZ.partition=void 0;function Syr(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}SZ.partition=Syr});var ymt=b(sF=>{"use strict";Object.defineProperty(sF,"__esModule",{value:!0});sF.withParsedProperties=sF.getObjectLikeUtils=void 0;var xyr=e0e(),Cyr=kf(),Oyr=p4(),Eyr=Lp();function hmt(t){return{withParsedProperties:e=>gmt(t,e)}}sF.getObjectLikeUtils=hmt;function gmt(t,e){let r={parse:(n,o)=>{let i=t.parse(n,o);if(!i.ok)return i;let a=Object.entries(e).reduce((s,[u,l])=>Object.assign(Object.assign({},s),{[u]:typeof l=="function"?l(i.value):l}),{});return{ok:!0,value:Object.assign(Object.assign({},i.value),a)}},json:(n,o)=>{var i;if(!(0,Oyr.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,Cyr.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,xyr.filterObject)(n,Object.keys(n).filter(u=>!a.has(u)));return t.json(s,o)},getType:()=>t.getType()};return Object.assign(Object.assign(Object.assign({},r),(0,Eyr.getSchemaUtils)(r)),hmt(r))}sF.withParsedProperties=gmt});var m4=b(uF=>{"use strict";Object.defineProperty(uF,"__esModule",{value:!0});uF.withParsedProperties=uF.getObjectLikeUtils=void 0;var bmt=ymt();Object.defineProperty(uF,"getObjectLikeUtils",{enumerable:!0,get:function(){return bmt.getObjectLikeUtils}});Object.defineProperty(uF,"withParsedProperties",{enumerable:!0,get:function(){return bmt.withParsedProperties}})});var r0e=b(lF=>{"use strict";Object.defineProperty(lF,"__esModule",{value:!0});lF.isProperty=lF.property=void 0;function Pyr(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}lF.property=Pyr;function Tyr(t){return t.isProperty}lF.isProperty=Tyr});var o0e=b(cF=>{"use strict";Object.defineProperty(cF,"__esModule",{value:!0});cF.getObjectUtils=cF.object=void 0;var g4=uc(),_mt=Qve(),vmt=e0e(),Ayr=kf(),Iyr=p4(),Cmt=t0e(),Myr=Jx(),Ryr=mmt(),Omt=m4(),Emt=Lp(),h4=r0e();function jyr(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,h4.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,Cmt.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,_mt.entries)(t)){let u=(0,h4.isProperty)(s)?s.rawKey:a,l=(0,h4.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,xmt(l)&&i.push(u)}return wmt({value:r,requiredKeys:i,getProperty:a=>{let s=o[a];if(s!=null)return{transformedKey:s.parsedKey,transform:u=>{var l;return s.valueSchema.parse(u,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(l=n?.breadcrumbsPrefix)!==null&&l!==void 0?l:[],a]}))}}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let o=[];for(let[i,a]of(0,_mt.entries)(t)){let s=(0,h4.isProperty)(a)?a.valueSchema:a;xmt(s)&&o.push(i)}return wmt({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,h4.isProperty)(a)?{transformedKey:a.rawKey,transform:s=>{var u;return a.valueSchema.json(s,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(u=n?.breadcrumbsPrefix)!==null&&u!==void 0?u:[],i]}))}}:{transformedKey:i,transform:s=>{var u;return a.json(s,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(u=n?.breadcrumbsPrefix)!==null&&u!==void 0?u:[],i]}))}}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>g4.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,Myr.maybeSkipValidation)(e)),(0,Emt.getSchemaUtils)(e)),(0,Omt.getObjectLikeUtils)(e)),n0e(e))}cF.object=jyr;function wmt({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,Iyr.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,Ayr.getErrorMessageForIncorrectType)(t,"object")}]};let a=new Set(e),s=[],u={};for(let[l,c]of Object.entries(t)){let d=r(l);if(d!=null){a.delete(l);let f=d.transform(c);f.ok?u[d.transformedKey]=f.value:(u[l]=c,s.push(...f.errors))}else switch(n){case"fail":s.push({path:[...i,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=c;break}}return s.push(...e.filter(l=>a.has(l)).map(l=>({path:i,message:`Missing required key "${l}"`}))),s.length===0||o?{ok:!0,value:u}:{ok:!1,errors:s}}function n0e(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>Smt({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>Smt({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>g4.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,Emt.getSchemaUtils)(r)),(0,Omt.getObjectLikeUtils)(r)),n0e(r))}}}cF.getObjectUtils=n0e;function Smt({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,Ryr.partition)((0,Cmt.keys)(e),l=>o.has(l)),s=r((0,vmt.filterObject)(e,a)),u=n((0,vmt.filterObject)(e,i));return s.ok&&u.ok?{ok:!0,value:Object.assign(Object.assign({},s.value),u.value)}:{ok:!1,errors:[...s.ok?[]:s.errors,...u.ok?[]:u.errors]}}function xmt(t){return!Dyr(t)}function Dyr(t){switch(t.getType()){case g4.SchemaType.ANY:case g4.SchemaType.UNKNOWN:case g4.SchemaType.OPTIONAL:return!0;default:return!1}}});var Pmt=b(xZ=>{"use strict";Object.defineProperty(xZ,"__esModule",{value:!0});xZ.objectWithoutOptionalProperties=void 0;var Nyr=o0e();function Lyr(t){return(0,Nyr.object)(t)}xZ.objectWithoutOptionalProperties=Lyr});var i0e=b(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.property=th.isProperty=th.objectWithoutOptionalProperties=th.object=th.getObjectUtils=void 0;var Tmt=o0e();Object.defineProperty(th,"getObjectUtils",{enumerable:!0,get:function(){return Tmt.getObjectUtils}});Object.defineProperty(th,"object",{enumerable:!0,get:function(){return Tmt.object}});var Fyr=Pmt();Object.defineProperty(th,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return Fyr.objectWithoutOptionalProperties}});var Amt=r0e();Object.defineProperty(th,"isProperty",{enumerable:!0,get:function(){return Amt.isProperty}});Object.defineProperty(th,"property",{enumerable:!0,get:function(){return Amt.property}})});var Imt=b(CZ=>{"use strict";Object.defineProperty(CZ,"__esModule",{value:!0});CZ.lazyObject=void 0;var kyr=i0e(),Byr=m4(),$yr=Lp(),a0e=Xve();function qyr(t){let e=Object.assign(Object.assign({},(0,a0e.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,a0e.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,a0e.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,$yr.getSchemaUtils)(e)),(0,Byr.getObjectLikeUtils)(e)),(0,kyr.getObjectUtils)(e))}CZ.lazyObject=qyr});var Mmt=b(dF=>{"use strict";Object.defineProperty(dF,"__esModule",{value:!0});dF.lazyObject=dF.lazy=void 0;var Uyr=Xve();Object.defineProperty(dF,"lazy",{enumerable:!0,get:function(){return Uyr.lazy}});var zyr=Imt();Object.defineProperty(dF,"lazyObject",{enumerable:!0,get:function(){return zyr.lazyObject}})});var jmt=b(OZ=>{"use strict";Object.defineProperty(OZ,"__esModule",{value:!0});OZ.list=void 0;var Hyr=uc(),Vyr=kf(),Wyr=Jx(),Kyr=Lp();function Jyr(t){let e={parse:(r,n)=>Rmt(r,(o,i)=>{var a;return t.parse(o,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(a=n?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`[${i}]`]}))}),json:(r,n)=>Rmt(r,(o,i)=>{var a;return t.json(o,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(a=n?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`[${i}]`]}))}),getType:()=>Hyr.SchemaType.LIST};return Object.assign(Object.assign({},(0,Wyr.maybeSkipValidation)(e)),(0,Kyr.getSchemaUtils)(e))}OZ.list=Jyr;function Rmt(t,e){return Array.isArray(t)?t.map((n,o)=>e(n,o)).reduce((n,o)=>{if(n.ok&&o.ok)return{ok:!0,value:[...n.value,o.value]};let i=[];return n.ok||i.push(...n.errors),o.ok||i.push(...o.errors),{ok:!1,errors:i}},{ok:!0,value:[]}):{ok:!1,errors:[{message:(0,Vyr.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var s0e=b(EZ=>{"use strict";Object.defineProperty(EZ,"__esModule",{value:!0});EZ.list=void 0;var Gyr=jmt();Object.defineProperty(EZ,"list",{enumerable:!0,get:function(){return Gyr.list}})});var Dmt=b(PZ=>{"use strict";Object.defineProperty(PZ,"__esModule",{value:!0});PZ.stringLiteral=void 0;var Yyr=uc(),Zyr=Gx(),Xyr=kf();function Qyr(t){return(0,Zyr.createIdentitySchemaCreator)(Yyr.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,Xyr.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}PZ.stringLiteral=Qyr});var Nmt=b(TZ=>{"use strict";Object.defineProperty(TZ,"__esModule",{value:!0});TZ.booleanLiteral=void 0;var ebr=uc(),tbr=Gx(),rbr=kf();function nbr(t){return(0,tbr.createIdentitySchemaCreator)(ebr.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,rbr.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}TZ.booleanLiteral=nbr});var Lmt=b(fF=>{"use strict";Object.defineProperty(fF,"__esModule",{value:!0});fF.booleanLiteral=fF.stringLiteral=void 0;var obr=Dmt();Object.defineProperty(fF,"stringLiteral",{enumerable:!0,get:function(){return obr.stringLiteral}});var ibr=Nmt();Object.defineProperty(fF,"booleanLiteral",{enumerable:!0,get:function(){return ibr.booleanLiteral}})});var Fmt=b(AZ=>{"use strict";Object.defineProperty(AZ,"__esModule",{value:!0});AZ.any=void 0;var abr=uc(),sbr=Gx();AZ.any=(0,sbr.createIdentitySchemaCreator)(abr.SchemaType.ANY,t=>({ok:!0,value:t}))});var kmt=b(IZ=>{"use strict";Object.defineProperty(IZ,"__esModule",{value:!0});IZ.boolean=void 0;var ubr=uc(),lbr=Gx(),cbr=kf();IZ.boolean=(0,lbr.createIdentitySchemaCreator)(ubr.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,cbr.getErrorMessageForIncorrectType)(t,"boolean")}]})});var Bmt=b(MZ=>{"use strict";Object.defineProperty(MZ,"__esModule",{value:!0});MZ.number=void 0;var dbr=uc(),fbr=Gx(),pbr=kf();MZ.number=(0,fbr.createIdentitySchemaCreator)(dbr.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,pbr.getErrorMessageForIncorrectType)(t,"number")}]})});var $mt=b(RZ=>{"use strict";Object.defineProperty(RZ,"__esModule",{value:!0});RZ.string=void 0;var mbr=uc(),hbr=Gx(),gbr=kf();RZ.string=(0,hbr.createIdentitySchemaCreator)(mbr.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,gbr.getErrorMessageForIncorrectType)(t,"string")}]})});var qmt=b(jZ=>{"use strict";Object.defineProperty(jZ,"__esModule",{value:!0});jZ.unknown=void 0;var ybr=uc(),bbr=Gx();jZ.unknown=(0,bbr.createIdentitySchemaCreator)(ybr.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var Umt=b(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.unknown=rh.string=rh.number=rh.boolean=rh.any=void 0;var _br=Fmt();Object.defineProperty(rh,"any",{enumerable:!0,get:function(){return _br.any}});var vbr=kmt();Object.defineProperty(rh,"boolean",{enumerable:!0,get:function(){return vbr.boolean}});var wbr=Bmt();Object.defineProperty(rh,"number",{enumerable:!0,get:function(){return wbr.number}});var Sbr=$mt();Object.defineProperty(rh,"string",{enumerable:!0,get:function(){return Sbr.string}});var xbr=qmt();Object.defineProperty(rh,"unknown",{enumerable:!0,get:function(){return xbr.unknown}})});var Hmt=b(DZ=>{"use strict";Object.defineProperty(DZ,"__esModule",{value:!0});DZ.record=void 0;var u0e=uc(),Cbr=Qve(),Obr=kf(),Ebr=p4(),Pbr=Jx(),Tbr=Lp();function Abr(t,e){let r={parse:(n,o)=>zmt({value:n,isKeyNumeric:t.getType()===u0e.SchemaType.NUMBER,transformKey:i=>{var a;return t.parse(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`${i} (key)`]}))},transformValue:(i,a)=>{var s;return e.parse(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`${a}`]}))},breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(n,o)=>zmt({value:n,isKeyNumeric:t.getType()===u0e.SchemaType.NUMBER,transformKey:i=>{var a;return t.json(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],`${i} (key)`]}))},transformValue:(i,a)=>{var s;return e.json(i,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],`${a}`]}))},breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>u0e.SchemaType.RECORD};return Object.assign(Object.assign({},(0,Pbr.maybeSkipValidation)(r)),(0,Tbr.getSchemaUtils)(r))}DZ.record=Abr;function zmt({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,Ebr.isPlainObject)(t)?(0,Cbr.entries)(t).reduce((i,[a,s])=>{if(s==null)return i;let u=i,l=a;if(e){let p=a.length>0?Number(a):NaN;isNaN(p)||(l=p)}let c=r(l),d=n(s,l);if(u.ok&&c.ok&&d.ok)return{ok:!0,value:Object.assign(Object.assign({},u.value),{[c.value]:d.value})};let f=[];return u.ok||f.push(...u.errors),c.ok||f.push(...c.errors),d.ok||f.push(...d.errors),{ok:!1,errors:f}},{ok:!0,value:{}}):{ok:!1,errors:[{path:o,message:(0,Obr.getErrorMessageForIncorrectType)(t,"object")}]}}});var Vmt=b(NZ=>{"use strict";Object.defineProperty(NZ,"__esModule",{value:!0});NZ.record=void 0;var Ibr=Hmt();Object.defineProperty(NZ,"record",{enumerable:!0,get:function(){return Ibr.record}})});var Wmt=b(LZ=>{"use strict";Object.defineProperty(LZ,"__esModule",{value:!0});LZ.set=void 0;var Mbr=uc(),Rbr=kf(),jbr=Jx(),Dbr=s0e(),Nbr=Lp();function Lbr(t){let e=(0,Dbr.list)(t),r={parse:(n,o)=>{let i=e.parse(n,o);return i.ok?{ok:!0,value:new Set(i.value)}:i},json:(n,o)=>{var i;return n instanceof Set?e.json([...n],o):{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,Rbr.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>Mbr.SchemaType.SET};return Object.assign(Object.assign({},(0,jbr.maybeSkipValidation)(r)),(0,Nbr.getSchemaUtils)(r))}LZ.set=Lbr});var Kmt=b(FZ=>{"use strict";Object.defineProperty(FZ,"__esModule",{value:!0});FZ.set=void 0;var Fbr=Wmt();Object.defineProperty(FZ,"set",{enumerable:!0,get:function(){return Fbr.set}})});var Gmt=b(kZ=>{"use strict";Object.defineProperty(kZ,"__esModule",{value:!0});kZ.undiscriminatedUnion=void 0;var kbr=uc(),Bbr=Jx(),$br=Lp();function qbr(t){let e={parse:(r,n)=>Jmt((o,i)=>o.parse(r,i),t,n),json:(r,n)=>Jmt((o,i)=>o.json(r,i),t,n),getType:()=>kbr.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,Bbr.maybeSkipValidation)(e)),(0,$br.getSchemaUtils)(e))}kZ.undiscriminatedUnion=qbr;function Jmt(t,e,r){let n=[];for(let[o,i]of e.entries()){let a=t(i,Object.assign(Object.assign({},r),{skipValidation:!1}));if(a.ok)return a;for(let s of a.errors)n.push({path:s.path,message:`[Variant ${o}] ${s.message}`})}return{ok:!1,errors:n}}});var Ymt=b(BZ=>{"use strict";Object.defineProperty(BZ,"__esModule",{value:!0});BZ.undiscriminatedUnion=void 0;var Ubr=Gmt();Object.defineProperty(BZ,"undiscriminatedUnion",{enumerable:!0,get:function(){return Ubr.undiscriminatedUnion}})});var Zmt=b($Z=>{"use strict";Object.defineProperty($Z,"__esModule",{value:!0});$Z.discriminant=void 0;function zbr(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}$Z.discriminant=zbr});var Qmt=b(pF=>{"use strict";var Hbr=pF&&pF.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r};Object.defineProperty(pF,"__esModule",{value:!0});pF.union=void 0;var Vbr=uc(),Wbr=kf(),Kbr=p4(),Jbr=t0e(),Gbr=Jx(),Ybr=Zve(),Zbr=m4(),Xbr=Lp();function Qbr(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,Ybr.enum_)((0,Jbr.keys)(e)),i={parse:(a,s)=>Xmt({value:a,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>{var l;return o.parse(u,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(l=s?.breadcrumbsPrefix)!==null&&l!==void 0?l:[],r]})},getAdditionalPropertiesSchema:u=>e[u],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,l)=>l.parse(u,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(a,s)=>Xmt({value:a,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>{var l;return o.json(u,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(l=s?.breadcrumbsPrefix)!==null&&l!==void 0?l:[],n]})},getAdditionalPropertiesSchema:u=>e[u],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,l)=>l.json(u,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>Vbr.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,Gbr.maybeSkipValidation)(i)),(0,Xbr.getSchemaUtils)(i)),(0,Zbr.getObjectLikeUtils)(i))}pF.union=Qbr;function Xmt({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,Kbr.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,Wbr.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=Hbr(u,[typeof l=="symbol"?l:l+""]);if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${e}")`}]};let f=n(c);if(!f.ok)return{ok:!1,errors:f.errors};let p=o(f.value);if(p==null)return i?{ok:!0,value:Object.assign({[r]:f.value},d)}:{ok:!1,errors:[{path:[...s,e],message:"Unexpected discriminant value"}]};let m=a(d,p);return m.ok?{ok:!0,value:Object.assign({[r]:c},m.value)}:m}});var eht=b(mF=>{"use strict";Object.defineProperty(mF,"__esModule",{value:!0});mF.union=mF.discriminant=void 0;var e_r=Zmt();Object.defineProperty(mF,"discriminant",{enumerable:!0,get:function(){return e_r.discriminant}});var t_r=Qmt();Object.defineProperty(mF,"union",{enumerable:!0,get:function(){return t_r.union}})});var tht=b(el=>{"use strict";var r_r=el&&el.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fp=el&&el.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&r_r(e,t,r)};Object.defineProperty(el,"__esModule",{value:!0});Fp(cmt(),el);Fp(Zve(),el);Fp(Mmt(),el);Fp(s0e(),el);Fp(Lmt(),el);Fp(i0e(),el);Fp(m4(),el);Fp(Umt(),el);Fp(Vmt(),el);Fp(Lp(),el);Fp(Kmt(),el);Fp(Ymt(),el);Fp(eht(),el)});var rht=b(fR=>{"use strict";var n_r=fR&&fR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o_r=fR&&fR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&n_r(e,t,r)};Object.defineProperty(fR,"__esModule",{value:!0});o_r(tht(),fR)});var q=b(lc=>{"use strict";var nht=lc&&lc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i_r=lc&&lc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y4=lc&&lc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nht(e,t,r)},a_r=lc&&lc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nht(e,t,r);return i_r(e,t),e};Object.defineProperty(lc,"__esModule",{value:!0});lc.serialization=void 0;y4(Tpt(),lc);y4(jpt(),lc);y4(kpt(),lc);y4(GL(),lc);y4(omt(),lc);lc.serialization=a_r(rht())});var iht=b(gs=>{"use strict";var b4=gs&&gs.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},_4=gs&&gs.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}},Yi=gs&&gs.__await||function(t){return this instanceof Yi?(this.v=t,this):new Yi(t)},v4=gs&&gs.__asyncGenerator||function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof Yi?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){s("next",f)}function c(f){s("throw",f)}function d(f,p){f(p),i.shift(),i.length&&s(i[0][0],i[0][1])}};Object.defineProperty(gs,"__esModule",{value:!0});gs.readableStreamAsyncIterable=gs._decodeChunks=gs.LineDecoder=gs._iterSSEMessages=gs.StreamUtils=void 0;var hF=Xa(),l0e=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return v4(this,arguments,function*(){var a,s;if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let u=!1;try{try{for(var l=_4(oht(e,r)),c;c=yield Yi(l.next()),!c.done;){let d=c.value;if(!u){if(d.data.startsWith("[DONE]")){u=!0;continue}if(d.event===null){let f;try{f=JSON.parse(d.data)}catch(p){throw console.error("Could not parse message into JSON:",d.data),console.error("From chunk:",d.raw),p}if(f&&f.error)throw new hF.CohereError({message:`Error: ${f.error}`});yield yield Yi(f)}else{let f;try{f=JSON.parse(d.data)}catch(p){throw console.error("Could not parse message into JSON:",d.data),console.error("From chunk:",d.raw),p}if(d.event=="error")throw new hF.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield Yi({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield Yi(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield Yi(void 0);throw d}finally{u||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return v4(this,arguments,function*(){var s,u;let l=new IP,c=d0e(e);try{for(var d=_4(c),f;f=yield Yi(d.next()),!f.done;){let p=f.value;for(let m of l.decode(p))yield yield Yi(m)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield Yi(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield Yi(p)})}function i(){return v4(this,arguments,function*(){var s,u;if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let l=!1;try{try{for(var c=_4(o()),d;d=yield Yi(c.next()),!d.done;){let f=d.value;l||f&&(yield yield Yi(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield Yi(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield Yi(void 0);throw f}finally{l||r?.abort()}})}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new ReadableStream({start(){return b4(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return b4(this,void 0,void 0,function*(){try{let{value:i,done:a}=yield r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}})},cancel(){var o;return b4(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};gs.StreamUtils=l0e;function oht(t,e){return v4(this,arguments,function*(){var n,o;if(!t.body)throw e?.abort(),new hF.CohereError({message:"Attempted to iterate over a response with no body"});let i=new c0e,a=new IP,s=d0e(t.body);try{for(var u=_4(s_r(s)),l;l=yield Yi(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield Yi(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield Yi(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield Yi(d))}})}gs._iterSSEMessages=oht;function s_r(t){return v4(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=_4(t),a;a=yield Yi(i.next()),!a.done;){let s=a.value;if(s==null)continue;let u=s instanceof ArrayBuffer?new Uint8Array(s):typeof s=="string"?new TextEncoder().encode(s):s,l=new Uint8Array(o.length+u.length);l.set(o),l.set(u,o.length),o=l;let c;for(;(c=u_r(o))!==-1;)yield yield Yi(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield Yi(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield Yi(o))})}function u_r(t){for(let n=0;n<t.length-2;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var c0e=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=c_r(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},IP=class t{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=t.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(t.NEWLINE_REGEXP);return n&&o.pop(),o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){var r;if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new hF.CohereError({message:`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`})}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return(r=this.textDecoder)!==null&&r!==void 0||(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new hF.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new hF.CohereError({message:"Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error."})}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}};gs.LineDecoder=IP;IP.NEWLINE_CHARS=new Set([`
`,"\r"]);IP.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function l_r(t){let e=new IP,r=[];for(let n of t)r.push(...e.decode(n));return r}gs._decodeChunks=l_r;function c_r(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function d0e(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return b4(this,void 0,void 0,function*(){try{let r=yield e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}})},return(){return b4(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}gs.readableStreamAsyncIterable=d0e});var f0e=b(Pb=>{"use strict";var d_r=Pb&&Pb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f_r=Pb&&Pb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p_r=Pb&&Pb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&d_r(e,t,r);return f_r(e,t),e};Object.defineProperty(Pb,"__esModule",{value:!0});Pb.V2ChatStreamRequestCitationMode=void 0;var m_r=p_r(q());Pb.V2ChatStreamRequestCitationMode=m_r.serialization.enum_(["FAST","ACCURATE","OFF"])});var p0e=b(Tb=>{"use strict";var h_r=Tb&&Tb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g_r=Tb&&Tb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y_r=Tb&&Tb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h_r(e,t,r);return g_r(e,t),e};Object.defineProperty(Tb,"__esModule",{value:!0});Tb.V2ChatRequestCitationMode=void 0;var b_r=y_r(q());Tb.V2ChatRequestCitationMode=b_r.serialization.enum_(["FAST","ACCURATE","OFF"])});var gF=b(Ab=>{"use strict";var __r=Ab&&Ab.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v_r=Ab&&Ab.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w_r=Ab&&Ab.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&__r(e,t,r);return v_r(e,t),e};Object.defineProperty(Ab,"__esModule",{value:!0});Ab.TextContent=void 0;var aht=w_r(q());Ab.TextContent=aht.serialization.object({text:aht.serialization.string()})});var m0e=b(Ib=>{"use strict";var S_r=Ib&&Ib.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x_r=Ib&&Ib.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C_r=Ib&&Ib.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&S_r(e,t,r);return x_r(e,t),e};Object.defineProperty(Ib,"__esModule",{value:!0});Ib.Content=void 0;var O_r=C_r(q()),E_r=gF();Ib.Content=O_r.serialization.union("type",{text:E_r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var g0e=b(Mb=>{"use strict";var P_r=Mb&&Mb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T_r=Mb&&Mb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A_r=Mb&&Mb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P_r(e,t,r);return T_r(e,t),e};Object.defineProperty(Mb,"__esModule",{value:!0});Mb.UserMessageContent=void 0;var h0e=A_r(q()),I_r=m0e();Mb.UserMessageContent=h0e.serialization.undiscriminatedUnion([h0e.serialization.string(),h0e.serialization.list(I_r.Content)])});var pR=b(Rb=>{"use strict";var M_r=Rb&&Rb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R_r=Rb&&Rb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j_r=Rb&&Rb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M_r(e,t,r);return R_r(e,t),e};Object.defineProperty(Rb,"__esModule",{value:!0});Rb.ChatDocument=void 0;var y0e=j_r(q());Rb.ChatDocument=y0e.serialization.record(y0e.serialization.string(),y0e.serialization.string())});var b0e=b(jb=>{"use strict";var D_r=jb&&jb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N_r=jb&&jb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L_r=jb&&jb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&D_r(e,t,r);return N_r(e,t),e};Object.defineProperty(jb,"__esModule",{value:!0});jb.UserMessage=void 0;var sht=L_r(q()),F_r=g0e(),k_r=pR();jb.UserMessage=sht.serialization.object({content:F_r.UserMessageContent,documents:sht.serialization.list(k_r.ChatDocument).optional()})});var v0e=b(Db=>{"use strict";var B_r=Db&&Db.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$_r=Db&&Db.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q_r=Db&&Db.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&B_r(e,t,r);return $_r(e,t),e};Object.defineProperty(Db,"__esModule",{value:!0});Db.ToolCall2Function=void 0;var _0e=q_r(q());Db.ToolCall2Function=_0e.serialization.object({name:_0e.serialization.string().optional(),arguments:_0e.serialization.string().optional()})});var qZ=b(Nb=>{"use strict";var U_r=Nb&&Nb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z_r=Nb&&Nb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H_r=Nb&&Nb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&U_r(e,t,r);return z_r(e,t),e};Object.defineProperty(Nb,"__esModule",{value:!0});Nb.ToolCall2=void 0;var w0e=H_r(q()),V_r=v0e();Nb.ToolCall2=w0e.serialization.object({id:w0e.serialization.string().optional(),type:w0e.serialization.stringLiteral("function").optional(),function:V_r.ToolCall2Function.optional()})});var S0e=b(Lb=>{"use strict";var W_r=Lb&&Lb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K_r=Lb&&Lb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J_r=Lb&&Lb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&W_r(e,t,r);return K_r(e,t),e};Object.defineProperty(Lb,"__esModule",{value:!0});Lb.ToolSource=void 0;var yF=J_r(q());Lb.ToolSource=yF.serialization.object({id:yF.serialization.string().optional(),toolOutput:yF.serialization.property("tool_output",yF.serialization.record(yF.serialization.string(),yF.serialization.unknown()).optional())})});var x0e=b(Fb=>{"use strict";var G_r=Fb&&Fb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y_r=Fb&&Fb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z_r=Fb&&Fb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G_r(e,t,r);return Y_r(e,t),e};Object.defineProperty(Fb,"__esModule",{value:!0});Fb.DocumentSource=void 0;var w4=Z_r(q());Fb.DocumentSource=w4.serialization.object({id:w4.serialization.string().optional(),document:w4.serialization.record(w4.serialization.string(),w4.serialization.unknown()).optional()})});var C0e=b(kb=>{"use strict";var X_r=kb&&kb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q_r=kb&&kb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),evr=kb&&kb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X_r(e,t,r);return Q_r(e,t),e};Object.defineProperty(kb,"__esModule",{value:!0});kb.Source=void 0;var tvr=evr(q()),rvr=S0e(),nvr=x0e();kb.Source=tvr.serialization.union("type",{tool:rvr.ToolSource,document:nvr.DocumentSource}).transform({transform:t=>t,untransform:t=>t})});var x4=b(Bb=>{"use strict";var ovr=Bb&&Bb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ivr=Bb&&Bb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),avr=Bb&&Bb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ovr(e,t,r);return ivr(e,t),e};Object.defineProperty(Bb,"__esModule",{value:!0});Bb.Citation=void 0;var S4=avr(q()),svr=C0e();Bb.Citation=S4.serialization.object({start:S4.serialization.number().optional(),end:S4.serialization.number().optional(),text:S4.serialization.string().optional(),sources:S4.serialization.list(svr.Source).optional()})});var O0e=b($b=>{"use strict";var uvr=$b&&$b.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lvr=$b&&$b.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cvr=$b&&$b.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uvr(e,t,r);return lvr(e,t),e};Object.defineProperty($b,"__esModule",{value:!0});$b.AssistantMessageContentItem=void 0;var dvr=cvr(q()),fvr=gF();$b.AssistantMessageContentItem=dvr.serialization.union("type",{text:fvr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var P0e=b(qb=>{"use strict";var pvr=qb&&qb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mvr=qb&&qb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hvr=qb&&qb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pvr(e,t,r);return mvr(e,t),e};Object.defineProperty(qb,"__esModule",{value:!0});qb.AssistantMessageContent=void 0;var E0e=hvr(q()),gvr=O0e();qb.AssistantMessageContent=E0e.serialization.undiscriminatedUnion([E0e.serialization.string(),E0e.serialization.list(gvr.AssistantMessageContentItem)])});var T0e=b(Ub=>{"use strict";var yvr=Ub&&Ub.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bvr=Ub&&Ub.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_vr=Ub&&Ub.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yvr(e,t,r);return bvr(e,t),e};Object.defineProperty(Ub,"__esModule",{value:!0});Ub.AssistantMessage=void 0;var bF=_vr(q()),vvr=qZ(),wvr=P0e(),Svr=x4();Ub.AssistantMessage=bF.serialization.object({toolCalls:bF.serialization.property("tool_calls",bF.serialization.list(vvr.ToolCall2).optional()),toolPlan:bF.serialization.property("tool_plan",bF.serialization.string().optional()),content:wvr.AssistantMessageContent.optional(),citations:bF.serialization.list(Svr.Citation).optional()})});var A0e=b(zb=>{"use strict";var xvr=zb&&zb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cvr=zb&&zb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ovr=zb&&zb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xvr(e,t,r);return Cvr(e,t),e};Object.defineProperty(zb,"__esModule",{value:!0});zb.SystemMessageContentItem=void 0;var Evr=Ovr(q()),Pvr=gF();zb.SystemMessageContentItem=Evr.serialization.union("type",{text:Pvr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var M0e=b(Hb=>{"use strict";var Tvr=Hb&&Hb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Avr=Hb&&Hb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ivr=Hb&&Hb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tvr(e,t,r);return Avr(e,t),e};Object.defineProperty(Hb,"__esModule",{value:!0});Hb.SystemMessageContent=void 0;var I0e=Ivr(q()),Mvr=A0e();Hb.SystemMessageContent=I0e.serialization.undiscriminatedUnion([I0e.serialization.string(),I0e.serialization.list(Mvr.SystemMessageContentItem)])});var R0e=b(Vb=>{"use strict";var Rvr=Vb&&Vb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jvr=Vb&&Vb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dvr=Vb&&Vb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rvr(e,t,r);return jvr(e,t),e};Object.defineProperty(Vb,"__esModule",{value:!0});Vb.SystemMessage=void 0;var Nvr=Dvr(q()),Lvr=M0e();Vb.SystemMessage=Nvr.serialization.object({content:Lvr.SystemMessageContent})});var j0e=b(Wb=>{"use strict";var Fvr=Wb&&Wb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kvr=Wb&&Wb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bvr=Wb&&Wb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fvr(e,t,r);return kvr(e,t),e};Object.defineProperty(Wb,"__esModule",{value:!0});Wb.ToolContent=void 0;var UZ=Bvr(q());Wb.ToolContent=UZ.serialization.object({output:UZ.serialization.record(UZ.serialization.string(),UZ.serialization.unknown())})});var D0e=b(Kb=>{"use strict";var $vr=Kb&&Kb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qvr=Kb&&Kb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uvr=Kb&&Kb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$vr(e,t,r);return qvr(e,t),e};Object.defineProperty(Kb,"__esModule",{value:!0});Kb.ToolMessage2ToolContentItem=void 0;var zvr=Uvr(q()),Hvr=j0e();Kb.ToolMessage2ToolContentItem=zvr.serialization.union("type",{tool_result_object:Hvr.ToolContent}).transform({transform:t=>t,untransform:t=>t})});var N0e=b(Jb=>{"use strict";var Vvr=Jb&&Jb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wvr=Jb&&Jb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kvr=Jb&&Jb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vvr(e,t,r);return Wvr(e,t),e};Object.defineProperty(Jb,"__esModule",{value:!0});Jb.ToolMessage2=void 0;var C4=Kvr(q()),Jvr=D0e();Jb.ToolMessage2=C4.serialization.object({toolCallId:C4.serialization.property("tool_call_id",C4.serialization.string()),toolContent:C4.serialization.property("tool_content",C4.serialization.list(Jvr.ToolMessage2ToolContentItem))})});var L0e=b(Gb=>{"use strict";var Gvr=Gb&&Gb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yvr=Gb&&Gb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zvr=Gb&&Gb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gvr(e,t,r);return Yvr(e,t),e};Object.defineProperty(Gb,"__esModule",{value:!0});Gb.ChatMessage2=void 0;var Xvr=Zvr(q()),Qvr=b0e(),e0r=T0e(),t0r=R0e(),r0r=N0e();Gb.ChatMessage2=Xvr.serialization.union("role",{user:Qvr.UserMessage,assistant:e0r.AssistantMessage,system:t0r.SystemMessage,tool:r0r.ToolMessage2}).transform({transform:t=>t,untransform:t=>t})});var zZ=b(Yb=>{"use strict";var n0r=Yb&&Yb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o0r=Yb&&Yb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i0r=Yb&&Yb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&n0r(e,t,r);return o0r(e,t),e};Object.defineProperty(Yb,"__esModule",{value:!0});Yb.ChatMessages=void 0;var a0r=i0r(q()),s0r=L0e();Yb.ChatMessages=a0r.serialization.list(s0r.ChatMessage2)});var F0e=b(Zb=>{"use strict";var u0r=Zb&&Zb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l0r=Zb&&Zb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c0r=Zb&&Zb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u0r(e,t,r);return l0r(e,t),e};Object.defineProperty(Zb,"__esModule",{value:!0});Zb.Tool2Function=void 0;var _F=c0r(q());Zb.Tool2Function=_F.serialization.object({name:_F.serialization.string().optional(),description:_F.serialization.string().optional(),parameters:_F.serialization.record(_F.serialization.string(),_F.serialization.unknown()).optional()})});var HZ=b(Xb=>{"use strict";var d0r=Xb&&Xb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f0r=Xb&&Xb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p0r=Xb&&Xb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&d0r(e,t,r);return f0r(e,t),e};Object.defineProperty(Xb,"__esModule",{value:!0});Xb.Tool2=void 0;var uht=p0r(q()),m0r=F0e();Xb.Tool2=uht.serialization.object({type:uht.serialization.stringLiteral("function").optional(),function:m0r.Tool2Function.optional()})});var VZ=b(Qb=>{"use strict";var h0r=Qb&&Qb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g0r=Qb&&Qb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y0r=Qb&&Qb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h0r(e,t,r);return g0r(e,t),e};Object.defineProperty(Qb,"__esModule",{value:!0});Qb.ChatFinishReason=void 0;var b0r=y0r(q());Qb.ChatFinishReason=b0r.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var k0e=b(e_=>{"use strict";var _0r=e_&&e_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v0r=e_&&e_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w0r=e_&&e_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_0r(e,t,r);return v0r(e,t),e};Object.defineProperty(e_,"__esModule",{value:!0});e_.AssistantMessageResponseContentItem=void 0;var S0r=w0r(q()),x0r=gF();e_.AssistantMessageResponseContentItem=S0r.serialization.union("type",{text:x0r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var B0e=b(t_=>{"use strict";var C0r=t_&&t_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O0r=t_&&t_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E0r=t_&&t_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C0r(e,t,r);return O0r(e,t),e};Object.defineProperty(t_,"__esModule",{value:!0});t_.AssistantMessageResponse=void 0;var MP=E0r(q()),P0r=qZ(),T0r=k0e(),A0r=x4();t_.AssistantMessageResponse=MP.serialization.object({role:MP.serialization.stringLiteral("assistant"),toolCalls:MP.serialization.property("tool_calls",MP.serialization.list(P0r.ToolCall2).optional()),toolPlan:MP.serialization.property("tool_plan",MP.serialization.string().optional()),content:MP.serialization.list(T0r.AssistantMessageResponseContentItem).optional(),citations:MP.serialization.list(A0r.Citation).optional()})});var $0e=b(r_=>{"use strict";var I0r=r_&&r_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M0r=r_&&r_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R0r=r_&&r_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&I0r(e,t,r);return M0r(e,t),e};Object.defineProperty(r_,"__esModule",{value:!0});r_.UsageBilledUnits=void 0;var RP=R0r(q());r_.UsageBilledUnits=RP.serialization.object({inputTokens:RP.serialization.property("input_tokens",RP.serialization.number().optional()),outputTokens:RP.serialization.property("output_tokens",RP.serialization.number().optional()),searchUnits:RP.serialization.property("search_units",RP.serialization.number().optional()),classifications:RP.serialization.number().optional()})});var q0e=b(n_=>{"use strict";var j0r=n_&&n_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D0r=n_&&n_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N0r=n_&&n_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&j0r(e,t,r);return D0r(e,t),e};Object.defineProperty(n_,"__esModule",{value:!0});n_.UsageTokens=void 0;var O4=N0r(q());n_.UsageTokens=O4.serialization.object({inputTokens:O4.serialization.property("input_tokens",O4.serialization.number().optional()),outputTokens:O4.serialization.property("output_tokens",O4.serialization.number().optional())})});var WZ=b(o_=>{"use strict";var L0r=o_&&o_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F0r=o_&&o_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k0r=o_&&o_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L0r(e,t,r);return F0r(e,t),e};Object.defineProperty(o_,"__esModule",{value:!0});o_.Usage=void 0;var lht=k0r(q()),B0r=$0e(),$0r=q0e();o_.Usage=lht.serialization.object({billedUnits:lht.serialization.property("billed_units",B0r.UsageBilledUnits.optional()),tokens:$0r.UsageTokens.optional()})});var cht=b(i_=>{"use strict";var q0r=i_&&i_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U0r=i_&&i_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z0r=i_&&i_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q0r(e,t,r);return U0r(e,t),e};Object.defineProperty(i_,"__esModule",{value:!0});i_.NonStreamedChatResponse2=void 0;var KZ=z0r(q()),H0r=VZ(),V0r=B0e(),W0r=WZ();i_.NonStreamedChatResponse2=KZ.serialization.object({id:KZ.serialization.string(),finishReason:KZ.serialization.property("finish_reason",H0r.ChatFinishReason),prompt:KZ.serialization.string().optional(),message:V0r.AssistantMessageResponse.optional(),usage:W0r.Usage.optional()})});var kp=b(a_=>{"use strict";var K0r=a_&&a_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J0r=a_&&a_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G0r=a_&&a_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K0r(e,t,r);return J0r(e,t),e};Object.defineProperty(a_,"__esModule",{value:!0});a_.ChatStreamEventType=void 0;var Y0r=G0r(q());a_.ChatStreamEventType=Y0r.serialization.object({})});var U0e=b(s_=>{"use strict";var Z0r=s_&&s_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X0r=s_&&s_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q0r=s_&&s_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Z0r(e,t,r);return X0r(e,t),e};Object.defineProperty(s_,"__esModule",{value:!0});s_.ChatMessageStartEventDeltaMessage=void 0;var dht=Q0r(q());s_.ChatMessageStartEventDeltaMessage=dht.serialization.object({role:dht.serialization.stringLiteral("assistant").optional()})});var z0e=b(u_=>{"use strict";var ewr=u_&&u_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),twr=u_&&u_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rwr=u_&&u_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ewr(e,t,r);return twr(e,t),e};Object.defineProperty(u_,"__esModule",{value:!0});u_.ChatMessageStartEventDelta=void 0;var nwr=rwr(q()),owr=U0e();u_.ChatMessageStartEventDelta=nwr.serialization.object({message:owr.ChatMessageStartEventDeltaMessage.optional()})});var H0e=b(l_=>{"use strict";var iwr=l_&&l_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),awr=l_&&l_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),swr=l_&&l_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iwr(e,t,r);return awr(e,t),e};Object.defineProperty(l_,"__esModule",{value:!0});l_.ChatMessageStartEvent=void 0;var fht=swr(q()),uwr=z0e(),lwr=kp();l_.ChatMessageStartEvent=fht.serialization.object({id:fht.serialization.string().optional(),delta:uwr.ChatMessageStartEventDelta.optional()}).extend(lwr.ChatStreamEventType)});var W0e=b(c_=>{"use strict";var cwr=c_&&c_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dwr=c_&&c_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fwr=c_&&c_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cwr(e,t,r);return dwr(e,t),e};Object.defineProperty(c_,"__esModule",{value:!0});c_.ChatContentStartEventDeltaMessageContent=void 0;var V0e=fwr(q());c_.ChatContentStartEventDeltaMessageContent=V0e.serialization.object({text:V0e.serialization.string().optional(),type:V0e.serialization.stringLiteral("text").optional()})});var K0e=b(d_=>{"use strict";var pwr=d_&&d_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mwr=d_&&d_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hwr=d_&&d_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pwr(e,t,r);return mwr(e,t),e};Object.defineProperty(d_,"__esModule",{value:!0});d_.ChatContentStartEventDeltaMessage=void 0;var gwr=hwr(q()),ywr=W0e();d_.ChatContentStartEventDeltaMessage=gwr.serialization.object({content:ywr.ChatContentStartEventDeltaMessageContent.optional()})});var J0e=b(f_=>{"use strict";var bwr=f_&&f_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_wr=f_&&f_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vwr=f_&&f_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bwr(e,t,r);return _wr(e,t),e};Object.defineProperty(f_,"__esModule",{value:!0});f_.ChatContentStartEventDelta=void 0;var wwr=vwr(q()),Swr=K0e();f_.ChatContentStartEventDelta=wwr.serialization.object({message:Swr.ChatContentStartEventDeltaMessage.optional()})});var G0e=b(p_=>{"use strict";var xwr=p_&&p_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cwr=p_&&p_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Owr=p_&&p_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xwr(e,t,r);return Cwr(e,t),e};Object.defineProperty(p_,"__esModule",{value:!0});p_.ChatContentStartEvent=void 0;var pht=Owr(q()),Ewr=J0e(),Pwr=kp();p_.ChatContentStartEvent=pht.serialization.object({index:pht.serialization.number().optional(),delta:Ewr.ChatContentStartEventDelta.optional()}).extend(Pwr.ChatStreamEventType)});var Y0e=b(m_=>{"use strict";var Twr=m_&&m_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Awr=m_&&m_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iwr=m_&&m_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Twr(e,t,r);return Awr(e,t),e};Object.defineProperty(m_,"__esModule",{value:!0});m_.ChatContentDeltaEventDeltaMessageContent=void 0;var mht=Iwr(q());m_.ChatContentDeltaEventDeltaMessageContent=mht.serialization.object({text:mht.serialization.string().optional()})});var Z0e=b(h_=>{"use strict";var Mwr=h_&&h_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Rwr=h_&&h_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jwr=h_&&h_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Mwr(e,t,r);return Rwr(e,t),e};Object.defineProperty(h_,"__esModule",{value:!0});h_.ChatContentDeltaEventDeltaMessage=void 0;var Dwr=jwr(q()),Nwr=Y0e();h_.ChatContentDeltaEventDeltaMessage=Dwr.serialization.object({content:Nwr.ChatContentDeltaEventDeltaMessageContent.optional()})});var X0e=b(g_=>{"use strict";var Lwr=g_&&g_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fwr=g_&&g_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kwr=g_&&g_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lwr(e,t,r);return Fwr(e,t),e};Object.defineProperty(g_,"__esModule",{value:!0});g_.ChatContentDeltaEventDelta=void 0;var Bwr=kwr(q()),$wr=Z0e();g_.ChatContentDeltaEventDelta=Bwr.serialization.object({message:$wr.ChatContentDeltaEventDeltaMessage.optional()})});var Q0e=b(y_=>{"use strict";var qwr=y_&&y_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Uwr=y_&&y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zwr=y_&&y_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qwr(e,t,r);return Uwr(e,t),e};Object.defineProperty(y_,"__esModule",{value:!0});y_.ChatContentDeltaEvent=void 0;var hht=zwr(q()),Hwr=X0e(),Vwr=kp();y_.ChatContentDeltaEvent=hht.serialization.object({index:hht.serialization.number().optional(),delta:Hwr.ChatContentDeltaEventDelta.optional()}).extend(Vwr.ChatStreamEventType)});var ewe=b(b_=>{"use strict";var Wwr=b_&&b_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kwr=b_&&b_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jwr=b_&&b_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Wwr(e,t,r);return Kwr(e,t),e};Object.defineProperty(b_,"__esModule",{value:!0});b_.ChatContentEndEvent=void 0;var ght=Jwr(q()),Gwr=kp();b_.ChatContentEndEvent=ght.serialization.object({index:ght.serialization.number().optional()}).extend(Gwr.ChatStreamEventType)});var rwe=b(__=>{"use strict";var Ywr=__&&__.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zwr=__&&__.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xwr=__&&__.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ywr(e,t,r);return Zwr(e,t),e};Object.defineProperty(__,"__esModule",{value:!0});__.ChatToolPlanDeltaEventDelta=void 0;var twe=Xwr(q());__.ChatToolPlanDeltaEventDelta=twe.serialization.object({toolPlan:twe.serialization.property("tool_plan",twe.serialization.string().optional())})});var nwe=b(v_=>{"use strict";var Qwr=v_&&v_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eSr=v_&&v_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tSr=v_&&v_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Qwr(e,t,r);return eSr(e,t),e};Object.defineProperty(v_,"__esModule",{value:!0});v_.ChatToolPlanDeltaEvent=void 0;var rSr=tSr(q()),nSr=rwe(),oSr=kp();v_.ChatToolPlanDeltaEvent=rSr.serialization.object({delta:nSr.ChatToolPlanDeltaEventDelta.optional()}).extend(oSr.ChatStreamEventType)});var iwe=b(w_=>{"use strict";var iSr=w_&&w_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aSr=w_&&w_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sSr=w_&&w_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iSr(e,t,r);return aSr(e,t),e};Object.defineProperty(w_,"__esModule",{value:!0});w_.ChatToolCallStartEventDeltaToolCallFunction=void 0;var owe=sSr(q());w_.ChatToolCallStartEventDeltaToolCallFunction=owe.serialization.object({name:owe.serialization.string().optional(),arguments:owe.serialization.string().optional()})});var swe=b(S_=>{"use strict";var uSr=S_&&S_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lSr=S_&&S_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cSr=S_&&S_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uSr(e,t,r);return lSr(e,t),e};Object.defineProperty(S_,"__esModule",{value:!0});S_.ChatToolCallStartEventDeltaToolCall=void 0;var awe=cSr(q()),dSr=iwe();S_.ChatToolCallStartEventDeltaToolCall=awe.serialization.object({id:awe.serialization.string().optional(),type:awe.serialization.stringLiteral("function").optional(),function:dSr.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var uwe=b(x_=>{"use strict";var fSr=x_&&x_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pSr=x_&&x_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mSr=x_&&x_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fSr(e,t,r);return pSr(e,t),e};Object.defineProperty(x_,"__esModule",{value:!0});x_.ChatToolCallStartEventDelta=void 0;var yht=mSr(q()),hSr=swe();x_.ChatToolCallStartEventDelta=yht.serialization.object({toolCall:yht.serialization.property("tool_call",hSr.ChatToolCallStartEventDeltaToolCall.optional())})});var lwe=b(C_=>{"use strict";var gSr=C_&&C_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ySr=C_&&C_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bSr=C_&&C_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gSr(e,t,r);return ySr(e,t),e};Object.defineProperty(C_,"__esModule",{value:!0});C_.ChatToolCallStartEvent=void 0;var bht=bSr(q()),_Sr=uwe(),vSr=kp();C_.ChatToolCallStartEvent=bht.serialization.object({index:bht.serialization.number().optional(),delta:_Sr.ChatToolCallStartEventDelta.optional()}).extend(vSr.ChatStreamEventType)});var cwe=b(O_=>{"use strict";var wSr=O_&&O_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SSr=O_&&O_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xSr=O_&&O_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wSr(e,t,r);return SSr(e,t),e};Object.defineProperty(O_,"__esModule",{value:!0});O_.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var _ht=xSr(q());O_.ChatToolCallDeltaEventDeltaToolCallFunction=_ht.serialization.object({arguments:_ht.serialization.string().optional()})});var dwe=b(E_=>{"use strict";var CSr=E_&&E_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OSr=E_&&E_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ESr=E_&&E_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CSr(e,t,r);return OSr(e,t),e};Object.defineProperty(E_,"__esModule",{value:!0});E_.ChatToolCallDeltaEventDeltaToolCall=void 0;var PSr=ESr(q()),TSr=cwe();E_.ChatToolCallDeltaEventDeltaToolCall=PSr.serialization.object({function:TSr.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var fwe=b(P_=>{"use strict";var ASr=P_&&P_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ISr=P_&&P_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MSr=P_&&P_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ASr(e,t,r);return ISr(e,t),e};Object.defineProperty(P_,"__esModule",{value:!0});P_.ChatToolCallDeltaEventDelta=void 0;var vht=MSr(q()),RSr=dwe();P_.ChatToolCallDeltaEventDelta=vht.serialization.object({toolCall:vht.serialization.property("tool_call",RSr.ChatToolCallDeltaEventDeltaToolCall.optional())})});var pwe=b(T_=>{"use strict";var jSr=T_&&T_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DSr=T_&&T_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NSr=T_&&T_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jSr(e,t,r);return DSr(e,t),e};Object.defineProperty(T_,"__esModule",{value:!0});T_.ChatToolCallDeltaEvent=void 0;var wht=NSr(q()),LSr=fwe(),FSr=kp();T_.ChatToolCallDeltaEvent=wht.serialization.object({index:wht.serialization.number().optional(),delta:LSr.ChatToolCallDeltaEventDelta.optional()}).extend(FSr.ChatStreamEventType)});var mwe=b(A_=>{"use strict";var kSr=A_&&A_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BSr=A_&&A_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Sr=A_&&A_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kSr(e,t,r);return BSr(e,t),e};Object.defineProperty(A_,"__esModule",{value:!0});A_.ChatToolCallEndEvent=void 0;var Sht=$Sr(q()),qSr=kp();A_.ChatToolCallEndEvent=Sht.serialization.object({index:Sht.serialization.number().optional()}).extend(qSr.ChatStreamEventType)});var hwe=b(I_=>{"use strict";var USr=I_&&I_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zSr=I_&&I_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HSr=I_&&I_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&USr(e,t,r);return zSr(e,t),e};Object.defineProperty(I_,"__esModule",{value:!0});I_.ChatMessageEndEventDelta=void 0;var xht=HSr(q()),VSr=VZ(),WSr=WZ();I_.ChatMessageEndEventDelta=xht.serialization.object({finishReason:xht.serialization.property("finish_reason",VSr.ChatFinishReason.optional()),usage:WSr.Usage.optional()})});var gwe=b(M_=>{"use strict";var KSr=M_&&M_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JSr=M_&&M_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GSr=M_&&M_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KSr(e,t,r);return JSr(e,t),e};Object.defineProperty(M_,"__esModule",{value:!0});M_.ChatMessageEndEvent=void 0;var Cht=GSr(q()),YSr=hwe(),ZSr=kp();M_.ChatMessageEndEvent=Cht.serialization.object({id:Cht.serialization.string().optional(),delta:YSr.ChatMessageEndEventDelta.optional()}).extend(ZSr.ChatStreamEventType)});var ywe=b(R_=>{"use strict";var XSr=R_&&R_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QSr=R_&&R_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),exr=R_&&R_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XSr(e,t,r);return QSr(e,t),e};Object.defineProperty(R_,"__esModule",{value:!0});R_.CitationStartEventDeltaMessage=void 0;var txr=exr(q()),rxr=x4();R_.CitationStartEventDeltaMessage=txr.serialization.object({citations:rxr.Citation.optional()})});var bwe=b(j_=>{"use strict";var nxr=j_&&j_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oxr=j_&&j_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ixr=j_&&j_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nxr(e,t,r);return oxr(e,t),e};Object.defineProperty(j_,"__esModule",{value:!0});j_.CitationStartEventDelta=void 0;var axr=ixr(q()),sxr=ywe();j_.CitationStartEventDelta=axr.serialization.object({message:sxr.CitationStartEventDeltaMessage.optional()})});var _we=b(D_=>{"use strict";var uxr=D_&&D_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lxr=D_&&D_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cxr=D_&&D_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uxr(e,t,r);return lxr(e,t),e};Object.defineProperty(D_,"__esModule",{value:!0});D_.CitationStartEvent=void 0;var Oht=cxr(q()),dxr=bwe(),fxr=kp();D_.CitationStartEvent=Oht.serialization.object({index:Oht.serialization.number().optional(),delta:dxr.CitationStartEventDelta.optional()}).extend(fxr.ChatStreamEventType)});var vwe=b(N_=>{"use strict";var pxr=N_&&N_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mxr=N_&&N_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hxr=N_&&N_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pxr(e,t,r);return mxr(e,t),e};Object.defineProperty(N_,"__esModule",{value:!0});N_.CitationEndEvent=void 0;var Eht=hxr(q()),gxr=kp();N_.CitationEndEvent=Eht.serialization.object({index:Eht.serialization.number().optional()}).extend(gxr.ChatStreamEventType)});var Pht=b(L_=>{"use strict";var yxr=L_&&L_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bxr=L_&&L_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_xr=L_&&L_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yxr(e,t,r);return bxr(e,t),e};Object.defineProperty(L_,"__esModule",{value:!0});L_.StreamedChatResponse2=void 0;var vxr=_xr(q()),wxr=H0e(),Sxr=G0e(),xxr=Q0e(),Cxr=ewe(),Oxr=nwe(),Exr=lwe(),Pxr=pwe(),Txr=mwe(),Axr=_we(),Ixr=vwe(),Mxr=gwe();L_.StreamedChatResponse2=vxr.serialization.union("type",{"message-start":wxr.ChatMessageStartEvent,"content-start":Sxr.ChatContentStartEvent,"content-delta":xxr.ChatContentDeltaEvent,"content-end":Cxr.ChatContentEndEvent,"tool-plan-delta":Oxr.ChatToolPlanDeltaEvent,"tool-call-start":Exr.ChatToolCallStartEvent,"tool-call-delta":Pxr.ChatToolCallDeltaEvent,"tool-call-end":Txr.ChatToolCallEndEvent,"citation-start":Axr.CitationStartEvent,"citation-end":Ixr.CitationEndEvent,"message-end":Mxr.ChatMessageEndEvent}).transform({transform:t=>t,untransform:t=>t})});var wwe=b(yt=>{"use strict";var Rxr=yt&&yt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tt=yt&&yt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Rxr(e,t,r)};Object.defineProperty(yt,"__esModule",{value:!0});Tt(f0e(),yt);Tt(p0e(),yt);Tt(gF(),yt);Tt(m0e(),yt);Tt(g0e(),yt);Tt(b0e(),yt);Tt(v0e(),yt);Tt(qZ(),yt);Tt(S0e(),yt);Tt(x0e(),yt);Tt(C0e(),yt);Tt(x4(),yt);Tt(O0e(),yt);Tt(P0e(),yt);Tt(T0e(),yt);Tt(A0e(),yt);Tt(M0e(),yt);Tt(R0e(),yt);Tt(j0e(),yt);Tt(D0e(),yt);Tt(N0e(),yt);Tt(L0e(),yt);Tt(zZ(),yt);Tt(F0e(),yt);Tt(HZ(),yt);Tt(VZ(),yt);Tt(k0e(),yt);Tt(B0e(),yt);Tt($0e(),yt);Tt(q0e(),yt);Tt(WZ(),yt);Tt(cht(),yt);Tt(kp(),yt);Tt(U0e(),yt);Tt(z0e(),yt);Tt(H0e(),yt);Tt(W0e(),yt);Tt(K0e(),yt);Tt(J0e(),yt);Tt(G0e(),yt);Tt(Y0e(),yt);Tt(Z0e(),yt);Tt(X0e(),yt);Tt(Q0e(),yt);Tt(ewe(),yt);Tt(rwe(),yt);Tt(nwe(),yt);Tt(iwe(),yt);Tt(swe(),yt);Tt(uwe(),yt);Tt(lwe(),yt);Tt(cwe(),yt);Tt(dwe(),yt);Tt(fwe(),yt);Tt(pwe(),yt);Tt(mwe(),yt);Tt(hwe(),yt);Tt(gwe(),yt);Tt(Pht(),yt)});var JZ=b(F_=>{"use strict";var jxr=F_&&F_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dxr=F_&&F_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nxr=F_&&F_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jxr(e,t,r);return Dxr(e,t),e};Object.defineProperty(F_,"__esModule",{value:!0});F_.TextResponseFormat=void 0;var Lxr=Nxr(q());F_.TextResponseFormat=Lxr.serialization.object({})});var Swe=b(k_=>{"use strict";var Fxr=k_&&k_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kxr=k_&&k_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bxr=k_&&k_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fxr(e,t,r);return kxr(e,t),e};Object.defineProperty(k_,"__esModule",{value:!0});k_.JsonResponseFormat2=void 0;var E4=Bxr(q());k_.JsonResponseFormat2=E4.serialization.object({jsonSchema:E4.serialization.property("json_schema",E4.serialization.record(E4.serialization.string(),E4.serialization.unknown()).optional())})});var GZ=b(B_=>{"use strict";var $xr=B_&&B_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qxr=B_&&B_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uxr=B_&&B_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$xr(e,t,r);return qxr(e,t),e};Object.defineProperty(B_,"__esModule",{value:!0});B_.ResponseFormat2=void 0;var zxr=Uxr(q()),Hxr=JZ(),Vxr=Swe();B_.ResponseFormat2=zxr.serialization.union("type",{text:Hxr.TextResponseFormat,json_object:Vxr.JsonResponseFormat2}).transform({transform:t=>t,untransform:t=>t})});var Tht=b($_=>{"use strict";var Wxr=$_&&$_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kxr=$_&&$_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jxr=$_&&$_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Wxr(e,t,r);return Kxr(e,t),e};Object.defineProperty($_,"__esModule",{value:!0});$_.V2ChatStreamRequest=void 0;var ys=Jxr(q()),Gxr=zZ(),Yxr=HZ(),Zxr=f0e(),Xxr=GZ();$_.V2ChatStreamRequest=ys.serialization.object({model:ys.serialization.string(),messages:Gxr.ChatMessages,tools:ys.serialization.list(Yxr.Tool2).optional(),citationMode:ys.serialization.property("citation_mode",Zxr.V2ChatStreamRequestCitationMode.optional()),responseFormat:ys.serialization.property("response_format",Xxr.ResponseFormat2.optional()),maxTokens:ys.serialization.property("max_tokens",ys.serialization.number().optional()),stopSequences:ys.serialization.property("stop_sequences",ys.serialization.list(ys.serialization.string()).optional()),temperature:ys.serialization.number().optional(),seed:ys.serialization.number().optional(),frequencyPenalty:ys.serialization.property("frequency_penalty",ys.serialization.number().optional()),presencePenalty:ys.serialization.property("presence_penalty",ys.serialization.number().optional()),k:ys.serialization.number().optional(),p:ys.serialization.number().optional(),returnPrompt:ys.serialization.property("return_prompt",ys.serialization.boolean().optional())})});var Aht=b(q_=>{"use strict";var Qxr=q_&&q_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eCr=q_&&q_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tCr=q_&&q_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Qxr(e,t,r);return eCr(e,t),e};Object.defineProperty(q_,"__esModule",{value:!0});q_.V2ChatRequest=void 0;var bs=tCr(q()),rCr=zZ(),nCr=HZ(),oCr=p0e(),iCr=GZ();q_.V2ChatRequest=bs.serialization.object({model:bs.serialization.string(),messages:rCr.ChatMessages,tools:bs.serialization.list(nCr.Tool2).optional(),citationMode:bs.serialization.property("citation_mode",oCr.V2ChatRequestCitationMode.optional()),responseFormat:bs.serialization.property("response_format",iCr.ResponseFormat2.optional()),maxTokens:bs.serialization.property("max_tokens",bs.serialization.number().optional()),stopSequences:bs.serialization.property("stop_sequences",bs.serialization.list(bs.serialization.string()).optional()),temperature:bs.serialization.number().optional(),seed:bs.serialization.number().optional(),frequencyPenalty:bs.serialization.property("frequency_penalty",bs.serialization.number().optional()),presencePenalty:bs.serialization.property("presence_penalty",bs.serialization.number().optional()),k:bs.serialization.number().optional(),p:bs.serialization.number().optional(),returnPrompt:bs.serialization.property("return_prompt",bs.serialization.boolean().optional())})});var xwe=b(vF=>{"use strict";Object.defineProperty(vF,"__esModule",{value:!0});vF.V2ChatRequest=vF.V2ChatStreamRequest=void 0;var aCr=Tht();Object.defineProperty(vF,"V2ChatStreamRequest",{enumerable:!0,get:function(){return aCr.V2ChatStreamRequest}});var sCr=Aht();Object.defineProperty(vF,"V2ChatRequest",{enumerable:!0,get:function(){return sCr.V2ChatRequest}})});var Iht=b(mR=>{"use strict";var uCr=mR&&mR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lCr=mR&&mR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uCr(e,t,r)};Object.defineProperty(mR,"__esModule",{value:!0});lCr(xwe(),mR)});var Rht=b(jP=>{"use strict";var cCr=jP&&jP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mht=jP&&jP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cCr(e,t,r)};Object.defineProperty(jP,"__esModule",{value:!0});Mht(wwe(),jP);Mht(Iht(),jP)});var Cwe=b(U_=>{"use strict";var dCr=U_&&U_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fCr=U_&&U_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pCr=U_&&U_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dCr(e,t,r);return fCr(e,t),e};Object.defineProperty(U_,"__esModule",{value:!0});U_.CreateEmbedJobRequestTruncate=void 0;var mCr=pCr(q());U_.CreateEmbedJobRequestTruncate=mCr.serialization.enum_(["START","END"])});var Owe=b(hR=>{"use strict";var hCr=hR&&hR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gCr=hR&&hR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hCr(e,t,r)};Object.defineProperty(hR,"__esModule",{value:!0});gCr(Cwe(),hR)});var YZ=b(z_=>{"use strict";var yCr=z_&&z_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bCr=z_&&z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Cr=z_&&z_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yCr(e,t,r);return bCr(e,t),e};Object.defineProperty(z_,"__esModule",{value:!0});z_.EmbedInputType=void 0;var vCr=_Cr(q());z_.EmbedInputType=vCr.serialization.enum_(["search_document","search_query","classification","clustering"])});var ZZ=b(H_=>{"use strict";var wCr=H_&&H_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SCr=H_&&H_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xCr=H_&&H_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wCr(e,t,r);return SCr(e,t),e};Object.defineProperty(H_,"__esModule",{value:!0});H_.EmbeddingType=void 0;var CCr=xCr(q());H_.EmbeddingType=CCr.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var jht=b(V_=>{"use strict";var OCr=V_&&V_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ECr=V_&&V_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PCr=V_&&V_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OCr(e,t,r);return ECr(e,t),e};Object.defineProperty(V_,"__esModule",{value:!0});V_.CreateEmbedJobRequest=void 0;var DP=PCr(q()),TCr=YZ(),ACr=ZZ(),ICr=Cwe();V_.CreateEmbedJobRequest=DP.serialization.object({model:DP.serialization.string(),datasetId:DP.serialization.property("dataset_id",DP.serialization.string()),inputType:DP.serialization.property("input_type",TCr.EmbedInputType),name:DP.serialization.string().optional(),embeddingTypes:DP.serialization.property("embedding_types",DP.serialization.list(ACr.EmbeddingType).optional()),truncate:ICr.CreateEmbedJobRequestTruncate.optional()})});var Ewe=b(XZ=>{"use strict";Object.defineProperty(XZ,"__esModule",{value:!0});XZ.CreateEmbedJobRequest=void 0;var MCr=jht();Object.defineProperty(XZ,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return MCr.CreateEmbedJobRequest}})});var Dht=b(gR=>{"use strict";var RCr=gR&&gR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jCr=gR&&gR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RCr(e,t,r)};Object.defineProperty(gR,"__esModule",{value:!0});jCr(Ewe(),gR)});var Lht=b(NP=>{"use strict";var DCr=NP&&NP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Nht=NP&&NP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DCr(e,t,r)};Object.defineProperty(NP,"__esModule",{value:!0});Nht(Owe(),NP);Nht(Dht(),NP)});var Pwe=b(W_=>{"use strict";var NCr=W_&&W_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LCr=W_&&W_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FCr=W_&&W_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NCr(e,t,r);return LCr(e,t),e};Object.defineProperty(W_,"__esModule",{value:!0});W_.DatasetType=void 0;var kCr=FCr(q());W_.DatasetType=kCr.serialization.enum_(["embed-input","embed-result","cluster-result","cluster-outliers","reranker-finetune-input","single-label-classification-finetune-input","chat-finetune-input","multi-label-classification-finetune-input"])});var Twe=b(K_=>{"use strict";var BCr=K_&&K_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Cr=K_&&K_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qCr=K_&&K_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BCr(e,t,r);return $Cr(e,t),e};Object.defineProperty(K_,"__esModule",{value:!0});K_.DatasetValidationStatus=void 0;var UCr=qCr(q());K_.DatasetValidationStatus=UCr.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var Awe=b(J_=>{"use strict";var zCr=J_&&J_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HCr=J_&&J_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VCr=J_&&J_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zCr(e,t,r);return HCr(e,t),e};Object.defineProperty(J_,"__esModule",{value:!0});J_.DatasetPart=void 0;var Bp=VCr(q());J_.DatasetPart=Bp.serialization.object({id:Bp.serialization.string(),name:Bp.serialization.string(),url:Bp.serialization.string().optional(),index:Bp.serialization.number().optional(),sizeBytes:Bp.serialization.property("size_bytes",Bp.serialization.number().optional()),numRows:Bp.serialization.property("num_rows",Bp.serialization.number().optional()),originalUrl:Bp.serialization.property("original_url",Bp.serialization.string().optional()),samples:Bp.serialization.list(Bp.serialization.string()).optional()})});var QZ=b(G_=>{"use strict";var WCr=G_&&G_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KCr=G_&&G_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JCr=G_&&G_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WCr(e,t,r);return KCr(e,t),e};Object.defineProperty(G_,"__esModule",{value:!0});G_.Dataset=void 0;var ya=JCr(q()),GCr=Pwe(),YCr=Twe(),ZCr=Awe();G_.Dataset=ya.serialization.object({id:ya.serialization.string(),name:ya.serialization.string(),createdAt:ya.serialization.property("created_at",ya.serialization.date()),updatedAt:ya.serialization.property("updated_at",ya.serialization.date()),datasetType:ya.serialization.property("dataset_type",GCr.DatasetType),validationStatus:ya.serialization.property("validation_status",YCr.DatasetValidationStatus),validationError:ya.serialization.property("validation_error",ya.serialization.string().optional()),schema:ya.serialization.string().optional(),requiredFields:ya.serialization.property("required_fields",ya.serialization.list(ya.serialization.string()).optional()),preserveFields:ya.serialization.property("preserve_fields",ya.serialization.list(ya.serialization.string()).optional()),datasetParts:ya.serialization.property("dataset_parts",ya.serialization.list(ZCr.DatasetPart).optional()),validationWarnings:ya.serialization.property("validation_warnings",ya.serialization.list(ya.serialization.string()).optional())})});var kht=b(Y_=>{"use strict";var XCr=Y_&&Y_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QCr=Y_&&Y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eOr=Y_&&Y_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XCr(e,t,r);return QCr(e,t),e};Object.defineProperty(Y_,"__esModule",{value:!0});Y_.DatasetsListResponse=void 0;var Fht=eOr(q()),tOr=QZ();Y_.DatasetsListResponse=Fht.serialization.object({datasets:Fht.serialization.list(tOr.Dataset).optional()})});var Bht=b(Z_=>{"use strict";var rOr=Z_&&Z_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nOr=Z_&&Z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oOr=Z_&&Z_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rOr(e,t,r);return nOr(e,t),e};Object.defineProperty(Z_,"__esModule",{value:!0});Z_.DatasetsCreateResponseDatasetPartsItem=void 0;var LP=oOr(q());Z_.DatasetsCreateResponseDatasetPartsItem=LP.serialization.object({name:LP.serialization.string().optional(),numRows:LP.serialization.property("num_rows",LP.serialization.number().optional()),samples:LP.serialization.list(LP.serialization.string()).optional(),partKind:LP.serialization.property("part_kind",LP.serialization.string().optional())})});var qht=b(X_=>{"use strict";var iOr=X_&&X_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aOr=X_&&X_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sOr=X_&&X_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iOr(e,t,r);return aOr(e,t),e};Object.defineProperty(X_,"__esModule",{value:!0});X_.DatasetsCreateResponse=void 0;var $ht=sOr(q());X_.DatasetsCreateResponse=$ht.serialization.object({id:$ht.serialization.string().optional()})});var Uht=b(Q_=>{"use strict";var uOr=Q_&&Q_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lOr=Q_&&Q_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cOr=Q_&&Q_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uOr(e,t,r);return lOr(e,t),e};Object.defineProperty(Q_,"__esModule",{value:!0});Q_.DatasetsGetUsageResponse=void 0;var Iwe=cOr(q());Q_.DatasetsGetUsageResponse=Iwe.serialization.object({organizationUsage:Iwe.serialization.property("organization_usage",Iwe.serialization.number().optional())})});var zht=b(ev=>{"use strict";var dOr=ev&&ev.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fOr=ev&&ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pOr=ev&&ev.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dOr(e,t,r);return fOr(e,t),e};Object.defineProperty(ev,"__esModule",{value:!0});ev.DatasetsGetResponse=void 0;var mOr=pOr(q()),hOr=QZ();ev.DatasetsGetResponse=mOr.serialization.object({dataset:hOr.Dataset})});var Mwe=b(Ag=>{"use strict";var gOr=Ag&&Ag.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),P4=Ag&&Ag.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gOr(e,t,r)};Object.defineProperty(Ag,"__esModule",{value:!0});P4(kht(),Ag);P4(Bht(),Ag);P4(qht(),Ag);P4(Uht(),Ag);P4(zht(),Ag)});var Hht=b(tv=>{"use strict";var yOr=tv&&tv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bOr=tv&&tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Or=tv&&tv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yOr(e,t,r);return bOr(e,t),e};Object.defineProperty(tv,"__esModule",{value:!0});tv.Response=void 0;var Rwe=_Or(q());tv.Response=Rwe.serialization.record(Rwe.serialization.string(),Rwe.serialization.unknown())});var Vht=b(rv=>{"use strict";var vOr=rv&&rv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wOr=rv&&rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SOr=rv&&rv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vOr(e,t,r);return wOr(e,t),e};Object.defineProperty(rv,"__esModule",{value:!0});rv.delete=void 0;rv.delete=SOr(Hht())});var Kht=b(FP=>{"use strict";var xOr=FP&&FP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wht=FP&&FP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xOr(e,t,r)};Object.defineProperty(FP,"__esModule",{value:!0});Wht(Mwe(),FP);Wht(Vht(),FP)});var jwe=b(nv=>{"use strict";var COr=nv&&nv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OOr=nv&&nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EOr=nv&&nv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&COr(e,t,r);return OOr(e,t),e};Object.defineProperty(nv,"__esModule",{value:!0});nv.BaseType=void 0;var POr=EOr(q());nv.BaseType=POr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var Dwe=b(ov=>{"use strict";var TOr=ov&&ov.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AOr=ov&&ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IOr=ov&&ov.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TOr(e,t,r);return AOr(e,t),e};Object.defineProperty(ov,"__esModule",{value:!0});ov.Strategy=void 0;var MOr=IOr(q());ov.Strategy=MOr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var Nwe=b(iv=>{"use strict";var ROr=iv&&iv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jOr=iv&&iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DOr=iv&&iv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ROr(e,t,r);return jOr(e,t),e};Object.defineProperty(iv,"__esModule",{value:!0});iv.BaseModel=void 0;var eX=DOr(q()),NOr=jwe(),LOr=Dwe();iv.BaseModel=eX.serialization.object({name:eX.serialization.string().optional(),version:eX.serialization.string().optional(),baseType:eX.serialization.property("base_type",NOr.BaseType),strategy:LOr.Strategy.optional()})});var Lwe=b(av=>{"use strict";var FOr=av&&av.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kOr=av&&av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BOr=av&&av.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FOr(e,t,r);return kOr(e,t),e};Object.defineProperty(av,"__esModule",{value:!0});av.Hyperparameters=void 0;var Ig=BOr(q());av.Hyperparameters=Ig.serialization.object({earlyStoppingPatience:Ig.serialization.property("early_stopping_patience",Ig.serialization.number().optional()),earlyStoppingThreshold:Ig.serialization.property("early_stopping_threshold",Ig.serialization.number().optional()),trainBatchSize:Ig.serialization.property("train_batch_size",Ig.serialization.number().optional()),trainEpochs:Ig.serialization.property("train_epochs",Ig.serialization.number().optional()),learningRate:Ig.serialization.property("learning_rate",Ig.serialization.number().optional())})});var Fwe=b(sv=>{"use strict";var $Or=sv&&sv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qOr=sv&&sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UOr=sv&&sv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Or(e,t,r);return qOr(e,t),e};Object.defineProperty(sv,"__esModule",{value:!0});sv.WandbConfig=void 0;var T4=UOr(q());sv.WandbConfig=T4.serialization.object({project:T4.serialization.string(),apiKey:T4.serialization.property("api_key",T4.serialization.string()),entity:T4.serialization.string().optional()})});var tX=b(uv=>{"use strict";var zOr=uv&&uv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HOr=uv&&uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VOr=uv&&uv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zOr(e,t,r);return HOr(e,t),e};Object.defineProperty(uv,"__esModule",{value:!0});uv.Settings=void 0;var wF=VOr(q()),WOr=Nwe(),KOr=Lwe(),JOr=Fwe();uv.Settings=wF.serialization.object({baseModel:wF.serialization.property("base_model",WOr.BaseModel),datasetId:wF.serialization.property("dataset_id",wF.serialization.string()),hyperparameters:KOr.Hyperparameters.optional(),multiLabel:wF.serialization.property("multi_label",wF.serialization.boolean().optional()),wandb:JOr.WandbConfig.optional()})});var A4=b(lv=>{"use strict";var GOr=lv&&lv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YOr=lv&&lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZOr=lv&&lv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GOr(e,t,r);return YOr(e,t),e};Object.defineProperty(lv,"__esModule",{value:!0});lv.Status=void 0;var XOr=ZOr(q());lv.Status=XOr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var SF=b(cv=>{"use strict";var QOr=cv&&cv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eEr=cv&&cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tEr=cv&&cv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QOr(e,t,r);return eEr(e,t),e};Object.defineProperty(cv,"__esModule",{value:!0});cv.FinetunedModel=void 0;var Yd=tEr(q()),rEr=tX(),nEr=A4();cv.FinetunedModel=Yd.serialization.object({id:Yd.serialization.string().optional(),name:Yd.serialization.string(),creatorId:Yd.serialization.property("creator_id",Yd.serialization.string().optional()),organizationId:Yd.serialization.property("organization_id",Yd.serialization.string().optional()),settings:rEr.Settings,status:nEr.Status.optional(),createdAt:Yd.serialization.property("created_at",Yd.serialization.date().optional()),updatedAt:Yd.serialization.property("updated_at",Yd.serialization.date().optional()),completedAt:Yd.serialization.property("completed_at",Yd.serialization.date().optional()),lastUsed:Yd.serialization.property("last_used",Yd.serialization.date().optional())})});var Jht=b(dv=>{"use strict";var oEr=dv&&dv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iEr=dv&&dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aEr=dv&&dv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oEr(e,t,r);return iEr(e,t),e};Object.defineProperty(dv,"__esModule",{value:!0});dv.ListFinetunedModelsResponse=void 0;var yR=aEr(q()),sEr=SF();dv.ListFinetunedModelsResponse=yR.serialization.object({finetunedModels:yR.serialization.property("finetuned_models",yR.serialization.list(sEr.FinetunedModel).optional()),nextPageToken:yR.serialization.property("next_page_token",yR.serialization.string().optional()),totalSize:yR.serialization.property("total_size",yR.serialization.number().optional())})});var Yht=b(fv=>{"use strict";var uEr=fv&&fv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lEr=fv&&fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cEr=fv&&fv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uEr(e,t,r);return lEr(e,t),e};Object.defineProperty(fv,"__esModule",{value:!0});fv.CreateFinetunedModelResponse=void 0;var Ght=cEr(q()),dEr=SF();fv.CreateFinetunedModelResponse=Ght.serialization.object({finetunedModel:Ght.serialization.property("finetuned_model",dEr.FinetunedModel.optional())})});var Xht=b(pv=>{"use strict";var fEr=pv&&pv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pEr=pv&&pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mEr=pv&&pv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fEr(e,t,r);return pEr(e,t),e};Object.defineProperty(pv,"__esModule",{value:!0});pv.GetFinetunedModelResponse=void 0;var Zht=mEr(q()),hEr=SF();pv.GetFinetunedModelResponse=Zht.serialization.object({finetunedModel:Zht.serialization.property("finetuned_model",hEr.FinetunedModel.optional())})});var Qht=b(mv=>{"use strict";var gEr=mv&&mv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yEr=mv&&mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bEr=mv&&mv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gEr(e,t,r);return yEr(e,t),e};Object.defineProperty(mv,"__esModule",{value:!0});mv.DeleteFinetunedModelResponse=void 0;var kwe=bEr(q());mv.DeleteFinetunedModelResponse=kwe.serialization.record(kwe.serialization.string(),kwe.serialization.unknown())});var tgt=b(hv=>{"use strict";var _Er=hv&&hv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vEr=hv&&hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wEr=hv&&hv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Er(e,t,r);return vEr(e,t),e};Object.defineProperty(hv,"__esModule",{value:!0});hv.UpdateFinetunedModelResponse=void 0;var egt=wEr(q()),SEr=SF();hv.UpdateFinetunedModelResponse=egt.serialization.object({finetunedModel:egt.serialization.property("finetuned_model",SEr.FinetunedModel.optional())})});var Bwe=b(gv=>{"use strict";var xEr=gv&&gv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CEr=gv&&gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OEr=gv&&gv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xEr(e,t,r);return CEr(e,t),e};Object.defineProperty(gv,"__esModule",{value:!0});gv.Event=void 0;var I4=OEr(q()),EEr=A4();gv.Event=I4.serialization.object({userId:I4.serialization.property("user_id",I4.serialization.string().optional()),status:EEr.Status.optional(),createdAt:I4.serialization.property("created_at",I4.serialization.date().optional())})});var rgt=b(yv=>{"use strict";var PEr=yv&&yv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TEr=yv&&yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AEr=yv&&yv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PEr(e,t,r);return TEr(e,t),e};Object.defineProperty(yv,"__esModule",{value:!0});yv.ListEventsResponse=void 0;var xF=AEr(q()),IEr=Bwe();yv.ListEventsResponse=xF.serialization.object({events:xF.serialization.list(IEr.Event).optional(),nextPageToken:xF.serialization.property("next_page_token",xF.serialization.string().optional()),totalSize:xF.serialization.property("total_size",xF.serialization.number().optional())})});var $we=b(bv=>{"use strict";var MEr=bv&&bv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),REr=bv&&bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jEr=bv&&bv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MEr(e,t,r);return REr(e,t),e};Object.defineProperty(bv,"__esModule",{value:!0});bv.TrainingStepMetrics=void 0;var kP=jEr(q());bv.TrainingStepMetrics=kP.serialization.object({createdAt:kP.serialization.property("created_at",kP.serialization.date().optional()),stepNumber:kP.serialization.property("step_number",kP.serialization.number().optional()),metrics:kP.serialization.record(kP.serialization.string(),kP.serialization.number()).optional()})});var ngt=b(_v=>{"use strict";var DEr=_v&&_v.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NEr=_v&&_v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LEr=_v&&_v.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DEr(e,t,r);return NEr(e,t),e};Object.defineProperty(_v,"__esModule",{value:!0});_v.ListTrainingStepMetricsResponse=void 0;var M4=LEr(q()),FEr=$we();_v.ListTrainingStepMetricsResponse=M4.serialization.object({stepMetrics:M4.serialization.property("step_metrics",M4.serialization.list(FEr.TrainingStepMetrics).optional()),nextPageToken:M4.serialization.property("next_page_token",M4.serialization.string().optional())})});var qwe=b(ba=>{"use strict";var kEr=ba&&ba.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cc=ba&&ba.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kEr(e,t,r)};Object.defineProperty(ba,"__esModule",{value:!0});cc(jwe(),ba);cc(Dwe(),ba);cc(Nwe(),ba);cc(Lwe(),ba);cc(Fwe(),ba);cc(tX(),ba);cc(A4(),ba);cc(SF(),ba);cc(Jht(),ba);cc(Yht(),ba);cc(Xht(),ba);cc(Qht(),ba);cc(tgt(),ba);cc(Bwe(),ba);cc(rgt(),ba);cc($we(),ba);cc(ngt(),ba)});var ogt=b(bR=>{"use strict";var BEr=bR&&bR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Er=bR&&bR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BEr(e,t,r)};Object.defineProperty(bR,"__esModule",{value:!0});$Er(qwe(),bR)});var agt=b($p=>{"use strict";var igt=$p&&$p.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qEr=$p&&$p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UEr=$p&&$p.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&igt(e,t,r);return qEr(e,t),e},zEr=$p&&$p.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&igt(e,t,r)};Object.defineProperty($p,"__esModule",{value:!0});$p.finetuning=void 0;$p.finetuning=UEr(ogt());zEr(qwe(),$p)});var sgt=b(vv=>{"use strict";var HEr=vv&&vv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VEr=vv&&vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WEr=vv&&vv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HEr(e,t,r);return VEr(e,t),e};Object.defineProperty(vv,"__esModule",{value:!0});vv.FinetuningUpdateFinetunedModelRequest=void 0;var Bf=WEr(q()),KEr=tX(),JEr=A4();vv.FinetuningUpdateFinetunedModelRequest=Bf.serialization.object({name:Bf.serialization.string(),creatorId:Bf.serialization.property("creator_id",Bf.serialization.string().optional()),organizationId:Bf.serialization.property("organization_id",Bf.serialization.string().optional()),settings:KEr.Settings,status:JEr.Status.optional(),createdAt:Bf.serialization.property("created_at",Bf.serialization.date().optional()),updatedAt:Bf.serialization.property("updated_at",Bf.serialization.date().optional()),completedAt:Bf.serialization.property("completed_at",Bf.serialization.date().optional()),lastUsed:Bf.serialization.property("last_used",Bf.serialization.date().optional())})});var Uwe=b(rX=>{"use strict";Object.defineProperty(rX,"__esModule",{value:!0});rX.FinetuningUpdateFinetunedModelRequest=void 0;var GEr=sgt();Object.defineProperty(rX,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return GEr.FinetuningUpdateFinetunedModelRequest}})});var ugt=b(_R=>{"use strict";var YEr=_R&&_R.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZEr=_R&&_R.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&YEr(e,t,r)};Object.defineProperty(_R,"__esModule",{value:!0});ZEr(Uwe(),_R)});var cgt=b(BP=>{"use strict";var XEr=BP&&BP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lgt=BP&&BP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&XEr(e,t,r)};Object.defineProperty(BP,"__esModule",{value:!0});lgt(agt(),BP);lgt(ugt(),BP)});var nX=b(Sv=>{"use strict";var QEr=Sv&&Sv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ePr=Sv&&Sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tPr=Sv&&Sv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QEr(e,t,r);return ePr(e,t),e};Object.defineProperty(Sv,"__esModule",{value:!0});Sv.CreateConnectorOAuth=void 0;var wv=tPr(q());Sv.CreateConnectorOAuth=wv.serialization.object({clientId:wv.serialization.property("client_id",wv.serialization.string().optional()),clientSecret:wv.serialization.property("client_secret",wv.serialization.string().optional()),authorizeUrl:wv.serialization.property("authorize_url",wv.serialization.string().optional()),tokenUrl:wv.serialization.property("token_url",wv.serialization.string().optional()),scope:wv.serialization.string().optional()})});var zwe=b(xv=>{"use strict";var rPr=xv&&xv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nPr=xv&&xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oPr=xv&&xv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rPr(e,t,r);return nPr(e,t),e};Object.defineProperty(xv,"__esModule",{value:!0});xv.AuthTokenType=void 0;var iPr=oPr(q());xv.AuthTokenType=iPr.serialization.enum_(["bearer","basic","noscheme"])});var oX=b(Cv=>{"use strict";var aPr=Cv&&Cv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sPr=Cv&&Cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uPr=Cv&&Cv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aPr(e,t,r);return sPr(e,t),e};Object.defineProperty(Cv,"__esModule",{value:!0});Cv.CreateConnectorServiceAuth=void 0;var dgt=uPr(q()),lPr=zwe();Cv.CreateConnectorServiceAuth=dgt.serialization.object({type:lPr.AuthTokenType,token:dgt.serialization.string()})});var fgt=b(Ev=>{"use strict";var cPr=Ev&&Ev.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dPr=Ev&&Ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fPr=Ev&&Ev.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cPr(e,t,r);return dPr(e,t),e};Object.defineProperty(Ev,"__esModule",{value:!0});Ev.CreateConnectorRequest=void 0;var Ov=fPr(q()),pPr=nX(),mPr=oX();Ev.CreateConnectorRequest=Ov.serialization.object({name:Ov.serialization.string(),description:Ov.serialization.string().optional(),url:Ov.serialization.string(),excludes:Ov.serialization.list(Ov.serialization.string()).optional(),oauth:pPr.CreateConnectorOAuth.optional(),active:Ov.serialization.boolean().optional(),continueOnFailure:Ov.serialization.property("continue_on_failure",Ov.serialization.boolean().optional()),serviceAuth:Ov.serialization.property("service_auth",mPr.CreateConnectorServiceAuth.optional())})});var pgt=b(Pv=>{"use strict";var hPr=Pv&&Pv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gPr=Pv&&Pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yPr=Pv&&Pv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hPr(e,t,r);return gPr(e,t),e};Object.defineProperty(Pv,"__esModule",{value:!0});Pv.UpdateConnectorRequest=void 0;var Yx=yPr(q()),bPr=nX(),_Pr=oX();Pv.UpdateConnectorRequest=Yx.serialization.object({name:Yx.serialization.string().optional(),url:Yx.serialization.string().optional(),excludes:Yx.serialization.list(Yx.serialization.string()).optional(),oauth:bPr.CreateConnectorOAuth.optional(),active:Yx.serialization.boolean().optional(),continueOnFailure:Yx.serialization.property("continue_on_failure",Yx.serialization.boolean().optional()),serviceAuth:Yx.serialization.property("service_auth",_Pr.CreateConnectorServiceAuth.optional())})});var Hwe=b(CF=>{"use strict";Object.defineProperty(CF,"__esModule",{value:!0});CF.UpdateConnectorRequest=CF.CreateConnectorRequest=void 0;var vPr=fgt();Object.defineProperty(CF,"CreateConnectorRequest",{enumerable:!0,get:function(){return vPr.CreateConnectorRequest}});var wPr=pgt();Object.defineProperty(CF,"UpdateConnectorRequest",{enumerable:!0,get:function(){return wPr.UpdateConnectorRequest}})});var mgt=b(vR=>{"use strict";var SPr=vR&&vR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xPr=vR&&vR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&SPr(e,t,r)};Object.defineProperty(vR,"__esModule",{value:!0});xPr(Hwe(),vR)});var hgt=b(wR=>{"use strict";var CPr=wR&&wR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OPr=wR&&wR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&CPr(e,t,r)};Object.defineProperty(wR,"__esModule",{value:!0});OPr(mgt(),wR)});var ygt=b(ci=>{"use strict";var ggt=ci&&ci.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EPr=ci&&ci.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R4=ci&&ci.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ggt(e,t,r);return EPr(e,t),e},SR=ci&&ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ggt(e,t,r)};Object.defineProperty(ci,"__esModule",{value:!0});ci.connectors=ci.finetuning=ci.datasets=ci.embedJobs=ci.v2=void 0;ci.v2=R4(Rht());SR(wwe(),ci);ci.embedJobs=R4(Lht());SR(Owe(),ci);ci.datasets=R4(Kht());SR(Mwe(),ci);ci.finetuning=R4(cgt());SR(xwe(),ci);SR(Ewe(),ci);ci.connectors=R4(hgt());SR(Hwe(),ci);SR(Uwe(),ci)});var Vwe=b(Tv=>{"use strict";var PPr=Tv&&Tv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TPr=Tv&&Tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),APr=Tv&&Tv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PPr(e,t,r);return TPr(e,t),e};Object.defineProperty(Tv,"__esModule",{value:!0});Tv.ChatStreamRequestPromptTruncation=void 0;var IPr=APr(q());Tv.ChatStreamRequestPromptTruncation=IPr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var Wwe=b(Av=>{"use strict";var MPr=Av&&Av.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RPr=Av&&Av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jPr=Av&&Av.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MPr(e,t,r);return RPr(e,t),e};Object.defineProperty(Av,"__esModule",{value:!0});Av.ChatStreamRequestCitationQuality=void 0;var DPr=jPr(q());Av.ChatStreamRequestCitationQuality=DPr.serialization.enum_(["fast","accurate","off"])});var _gt=b(Iv=>{"use strict";var NPr=Iv&&Iv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LPr=Iv&&Iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FPr=Iv&&Iv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NPr(e,t,r);return LPr(e,t),e};Object.defineProperty(Iv,"__esModule",{value:!0});Iv.ChatStreamRequestConnectorsSearchOptions=void 0;var bgt=FPr(q());Iv.ChatStreamRequestConnectorsSearchOptions=bgt.serialization.object({seed:bgt.serialization.number().optional()})});var Kwe=b(Mv=>{"use strict";var kPr=Mv&&Mv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BPr=Mv&&Mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Pr=Mv&&Mv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kPr(e,t,r);return BPr(e,t),e};Object.defineProperty(Mv,"__esModule",{value:!0});Mv.ChatStreamRequestSafetyMode=void 0;var qPr=$Pr(q());Mv.ChatStreamRequestSafetyMode=qPr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var wgt=b(Rv=>{"use strict";var UPr=Rv&&Rv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zPr=Rv&&Rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HPr=Rv&&Rv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UPr(e,t,r);return zPr(e,t),e};Object.defineProperty(Rv,"__esModule",{value:!0});Rv.UnprocessableEntityErrorBody=void 0;var vgt=HPr(q());Rv.UnprocessableEntityErrorBody=vgt.serialization.object({data:vgt.serialization.string().optional()})});var xgt=b(jv=>{"use strict";var VPr=jv&&jv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WPr=jv&&jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KPr=jv&&jv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VPr(e,t,r);return WPr(e,t),e};Object.defineProperty(jv,"__esModule",{value:!0});jv.TooManyRequestsErrorBody=void 0;var Sgt=KPr(q());jv.TooManyRequestsErrorBody=Sgt.serialization.object({data:Sgt.serialization.string().optional()})});var Ogt=b(Dv=>{"use strict";var JPr=Dv&&Dv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GPr=Dv&&Dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YPr=Dv&&Dv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JPr(e,t,r);return GPr(e,t),e};Object.defineProperty(Dv,"__esModule",{value:!0});Dv.ClientClosedRequestErrorBody=void 0;var Cgt=YPr(q());Dv.ClientClosedRequestErrorBody=Cgt.serialization.object({data:Cgt.serialization.string().optional()})});var Pgt=b(Nv=>{"use strict";var ZPr=Nv&&Nv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XPr=Nv&&Nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QPr=Nv&&Nv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZPr(e,t,r);return XPr(e,t),e};Object.defineProperty(Nv,"__esModule",{value:!0});Nv.NotImplementedErrorBody=void 0;var Egt=QPr(q());Nv.NotImplementedErrorBody=Egt.serialization.object({data:Egt.serialization.string().optional()})});var Agt=b(Lv=>{"use strict";var eTr=Lv&&Lv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tTr=Lv&&Lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rTr=Lv&&Lv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eTr(e,t,r);return tTr(e,t),e};Object.defineProperty(Lv,"__esModule",{value:!0});Lv.GatewayTimeoutErrorBody=void 0;var Tgt=rTr(q());Lv.GatewayTimeoutErrorBody=Tgt.serialization.object({data:Tgt.serialization.string().optional()})});var Jwe=b(Fv=>{"use strict";var nTr=Fv&&Fv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oTr=Fv&&Fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iTr=Fv&&Fv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nTr(e,t,r);return oTr(e,t),e};Object.defineProperty(Fv,"__esModule",{value:!0});Fv.ChatRequestPromptTruncation=void 0;var aTr=iTr(q());Fv.ChatRequestPromptTruncation=aTr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var Gwe=b(kv=>{"use strict";var sTr=kv&&kv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uTr=kv&&kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lTr=kv&&kv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sTr(e,t,r);return uTr(e,t),e};Object.defineProperty(kv,"__esModule",{value:!0});kv.ChatRequestCitationQuality=void 0;var cTr=lTr(q());kv.ChatRequestCitationQuality=cTr.serialization.enum_(["fast","accurate","off"])});var Mgt=b(Bv=>{"use strict";var dTr=Bv&&Bv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fTr=Bv&&Bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pTr=Bv&&Bv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dTr(e,t,r);return fTr(e,t),e};Object.defineProperty(Bv,"__esModule",{value:!0});Bv.ChatRequestConnectorsSearchOptions=void 0;var Igt=pTr(q());Bv.ChatRequestConnectorsSearchOptions=Igt.serialization.object({seed:Igt.serialization.number().optional()})});var Ywe=b($v=>{"use strict";var mTr=$v&&$v.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hTr=$v&&$v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gTr=$v&&$v.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mTr(e,t,r);return hTr(e,t),e};Object.defineProperty($v,"__esModule",{value:!0});$v.ChatRequestSafetyMode=void 0;var yTr=gTr(q());$v.ChatRequestSafetyMode=yTr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var Zwe=b(qv=>{"use strict";var bTr=qv&&qv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Tr=qv&&qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vTr=qv&&qv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bTr(e,t,r);return _Tr(e,t),e};Object.defineProperty(qv,"__esModule",{value:!0});qv.GenerateStreamRequestTruncate=void 0;var wTr=vTr(q());qv.GenerateStreamRequestTruncate=wTr.serialization.enum_(["NONE","START","END"])});var Xwe=b(Uv=>{"use strict";var STr=Uv&&Uv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xTr=Uv&&Uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CTr=Uv&&Uv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&STr(e,t,r);return xTr(e,t),e};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.GenerateStreamRequestReturnLikelihoods=void 0;var OTr=CTr(q());Uv.GenerateStreamRequestReturnLikelihoods=OTr.serialization.enum_(["GENERATION","ALL","NONE"])});var Qwe=b(zv=>{"use strict";var ETr=zv&&zv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PTr=zv&&zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TTr=zv&&zv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ETr(e,t,r);return PTr(e,t),e};Object.defineProperty(zv,"__esModule",{value:!0});zv.GenerateRequestTruncate=void 0;var ATr=TTr(q());zv.GenerateRequestTruncate=ATr.serialization.enum_(["NONE","START","END"])});var eSe=b(Hv=>{"use strict";var ITr=Hv&&Hv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MTr=Hv&&Hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RTr=Hv&&Hv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ITr(e,t,r);return MTr(e,t),e};Object.defineProperty(Hv,"__esModule",{value:!0});Hv.GenerateRequestReturnLikelihoods=void 0;var jTr=RTr(q());Hv.GenerateRequestReturnLikelihoods=jTr.serialization.enum_(["GENERATION","ALL","NONE"])});var tSe=b(Vv=>{"use strict";var DTr=Vv&&Vv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NTr=Vv&&Vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LTr=Vv&&Vv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DTr(e,t,r);return NTr(e,t),e};Object.defineProperty(Vv,"__esModule",{value:!0});Vv.EmbedRequestTruncate=void 0;var FTr=LTr(q());Vv.EmbedRequestTruncate=FTr.serialization.enum_(["NONE","START","END"])});var rSe=b(Wv=>{"use strict";var kTr=Wv&&Wv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BTr=Wv&&Wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Tr=Wv&&Wv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kTr(e,t,r);return BTr(e,t),e};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.ApiMetaApiVersion=void 0;var OF=$Tr(q());Wv.ApiMetaApiVersion=OF.serialization.object({version:OF.serialization.string(),isDeprecated:OF.serialization.property("is_deprecated",OF.serialization.boolean().optional()),isExperimental:OF.serialization.property("is_experimental",OF.serialization.boolean().optional())})});var nSe=b(Kv=>{"use strict";var qTr=Kv&&Kv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UTr=Kv&&Kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zTr=Kv&&Kv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qTr(e,t,r);return UTr(e,t),e};Object.defineProperty(Kv,"__esModule",{value:!0});Kv.ApiMetaBilledUnits=void 0;var $P=zTr(q());Kv.ApiMetaBilledUnits=$P.serialization.object({inputTokens:$P.serialization.property("input_tokens",$P.serialization.number().optional()),outputTokens:$P.serialization.property("output_tokens",$P.serialization.number().optional()),searchUnits:$P.serialization.property("search_units",$P.serialization.number().optional()),classifications:$P.serialization.number().optional()})});var oSe=b(Jv=>{"use strict";var HTr=Jv&&Jv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VTr=Jv&&Jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WTr=Jv&&Jv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HTr(e,t,r);return VTr(e,t),e};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.ApiMetaTokens=void 0;var j4=WTr(q());Jv.ApiMetaTokens=j4.serialization.object({inputTokens:j4.serialization.property("input_tokens",j4.serialization.number().optional()),outputTokens:j4.serialization.property("output_tokens",j4.serialization.number().optional())})});var qp=b(Gv=>{"use strict";var KTr=Gv&&Gv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JTr=Gv&&Gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GTr=Gv&&Gv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KTr(e,t,r);return JTr(e,t),e};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.ApiMeta=void 0;var D4=GTr(q()),YTr=rSe(),ZTr=nSe(),XTr=oSe();Gv.ApiMeta=D4.serialization.object({apiVersion:D4.serialization.property("api_version",YTr.ApiMetaApiVersion.optional()),billedUnits:D4.serialization.property("billed_units",ZTr.ApiMetaBilledUnits.optional()),tokens:XTr.ApiMetaTokens.optional(),warnings:D4.serialization.list(D4.serialization.string()).optional()})});var iSe=b(Yv=>{"use strict";var QTr=Yv&&Yv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eAr=Yv&&Yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tAr=Yv&&Yv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QTr(e,t,r);return eAr(e,t),e};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.EmbedFloatsResponse=void 0;var xR=tAr(q()),rAr=qp();Yv.EmbedFloatsResponse=xR.serialization.object({id:xR.serialization.string(),embeddings:xR.serialization.list(xR.serialization.list(xR.serialization.number())),texts:xR.serialization.list(xR.serialization.string()),meta:rAr.ApiMeta.optional()})});var aSe=b(Zv=>{"use strict";var nAr=Zv&&Zv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oAr=Zv&&Zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iAr=Zv&&Zv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nAr(e,t,r);return oAr(e,t),e};Object.defineProperty(Zv,"__esModule",{value:!0});Zv.EmbedByTypeResponseEmbeddings=void 0;var dd=iAr(q());Zv.EmbedByTypeResponseEmbeddings=dd.serialization.object({float:dd.serialization.list(dd.serialization.list(dd.serialization.number())).optional(),int8:dd.serialization.list(dd.serialization.list(dd.serialization.number())).optional(),uint8:dd.serialization.list(dd.serialization.list(dd.serialization.number())).optional(),binary:dd.serialization.list(dd.serialization.list(dd.serialization.number())).optional(),ubinary:dd.serialization.list(dd.serialization.list(dd.serialization.number())).optional()})});var sSe=b(Xv=>{"use strict";var aAr=Xv&&Xv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sAr=Xv&&Xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uAr=Xv&&Xv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aAr(e,t,r);return sAr(e,t),e};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.EmbedByTypeResponse=void 0;var iX=uAr(q()),lAr=aSe(),cAr=qp();Xv.EmbedByTypeResponse=iX.serialization.object({id:iX.serialization.string(),embeddings:lAr.EmbedByTypeResponseEmbeddings,texts:iX.serialization.list(iX.serialization.string()),meta:cAr.ApiMeta.optional()})});var jgt=b(Qv=>{"use strict";var dAr=Qv&&Qv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fAr=Qv&&Qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pAr=Qv&&Qv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dAr(e,t,r);return fAr(e,t),e};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.EmbedResponse=void 0;var Rgt=pAr(q()),mAr=iSe(),hAr=sSe();Qv.EmbedResponse=Rgt.serialization.union(Rgt.serialization.discriminant("responseType","response_type"),{embeddings_floats:mAr.EmbedFloatsResponse,embeddings_by_type:hAr.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var lSe=b(e0=>{"use strict";var gAr=e0&&e0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yAr=e0&&e0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bAr=e0&&e0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gAr(e,t,r);return yAr(e,t),e};Object.defineProperty(e0,"__esModule",{value:!0});e0.RerankDocument=void 0;var uSe=bAr(q());e0.RerankDocument=uSe.serialization.record(uSe.serialization.string(),uSe.serialization.string())});var cSe=b(t0=>{"use strict";var _Ar=t0&&t0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vAr=t0&&t0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wAr=t0&&t0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Ar(e,t,r);return vAr(e,t),e};Object.defineProperty(t0,"__esModule",{value:!0});t0.RerankRequestDocumentsItem=void 0;var Dgt=wAr(q()),SAr=lSe();t0.RerankRequestDocumentsItem=Dgt.serialization.undiscriminatedUnion([Dgt.serialization.string(),SAr.RerankDocument])});var dSe=b(r0=>{"use strict";var xAr=r0&&r0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CAr=r0&&r0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OAr=r0&&r0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xAr(e,t,r);return CAr(e,t),e};Object.defineProperty(r0,"__esModule",{value:!0});r0.RerankResponseResultsItemDocument=void 0;var Ngt=OAr(q());r0.RerankResponseResultsItemDocument=Ngt.serialization.object({text:Ngt.serialization.string()})});var fSe=b(n0=>{"use strict";var EAr=n0&&n0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PAr=n0&&n0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TAr=n0&&n0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EAr(e,t,r);return PAr(e,t),e};Object.defineProperty(n0,"__esModule",{value:!0});n0.RerankResponseResultsItem=void 0;var aX=TAr(q()),AAr=dSe();n0.RerankResponseResultsItem=aX.serialization.object({document:AAr.RerankResponseResultsItemDocument.optional(),index:aX.serialization.number(),relevanceScore:aX.serialization.property("relevance_score",aX.serialization.number())})});var Lgt=b(o0=>{"use strict";var IAr=o0&&o0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MAr=o0&&o0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RAr=o0&&o0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IAr(e,t,r);return MAr(e,t),e};Object.defineProperty(o0,"__esModule",{value:!0});o0.RerankResponse=void 0;var pSe=RAr(q()),jAr=fSe(),DAr=qp();o0.RerankResponse=pSe.serialization.object({id:pSe.serialization.string().optional(),results:pSe.serialization.list(jAr.RerankResponseResultsItem),meta:DAr.ApiMeta.optional()})});var mSe=b(i0=>{"use strict";var NAr=i0&&i0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LAr=i0&&i0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FAr=i0&&i0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NAr(e,t,r);return LAr(e,t),e};Object.defineProperty(i0,"__esModule",{value:!0});i0.ClassifyRequestTruncate=void 0;var kAr=FAr(q());i0.ClassifyRequestTruncate=kAr.serialization.enum_(["NONE","START","END"])});var hSe=b(a0=>{"use strict";var BAr=a0&&a0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Ar=a0&&a0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qAr=a0&&a0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BAr(e,t,r);return $Ar(e,t),e};Object.defineProperty(a0,"__esModule",{value:!0});a0.ClassifyResponseClassificationsItemLabelsValue=void 0;var Fgt=qAr(q());a0.ClassifyResponseClassificationsItemLabelsValue=Fgt.serialization.object({confidence:Fgt.serialization.number().optional()})});var gSe=b(s0=>{"use strict";var UAr=s0&&s0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zAr=s0&&s0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HAr=s0&&s0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UAr(e,t,r);return zAr(e,t),e};Object.defineProperty(s0,"__esModule",{value:!0});s0.ClassifyResponseClassificationsItemClassificationType=void 0;var VAr=HAr(q());s0.ClassifyResponseClassificationsItemClassificationType=VAr.serialization.enum_(["single-label","multi-label"])});var ySe=b(u0=>{"use strict";var WAr=u0&&u0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KAr=u0&&u0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JAr=u0&&u0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WAr(e,t,r);return KAr(e,t),e};Object.defineProperty(u0,"__esModule",{value:!0});u0.ClassifyResponseClassificationsItem=void 0;var nh=JAr(q()),GAr=hSe(),YAr=gSe();u0.ClassifyResponseClassificationsItem=nh.serialization.object({id:nh.serialization.string(),input:nh.serialization.string().optional(),prediction:nh.serialization.string().optional(),predictions:nh.serialization.list(nh.serialization.string()),confidence:nh.serialization.number().optional(),confidences:nh.serialization.list(nh.serialization.number()),labels:nh.serialization.record(nh.serialization.string(),GAr.ClassifyResponseClassificationsItemLabelsValue),classificationType:nh.serialization.property("classification_type",YAr.ClassifyResponseClassificationsItemClassificationType)})});var kgt=b(l0=>{"use strict";var ZAr=l0&&l0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XAr=l0&&l0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QAr=l0&&l0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZAr(e,t,r);return XAr(e,t),e};Object.defineProperty(l0,"__esModule",{value:!0});l0.ClassifyResponse=void 0;var bSe=QAr(q()),eIr=ySe(),tIr=qp();l0.ClassifyResponse=bSe.serialization.object({id:bSe.serialization.string(),classifications:bSe.serialization.list(eIr.ClassifyResponseClassificationsItem),meta:tIr.ApiMeta.optional()})});var _Se=b(c0=>{"use strict";var rIr=c0&&c0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nIr=c0&&c0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oIr=c0&&c0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rIr(e,t,r);return nIr(e,t),e};Object.defineProperty(c0,"__esModule",{value:!0});c0.SummarizeRequestLength=void 0;var iIr=oIr(q());c0.SummarizeRequestLength=iIr.serialization.enum_(["short","medium","long"])});var vSe=b(d0=>{"use strict";var aIr=d0&&d0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sIr=d0&&d0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uIr=d0&&d0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aIr(e,t,r);return sIr(e,t),e};Object.defineProperty(d0,"__esModule",{value:!0});d0.SummarizeRequestFormat=void 0;var lIr=uIr(q());d0.SummarizeRequestFormat=lIr.serialization.enum_(["paragraph","bullets"])});var wSe=b(f0=>{"use strict";var cIr=f0&&f0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dIr=f0&&f0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fIr=f0&&f0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cIr(e,t,r);return dIr(e,t),e};Object.defineProperty(f0,"__esModule",{value:!0});f0.SummarizeRequestExtractiveness=void 0;var pIr=fIr(q());f0.SummarizeRequestExtractiveness=pIr.serialization.enum_(["low","medium","high"])});var Bgt=b(p0=>{"use strict";var mIr=p0&&p0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hIr=p0&&p0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gIr=p0&&p0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mIr(e,t,r);return hIr(e,t),e};Object.defineProperty(p0,"__esModule",{value:!0});p0.SummarizeResponse=void 0;var SSe=gIr(q()),yIr=qp();p0.SummarizeResponse=SSe.serialization.object({id:SSe.serialization.string().optional(),summary:SSe.serialization.string().optional(),meta:yIr.ApiMeta.optional()})});var $gt=b(m0=>{"use strict";var bIr=m0&&m0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Ir=m0&&m0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vIr=m0&&m0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bIr(e,t,r);return _Ir(e,t),e};Object.defineProperty(m0,"__esModule",{value:!0});m0.TokenizeResponse=void 0;var EF=vIr(q()),wIr=qp();m0.TokenizeResponse=EF.serialization.object({tokens:EF.serialization.list(EF.serialization.number()),tokenStrings:EF.serialization.property("token_strings",EF.serialization.list(EF.serialization.string())),meta:wIr.ApiMeta.optional()})});var Ugt=b(h0=>{"use strict";var SIr=h0&&h0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xIr=h0&&h0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CIr=h0&&h0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SIr(e,t,r);return xIr(e,t),e};Object.defineProperty(h0,"__esModule",{value:!0});h0.DetokenizeResponse=void 0;var qgt=CIr(q()),OIr=qp();h0.DetokenizeResponse=qgt.serialization.object({text:qgt.serialization.string(),meta:OIr.ApiMeta.optional()})});var zgt=b(g0=>{"use strict";var EIr=g0&&g0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PIr=g0&&g0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TIr=g0&&g0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EIr(e,t,r);return PIr(e,t),e};Object.defineProperty(g0,"__esModule",{value:!0});g0.CheckApiKeyResponse=void 0;var PF=TIr(q());g0.CheckApiKeyResponse=PF.serialization.object({valid:PF.serialization.boolean(),organizationId:PF.serialization.property("organization_id",PF.serialization.string().optional()),ownerId:PF.serialization.property("owner_id",PF.serialization.string().optional())})});var TF=b(y0=>{"use strict";var AIr=y0&&y0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IIr=y0&&y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MIr=y0&&y0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AIr(e,t,r);return IIr(e,t),e};Object.defineProperty(y0,"__esModule",{value:!0});y0.ToolCall=void 0;var N4=MIr(q());y0.ToolCall=N4.serialization.object({name:N4.serialization.string(),parameters:N4.serialization.record(N4.serialization.string(),N4.serialization.unknown())})});var xSe=b(b0=>{"use strict";var RIr=b0&&b0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jIr=b0&&b0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DIr=b0&&b0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RIr(e,t,r);return jIr(e,t),e};Object.defineProperty(b0,"__esModule",{value:!0});b0.ChatMessage=void 0;var sX=DIr(q()),NIr=TF();b0.ChatMessage=sX.serialization.object({message:sX.serialization.string(),toolCalls:sX.serialization.property("tool_calls",sX.serialization.list(NIr.ToolCall).optional())})});var F4=b(_0=>{"use strict";var LIr=_0&&_0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FIr=_0&&_0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kIr=_0&&_0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LIr(e,t,r);return FIr(e,t),e};Object.defineProperty(_0,"__esModule",{value:!0});_0.ToolResult=void 0;var L4=kIr(q()),BIr=TF();_0.ToolResult=L4.serialization.object({call:BIr.ToolCall,outputs:L4.serialization.list(L4.serialization.record(L4.serialization.string(),L4.serialization.unknown()))})});var OSe=b(v0=>{"use strict";var $Ir=v0&&v0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qIr=v0&&v0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UIr=v0&&v0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Ir(e,t,r);return qIr(e,t),e};Object.defineProperty(v0,"__esModule",{value:!0});v0.ToolMessage=void 0;var CSe=UIr(q()),zIr=F4();v0.ToolMessage=CSe.serialization.object({toolResults:CSe.serialization.property("tool_results",CSe.serialization.list(zIr.ToolResult).optional())})});var k4=b(w0=>{"use strict";var HIr=w0&&w0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VIr=w0&&w0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WIr=w0&&w0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HIr(e,t,r);return VIr(e,t),e};Object.defineProperty(w0,"__esModule",{value:!0});w0.Message=void 0;var KIr=WIr(q()),ESe=xSe(),JIr=OSe();w0.Message=KIr.serialization.union("role",{CHATBOT:ESe.ChatMessage,SYSTEM:ESe.ChatMessage,USER:ESe.ChatMessage,TOOL:JIr.ToolMessage}).transform({transform:t=>t,untransform:t=>t})});var uX=b(S0=>{"use strict";var GIr=S0&&S0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YIr=S0&&S0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZIr=S0&&S0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GIr(e,t,r);return YIr(e,t),e};Object.defineProperty(S0,"__esModule",{value:!0});S0.ChatConnector=void 0;var Zx=ZIr(q());S0.ChatConnector=Zx.serialization.object({id:Zx.serialization.string(),userAccessToken:Zx.serialization.property("user_access_token",Zx.serialization.string().optional()),continueOnFailure:Zx.serialization.property("continue_on_failure",Zx.serialization.boolean().optional()),options:Zx.serialization.record(Zx.serialization.string(),Zx.serialization.unknown()).optional()})});var PSe=b(x0=>{"use strict";var XIr=x0&&x0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QIr=x0&&x0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eMr=x0&&x0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&XIr(e,t,r);return QIr(e,t),e};Object.defineProperty(x0,"__esModule",{value:!0});x0.ToolParameterDefinitionsValue=void 0;var lX=eMr(q());x0.ToolParameterDefinitionsValue=lX.serialization.object({description:lX.serialization.string().optional(),type:lX.serialization.string(),required:lX.serialization.boolean().optional()})});var cX=b(C0=>{"use strict";var tMr=C0&&C0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rMr=C0&&C0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nMr=C0&&C0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&tMr(e,t,r);return rMr(e,t),e};Object.defineProperty(C0,"__esModule",{value:!0});C0.Tool=void 0;var AF=nMr(q()),oMr=PSe();C0.Tool=AF.serialization.object({name:AF.serialization.string(),description:AF.serialization.string(),parameterDefinitions:AF.serialization.property("parameter_definitions",AF.serialization.record(AF.serialization.string(),oMr.ToolParameterDefinitionsValue).optional())})});var TSe=b(O0=>{"use strict";var iMr=O0&&O0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aMr=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sMr=O0&&O0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iMr(e,t,r);return aMr(e,t),e};Object.defineProperty(O0,"__esModule",{value:!0});O0.JsonResponseFormat=void 0;var dX=sMr(q());O0.JsonResponseFormat=dX.serialization.object({schema:dX.serialization.record(dX.serialization.string(),dX.serialization.unknown()).optional()})});var fX=b(E0=>{"use strict";var uMr=E0&&E0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lMr=E0&&E0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cMr=E0&&E0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uMr(e,t,r);return lMr(e,t),e};Object.defineProperty(E0,"__esModule",{value:!0});E0.ResponseFormat=void 0;var dMr=cMr(q()),fMr=JZ(),pMr=TSe();E0.ResponseFormat=dMr.serialization.union("type",{text:fMr.TextResponseFormat,json_object:pMr.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var pX=b(P0=>{"use strict";var mMr=P0&&P0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hMr=P0&&P0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gMr=P0&&P0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mMr(e,t,r);return hMr(e,t),e};Object.defineProperty(P0,"__esModule",{value:!0});P0.ChatCitation=void 0;var CR=gMr(q());P0.ChatCitation=CR.serialization.object({start:CR.serialization.number(),end:CR.serialization.number(),text:CR.serialization.string(),documentIds:CR.serialization.property("document_ids",CR.serialization.list(CR.serialization.string()))})});var B4=b(T0=>{"use strict";var yMr=T0&&T0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bMr=T0&&T0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Mr=T0&&T0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yMr(e,t,r);return bMr(e,t),e};Object.defineProperty(T0,"__esModule",{value:!0});T0.ChatSearchQuery=void 0;var mX=_Mr(q());T0.ChatSearchQuery=mX.serialization.object({text:mX.serialization.string(),generationId:mX.serialization.property("generation_id",mX.serialization.string())})});var ASe=b(A0=>{"use strict";var vMr=A0&&A0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wMr=A0&&A0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SMr=A0&&A0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vMr(e,t,r);return wMr(e,t),e};Object.defineProperty(A0,"__esModule",{value:!0});A0.ChatSearchResultConnector=void 0;var Hgt=SMr(q());A0.ChatSearchResultConnector=Hgt.serialization.object({id:Hgt.serialization.string()})});var hX=b(I0=>{"use strict";var xMr=I0&&I0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CMr=I0&&I0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OMr=I0&&I0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xMr(e,t,r);return CMr(e,t),e};Object.defineProperty(I0,"__esModule",{value:!0});I0.ChatSearchResult=void 0;var Xx=OMr(q()),EMr=B4(),PMr=ASe();I0.ChatSearchResult=Xx.serialization.object({searchQuery:Xx.serialization.property("search_query",EMr.ChatSearchQuery.optional()),connector:PMr.ChatSearchResultConnector,documentIds:Xx.serialization.property("document_ids",Xx.serialization.list(Xx.serialization.string())),errorMessage:Xx.serialization.property("error_message",Xx.serialization.string().optional()),continueOnFailure:Xx.serialization.property("continue_on_failure",Xx.serialization.boolean().optional())})});var IF=b(M0=>{"use strict";var TMr=M0&&M0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AMr=M0&&M0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IMr=M0&&M0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TMr(e,t,r);return AMr(e,t),e};Object.defineProperty(M0,"__esModule",{value:!0});M0.FinishReason=void 0;var MMr=IMr(q());M0.FinishReason=MMr.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var ISe=b(R0=>{"use strict";var RMr=R0&&R0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jMr=R0&&R0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DMr=R0&&R0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RMr(e,t,r);return jMr(e,t),e};Object.defineProperty(R0,"__esModule",{value:!0});R0.NonStreamedChatResponse=void 0;var Tl=DMr(q()),NMr=pX(),LMr=pR(),FMr=B4(),kMr=hX(),BMr=IF(),$Mr=TF(),qMr=k4(),UMr=qp();R0.NonStreamedChatResponse=Tl.serialization.object({text:Tl.serialization.string(),generationId:Tl.serialization.property("generation_id",Tl.serialization.string().optional()),citations:Tl.serialization.list(NMr.ChatCitation).optional(),documents:Tl.serialization.list(LMr.ChatDocument).optional(),isSearchRequired:Tl.serialization.property("is_search_required",Tl.serialization.boolean().optional()),searchQueries:Tl.serialization.property("search_queries",Tl.serialization.list(FMr.ChatSearchQuery).optional()),searchResults:Tl.serialization.property("search_results",Tl.serialization.list(kMr.ChatSearchResult).optional()),finishReason:Tl.serialization.property("finish_reason",BMr.FinishReason.optional()),toolCalls:Tl.serialization.property("tool_calls",Tl.serialization.list($Mr.ToolCall).optional()),chatHistory:Tl.serialization.property("chat_history",Tl.serialization.list(qMr.Message).optional()),prompt:Tl.serialization.string().optional(),meta:UMr.ApiMeta.optional()})});var D0=b(j0=>{"use strict";var zMr=j0&&j0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HMr=j0&&j0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VMr=j0&&j0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zMr(e,t,r);return HMr(e,t),e};Object.defineProperty(j0,"__esModule",{value:!0});j0.ChatStreamEvent=void 0;var WMr=VMr(q());j0.ChatStreamEvent=WMr.serialization.object({})});var RSe=b(N0=>{"use strict";var KMr=N0&&N0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JMr=N0&&N0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GMr=N0&&N0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KMr(e,t,r);return JMr(e,t),e};Object.defineProperty(N0,"__esModule",{value:!0});N0.ChatStreamStartEvent=void 0;var MSe=GMr(q()),YMr=D0();N0.ChatStreamStartEvent=MSe.serialization.object({generationId:MSe.serialization.property("generation_id",MSe.serialization.string())}).extend(YMr.ChatStreamEvent)});var DSe=b(L0=>{"use strict";var ZMr=L0&&L0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XMr=L0&&L0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QMr=L0&&L0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZMr(e,t,r);return XMr(e,t),e};Object.defineProperty(L0,"__esModule",{value:!0});L0.ChatSearchQueriesGenerationEvent=void 0;var jSe=QMr(q()),eRr=B4(),tRr=D0();L0.ChatSearchQueriesGenerationEvent=jSe.serialization.object({searchQueries:jSe.serialization.property("search_queries",jSe.serialization.list(eRr.ChatSearchQuery))}).extend(tRr.ChatStreamEvent)});var NSe=b(F0=>{"use strict";var rRr=F0&&F0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nRr=F0&&F0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oRr=F0&&F0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rRr(e,t,r);return nRr(e,t),e};Object.defineProperty(F0,"__esModule",{value:!0});F0.ChatSearchResultsEvent=void 0;var gX=oRr(q()),iRr=hX(),aRr=pR(),sRr=D0();F0.ChatSearchResultsEvent=gX.serialization.object({searchResults:gX.serialization.property("search_results",gX.serialization.list(iRr.ChatSearchResult).optional()),documents:gX.serialization.list(aRr.ChatDocument).optional()}).extend(sRr.ChatStreamEvent)});var LSe=b(k0=>{"use strict";var uRr=k0&&k0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lRr=k0&&k0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cRr=k0&&k0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uRr(e,t,r);return lRr(e,t),e};Object.defineProperty(k0,"__esModule",{value:!0});k0.ChatTextGenerationEvent=void 0;var Vgt=cRr(q()),dRr=D0();k0.ChatTextGenerationEvent=Vgt.serialization.object({text:Vgt.serialization.string()}).extend(dRr.ChatStreamEvent)});var FSe=b(B0=>{"use strict";var fRr=B0&&B0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pRr=B0&&B0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mRr=B0&&B0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fRr(e,t,r);return pRr(e,t),e};Object.defineProperty(B0,"__esModule",{value:!0});B0.ChatCitationGenerationEvent=void 0;var Wgt=mRr(q()),hRr=pX(),gRr=D0();B0.ChatCitationGenerationEvent=Wgt.serialization.object({citations:Wgt.serialization.list(hRr.ChatCitation)}).extend(gRr.ChatStreamEvent)});var kSe=b($0=>{"use strict";var yRr=$0&&$0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bRr=$0&&$0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Rr=$0&&$0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yRr(e,t,r);return bRr(e,t),e};Object.defineProperty($0,"__esModule",{value:!0});$0.ChatToolCallsGenerationEvent=void 0;var yX=_Rr(q()),vRr=TF(),wRr=D0();$0.ChatToolCallsGenerationEvent=yX.serialization.object({text:yX.serialization.string().optional(),toolCalls:yX.serialization.property("tool_calls",yX.serialization.list(vRr.ToolCall))}).extend(wRr.ChatStreamEvent)});var BSe=b(q0=>{"use strict";var SRr=q0&&q0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xRr=q0&&q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CRr=q0&&q0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SRr(e,t,r);return xRr(e,t),e};Object.defineProperty(q0,"__esModule",{value:!0});q0.ChatStreamEndEventFinishReason=void 0;var ORr=CRr(q());q0.ChatStreamEndEventFinishReason=ORr.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var $Se=b(U0=>{"use strict";var ERr=U0&&U0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PRr=U0&&U0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TRr=U0&&U0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ERr(e,t,r);return PRr(e,t),e};Object.defineProperty(U0,"__esModule",{value:!0});U0.ChatStreamEndEvent=void 0;var Kgt=TRr(q()),ARr=BSe(),IRr=ISe(),MRr=D0();U0.ChatStreamEndEvent=Kgt.serialization.object({finishReason:Kgt.serialization.property("finish_reason",ARr.ChatStreamEndEventFinishReason),response:IRr.NonStreamedChatResponse}).extend(MRr.ChatStreamEvent)});var qSe=b(z0=>{"use strict";var RRr=z0&&z0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jRr=z0&&z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DRr=z0&&z0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RRr(e,t,r);return jRr(e,t),e};Object.defineProperty(z0,"__esModule",{value:!0});z0.ToolCallDelta=void 0;var $4=DRr(q());z0.ToolCallDelta=$4.serialization.object({name:$4.serialization.string().optional(),index:$4.serialization.number().optional(),parameters:$4.serialization.string().optional(),text:$4.serialization.string().optional()})});var USe=b(H0=>{"use strict";var NRr=H0&&H0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LRr=H0&&H0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FRr=H0&&H0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NRr(e,t,r);return LRr(e,t),e};Object.defineProperty(H0,"__esModule",{value:!0});H0.ChatToolCallsChunkEvent=void 0;var Jgt=FRr(q()),kRr=qSe(),BRr=D0();H0.ChatToolCallsChunkEvent=Jgt.serialization.object({toolCallDelta:Jgt.serialization.property("tool_call_delta",kRr.ToolCallDelta)}).extend(BRr.ChatStreamEvent)});var Ygt=b(V0=>{"use strict";var $Rr=V0&&V0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qRr=V0&&V0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),URr=V0&&V0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Rr(e,t,r);return qRr(e,t),e};Object.defineProperty(V0,"__esModule",{value:!0});V0.StreamedChatResponse=void 0;var Ggt=URr(q()),zRr=RSe(),HRr=DSe(),VRr=NSe(),WRr=LSe(),KRr=FSe(),JRr=kSe(),GRr=$Se(),YRr=USe();V0.StreamedChatResponse=Ggt.serialization.union(Ggt.serialization.discriminant("eventType","event_type"),{"stream-start":zRr.ChatStreamStartEvent,"search-queries-generation":HRr.ChatSearchQueriesGenerationEvent,"search-results":VRr.ChatSearchResultsEvent,"text-generation":WRr.ChatTextGenerationEvent,"citation-generation":KRr.ChatCitationGenerationEvent,"tool-calls-generation":JRr.ChatToolCallsGenerationEvent,"stream-end":GRr.ChatStreamEndEvent,"tool-calls-chunk":YRr.ChatToolCallsChunkEvent}).transform({transform:t=>t,untransform:t=>t})});var HSe=b(W0=>{"use strict";var ZRr=W0&&W0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XRr=W0&&W0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QRr=W0&&W0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZRr(e,t,r);return XRr(e,t),e};Object.defineProperty(W0,"__esModule",{value:!0});W0.SingleGenerationTokenLikelihoodsItem=void 0;var zSe=QRr(q());W0.SingleGenerationTokenLikelihoodsItem=zSe.serialization.object({token:zSe.serialization.string(),likelihood:zSe.serialization.number()})});var VSe=b(K0=>{"use strict";var e1r=K0&&K0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t1r=K0&&K0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r1r=K0&&K0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e1r(e,t,r);return t1r(e,t),e};Object.defineProperty(K0,"__esModule",{value:!0});K0.SingleGeneration=void 0;var OR=r1r(q()),n1r=HSe();K0.SingleGeneration=OR.serialization.object({id:OR.serialization.string(),text:OR.serialization.string(),index:OR.serialization.number().optional(),likelihood:OR.serialization.number().optional(),tokenLikelihoods:OR.serialization.property("token_likelihoods",OR.serialization.list(n1r.SingleGenerationTokenLikelihoodsItem).optional())})});var Zgt=b(J0=>{"use strict";var o1r=J0&&J0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i1r=J0&&J0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a1r=J0&&J0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o1r(e,t,r);return i1r(e,t),e};Object.defineProperty(J0,"__esModule",{value:!0});J0.Generation=void 0;var bX=a1r(q()),s1r=VSe(),u1r=qp();J0.Generation=bX.serialization.object({id:bX.serialization.string(),prompt:bX.serialization.string().optional(),generations:bX.serialization.list(s1r.SingleGeneration),meta:u1r.ApiMeta.optional()})});var q4=b(G0=>{"use strict";var l1r=G0&&G0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),c1r=G0&&G0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d1r=G0&&G0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&l1r(e,t,r);return c1r(e,t),e};Object.defineProperty(G0,"__esModule",{value:!0});G0.GenerateStreamEvent=void 0;var f1r=d1r(q());G0.GenerateStreamEvent=f1r.serialization.object({})});var WSe=b(Y0=>{"use strict";var p1r=Y0&&Y0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m1r=Y0&&Y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h1r=Y0&&Y0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&p1r(e,t,r);return m1r(e,t),e};Object.defineProperty(Y0,"__esModule",{value:!0});Y0.GenerateStreamText=void 0;var U4=h1r(q()),g1r=q4();Y0.GenerateStreamText=U4.serialization.object({text:U4.serialization.string(),index:U4.serialization.number().optional(),isFinished:U4.serialization.property("is_finished",U4.serialization.boolean())}).extend(g1r.GenerateStreamEvent)});var KSe=b(Z0=>{"use strict";var y1r=Z0&&Z0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b1r=Z0&&Z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_1r=Z0&&Z0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&y1r(e,t,r);return b1r(e,t),e};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.SingleGenerationInStream=void 0;var z4=_1r(q()),v1r=IF();Z0.SingleGenerationInStream=z4.serialization.object({id:z4.serialization.string(),text:z4.serialization.string(),index:z4.serialization.number().optional(),finishReason:z4.serialization.property("finish_reason",v1r.FinishReason)})});var JSe=b(X0=>{"use strict";var w1r=X0&&X0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),S1r=X0&&X0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x1r=X0&&X0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&w1r(e,t,r);return S1r(e,t),e};Object.defineProperty(X0,"__esModule",{value:!0});X0.GenerateStreamEndResponse=void 0;var _X=x1r(q()),C1r=KSe();X0.GenerateStreamEndResponse=_X.serialization.object({id:_X.serialization.string(),prompt:_X.serialization.string().optional(),generations:_X.serialization.list(C1r.SingleGenerationInStream).optional()})});var GSe=b(Q0=>{"use strict";var O1r=Q0&&Q0.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E1r=Q0&&Q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P1r=Q0&&Q0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&O1r(e,t,r);return E1r(e,t),e};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.GenerateStreamEnd=void 0;var vX=P1r(q()),T1r=IF(),A1r=JSe(),I1r=q4();Q0.GenerateStreamEnd=vX.serialization.object({isFinished:vX.serialization.property("is_finished",vX.serialization.boolean()),finishReason:vX.serialization.property("finish_reason",T1r.FinishReason.optional()),response:A1r.GenerateStreamEndResponse}).extend(I1r.GenerateStreamEvent)});var YSe=b(ew=>{"use strict";var M1r=ew&&ew.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R1r=ew&&ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j1r=ew&&ew.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&M1r(e,t,r);return R1r(e,t),e};Object.defineProperty(ew,"__esModule",{value:!0});ew.GenerateStreamError=void 0;var MF=j1r(q()),D1r=IF(),N1r=q4();ew.GenerateStreamError=MF.serialization.object({index:MF.serialization.number().optional(),isFinished:MF.serialization.property("is_finished",MF.serialization.boolean()),finishReason:MF.serialization.property("finish_reason",D1r.FinishReason),err:MF.serialization.string()}).extend(N1r.GenerateStreamEvent)});var Qgt=b(tw=>{"use strict";var L1r=tw&&tw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F1r=tw&&tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k1r=tw&&tw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L1r(e,t,r);return F1r(e,t),e};Object.defineProperty(tw,"__esModule",{value:!0});tw.GenerateStreamedResponse=void 0;var Xgt=k1r(q()),B1r=WSe(),$1r=GSe(),q1r=YSe();tw.GenerateStreamedResponse=Xgt.serialization.union(Xgt.serialization.discriminant("eventType","event_type"),{"text-generation":B1r.GenerateStreamText,"stream-end":$1r.GenerateStreamEnd,"stream-error":q1r.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var ZSe=b(rw=>{"use strict";var U1r=rw&&rw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z1r=rw&&rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H1r=rw&&rw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&U1r(e,t,r);return z1r(e,t),e};Object.defineProperty(rw,"__esModule",{value:!0});rw.EmbedJobStatus=void 0;var V1r=H1r(q());rw.EmbedJobStatus=V1r.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var XSe=b(nw=>{"use strict";var W1r=nw&&nw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K1r=nw&&nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J1r=nw&&nw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&W1r(e,t,r);return K1r(e,t),e};Object.defineProperty(nw,"__esModule",{value:!0});nw.EmbedJobTruncate=void 0;var G1r=J1r(q());nw.EmbedJobTruncate=G1r.serialization.enum_(["START","END"])});var QSe=b(ow=>{"use strict";var Y1r=ow&&ow.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z1r=ow&&ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X1r=ow&&ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Y1r(e,t,r);return Z1r(e,t),e};Object.defineProperty(ow,"__esModule",{value:!0});ow.EmbedJob=void 0;var Mg=X1r(q()),Q1r=ZSe(),ejr=XSe(),tjr=qp();ow.EmbedJob=Mg.serialization.object({jobId:Mg.serialization.property("job_id",Mg.serialization.string()),name:Mg.serialization.string().optional(),status:Q1r.EmbedJobStatus,createdAt:Mg.serialization.property("created_at",Mg.serialization.date()),inputDatasetId:Mg.serialization.property("input_dataset_id",Mg.serialization.string()),outputDatasetId:Mg.serialization.property("output_dataset_id",Mg.serialization.string().optional()),model:Mg.serialization.string(),truncate:ejr.EmbedJobTruncate,meta:tjr.ApiMeta.optional()})});var eyt=b(iw=>{"use strict";var rjr=iw&&iw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),njr=iw&&iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ojr=iw&&iw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rjr(e,t,r);return njr(e,t),e};Object.defineProperty(iw,"__esModule",{value:!0});iw.ListEmbedJobResponse=void 0;var exe=ojr(q()),ijr=QSe();iw.ListEmbedJobResponse=exe.serialization.object({embedJobs:exe.serialization.property("embed_jobs",exe.serialization.list(ijr.EmbedJob).optional())})});var tyt=b(aw=>{"use strict";var ajr=aw&&aw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sjr=aw&&aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ujr=aw&&aw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ajr(e,t,r);return sjr(e,t),e};Object.defineProperty(aw,"__esModule",{value:!0});aw.CreateEmbedJobResponse=void 0;var txe=ujr(q()),ljr=qp();aw.CreateEmbedJobResponse=txe.serialization.object({jobId:txe.serialization.property("job_id",txe.serialization.string()),meta:ljr.ApiMeta.optional()})});var nxe=b(sw=>{"use strict";var cjr=sw&&sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),djr=sw&&sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fjr=sw&&sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cjr(e,t,r);return djr(e,t),e};Object.defineProperty(sw,"__esModule",{value:!0});sw.ClassifyExample=void 0;var rxe=fjr(q());sw.ClassifyExample=rxe.serialization.object({text:rxe.serialization.string().optional(),label:rxe.serialization.string().optional()})});var ryt=b(uw=>{"use strict";var pjr=uw&&uw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mjr=uw&&uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hjr=uw&&uw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pjr(e,t,r);return mjr(e,t),e};Object.defineProperty(uw,"__esModule",{value:!0});uw.ParseInfo=void 0;var oxe=hjr(q());uw.ParseInfo=oxe.serialization.object({separator:oxe.serialization.string().optional(),delimiter:oxe.serialization.string().optional()})});var nyt=b(lw=>{"use strict";var gjr=lw&&lw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yjr=lw&&lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bjr=lw&&lw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gjr(e,t,r);return yjr(e,t),e};Object.defineProperty(lw,"__esModule",{value:!0});lw.RerankerDataMetrics=void 0;var Up=bjr(q());lw.RerankerDataMetrics=Up.serialization.object({numTrainQueries:Up.serialization.property("num_train_queries",Up.serialization.number().optional()),numTrainRelevantPassages:Up.serialization.property("num_train_relevant_passages",Up.serialization.number().optional()),numTrainHardNegatives:Up.serialization.property("num_train_hard_negatives",Up.serialization.number().optional()),numEvalQueries:Up.serialization.property("num_eval_queries",Up.serialization.number().optional()),numEvalRelevantPassages:Up.serialization.property("num_eval_relevant_passages",Up.serialization.number().optional()),numEvalHardNegatives:Up.serialization.property("num_eval_hard_negatives",Up.serialization.number().optional())})});var oyt=b(cw=>{"use strict";var _jr=cw&&cw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vjr=cw&&cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wjr=cw&&cw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_jr(e,t,r);return vjr(e,t),e};Object.defineProperty(cw,"__esModule",{value:!0});cw.ChatDataMetrics=void 0;var RF=wjr(q());cw.ChatDataMetrics=RF.serialization.object({numTrainTurns:RF.serialization.property("num_train_turns",RF.serialization.number().optional()),numEvalTurns:RF.serialization.property("num_eval_turns",RF.serialization.number().optional()),preamble:RF.serialization.string().optional()})});var ixe=b(dw=>{"use strict";var Sjr=dw&&dw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xjr=dw&&dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cjr=dw&&dw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Sjr(e,t,r);return xjr(e,t),e};Object.defineProperty(dw,"__esModule",{value:!0});dw.LabelMetric=void 0;var jF=Cjr(q());dw.LabelMetric=jF.serialization.object({totalExamples:jF.serialization.property("total_examples",jF.serialization.number().optional()),label:jF.serialization.string().optional(),samples:jF.serialization.list(jF.serialization.string()).optional()})});var iyt=b(fw=>{"use strict";var Ojr=fw&&fw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ejr=fw&&fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pjr=fw&&fw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ojr(e,t,r);return Ejr(e,t),e};Object.defineProperty(fw,"__esModule",{value:!0});fw.ClassifyDataMetrics=void 0;var axe=Pjr(q()),Tjr=ixe();fw.ClassifyDataMetrics=axe.serialization.object({labelMetrics:axe.serialization.property("label_metrics",axe.serialization.list(Tjr.LabelMetric).optional())})});var sxe=b(pw=>{"use strict";var Ajr=pw&&pw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ijr=pw&&pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mjr=pw&&pw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ajr(e,t,r);return Ijr(e,t),e};Object.defineProperty(pw,"__esModule",{value:!0});pw.FinetuneDatasetMetrics=void 0;var zp=Mjr(q());pw.FinetuneDatasetMetrics=zp.serialization.object({trainableTokenCount:zp.serialization.property("trainable_token_count",zp.serialization.number().optional()),totalExamples:zp.serialization.property("total_examples",zp.serialization.number().optional()),trainExamples:zp.serialization.property("train_examples",zp.serialization.number().optional()),trainSizeBytes:zp.serialization.property("train_size_bytes",zp.serialization.number().optional()),evalExamples:zp.serialization.property("eval_examples",zp.serialization.number().optional()),evalSizeBytes:zp.serialization.property("eval_size_bytes",zp.serialization.number().optional())})});var lxe=b(mw=>{"use strict";var Rjr=mw&&mw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jjr=mw&&mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Djr=mw&&mw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rjr(e,t,r);return jjr(e,t),e};Object.defineProperty(mw,"__esModule",{value:!0});mw.MetricsEmbedDataFieldsItem=void 0;var uxe=Djr(q());mw.MetricsEmbedDataFieldsItem=uxe.serialization.object({name:uxe.serialization.string().optional(),count:uxe.serialization.number().optional()})});var cxe=b(hw=>{"use strict";var Njr=hw&&hw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ljr=hw&&hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fjr=hw&&hw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Njr(e,t,r);return Ljr(e,t),e};Object.defineProperty(hw,"__esModule",{value:!0});hw.MetricsEmbedData=void 0;var ayt=Fjr(q()),kjr=lxe();hw.MetricsEmbedData=ayt.serialization.object({fields:ayt.serialization.list(kjr.MetricsEmbedDataFieldsItem).optional()})});var syt=b(gw=>{"use strict";var Bjr=gw&&gw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$jr=gw&&gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qjr=gw&&gw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Bjr(e,t,r);return $jr(e,t),e};Object.defineProperty(gw,"__esModule",{value:!0});gw.Metrics=void 0;var dxe=qjr(q()),Ujr=sxe(),zjr=cxe();gw.Metrics=dxe.serialization.object({finetuneDatasetMetrics:dxe.serialization.property("finetune_dataset_metrics",Ujr.FinetuneDatasetMetrics.optional()),embedData:dxe.serialization.property("embed_data",zjr.MetricsEmbedData.optional())})});var fxe=b(bw=>{"use strict";var Hjr=bw&&bw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vjr=bw&&bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wjr=bw&&bw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Hjr(e,t,r);return Vjr(e,t),e};Object.defineProperty(bw,"__esModule",{value:!0});bw.ConnectorOAuth=void 0;var yw=Wjr(q());bw.ConnectorOAuth=yw.serialization.object({clientId:yw.serialization.property("client_id",yw.serialization.string().optional()),clientSecret:yw.serialization.property("client_secret",yw.serialization.string().optional()),authorizeUrl:yw.serialization.property("authorize_url",yw.serialization.string()),tokenUrl:yw.serialization.property("token_url",yw.serialization.string()),scope:yw.serialization.string().optional()})});var pxe=b(_w=>{"use strict";var Kjr=_w&&_w.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Jjr=_w&&_w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gjr=_w&&_w.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kjr(e,t,r);return Jjr(e,t),e};Object.defineProperty(_w,"__esModule",{value:!0});_w.ConnectorAuthStatus=void 0;var Yjr=Gjr(q());_w.ConnectorAuthStatus=Yjr.serialization.enum_(["valid","expired"])});var DF=b(vw=>{"use strict";var Zjr=vw&&vw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xjr=vw&&vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qjr=vw&&vw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zjr(e,t,r);return Xjr(e,t),e};Object.defineProperty(vw,"__esModule",{value:!0});vw.Connector=void 0;var tl=Qjr(q()),eDr=fxe(),tDr=pxe();vw.Connector=tl.serialization.object({id:tl.serialization.string(),organizationId:tl.serialization.property("organization_id",tl.serialization.string().optional()),name:tl.serialization.string(),description:tl.serialization.string().optional(),url:tl.serialization.string().optional(),createdAt:tl.serialization.property("created_at",tl.serialization.date()),updatedAt:tl.serialization.property("updated_at",tl.serialization.date()),excludes:tl.serialization.list(tl.serialization.string()).optional(),authType:tl.serialization.property("auth_type",tl.serialization.string().optional()),oauth:eDr.ConnectorOAuth.optional(),authStatus:tl.serialization.property("auth_status",tDr.ConnectorAuthStatus.optional()),active:tl.serialization.boolean().optional(),continueOnFailure:tl.serialization.property("continue_on_failure",tl.serialization.boolean().optional())})});var uyt=b(ww=>{"use strict";var rDr=ww&&ww.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nDr=ww&&ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oDr=ww&&ww.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rDr(e,t,r);return nDr(e,t),e};Object.defineProperty(ww,"__esModule",{value:!0});ww.ListConnectorsResponse=void 0;var wX=oDr(q()),iDr=DF();ww.ListConnectorsResponse=wX.serialization.object({connectors:wX.serialization.list(iDr.Connector),totalCount:wX.serialization.property("total_count",wX.serialization.number().optional())})});var lyt=b(Sw=>{"use strict";var aDr=Sw&&Sw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sDr=Sw&&Sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uDr=Sw&&Sw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aDr(e,t,r);return sDr(e,t),e};Object.defineProperty(Sw,"__esModule",{value:!0});Sw.CreateConnectorResponse=void 0;var lDr=uDr(q()),cDr=DF();Sw.CreateConnectorResponse=lDr.serialization.object({connector:cDr.Connector})});var cyt=b(xw=>{"use strict";var dDr=xw&&xw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fDr=xw&&xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pDr=xw&&xw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dDr(e,t,r);return fDr(e,t),e};Object.defineProperty(xw,"__esModule",{value:!0});xw.GetConnectorResponse=void 0;var mDr=pDr(q()),hDr=DF();xw.GetConnectorResponse=mDr.serialization.object({connector:hDr.Connector})});var dyt=b(Cw=>{"use strict";var gDr=Cw&&Cw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yDr=Cw&&Cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bDr=Cw&&Cw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gDr(e,t,r);return yDr(e,t),e};Object.defineProperty(Cw,"__esModule",{value:!0});Cw.DeleteConnectorResponse=void 0;var mxe=bDr(q());Cw.DeleteConnectorResponse=mxe.serialization.record(mxe.serialization.string(),mxe.serialization.unknown())});var fyt=b(Ow=>{"use strict";var _Dr=Ow&&Ow.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vDr=Ow&&Ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wDr=Ow&&Ow.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Dr(e,t,r);return vDr(e,t),e};Object.defineProperty(Ow,"__esModule",{value:!0});Ow.UpdateConnectorResponse=void 0;var SDr=wDr(q()),xDr=DF();Ow.UpdateConnectorResponse=SDr.serialization.object({connector:xDr.Connector})});var pyt=b(Ew=>{"use strict";var CDr=Ew&&Ew.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ODr=Ew&&Ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EDr=Ew&&Ew.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CDr(e,t,r);return ODr(e,t),e};Object.defineProperty(Ew,"__esModule",{value:!0});Ew.OAuthAuthorizeResponse=void 0;var hxe=EDr(q());Ew.OAuthAuthorizeResponse=hxe.serialization.object({redirectUrl:hxe.serialization.property("redirect_url",hxe.serialization.string().optional())})});var gxe=b(Pw=>{"use strict";var PDr=Pw&&Pw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TDr=Pw&&Pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ADr=Pw&&Pw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PDr(e,t,r);return TDr(e,t),e};Object.defineProperty(Pw,"__esModule",{value:!0});Pw.CompatibleEndpoint=void 0;var IDr=ADr(q());Pw.CompatibleEndpoint=IDr.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var yxe=b(Aw=>{"use strict";var MDr=Aw&&Aw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RDr=Aw&&Aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jDr=Aw&&Aw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MDr(e,t,r);return RDr(e,t),e};Object.defineProperty(Aw,"__esModule",{value:!0});Aw.GetModelResponse=void 0;var Tw=jDr(q()),myt=gxe();Aw.GetModelResponse=Tw.serialization.object({name:Tw.serialization.string().optional(),endpoints:Tw.serialization.list(myt.CompatibleEndpoint).optional(),finetuned:Tw.serialization.boolean().optional(),contextLength:Tw.serialization.property("context_length",Tw.serialization.number().optional()),tokenizerUrl:Tw.serialization.property("tokenizer_url",Tw.serialization.string().optional()),defaultEndpoints:Tw.serialization.property("default_endpoints",Tw.serialization.list(myt.CompatibleEndpoint).optional())})});var hyt=b(Iw=>{"use strict";var DDr=Iw&&Iw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NDr=Iw&&Iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LDr=Iw&&Iw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DDr(e,t,r);return NDr(e,t),e};Object.defineProperty(Iw,"__esModule",{value:!0});Iw.ListModelsResponse=void 0;var SX=LDr(q()),FDr=yxe();Iw.ListModelsResponse=SX.serialization.object({models:SX.serialization.list(FDr.GetModelResponse),nextPageToken:SX.serialization.property("next_page_token",SX.serialization.string().optional())})});var gyt=b(se=>{"use strict";var kDr=se&&se.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),he=se&&se.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kDr(e,t,r)};Object.defineProperty(se,"__esModule",{value:!0});he(Vwe(),se);he(Wwe(),se);he(_gt(),se);he(Kwe(),se);he(wgt(),se);he(xgt(),se);he(Ogt(),se);he(Pgt(),se);he(Agt(),se);he(Jwe(),se);he(Gwe(),se);he(Mgt(),se);he(Ywe(),se);he(Zwe(),se);he(Xwe(),se);he(Qwe(),se);he(eSe(),se);he(tSe(),se);he(jgt(),se);he(cSe(),se);he(dSe(),se);he(fSe(),se);he(Lgt(),se);he(mSe(),se);he(hSe(),se);he(gSe(),se);he(ySe(),se);he(kgt(),se);he(_Se(),se);he(vSe(),se);he(wSe(),se);he(Bgt(),se);he($gt(),se);he(Ugt(),se);he(zgt(),se);he(TF(),se);he(xSe(),se);he(F4(),se);he(OSe(),se);he(k4(),se);he(uX(),se);he(pR(),se);he(PSe(),se);he(cX(),se);he(JZ(),se);he(TSe(),se);he(fX(),se);he(pX(),se);he(B4(),se);he(ASe(),se);he(hX(),se);he(IF(),se);he(rSe(),se);he(nSe(),se);he(oSe(),se);he(qp(),se);he(ISe(),se);he(D0(),se);he(RSe(),se);he(DSe(),se);he(NSe(),se);he(LSe(),se);he(FSe(),se);he(kSe(),se);he(BSe(),se);he($Se(),se);he(qSe(),se);he(USe(),se);he(Ygt(),se);he(Swe(),se);he(GZ(),se);he(ywe(),se);he(bwe(),se);he(_we(),se);he(vwe(),se);he(HSe(),se);he(VSe(),se);he(Zgt(),se);he(q4(),se);he(WSe(),se);he(KSe(),se);he(JSe(),se);he(GSe(),se);he(YSe(),se);he(Qgt(),se);he(YZ(),se);he(ZZ(),se);he(iSe(),se);he(aSe(),se);he(sSe(),se);he(ZSe(),se);he(XSe(),se);he(QSe(),se);he(eyt(),se);he(tyt(),se);he(lSe(),se);he(nxe(),se);he(Twe(),se);he(Pwe(),se);he(Awe(),se);he(ryt(),se);he(nyt(),se);he(oyt(),se);he(ixe(),se);he(iyt(),se);he(sxe(),se);he(lxe(),se);he(cxe(),se);he(syt(),se);he(QZ(),se);he(fxe(),se);he(pxe(),se);he(DF(),se);he(uyt(),se);he(nX(),se);he(zwe(),se);he(oX(),se);he(lyt(),se);he(cyt(),se);he(dyt(),se);he(fyt(),se);he(pyt(),se);he(gxe(),se);he(yxe(),se);he(hyt(),se)});var yyt=b(Mw=>{"use strict";var BDr=Mw&&Mw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Dr=Mw&&Mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qDr=Mw&&Mw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BDr(e,t,r);return $Dr(e,t),e};Object.defineProperty(Mw,"__esModule",{value:!0});Mw.ChatStreamRequest=void 0;var Yr=qDr(q()),UDr=k4(),zDr=Vwe(),HDr=uX(),VDr=pR(),WDr=Wwe(),KDr=cX(),JDr=F4(),GDr=fX(),YDr=Kwe();Mw.ChatStreamRequest=Yr.serialization.object({message:Yr.serialization.string(),model:Yr.serialization.string().optional(),preamble:Yr.serialization.string().optional(),chatHistory:Yr.serialization.property("chat_history",Yr.serialization.list(UDr.Message).optional()),conversationId:Yr.serialization.property("conversation_id",Yr.serialization.string().optional()),promptTruncation:Yr.serialization.property("prompt_truncation",zDr.ChatStreamRequestPromptTruncation.optional()),connectors:Yr.serialization.list(HDr.ChatConnector).optional(),searchQueriesOnly:Yr.serialization.property("search_queries_only",Yr.serialization.boolean().optional()),documents:Yr.serialization.list(VDr.ChatDocument).optional(),citationQuality:Yr.serialization.property("citation_quality",WDr.ChatStreamRequestCitationQuality.optional()),temperature:Yr.serialization.number().optional(),maxTokens:Yr.serialization.property("max_tokens",Yr.serialization.number().optional()),maxInputTokens:Yr.serialization.property("max_input_tokens",Yr.serialization.number().optional()),k:Yr.serialization.number().optional(),p:Yr.serialization.number().optional(),seed:Yr.serialization.number().optional(),stopSequences:Yr.serialization.property("stop_sequences",Yr.serialization.list(Yr.serialization.string()).optional()),frequencyPenalty:Yr.serialization.property("frequency_penalty",Yr.serialization.number().optional()),presencePenalty:Yr.serialization.property("presence_penalty",Yr.serialization.number().optional()),rawPrompting:Yr.serialization.property("raw_prompting",Yr.serialization.boolean().optional()),returnPrompt:Yr.serialization.property("return_prompt",Yr.serialization.boolean().optional()),tools:Yr.serialization.list(KDr.Tool).optional(),toolResults:Yr.serialization.property("tool_results",Yr.serialization.list(JDr.ToolResult).optional()),forceSingleStep:Yr.serialization.property("force_single_step",Yr.serialization.boolean().optional()),responseFormat:Yr.serialization.property("response_format",GDr.ResponseFormat.optional()),safetyMode:Yr.serialization.property("safety_mode",YDr.ChatStreamRequestSafetyMode.optional())})});var byt=b(Rw=>{"use strict";var ZDr=Rw&&Rw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XDr=Rw&&Rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QDr=Rw&&Rw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZDr(e,t,r);return XDr(e,t),e};Object.defineProperty(Rw,"__esModule",{value:!0});Rw.ChatRequest=void 0;var Zr=QDr(q()),eNr=k4(),tNr=Jwe(),rNr=uX(),nNr=pR(),oNr=Gwe(),iNr=cX(),aNr=F4(),sNr=fX(),uNr=Ywe();Rw.ChatRequest=Zr.serialization.object({message:Zr.serialization.string(),model:Zr.serialization.string().optional(),preamble:Zr.serialization.string().optional(),chatHistory:Zr.serialization.property("chat_history",Zr.serialization.list(eNr.Message).optional()),conversationId:Zr.serialization.property("conversation_id",Zr.serialization.string().optional()),promptTruncation:Zr.serialization.property("prompt_truncation",tNr.ChatRequestPromptTruncation.optional()),connectors:Zr.serialization.list(rNr.ChatConnector).optional(),searchQueriesOnly:Zr.serialization.property("search_queries_only",Zr.serialization.boolean().optional()),documents:Zr.serialization.list(nNr.ChatDocument).optional(),citationQuality:Zr.serialization.property("citation_quality",oNr.ChatRequestCitationQuality.optional()),temperature:Zr.serialization.number().optional(),maxTokens:Zr.serialization.property("max_tokens",Zr.serialization.number().optional()),maxInputTokens:Zr.serialization.property("max_input_tokens",Zr.serialization.number().optional()),k:Zr.serialization.number().optional(),p:Zr.serialization.number().optional(),seed:Zr.serialization.number().optional(),stopSequences:Zr.serialization.property("stop_sequences",Zr.serialization.list(Zr.serialization.string()).optional()),frequencyPenalty:Zr.serialization.property("frequency_penalty",Zr.serialization.number().optional()),presencePenalty:Zr.serialization.property("presence_penalty",Zr.serialization.number().optional()),rawPrompting:Zr.serialization.property("raw_prompting",Zr.serialization.boolean().optional()),returnPrompt:Zr.serialization.property("return_prompt",Zr.serialization.boolean().optional()),tools:Zr.serialization.list(iNr.Tool).optional(),toolResults:Zr.serialization.property("tool_results",Zr.serialization.list(aNr.ToolResult).optional()),forceSingleStep:Zr.serialization.property("force_single_step",Zr.serialization.boolean().optional()),responseFormat:Zr.serialization.property("response_format",sNr.ResponseFormat.optional()),safetyMode:Zr.serialization.property("safety_mode",uNr.ChatRequestSafetyMode.optional())})});var _yt=b(jw=>{"use strict";var lNr=jw&&jw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cNr=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dNr=jw&&jw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lNr(e,t,r);return cNr(e,t),e};Object.defineProperty(jw,"__esModule",{value:!0});jw.GenerateStreamRequest=void 0;var ji=dNr(q()),fNr=Zwe(),pNr=Xwe();jw.GenerateStreamRequest=ji.serialization.object({prompt:ji.serialization.string(),model:ji.serialization.string().optional(),numGenerations:ji.serialization.property("num_generations",ji.serialization.number().optional()),maxTokens:ji.serialization.property("max_tokens",ji.serialization.number().optional()),truncate:fNr.GenerateStreamRequestTruncate.optional(),temperature:ji.serialization.number().optional(),seed:ji.serialization.number().optional(),preset:ji.serialization.string().optional(),endSequences:ji.serialization.property("end_sequences",ji.serialization.list(ji.serialization.string()).optional()),stopSequences:ji.serialization.property("stop_sequences",ji.serialization.list(ji.serialization.string()).optional()),k:ji.serialization.number().optional(),p:ji.serialization.number().optional(),frequencyPenalty:ji.serialization.property("frequency_penalty",ji.serialization.number().optional()),presencePenalty:ji.serialization.property("presence_penalty",ji.serialization.number().optional()),returnLikelihoods:ji.serialization.property("return_likelihoods",pNr.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:ji.serialization.property("raw_prompting",ji.serialization.boolean().optional())})});var vyt=b(Dw=>{"use strict";var mNr=Dw&&Dw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hNr=Dw&&Dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gNr=Dw&&Dw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mNr(e,t,r);return hNr(e,t),e};Object.defineProperty(Dw,"__esModule",{value:!0});Dw.GenerateRequest=void 0;var Di=gNr(q()),yNr=Qwe(),bNr=eSe();Dw.GenerateRequest=Di.serialization.object({prompt:Di.serialization.string(),model:Di.serialization.string().optional(),numGenerations:Di.serialization.property("num_generations",Di.serialization.number().optional()),maxTokens:Di.serialization.property("max_tokens",Di.serialization.number().optional()),truncate:yNr.GenerateRequestTruncate.optional(),temperature:Di.serialization.number().optional(),seed:Di.serialization.number().optional(),preset:Di.serialization.string().optional(),endSequences:Di.serialization.property("end_sequences",Di.serialization.list(Di.serialization.string()).optional()),stopSequences:Di.serialization.property("stop_sequences",Di.serialization.list(Di.serialization.string()).optional()),k:Di.serialization.number().optional(),p:Di.serialization.number().optional(),frequencyPenalty:Di.serialization.property("frequency_penalty",Di.serialization.number().optional()),presencePenalty:Di.serialization.property("presence_penalty",Di.serialization.number().optional()),returnLikelihoods:Di.serialization.property("return_likelihoods",bNr.GenerateRequestReturnLikelihoods.optional()),rawPrompting:Di.serialization.property("raw_prompting",Di.serialization.boolean().optional())})});var wyt=b(Nw=>{"use strict";var _Nr=Nw&&Nw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vNr=Nw&&Nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wNr=Nw&&Nw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Nr(e,t,r);return vNr(e,t),e};Object.defineProperty(Nw,"__esModule",{value:!0});Nw.EmbedRequest=void 0;var ER=wNr(q()),SNr=YZ(),xNr=ZZ(),CNr=tSe();Nw.EmbedRequest=ER.serialization.object({texts:ER.serialization.list(ER.serialization.string()),model:ER.serialization.string().optional(),inputType:ER.serialization.property("input_type",SNr.EmbedInputType.optional()),embeddingTypes:ER.serialization.property("embedding_types",ER.serialization.list(xNr.EmbeddingType).optional()),truncate:CNr.EmbedRequestTruncate.optional()})});var Syt=b(Lw=>{"use strict";var ONr=Lw&&Lw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ENr=Lw&&Lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PNr=Lw&&Lw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ONr(e,t,r);return ENr(e,t),e};Object.defineProperty(Lw,"__esModule",{value:!0});Lw.RerankRequest=void 0;var Hp=PNr(q()),TNr=cSe();Lw.RerankRequest=Hp.serialization.object({model:Hp.serialization.string().optional(),query:Hp.serialization.string(),documents:Hp.serialization.list(TNr.RerankRequestDocumentsItem),topN:Hp.serialization.property("top_n",Hp.serialization.number().optional()),rankFields:Hp.serialization.property("rank_fields",Hp.serialization.list(Hp.serialization.string()).optional()),returnDocuments:Hp.serialization.property("return_documents",Hp.serialization.boolean().optional()),maxChunksPerDoc:Hp.serialization.property("max_chunks_per_doc",Hp.serialization.number().optional())})});var xyt=b(Fw=>{"use strict";var ANr=Fw&&Fw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),INr=Fw&&Fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MNr=Fw&&Fw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ANr(e,t,r);return INr(e,t),e};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.ClassifyRequest=void 0;var NF=MNr(q()),RNr=nxe(),jNr=mSe();Fw.ClassifyRequest=NF.serialization.object({inputs:NF.serialization.list(NF.serialization.string()),examples:NF.serialization.list(RNr.ClassifyExample).optional(),model:NF.serialization.string().optional(),preset:NF.serialization.string().optional(),truncate:jNr.ClassifyRequestTruncate.optional()})});var Cyt=b(kw=>{"use strict";var DNr=kw&&kw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NNr=kw&&kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LNr=kw&&kw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DNr(e,t,r);return NNr(e,t),e};Object.defineProperty(kw,"__esModule",{value:!0});kw.SummarizeRequest=void 0;var LF=LNr(q()),FNr=_Se(),kNr=vSe(),BNr=wSe();kw.SummarizeRequest=LF.serialization.object({text:LF.serialization.string(),length:FNr.SummarizeRequestLength.optional(),format:kNr.SummarizeRequestFormat.optional(),model:LF.serialization.string().optional(),extractiveness:BNr.SummarizeRequestExtractiveness.optional(),temperature:LF.serialization.number().optional(),additionalCommand:LF.serialization.property("additional_command",LF.serialization.string().optional())})});var Oyt=b(Bw=>{"use strict";var $Nr=Bw&&Bw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qNr=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UNr=Bw&&Bw.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Nr(e,t,r);return qNr(e,t),e};Object.defineProperty(Bw,"__esModule",{value:!0});Bw.TokenizeRequest=void 0;var bxe=UNr(q());Bw.TokenizeRequest=bxe.serialization.object({text:bxe.serialization.string(),model:bxe.serialization.string()})});var Eyt=b($w=>{"use strict";var zNr=$w&&$w.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HNr=$w&&$w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VNr=$w&&$w.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zNr(e,t,r);return HNr(e,t),e};Object.defineProperty($w,"__esModule",{value:!0});$w.DetokenizeRequest=void 0;var xX=VNr(q());$w.DetokenizeRequest=xX.serialization.object({tokens:xX.serialization.list(xX.serialization.number()),model:xX.serialization.string()})});var Pyt=b(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.DetokenizeRequest=Fa.TokenizeRequest=Fa.SummarizeRequest=Fa.ClassifyRequest=Fa.RerankRequest=Fa.EmbedRequest=Fa.GenerateRequest=Fa.GenerateStreamRequest=Fa.ChatRequest=Fa.ChatStreamRequest=void 0;var WNr=yyt();Object.defineProperty(Fa,"ChatStreamRequest",{enumerable:!0,get:function(){return WNr.ChatStreamRequest}});var KNr=byt();Object.defineProperty(Fa,"ChatRequest",{enumerable:!0,get:function(){return KNr.ChatRequest}});var JNr=_yt();Object.defineProperty(Fa,"GenerateStreamRequest",{enumerable:!0,get:function(){return JNr.GenerateStreamRequest}});var GNr=vyt();Object.defineProperty(Fa,"GenerateRequest",{enumerable:!0,get:function(){return GNr.GenerateRequest}});var YNr=wyt();Object.defineProperty(Fa,"EmbedRequest",{enumerable:!0,get:function(){return YNr.EmbedRequest}});var ZNr=Syt();Object.defineProperty(Fa,"RerankRequest",{enumerable:!0,get:function(){return ZNr.RerankRequest}});var XNr=xyt();Object.defineProperty(Fa,"ClassifyRequest",{enumerable:!0,get:function(){return XNr.ClassifyRequest}});var QNr=Cyt();Object.defineProperty(Fa,"SummarizeRequest",{enumerable:!0,get:function(){return QNr.SummarizeRequest}});var eLr=Oyt();Object.defineProperty(Fa,"TokenizeRequest",{enumerable:!0,get:function(){return eLr.TokenizeRequest}});var tLr=Eyt();Object.defineProperty(Fa,"DetokenizeRequest",{enumerable:!0,get:function(){return tLr.DetokenizeRequest}})});var Tyt=b(PR=>{"use strict";var rLr=PR&&PR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nLr=PR&&PR.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rLr(e,t,r)};Object.defineProperty(PR,"__esModule",{value:!0});nLr(Pyt(),PR)});var eC=b(Qx=>{"use strict";var oLr=Qx&&Qx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_xe=Qx&&Qx.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oLr(e,t,r)};Object.defineProperty(Qx,"__esModule",{value:!0});_xe(ygt(),Qx);_xe(gyt(),Qx);_xe(Tyt(),Qx)});var vxe=b(Ro=>{"use strict";var iLr=Ro&&Ro.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aLr=Ro&&Ro.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sLr=Ro&&Ro.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iLr(e,t,r);return aLr(e,t),e},CX=Ro&&Ro.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},uLr=Ro&&Ro.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.fetchOverride=Ro.parseAWSEvent=Ro.getEndpointFromUrl=Ro.getAuthHeaders=Ro.getUrl=Ro.mapResponseFromBedrock=void 0;var lLr=ame(),cLr=(vot(),gl(_ot)),dLr=Eat(),fLr=qst(),pLr=Y2(),mLr=q(),hLr=Nve(),gLr=iht(),H4=sLr(eC()),yLr=(t,e)=>CX(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),bLr={chat:H4.StreamedChatResponse,generate:H4.GenerateStreamedResponse},_Lr={chat:H4.NonStreamedChatResponse,embed:H4.EmbedResponse,generate:H4.Generation},vLr=(t,e,r)=>CX(void 0,void 0,void 0,function*(){let n=t?bLr[e]:_Lr[e],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});Ro.mapResponseFromBedrock=vLr;var wLr=(t,e,r,n)=>{let o={bedrock:n?"invoke-with-response-stream":"invoke",sagemaker:n?"invocations-response-stream":"invocations"}[t];return{bedrock:`https://${t}-runtime.${e}.amazonaws.com/model/${r}/${o}`,sagemaker:`https://runtime.sagemaker.${e}.amazonaws.com/endpoints/${r}/${o}`}[t]};Ro.getUrl=wLr;var SLr=(t,e,r,n,o,i)=>CX(void 0,void 0,void 0,function*(){let a=(0,cLr.fromNodeProviderChain)(),s=yield yLr(()=>{i.awsAccessKey&&(process.env.AWS_ACCESS_KEY_ID=i.awsAccessKey),i.awsSecretKey&&(process.env.AWS_SECRET_ACCESS_KEY=i.awsSecretKey),i.awsSessionToken&&(process.env.AWS_SESSION_TOKEN=i.awsSessionToken)},()=>a()),u=new fLr.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:lLr.Sha256});delete r.connection,r.host=t.hostname;let l=new dLr.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});Ro.getAuthHeaders=SLr;var xLr=(t,e,r,n)=>{if(e&&t.includes(e))return"chat";if(r&&t.includes(r))return"embed";if(n&&t.includes(n))return"generate";throw new Error(`Unknown endpoint in url: ${t}`)};Ro.getEndpointFromUrl=xLr;var CLr=t=>{let e=/{[^\}]*}/,r=t.match(e);if(r?.[0]){let n=JSON.parse(r[0]);if(n.bytes){let o=Buffer.from(n.bytes,"base64").toString("utf-8"),i=JSON.parse(o);if(i.event_type)return i}}};Ro.parseAWSEvent=CLr;var OLr=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>CX(void 0,void 0,void 0,function*(){var a,s;let u=i.url.split("/").pop(),l=i.body;console.assert(l.model,"model is required");let c=!!l.stream,d=(0,Ro.getUrl)(t,e,l.model,c);delete l.stream,delete l.model,delete i.headers.Authorization,i.headers.Host=new URL(d).hostname;let f=yield(0,Ro.getAuthHeaders)(new URL(d),i.method,i.headers,JSON.stringify(l),t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o});i.url=d,i.headers=f;let p=yield(0,mLr.fetcher)(i);if(!p.ok)return p;try{if(c){let v=(0,hLr.readableStreamAsyncIterable)(p.body),g=new gLr.LineDecoder,_=new pLr.PassThrough;try{for(var m=uLr(v),h;h=yield m.next(),!h.done;){let w=h.value;for(let x of g.decode(w)){let C=(0,Ro.parseAWSEvent)(x);if(C){let P=yield(0,Ro.mapResponseFromBedrock)(c,u,C);_.push(JSON.stringify(P)+`
`)}}}}catch(w){a={error:w}}finally{try{h&&!h.done&&(s=m.return)&&(yield s.call(m))}finally{if(a)throw a.error}}for(let w of g.flush()){let x=(0,Ro.parseAWSEvent)(w);if(x){let C=yield(0,Ro.mapResponseFromBedrock)(c,u,x);_.push(JSON.stringify(C)+`
`)}}return _.end(),{ok:!0,body:_}}else{let v=yield p.body;return{ok:!0,body:yield(0,Ro.mapResponseFromBedrock)(c,u,v)}}}catch(v){throw v}});Ro.fetchOverride=OLr});var tC=b(OX=>{"use strict";Object.defineProperty(OX,"__esModule",{value:!0});OX.CohereEnvironment=void 0;OX.CohereEnvironment={Production:"https://api.cohere.com"}});var qP=b((Ayt,EX)=>{(function(t,e,r){typeof EX<"u"&&EX.exports?EX.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",Ayt,function(){function t(e){var r=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var o=0;o<e.length;o++){var i=e[o];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(o>0&&(i=i.replace(/^[\/]+/,"")),o<e.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),r.push(i))}var a=r.join("/");a=a.replace(/\/(\?|&|#[^!])/g,"$1");var s=a.split("?");return a=s.shift()+(s.length>0?"?":"")+s.join("&"),a}return function(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),t(e)}})});var Sxe=b(Uf=>{"use strict";var ELr=Uf&&Uf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PLr=Uf&&Uf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V4=Uf&&Uf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ELr(e,t,r);return PLr(e,t),e},PX=Uf&&Uf.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},TLr=Uf&&Uf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Uf,"__esModule",{value:!0});Uf.V2=void 0;var Iyt=V4(tC()),$f=V4(q()),ka=V4(Ox()),qf=V4(eC()),Myt=TLr(qP()),rC=V4(Xa()),wxe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return PX(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:$f.fetcher)({url:(0,Myt.default)((o=yield $f.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Iyt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield $f.Supplier.get(this._options.clientName))!=null?yield $f.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":$f.RUNTIME.type,"X-Fern-Runtime-Version":$f.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},qf.V2ChatStreamRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new $f.Stream({stream:i.body,parse:a=>PX(this,void 0,void 0,function*(){return qf.StreamedChatResponse2.parseOrThrow(a,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"sse",streamTerminator:"[DONE]"}});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ka.BadRequestError(i.error.body);case 401:throw new ka.UnauthorizedError(i.error.body);case 403:throw new ka.ForbiddenError(i.error.body);case 404:throw new ka.NotFoundError(i.error.body);case 422:throw new ka.UnprocessableEntityError(qf.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ka.TooManyRequestsError(qf.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ka.ClientClosedRequestError(qf.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ka.InternalServerError(i.error.body);case 501:throw new ka.NotImplementedError(qf.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ka.ServiceUnavailableError(i.error.body);case 504:throw new ka.GatewayTimeoutError(qf.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new rC.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new rC.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new rC.CohereTimeoutError;case"unknown":throw new rC.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return PX(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:$f.fetcher)({url:(0,Myt.default)((o=yield $f.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Iyt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield $f.Supplier.get(this._options.clientName))!=null?yield $f.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":$f.RUNTIME.type,"X-Fern-Runtime-Version":$f.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},qf.V2ChatRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return qf.NonStreamedChatResponse2.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ka.BadRequestError(i.error.body);case 401:throw new ka.UnauthorizedError(i.error.body);case 403:throw new ka.ForbiddenError(i.error.body);case 404:throw new ka.NotFoundError(i.error.body);case 422:throw new ka.UnprocessableEntityError(qf.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ka.TooManyRequestsError(qf.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ka.ClientClosedRequestError(qf.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ka.InternalServerError(i.error.body);case 501:throw new ka.NotImplementedError(qf.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ka.ServiceUnavailableError(i.error.body);case 504:throw new ka.GatewayTimeoutError(qf.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new rC.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new rC.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new rC.CohereTimeoutError;case"unknown":throw new rC.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return PX(this,void 0,void 0,function*(){let r=(e=yield $f.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new rC.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Uf.V2=wxe});var Ryt=b(zf=>{"use strict";var ALr=zf&&zf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ILr=zf&&zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K4=zf&&zf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ALr(e,t,r);return ILr(e,t),e},W4=zf&&zf.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},MLr=zf&&zf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zf,"__esModule",{value:!0});zf.EmbedJobs=void 0;var TX=K4(tC()),Ni=K4(q()),_r=K4(Ox()),AX=MLr(qP()),Zi=K4(eC()),dc=K4(Xa()),xxe=class{constructor(e={}){this._options=e}list(e){var r,n;return W4(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Ni.fetcher)({url:(0,AX.default)((n=yield Ni.Supplier.get(this._options.environment))!==null&&n!==void 0?n:TX.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ni.Supplier.get(this._options.clientName))!=null?yield Ni.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Ni.RUNTIME.type,"X-Fern-Runtime-Version":Ni.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return Zi.ListEmbedJobResponse.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new _r.BadRequestError(o.error.body);case 401:throw new _r.UnauthorizedError(o.error.body);case 403:throw new _r.ForbiddenError(o.error.body);case 404:throw new _r.NotFoundError(o.error.body);case 422:throw new _r.UnprocessableEntityError(Zi.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new _r.TooManyRequestsError(Zi.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new _r.ClientClosedRequestError(Zi.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new _r.InternalServerError(o.error.body);case 501:throw new _r.NotImplementedError(Zi.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new _r.ServiceUnavailableError(o.error.body);case 504:throw new _r.GatewayTimeoutError(Zi.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new dc.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new dc.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new dc.CohereTimeoutError;case"unknown":throw new dc.CohereError({message:o.error.errorMessage})}})}create(e,r){var n,o;return W4(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ni.fetcher)({url:(0,AX.default)((o=yield Ni.Supplier.get(this._options.environment))!==null&&o!==void 0?o:TX.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ni.Supplier.get(this._options.clientName))!=null?yield Ni.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Ni.RUNTIME.type,"X-Fern-Runtime-Version":Ni.RUNTIME.version},contentType:"application/json",requestType:"json",body:Zi.CreateEmbedJobRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Zi.CreateEmbedJobResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _r.BadRequestError(i.error.body);case 401:throw new _r.UnauthorizedError(i.error.body);case 403:throw new _r.ForbiddenError(i.error.body);case 404:throw new _r.NotFoundError(i.error.body);case 422:throw new _r.UnprocessableEntityError(Zi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new _r.TooManyRequestsError(Zi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new _r.ClientClosedRequestError(Zi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new _r.InternalServerError(i.error.body);case 501:throw new _r.NotImplementedError(Zi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new _r.ServiceUnavailableError(i.error.body);case 504:throw new _r.GatewayTimeoutError(Zi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new dc.CohereTimeoutError;case"unknown":throw new dc.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return W4(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ni.fetcher)({url:(0,AX.default)((o=yield Ni.Supplier.get(this._options.environment))!==null&&o!==void 0?o:TX.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ni.Supplier.get(this._options.clientName))!=null?yield Ni.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Ni.RUNTIME.type,"X-Fern-Runtime-Version":Ni.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Zi.EmbedJob.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _r.BadRequestError(i.error.body);case 401:throw new _r.UnauthorizedError(i.error.body);case 403:throw new _r.ForbiddenError(i.error.body);case 404:throw new _r.NotFoundError(i.error.body);case 422:throw new _r.UnprocessableEntityError(Zi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new _r.TooManyRequestsError(Zi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new _r.ClientClosedRequestError(Zi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new _r.InternalServerError(i.error.body);case 501:throw new _r.NotImplementedError(Zi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new _r.ServiceUnavailableError(i.error.body);case 504:throw new _r.GatewayTimeoutError(Zi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new dc.CohereTimeoutError;case"unknown":throw new dc.CohereError({message:i.error.errorMessage})}})}cancel(e,r){var n,o;return W4(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ni.fetcher)({url:(0,AX.default)((o=yield Ni.Supplier.get(this._options.environment))!==null&&o!==void 0?o:TX.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ni.Supplier.get(this._options.clientName))!=null?yield Ni.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Ni.RUNTIME.type,"X-Fern-Runtime-Version":Ni.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(!i.ok){if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new _r.BadRequestError(i.error.body);case 401:throw new _r.UnauthorizedError(i.error.body);case 403:throw new _r.ForbiddenError(i.error.body);case 404:throw new _r.NotFoundError(i.error.body);case 422:throw new _r.UnprocessableEntityError(Zi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new _r.TooManyRequestsError(Zi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new _r.ClientClosedRequestError(Zi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new _r.InternalServerError(i.error.body);case 501:throw new _r.NotImplementedError(Zi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new _r.ServiceUnavailableError(i.error.body);case 504:throw new _r.GatewayTimeoutError(Zi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new dc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new dc.CohereTimeoutError;case"unknown":throw new dc.CohereError({message:i.error.errorMessage})}}})}_getAuthorizationHeader(){var e;return W4(this,void 0,void 0,function*(){let r=(e=yield Ni.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new dc.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};zf.EmbedJobs=xxe});var jyt=b(Hf=>{"use strict";var RLr=Hf&&Hf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jLr=Hf&&Hf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y4=Hf&&Hf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RLr(e,t,r);return jLr(e,t),e},FF=Hf&&Hf.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},DLr=Hf&&Hf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hf,"__esModule",{value:!0});Hf.Datasets=void 0;var J4=Y4(tC()),to=Y4(q()),qt=Y4(Ox()),G4=DLr(qP()),$o=Y4(eC()),ns=Y4(Xa()),Cxe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return FF(this,void 0,void 0,function*(){let{datasetType:i,before:a,after:s,limit:u,offset:l,validationStatus:c}=e,d={};i!=null&&(d.datasetType=i),a!=null&&(d.before=a.toISOString()),s!=null&&(d.after=s.toISOString()),u!=null&&(d.limit=u.toString()),l!=null&&(d.offset=l.toString()),c!=null&&(d.validationStatus=c);let f=yield((n=this._options.fetcher)!==null&&n!==void 0?n:to.fetcher)({url:(0,G4.default)((o=yield to.Supplier.get(this._options.environment))!==null&&o!==void 0?o:J4.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield to.Supplier.get(this._options.clientName))!=null?yield to.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.12.0","X-Fern-Runtime":to.RUNTIME.type,"X-Fern-Runtime-Version":to.RUNTIME.version},contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(f.ok)return $o.DatasetsListResponse.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new qt.BadRequestError(f.error.body);case 401:throw new qt.UnauthorizedError(f.error.body);case 403:throw new qt.ForbiddenError(f.error.body);case 404:throw new qt.NotFoundError(f.error.body);case 422:throw new qt.UnprocessableEntityError($o.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new qt.TooManyRequestsError($o.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new qt.ClientClosedRequestError($o.ClientClosedRequestErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new qt.InternalServerError(f.error.body);case 501:throw new qt.NotImplementedError($o.NotImplementedErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new qt.ServiceUnavailableError(f.error.body);case 504:throw new qt.GatewayTimeoutError($o.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ns.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new ns.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new ns.CohereTimeoutError;case"unknown":throw new ns.CohereError({message:f.error.errorMessage})}})}create(e,r,n,o){var i,a;return FF(this,void 0,void 0,function*(){let s={};s.name=n.name,s.type=n.type,n.keepOriginalFile!=null&&(s.keep_original_file=n.keepOriginalFile.toString()),n.skipMalformedInput!=null&&(s.skip_malformed_input=n.skipMalformedInput.toString()),n.keepFields!=null&&(Array.isArray(n.keepFields)?s.keep_fields=n.keepFields.map(d=>d):s.keep_fields=n.keepFields),n.optionalFields!=null&&(Array.isArray(n.optionalFields)?s.optional_fields=n.optionalFields.map(d=>d):s.optional_fields=n.optionalFields),n.textSeparator!=null&&(s.text_separator=n.textSeparator),n.csvDelimiter!=null&&(s.csv_delimiter=n.csvDelimiter),n.dryRun!=null&&(s.dry_run=n.dryRun.toString());let u=yield to.newFormData();yield u.appendFile("data",e,e?.name),r!=null&&(yield u.appendFile("eval_data",r,r?.name));let l=yield u.getRequest(),c=yield((i=this._options.fetcher)!==null&&i!==void 0?i:to.fetcher)({url:(0,G4.default)((a=yield to.Supplier.get(this._options.environment))!==null&&a!==void 0?a:J4.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield to.Supplier.get(this._options.clientName))!=null?yield to.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.12.0","X-Fern-Runtime":to.RUNTIME.type,"X-Fern-Runtime-Version":to.RUNTIME.version},l.headers),queryParameters:s,requestType:"file",duplex:l.duplex,body:l.body,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(c.ok)return $o.DatasetsCreateResponse.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new qt.BadRequestError(c.error.body);case 401:throw new qt.UnauthorizedError(c.error.body);case 403:throw new qt.ForbiddenError(c.error.body);case 404:throw new qt.NotFoundError(c.error.body);case 422:throw new qt.UnprocessableEntityError($o.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new qt.TooManyRequestsError($o.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new qt.ClientClosedRequestError($o.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new qt.InternalServerError(c.error.body);case 501:throw new qt.NotImplementedError($o.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new qt.ServiceUnavailableError(c.error.body);case 504:throw new qt.GatewayTimeoutError($o.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ns.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new ns.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new ns.CohereTimeoutError;case"unknown":throw new ns.CohereError({message:c.error.errorMessage})}})}getUsage(e){var r,n;return FF(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:to.fetcher)({url:(0,G4.default)((n=yield to.Supplier.get(this._options.environment))!==null&&n!==void 0?n:J4.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield to.Supplier.get(this._options.clientName))!=null?yield to.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.12.0","X-Fern-Runtime":to.RUNTIME.type,"X-Fern-Runtime-Version":to.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return $o.DatasetsGetUsageResponse.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new qt.BadRequestError(o.error.body);case 401:throw new qt.UnauthorizedError(o.error.body);case 403:throw new qt.ForbiddenError(o.error.body);case 404:throw new qt.NotFoundError(o.error.body);case 422:throw new qt.UnprocessableEntityError($o.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new qt.TooManyRequestsError($o.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new qt.ClientClosedRequestError($o.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new qt.InternalServerError(o.error.body);case 501:throw new qt.NotImplementedError($o.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new qt.ServiceUnavailableError(o.error.body);case 504:throw new qt.GatewayTimeoutError($o.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ns.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new ns.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new ns.CohereTimeoutError;case"unknown":throw new ns.CohereError({message:o.error.errorMessage})}})}get(e,r){var n,o;return FF(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:to.fetcher)({url:(0,G4.default)((o=yield to.Supplier.get(this._options.environment))!==null&&o!==void 0?o:J4.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield to.Supplier.get(this._options.clientName))!=null?yield to.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.12.0","X-Fern-Runtime":to.RUNTIME.type,"X-Fern-Runtime-Version":to.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return $o.DatasetsGetResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new qt.BadRequestError(i.error.body);case 401:throw new qt.UnauthorizedError(i.error.body);case 403:throw new qt.ForbiddenError(i.error.body);case 404:throw new qt.NotFoundError(i.error.body);case 422:throw new qt.UnprocessableEntityError($o.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new qt.TooManyRequestsError($o.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new qt.ClientClosedRequestError($o.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new qt.InternalServerError(i.error.body);case 501:throw new qt.NotImplementedError($o.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new qt.ServiceUnavailableError(i.error.body);case 504:throw new qt.GatewayTimeoutError($o.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ns.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ns.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ns.CohereTimeoutError;case"unknown":throw new ns.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return FF(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:to.fetcher)({url:(0,G4.default)((o=yield to.Supplier.get(this._options.environment))!==null&&o!==void 0?o:J4.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield to.Supplier.get(this._options.clientName))!=null?yield to.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.12.0","X-Fern-Runtime":to.RUNTIME.type,"X-Fern-Runtime-Version":to.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return $o.datasets.delete.Response.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new qt.BadRequestError(i.error.body);case 401:throw new qt.UnauthorizedError(i.error.body);case 403:throw new qt.ForbiddenError(i.error.body);case 404:throw new qt.NotFoundError(i.error.body);case 422:throw new qt.UnprocessableEntityError($o.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new qt.TooManyRequestsError($o.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new qt.ClientClosedRequestError($o.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new qt.InternalServerError(i.error.body);case 501:throw new qt.NotImplementedError($o.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new qt.ServiceUnavailableError(i.error.body);case 504:throw new qt.GatewayTimeoutError($o.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new ns.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new ns.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new ns.CohereTimeoutError;case"unknown":throw new ns.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return FF(this,void 0,void 0,function*(){let r=(e=yield to.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new ns.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Hf.Datasets=Cxe});var Dyt=b(Vf=>{"use strict";var NLr=Vf&&Vf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LLr=Vf&&Vf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z4=Vf&&Vf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NLr(e,t,r);return LLr(e,t),e},TR=Vf&&Vf.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},FLr=Vf&&Vf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Vf,"__esModule",{value:!0});Vf.Connectors=void 0;var kF=Z4(tC()),sn=Z4(q()),mt=Z4(Ox()),BF=FLr(qP()),nn=Z4(eC()),Li=Z4(Xa()),Oxe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return TR(this,void 0,void 0,function*(){let{limit:i,offset:a}=e,s={};i!=null&&(s.limit=i.toString()),a!=null&&(s.offset=a.toString());let u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,BF.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:kF.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(u.ok)return nn.ListConnectorsResponse.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new mt.BadRequestError(u.error.body);case 401:throw new mt.UnauthorizedError(u.error.body);case 403:throw new mt.ForbiddenError(u.error.body);case 404:throw new mt.NotFoundError(u.error.body);case 422:throw new mt.UnprocessableEntityError(nn.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mt.TooManyRequestsError(nn.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mt.ClientClosedRequestError(nn.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mt.InternalServerError(u.error.body);case 501:throw new mt.NotImplementedError(nn.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mt.ServiceUnavailableError(u.error.body);case 504:throw new mt.GatewayTimeoutError(nn.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Li.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Li.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Li.CohereTimeoutError;case"unknown":throw new Li.CohereError({message:u.error.errorMessage})}})}create(e,r){var n,o;return TR(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,BF.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:kF.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",requestType:"json",body:nn.CreateConnectorRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return nn.CreateConnectorResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new mt.BadRequestError(i.error.body);case 401:throw new mt.UnauthorizedError(i.error.body);case 403:throw new mt.ForbiddenError(i.error.body);case 404:throw new mt.NotFoundError(i.error.body);case 422:throw new mt.UnprocessableEntityError(nn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mt.TooManyRequestsError(nn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mt.ClientClosedRequestError(nn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mt.InternalServerError(i.error.body);case 501:throw new mt.NotImplementedError(nn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mt.ServiceUnavailableError(i.error.body);case 504:throw new mt.GatewayTimeoutError(nn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Li.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Li.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Li.CohereTimeoutError;case"unknown":throw new Li.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return TR(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,BF.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:kF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return nn.GetConnectorResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new mt.BadRequestError(i.error.body);case 401:throw new mt.UnauthorizedError(i.error.body);case 403:throw new mt.ForbiddenError(i.error.body);case 404:throw new mt.NotFoundError(i.error.body);case 422:throw new mt.UnprocessableEntityError(nn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mt.TooManyRequestsError(nn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mt.ClientClosedRequestError(nn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mt.InternalServerError(i.error.body);case 501:throw new mt.NotImplementedError(nn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mt.ServiceUnavailableError(i.error.body);case 504:throw new mt.GatewayTimeoutError(nn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Li.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Li.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Li.CohereTimeoutError;case"unknown":throw new Li.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return TR(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:sn.fetcher)({url:(0,BF.default)((o=yield sn.Supplier.get(this._options.environment))!==null&&o!==void 0?o:kF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return nn.DeleteConnectorResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new mt.BadRequestError(i.error.body);case 401:throw new mt.UnauthorizedError(i.error.body);case 403:throw new mt.ForbiddenError(i.error.body);case 404:throw new mt.NotFoundError(i.error.body);case 422:throw new mt.UnprocessableEntityError(nn.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mt.TooManyRequestsError(nn.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mt.ClientClosedRequestError(nn.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mt.InternalServerError(i.error.body);case 501:throw new mt.NotImplementedError(nn.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mt.ServiceUnavailableError(i.error.body);case 504:throw new mt.GatewayTimeoutError(nn.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Li.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Li.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Li.CohereTimeoutError;case"unknown":throw new Li.CohereError({message:i.error.errorMessage})}})}update(e,r={},n){var o,i;return TR(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:sn.fetcher)({url:(0,BF.default)((i=yield sn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:kF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",requestType:"json",body:nn.UpdateConnectorRequest.jsonOrThrow(r,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(a.ok)return nn.UpdateConnectorResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new mt.BadRequestError(a.error.body);case 401:throw new mt.UnauthorizedError(a.error.body);case 403:throw new mt.ForbiddenError(a.error.body);case 404:throw new mt.NotFoundError(a.error.body);case 422:throw new mt.UnprocessableEntityError(nn.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mt.TooManyRequestsError(nn.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mt.ClientClosedRequestError(nn.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mt.InternalServerError(a.error.body);case 501:throw new mt.NotImplementedError(nn.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mt.ServiceUnavailableError(a.error.body);case 504:throw new mt.GatewayTimeoutError(nn.GatewayTimeoutErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Li.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Li.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Li.CohereTimeoutError;case"unknown":throw new Li.CohereError({message:a.error.errorMessage})}})}oAuthAuthorize(e,r={},n){var o,i;return TR(this,void 0,void 0,function*(){let{afterTokenRedirect:a}=r,s={};a!=null&&(s.after_token_redirect=a);let u=yield((o=this._options.fetcher)!==null&&o!==void 0?o:sn.fetcher)({url:(0,BF.default)((i=yield sn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:kF.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}/oauth/authorize`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield sn.Supplier.get(this._options.clientName))!=null?yield sn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":sn.RUNTIME.type,"X-Fern-Runtime-Version":sn.RUNTIME.version},contentType:"application/json",queryParameters:s,requestType:"json",timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(u.ok)return nn.OAuthAuthorizeResponse.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new mt.BadRequestError(u.error.body);case 401:throw new mt.UnauthorizedError(u.error.body);case 403:throw new mt.ForbiddenError(u.error.body);case 404:throw new mt.NotFoundError(u.error.body);case 422:throw new mt.UnprocessableEntityError(nn.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new mt.TooManyRequestsError(nn.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new mt.ClientClosedRequestError(nn.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new mt.InternalServerError(u.error.body);case 501:throw new mt.NotImplementedError(nn.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new mt.ServiceUnavailableError(u.error.body);case 504:throw new mt.GatewayTimeoutError(nn.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Li.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new Li.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new Li.CohereTimeoutError;case"unknown":throw new Li.CohereError({message:u.error.errorMessage})}})}_getAuthorizationHeader(){var e;return TR(this,void 0,void 0,function*(){let r=(e=yield sn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Li.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Vf.Connectors=Oxe});var Fyt=b(Wf=>{"use strict";var kLr=Wf&&Wf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BLr=Wf&&Wf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X4=Wf&&Wf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kLr(e,t,r);return BLr(e,t),e},Exe=Wf&&Wf.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},$Lr=Wf&&Wf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Wf,"__esModule",{value:!0});Wf.Models=void 0;var Nyt=X4(tC()),Vp=X4(q()),Ba=X4(Ox()),Lyt=$Lr(qP()),oh=X4(eC()),nC=X4(Xa()),Pxe=class{constructor(e={}){this._options=e}get(e,r){var n,o;return Exe(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Vp.fetcher)({url:(0,Lyt.default)((o=yield Vp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Nyt.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vp.Supplier.get(this._options.clientName))!=null?yield Vp.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Vp.RUNTIME.type,"X-Fern-Runtime-Version":Vp.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return oh.GetModelResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Ba.BadRequestError(i.error.body);case 401:throw new Ba.UnauthorizedError(i.error.body);case 403:throw new Ba.ForbiddenError(i.error.body);case 404:throw new Ba.NotFoundError(i.error.body);case 422:throw new Ba.UnprocessableEntityError(oh.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ba.TooManyRequestsError(oh.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ba.ClientClosedRequestError(oh.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ba.InternalServerError(i.error.body);case 501:throw new Ba.NotImplementedError(oh.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ba.ServiceUnavailableError(i.error.body);case 504:throw new Ba.GatewayTimeoutError(oh.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new nC.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new nC.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new nC.CohereTimeoutError;case"unknown":throw new nC.CohereError({message:i.error.errorMessage})}})}list(e={},r){var n,o;return Exe(this,void 0,void 0,function*(){let{pageSize:i,pageToken:a,endpoint:s,defaultOnly:u}=e,l={};i!=null&&(l.page_size=i.toString()),a!=null&&(l.page_token=a),s!=null&&(l.endpoint=s),u!=null&&(l.default_only=u.toString());let c=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Vp.fetcher)({url:(0,Lyt.default)((o=yield Vp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Nyt.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vp.Supplier.get(this._options.clientName))!=null?yield Vp.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Vp.RUNTIME.type,"X-Fern-Runtime-Version":Vp.RUNTIME.version},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(c.ok)return oh.ListModelsResponse.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new Ba.BadRequestError(c.error.body);case 401:throw new Ba.UnauthorizedError(c.error.body);case 403:throw new Ba.ForbiddenError(c.error.body);case 404:throw new Ba.NotFoundError(c.error.body);case 422:throw new Ba.UnprocessableEntityError(oh.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ba.TooManyRequestsError(oh.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ba.ClientClosedRequestError(oh.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Ba.InternalServerError(c.error.body);case 501:throw new Ba.NotImplementedError(oh.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Ba.ServiceUnavailableError(c.error.body);case 504:throw new Ba.GatewayTimeoutError(oh.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new nC.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new nC.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new nC.CohereTimeoutError;case"unknown":throw new nC.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Exe(this,void 0,void 0,function*(){let r=(e=yield Vp.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new nC.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Wf.Models=Pxe});var kyt=b(Kf=>{"use strict";var qLr=Kf&&Kf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ULr=Kf&&Kf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q4=Kf&&Kf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qLr(e,t,r);return ULr(e,t),e},UP=Kf&&Kf.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},zLr=Kf&&Kf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Kf,"__esModule",{value:!0});Kf.Finetuning=void 0;var AR=Q4(tC()),Sr=Q4(q()),Ar=Q4(Ox()),IR=zLr(qP()),oC=Q4(eC()),Jo=Q4(Xa()),Txe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){var n,o;return UP(this,void 0,void 0,function*(){let{pageSize:i,pageToken:a,orderBy:s}=e,u={};i!=null&&(u.page_size=i.toString()),a!=null&&(u.page_token=a),s!=null&&(u.order_by=s);let l=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Sr.fetcher)({url:(0,IR.default)((o=yield Sr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:AR.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Sr.Supplier.get(this._options.clientName))!=null?yield Sr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Sr.RUNTIME.type,"X-Fern-Runtime-Version":Sr.RUNTIME.version},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(l.ok)return oC.finetuning.ListFinetunedModelsResponse.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new Ar.BadRequestError(l.error.body);case 401:throw new Ar.UnauthorizedError(l.error.body);case 403:throw new Ar.ForbiddenError(l.error.body);case 404:throw new Ar.NotFoundError(l.error.body);case 500:throw new Ar.InternalServerError(l.error.body);case 503:throw new Ar.ServiceUnavailableError(l.error.body);default:throw new Jo.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new Jo.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new Jo.CohereTimeoutError;case"unknown":throw new Jo.CohereError({message:l.error.errorMessage})}})}createFinetunedModel(e,r){var n,o;return UP(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Sr.fetcher)({url:(0,IR.default)((o=yield Sr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:AR.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Sr.Supplier.get(this._options.clientName))!=null?yield Sr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Sr.RUNTIME.type,"X-Fern-Runtime-Version":Sr.RUNTIME.version},contentType:"application/json",requestType:"json",body:oC.finetuning.FinetunedModel.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return oC.finetuning.CreateFinetunedModelResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Ar.BadRequestError(i.error.body);case 401:throw new Ar.UnauthorizedError(i.error.body);case 403:throw new Ar.ForbiddenError(i.error.body);case 404:throw new Ar.NotFoundError(i.error.body);case 500:throw new Ar.InternalServerError(i.error.body);case 503:throw new Ar.ServiceUnavailableError(i.error.body);default:throw new Jo.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Jo.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Jo.CohereTimeoutError;case"unknown":throw new Jo.CohereError({message:i.error.errorMessage})}})}getFinetunedModel(e,r){var n,o;return UP(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Sr.fetcher)({url:(0,IR.default)((o=yield Sr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:AR.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Sr.Supplier.get(this._options.clientName))!=null?yield Sr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Sr.RUNTIME.type,"X-Fern-Runtime-Version":Sr.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return oC.finetuning.GetFinetunedModelResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Ar.BadRequestError(i.error.body);case 401:throw new Ar.UnauthorizedError(i.error.body);case 403:throw new Ar.ForbiddenError(i.error.body);case 404:throw new Ar.NotFoundError(i.error.body);case 500:throw new Ar.InternalServerError(i.error.body);case 503:throw new Ar.ServiceUnavailableError(i.error.body);default:throw new Jo.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Jo.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Jo.CohereTimeoutError;case"unknown":throw new Jo.CohereError({message:i.error.errorMessage})}})}deleteFinetunedModel(e,r){var n,o;return UP(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Sr.fetcher)({url:(0,IR.default)((o=yield Sr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:AR.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Sr.Supplier.get(this._options.clientName))!=null?yield Sr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Sr.RUNTIME.type,"X-Fern-Runtime-Version":Sr.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return oC.finetuning.DeleteFinetunedModelResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Ar.BadRequestError(i.error.body);case 401:throw new Ar.UnauthorizedError(i.error.body);case 403:throw new Ar.ForbiddenError(i.error.body);case 404:throw new Ar.NotFoundError(i.error.body);case 500:throw new Ar.InternalServerError(i.error.body);case 503:throw new Ar.ServiceUnavailableError(i.error.body);default:throw new Jo.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Jo.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Jo.CohereTimeoutError;case"unknown":throw new Jo.CohereError({message:i.error.errorMessage})}})}updateFinetunedModel(e,r,n){var o,i;return UP(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Sr.fetcher)({url:(0,IR.default)((i=yield Sr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:AR.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Sr.Supplier.get(this._options.clientName))!=null?yield Sr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Sr.RUNTIME.type,"X-Fern-Runtime-Version":Sr.RUNTIME.version},contentType:"application/json",requestType:"json",body:oC.FinetuningUpdateFinetunedModelRequest.jsonOrThrow(r,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(a.ok)return oC.finetuning.UpdateFinetunedModelResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Ar.BadRequestError(a.error.body);case 401:throw new Ar.UnauthorizedError(a.error.body);case 403:throw new Ar.ForbiddenError(a.error.body);case 404:throw new Ar.NotFoundError(a.error.body);case 500:throw new Ar.InternalServerError(a.error.body);case 503:throw new Ar.ServiceUnavailableError(a.error.body);default:throw new Jo.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new Jo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new Jo.CohereTimeoutError;case"unknown":throw new Jo.CohereError({message:a.error.errorMessage})}})}listEvents(e,r={},n){var o,i;return UP(this,void 0,void 0,function*(){let{pageSize:a,pageToken:s,orderBy:u}=r,l={};a!=null&&(l.page_size=a.toString()),s!=null&&(l.page_token=s),u!=null&&(l.order_by=u);let c=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Sr.fetcher)({url:(0,IR.default)((i=yield Sr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:AR.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/events`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Sr.Supplier.get(this._options.clientName))!=null?yield Sr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Sr.RUNTIME.type,"X-Fern-Runtime-Version":Sr.RUNTIME.version},contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(c.ok)return oC.finetuning.ListEventsResponse.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new Ar.BadRequestError(c.error.body);case 401:throw new Ar.UnauthorizedError(c.error.body);case 403:throw new Ar.ForbiddenError(c.error.body);case 404:throw new Ar.NotFoundError(c.error.body);case 500:throw new Ar.InternalServerError(c.error.body);case 503:throw new Ar.ServiceUnavailableError(c.error.body);default:throw new Jo.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new Jo.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new Jo.CohereTimeoutError;case"unknown":throw new Jo.CohereError({message:c.error.errorMessage})}})}listTrainingStepMetrics(e,r={},n){var o,i;return UP(this,void 0,void 0,function*(){let{pageSize:a,pageToken:s}=r,u={};a!=null&&(u.page_size=a.toString()),s!=null&&(u.page_token=s);let l=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Sr.fetcher)({url:(0,IR.default)((i=yield Sr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:AR.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/training-step-metrics`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Sr.Supplier.get(this._options.clientName))!=null?yield Sr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":Sr.RUNTIME.type,"X-Fern-Runtime-Version":Sr.RUNTIME.version},contentType:"application/json",queryParameters:u,requestType:"json",timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(l.ok)return oC.finetuning.ListTrainingStepMetricsResponse.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new Ar.BadRequestError(l.error.body);case 401:throw new Ar.UnauthorizedError(l.error.body);case 403:throw new Ar.ForbiddenError(l.error.body);case 404:throw new Ar.NotFoundError(l.error.body);case 500:throw new Ar.InternalServerError(l.error.body);case 503:throw new Ar.ServiceUnavailableError(l.error.body);default:throw new Jo.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new Jo.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new Jo.CohereTimeoutError;case"unknown":throw new Jo.CohereError({message:l.error.errorMessage})}})}_getAuthorizationHeader(){var e;return UP(this,void 0,void 0,function*(){let r=(e=yield Sr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Jo.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Kf.Finetuning=Txe});var IX=b(Gf=>{"use strict";var HLr=Gf&&Gf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VLr=Gf&&Gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e3=Gf&&Gf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HLr(e,t,r);return VLr(e,t),e},Jf=Gf&&Gf.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},WLr=Gf&&Gf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gf,"__esModule",{value:!0});Gf.CohereClient=void 0;var Rg=e3(tC()),st=e3(q()),ge=e3(Ox()),Xe=e3(eC()),jg=WLr(qP()),gr=e3(Xa()),KLr=Sxe(),JLr=Ryt(),GLr=jyt(),YLr=Dyt(),ZLr=Fyt(),XLr=kyt(),Axe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Jf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:st.fetcher)({url:(0,jg.default)((o=yield st.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rg.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Xe.ChatStreamRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new st.Stream({stream:i.body,parse:a=>Jf(this,void 0,void 0,function*(){return Xe.StreamedChatResponse.parseOrThrow(a,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"json",messageTerminator:`
`}});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ge.BadRequestError(i.error.body);case 401:throw new ge.UnauthorizedError(i.error.body);case 403:throw new ge.ForbiddenError(i.error.body);case 404:throw new ge.NotFoundError(i.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(i.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(i.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return Jf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:st.fetcher)({url:(0,jg.default)((o=yield st.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rg.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Xe.ChatRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Xe.NonStreamedChatResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ge.BadRequestError(i.error.body);case 401:throw new ge.UnauthorizedError(i.error.body);case 403:throw new ge.ForbiddenError(i.error.body);case 404:throw new ge.NotFoundError(i.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(i.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(i.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:i.error.errorMessage})}})}generateStream(e,r){var n,o;return Jf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:st.fetcher)({url:(0,jg.default)((o=yield st.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rg.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Xe.GenerateStreamRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!0}),responseType:"sse",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return new st.Stream({stream:i.body,parse:a=>Jf(this,void 0,void 0,function*(){return Xe.GenerateStreamedResponse.parseOrThrow(a,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"json",messageTerminator:`
`}});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ge.BadRequestError(i.error.body);case 401:throw new ge.UnauthorizedError(i.error.body);case 403:throw new ge.ForbiddenError(i.error.body);case 404:throw new ge.NotFoundError(i.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(i.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(i.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:i.error.errorMessage})}})}generate(e,r){var n,o;return Jf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:st.fetcher)({url:(0,jg.default)((o=yield st.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rg.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Xe.GenerateRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Xe.Generation.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ge.BadRequestError(i.error.body);case 401:throw new ge.UnauthorizedError(i.error.body);case 403:throw new ge.ForbiddenError(i.error.body);case 404:throw new ge.NotFoundError(i.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(i.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(i.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:i.error.errorMessage})}})}embed(e,r){var n,o;return Jf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:st.fetcher)({url:(0,jg.default)((o=yield st.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rg.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",body:Xe.EmbedRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Xe.EmbedResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ge.BadRequestError(i.error.body);case 401:throw new ge.UnauthorizedError(i.error.body);case 403:throw new ge.ForbiddenError(i.error.body);case 404:throw new ge.NotFoundError(i.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(i.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(i.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:i.error.errorMessage})}})}rerank(e,r){var n,o;return Jf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:st.fetcher)({url:(0,jg.default)((o=yield st.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rg.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",body:Xe.RerankRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Xe.RerankResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ge.BadRequestError(i.error.body);case 401:throw new ge.UnauthorizedError(i.error.body);case 403:throw new ge.ForbiddenError(i.error.body);case 404:throw new ge.NotFoundError(i.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(i.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(i.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:i.error.errorMessage})}})}classify(e,r){var n,o;return Jf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:st.fetcher)({url:(0,jg.default)((o=yield st.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rg.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",body:Xe.ClassifyRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Xe.ClassifyResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ge.BadRequestError(i.error.body);case 401:throw new ge.UnauthorizedError(i.error.body);case 403:throw new ge.ForbiddenError(i.error.body);case 404:throw new ge.NotFoundError(i.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(i.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(i.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:i.error.errorMessage})}})}summarize(e,r){var n,o;return Jf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:st.fetcher)({url:(0,jg.default)((o=yield st.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rg.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",body:Xe.SummarizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Xe.SummarizeResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ge.BadRequestError(i.error.body);case 401:throw new ge.UnauthorizedError(i.error.body);case 403:throw new ge.ForbiddenError(i.error.body);case 404:throw new ge.NotFoundError(i.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(i.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(i.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:i.error.errorMessage})}})}tokenize(e,r){var n,o;return Jf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:st.fetcher)({url:(0,jg.default)((o=yield st.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rg.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",body:Xe.TokenizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Xe.TokenizeResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ge.BadRequestError(i.error.body);case 401:throw new ge.UnauthorizedError(i.error.body);case 403:throw new ge.ForbiddenError(i.error.body);case 404:throw new ge.NotFoundError(i.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(i.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(i.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:i.error.errorMessage})}})}detokenize(e,r){var n,o;return Jf(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:st.fetcher)({url:(0,jg.default)((o=yield st.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Rg.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",body:Xe.DetokenizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(i.ok)return Xe.DetokenizeResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new ge.BadRequestError(i.error.body);case 401:throw new ge.UnauthorizedError(i.error.body);case 403:throw new ge.ForbiddenError(i.error.body);case 404:throw new ge.NotFoundError(i.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(i.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(i.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new gr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:i.error.errorMessage})}})}checkApiKey(e){var r,n;return Jf(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:st.fetcher)({url:(0,jg.default)((n=yield st.Supplier.get(this._options.environment))!==null&&n!==void 0?n:Rg.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield st.Supplier.get(this._options.clientName))!=null?yield st.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.13.0","User-Agent":"cohere-ai/7.13.0","X-Fern-Runtime":st.RUNTIME.type,"X-Fern-Runtime-Version":st.RUNTIME.version},contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return Xe.CheckApiKeyResponse.parseOrThrow(o.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]});if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new ge.BadRequestError(o.error.body);case 401:throw new ge.UnauthorizedError(o.error.body);case 403:throw new ge.ForbiddenError(o.error.body);case 404:throw new ge.NotFoundError(o.error.body);case 422:throw new ge.UnprocessableEntityError(Xe.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ge.TooManyRequestsError(Xe.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ge.ClientClosedRequestError(Xe.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ge.InternalServerError(o.error.body);case 501:throw new ge.NotImplementedError(Xe.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ge.ServiceUnavailableError(o.error.body);case 504:throw new ge.GatewayTimeoutError(Xe.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new gr.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new gr.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new gr.CohereTimeoutError;case"unknown":throw new gr.CohereError({message:o.error.errorMessage})}})}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new KLr.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new JLr.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new GLr.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new YLr.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new ZLr.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new XLr.Finetuning(this._options)}_getAuthorizationHeader(){var e;return Jf(this,void 0,void 0,function*(){let r=(e=yield st.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new gr.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Gf.CohereClient=Axe});var Mxe=b(MX=>{"use strict";Object.defineProperty(MX,"__esModule",{value:!0});MX.AwsClient=void 0;var QLr=IX(),Ixe=class extends QLr.CohereClient{constructor(e){e.token="n/a",super(e)}};MX.AwsClient=Ixe});var Byt=b(RX=>{"use strict";Object.defineProperty(RX,"__esModule",{value:!0});RX.BedrockClient=void 0;var eFr=vxe(),tFr=Mxe(),Rxe=class extends tFr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,eFr.fetchOverride)("bedrock",e)}))}};RX.BedrockClient=Rxe});var $yt=b(jX=>{"use strict";Object.defineProperty(jX,"__esModule",{value:!0});jX.CohereClientV2=void 0;var rFr=Sxe(),nFr=IX(),jxe=class{constructor(e){this._options=e,this.client=new nFr.CohereClient(this._options),this.clientV2=new rFr.V2(this._options),this.chat=this.clientV2.chat.bind(this.clientV2),this.chatStream=this.clientV2.chatStream.bind(this.clientV2),this.generateStream=this.client.generateStream.bind(this.clientV2),this.generate=this.client.generate.bind(this.clientV2),this.embed=this.client.embed.bind(this.clientV2),this.rerank=this.client.rerank.bind(this.clientV2),this.classify=this.client.classify.bind(this.clientV2),this.summarize=this.client.summarize.bind(this.clientV2),this.tokenize=this.client.tokenize.bind(this.clientV2),this.detokenize=this.client.detokenize.bind(this.clientV2),this.checkApiKey=this.client.checkApiKey.bind(this.clientV2),this.embedJobs=this.client.embedJobs,this.datasets=this.client.datasets,this.connectors=this.client.connectors,this.models=this.client.models,this.finetuning=this.client.finetuning}};jX.CohereClientV2=jxe});var qyt=b(DX=>{"use strict";Object.defineProperty(DX,"__esModule",{value:!0});DX.CustomClient=void 0;var oFr=IX(),Dxe=class extends oFr.CohereClient{constructor(e={}){var r,n;try{let o=/\/v1\/?$/,i=(r=e.environment)===null||r===void 0?void 0:r.toString().replace(o,"");i!==((n=e.environment)===null||n===void 0?void 0:n.toString())&&(e.environment=i)}catch{}super(e),this._options=e}};DX.CustomClient=Dxe});var Uyt=b(NX=>{"use strict";Object.defineProperty(NX,"__esModule",{value:!0});NX.SagemakerClient=void 0;var iFr=Mxe(),aFr=vxe(),Nxe=class extends iFr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,aFr.fetchOverride)("sagemaker",e)}))}};NX.SagemakerClient=Nxe});var t3=b(Xi=>{"use strict";var sFr=Xi&&Xi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uFr=Xi&&Xi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lFr=Xi&&Xi.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sFr(e,t,r);return uFr(e,t),e};Object.defineProperty(Xi,"__esModule",{value:!0});Xi.SagemakerClient=Xi.CohereTimeoutError=Xi.CohereError=Xi.CohereEnvironment=Xi.CohereClient=Xi.CohereClientV2=Xi.BedrockClient=Xi.Cohere=void 0;Xi.Cohere=lFr(Ox());var cFr=Byt();Object.defineProperty(Xi,"BedrockClient",{enumerable:!0,get:function(){return cFr.BedrockClient}});var dFr=$yt();Object.defineProperty(Xi,"CohereClientV2",{enumerable:!0,get:function(){return dFr.CohereClientV2}});var fFr=qyt();Object.defineProperty(Xi,"CohereClient",{enumerable:!0,get:function(){return fFr.CustomClient}});var pFr=tC();Object.defineProperty(Xi,"CohereEnvironment",{enumerable:!0,get:function(){return pFr.CohereEnvironment}});var zyt=Xa();Object.defineProperty(Xi,"CohereError",{enumerable:!0,get:function(){return zyt.CohereError}});Object.defineProperty(Xi,"CohereTimeoutError",{enumerable:!0,get:function(){return zyt.CohereTimeoutError}});var mFr=Uyt();Object.defineProperty(Xi,"SagemakerClient",{enumerable:!0,get:function(){return mFr.SagemakerClient}})});function Ng(t){t?(Al[0]=Al[16]=Al[1]=Al[2]=Al[3]=Al[4]=Al[5]=Al[6]=Al[7]=Al[8]=Al[9]=Al[10]=Al[11]=Al[12]=Al[13]=Al[14]=Al[15]=0,this.blocks=Al):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var hFr,Xr,gFr,Dg,Al,Lxe,Hyt=O(()=>{"use strict";hFr=typeof window=="object"?window:{},Xr="0123456789abcdef".split(""),gFr=[-2147483648,8388608,32768,128],Dg=[24,16,8,0],Al=[];Ng.prototype.update=function(t){if(!this.finalized){var e=typeof t!="string";e&&t.constructor===hFr.ArrayBuffer&&(t=new Uint8Array(t));for(var r,n=0,o,i=t.length||0,a=this.blocks;n<i;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)for(o=this.start;n<i&&o<64;++n)a[o>>2]|=t[n]<<Dg[o++&3];else for(o=this.start;n<i&&o<64;++n)r=t.charCodeAt(n),r<128?a[o>>2]|=r<<Dg[o++&3]:r<2048?(a[o>>2]|=(192|r>>6)<<Dg[o++&3],a[o>>2]|=(128|r&63)<<Dg[o++&3]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<Dg[o++&3],a[o>>2]|=(128|r>>6&63)<<Dg[o++&3],a[o>>2]|=(128|r&63)<<Dg[o++&3]):(r=65536+((r&1023)<<10|t.charCodeAt(++n)&1023),a[o>>2]|=(240|r>>18)<<Dg[o++&3],a[o>>2]|=(128|r>>12&63)<<Dg[o++&3],a[o>>2]|=(128|r>>6&63)<<Dg[o++&3],a[o>>2]|=(128|r&63)<<Dg[o++&3]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=a[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};Ng.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=gFr[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}};Ng.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i,a,s,u=this.blocks;for(a=16;a<80;++a)s=u[a-3]^u[a-8]^u[a-14]^u[a-16],u[a]=s<<1|s>>>31;for(a=0;a<20;a+=5)i=e&r|~e&n,s=t<<5|t>>>27,o=s+i+o+1518500249+u[a]<<0,e=e<<30|e>>>2,i=t&e|~t&r,s=o<<5|o>>>27,n=s+i+n+1518500249+u[a+1]<<0,t=t<<30|t>>>2,i=o&t|~o&e,s=n<<5|n>>>27,r=s+i+r+1518500249+u[a+2]<<0,o=o<<30|o>>>2,i=n&o|~n&t,s=r<<5|r>>>27,e=s+i+e+1518500249+u[a+3]<<0,n=n<<30|n>>>2,i=r&n|~r&o,s=e<<5|e>>>27,t=s+i+t+1518500249+u[a+4]<<0,r=r<<30|r>>>2;for(;a<40;a+=5)i=e^r^n,s=t<<5|t>>>27,o=s+i+o+1859775393+u[a]<<0,e=e<<30|e>>>2,i=t^e^r,s=o<<5|o>>>27,n=s+i+n+1859775393+u[a+1]<<0,t=t<<30|t>>>2,i=o^t^e,s=n<<5|n>>>27,r=s+i+r+1859775393+u[a+2]<<0,o=o<<30|o>>>2,i=n^o^t,s=r<<5|r>>>27,e=s+i+e+1859775393+u[a+3]<<0,n=n<<30|n>>>2,i=r^n^o,s=e<<5|e>>>27,t=s+i+t+1859775393+u[a+4]<<0,r=r<<30|r>>>2;for(;a<60;a+=5)i=e&r|e&n|r&n,s=t<<5|t>>>27,o=s+i+o-1894007588+u[a]<<0,e=e<<30|e>>>2,i=t&e|t&r|e&r,s=o<<5|o>>>27,n=s+i+n-1894007588+u[a+1]<<0,t=t<<30|t>>>2,i=o&t|o&e|t&e,s=n<<5|n>>>27,r=s+i+r-1894007588+u[a+2]<<0,o=o<<30|o>>>2,i=n&o|n&t|o&t,s=r<<5|r>>>27,e=s+i+e-1894007588+u[a+3]<<0,n=n<<30|n>>>2,i=r&n|r&o|n&o,s=e<<5|e>>>27,t=s+i+t-1894007588+u[a+4]<<0,r=r<<30|r>>>2;for(;a<80;a+=5)i=e^r^n,s=t<<5|t>>>27,o=s+i+o-899497514+u[a]<<0,e=e<<30|e>>>2,i=t^e^r,s=o<<5|o>>>27,n=s+i+n-899497514+u[a+1]<<0,t=t<<30|t>>>2,i=o^t^e,s=n<<5|n>>>27,r=s+i+r-899497514+u[a+2]<<0,o=o<<30|o>>>2,i=n^o^t,s=r<<5|r>>>27,e=s+i+e-899497514+u[a+3]<<0,n=n<<30|n>>>2,i=r^n^o,s=e<<5|e>>>27,t=s+i+t-899497514+u[a+4]<<0,r=r<<30|r>>>2;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0};Ng.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return Xr[t>>28&15]+Xr[t>>24&15]+Xr[t>>20&15]+Xr[t>>16&15]+Xr[t>>12&15]+Xr[t>>8&15]+Xr[t>>4&15]+Xr[t&15]+Xr[e>>28&15]+Xr[e>>24&15]+Xr[e>>20&15]+Xr[e>>16&15]+Xr[e>>12&15]+Xr[e>>8&15]+Xr[e>>4&15]+Xr[e&15]+Xr[r>>28&15]+Xr[r>>24&15]+Xr[r>>20&15]+Xr[r>>16&15]+Xr[r>>12&15]+Xr[r>>8&15]+Xr[r>>4&15]+Xr[r&15]+Xr[n>>28&15]+Xr[n>>24&15]+Xr[n>>20&15]+Xr[n>>16&15]+Xr[n>>12&15]+Xr[n>>8&15]+Xr[n>>4&15]+Xr[n&15]+Xr[o>>28&15]+Xr[o>>24&15]+Xr[o>>20&15]+Xr[o>>16&15]+Xr[o>>12&15]+Xr[o>>8&15]+Xr[o>>4&15]+Xr[o&15]};Ng.prototype.toString=Ng.prototype.hex;Ng.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24&255,r>>16&255,r>>8&255,r&255,n>>24&255,n>>16&255,n>>8&255,n&255,o>>24&255,o>>16&255,o>>8&255,o&255]};Ng.prototype.array=Ng.prototype.digest;Ng.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(20),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),t};Lxe=t=>new Ng(!0).update(t).hex()});var Vyt=O(()=>{Hyt()});var Wyt,Fxe,yFr,LX,Kyt=O(()=>{Vyt();KO();Wyt=(...t)=>Lxe(t.join("_")),Fxe=class{},yFr=new Map,LX=class t extends Fxe{constructor(e){super(),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cache=e??new Map}lookup(e,r){return Promise.resolve(this.cache.get(Wyt(e,r))??null)}async update(e,r,n){this.cache.set(Wyt(e,r),n)}static global(){return new t(yFr)}}});function wFr(t,e){let r=Array.from({length:t.length},(n,o)=>({start:o,end:o+1}));for(;r.length>1;){let n=null;for(let o=0;o<r.length-1;o++){let i=t.slice(r[o].start,r[o+1].end),a=e.get(i.join(","));a!=null&&(n==null||a<n[0])&&(n=[a,o])}if(n!=null){let o=n[1];r[o]={start:r[o].start,end:r[o+1].end},r.splice(o+1,1)}else break}return r}function SFr(t,e){return t.length===1?[e.get(t.join(","))]:wFr(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function xFr(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function Bxe(t){switch(t){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":return"o200k_base";default:throw new Error("Unknown model")}}var Jyt,bFr,_Fr,vFr,kxe,FX,Gyt=O(()=>{Jyt=B(Wce(),1),bFr=Object.defineProperty,_Fr=(t,e,r)=>e in t?bFr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vFr=(t,e,r)=>(_Fr(t,typeof e!="symbol"?e+"":e,r),r);kxe=class{constructor(t,e){Wl(this,"specialTokens");Wl(this,"inverseSpecialTokens");Wl(this,"patStr");Wl(this,"textEncoder",new TextEncoder);Wl(this,"textDecoder",new TextDecoder("utf-8"));Wl(this,"rankMap",new Map);Wl(this,"textMap",new Map);this.patStr=t.pat_str;let r=t.bpe_ranks.split(`
`).filter(Boolean).reduce((n,o)=>{let[i,a,...s]=o.split(" "),u=Number.parseInt(a,10);return s.forEach((l,c)=>n[l]=u+c),n},{});for(let[n,o]of Object.entries(r)){let i=Jyt.default.toByteArray(n);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[o,i])=>(n[i]=this.textEncoder.encode(o),n),{})}encode(t,e=[],r="all"){let n=new RegExp(this.patStr,"ug"),o=kxe.specialTokenRegex(Object.keys(this.specialTokens)),i=[],a=new Set(e==="all"?Object.keys(this.specialTokens):e),s=new Set(r==="all"?Object.keys(this.specialTokens).filter(l=>!a.has(l)):r);if(s.size>0){let l=kxe.specialTokenRegex([...s]),c=t.match(l);if(c!=null)throw new Error(`The text contains a special token that is not allowed: ${c[0]}`)}let u=0;for(;;){let l=null,c=u;for(;o.lastIndex=c,l=o.exec(t),!(l==null||a.has(l[0]));)c=l.index+1;let d=l?.index??t.length;for(let p of t.substring(u,d).matchAll(n)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...SFr(m,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];i.push(f),u=l.index+l[0].length}return i}decode(t){let e=[],r=0;for(let i=0;i<t.length;++i){let a=t[i],s=this.textMap.get(a)??this.inverseSpecialTokens[a];s!=null&&(e.push(s),r+=s.length)}let n=new Uint8Array(r),o=0;for(let i of e)n.set(i,o),o+=i.length;return this.textDecoder.decode(n)}},FX=kxe;vFr(FX,"specialTokenRegex",t=>new RegExp(t.map(e=>xFr(e)).join("|"),"g"))});var Yyt=O(()=>{Gyt()});async function Zyt(t){return t in kX||(kX[t]=CFr.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new FX(e)).catch(e=>{throw delete kX[t],e})),await kX[t]}async function Xyt(t){return Zyt(Bxe(t))}var kX,CFr,$xe=O(()=>{Yyt();PD();kX={},CFr=new wp({})});function fc(t){return typeof t!="object"||!t?!1:!!("type"in t&&t.type==="function"&&"function"in t&&typeof t.function=="object"&&t.function&&"name"in t.function&&"parameters"in t.function)}var OFr,EFr,$F,qF,r3=O(()=>{Kyt();Qq();KO();PD();$xe();xf();OFr=t=>t.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":t.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":t.startsWith("gpt-4-32k")?"gpt-4-32k":t.startsWith("gpt-4-")?"gpt-4":t.startsWith("gpt-4o")?"gpt-4o":t;EFr=()=>!1,$F=class extends ln{get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(e){super(e),Object.defineProperty(this,"verbose",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.verbose=e.verbose??EFr(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},qF=class extends $F{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}constructor({callbacks:e,callbackManager:r,...n}){let{cache:o,...i}=n;super({callbacks:e??r,...i}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_encoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof o=="object"?this.cache=o:o?this.cache=LX.global():this.cache=void 0,this.caller=new wp(n??{})}async getNumTokens(e){if(typeof e!="string")return 0;let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await Xyt("modelName"in this?OFr(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(e){return typeof e=="string"?new ID(e):Array.isArray(e)?new MD(e.map(eg)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...r}){let n={...this._identifyingParams(),...r,_type:this._llmType(),_model:this._modelType()};return Object.entries(n).filter(([a,s])=>s!==void 0).map(([a,s])=>`${a}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}}});var Wp=O(()=>{r3()});var fd=O(()=>{ED()});var N0t=b(()=>{});var pn=b((XQ,L0t)=>{(function(t,e){typeof XQ=="object"?L0t.exports=XQ=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(XQ,function(){var t=t||function(e,r){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof window<"u"&&window.crypto&&(n=window.crypto),!n&&typeof require=="function")try{n=N0t()}catch{}var o=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function g(){}return function(_){var w;return g.prototype=_,w=new g,g.prototype=null,w}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(g){var _=i(this);return g&&_.mixIn(g),(!_.hasOwnProperty("init")||this.init===_.init)&&(_.init=function(){_.$super.init.apply(this,arguments)}),_.init.prototype=_,_.$super=this,_},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var _ in g)g.hasOwnProperty(_)&&(this[_]=g[_]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(g,_){g=this.words=g||[],_!=r?this.sigBytes=_:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var _=this.words,w=g.words,x=this.sigBytes,C=g.sigBytes;if(this.clamp(),x%4)for(var P=0;P<C;P++){var E=w[P>>>2]>>>24-P%4*8&255;_[x+P>>>2]|=E<<24-(x+P)%4*8}else for(var A=0;A<C;A+=4)_[x+A>>>2]=w[A>>>2];return this.sigBytes+=C,this},clamp:function(){var g=this.words,_=this.sigBytes;g[_>>>2]&=4294967295<<32-_%4*8,g.length=e.ceil(_/4)},clone:function(){var g=u.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var _=[],w=0;w<g;w+=4)_.push(o());return new l.init(_,g)}}),c=a.enc={},d=c.Hex={stringify:function(g){for(var _=g.words,w=g.sigBytes,x=[],C=0;C<w;C++){var P=_[C>>>2]>>>24-C%4*8&255;x.push((P>>>4).toString(16)),x.push((P&15).toString(16))}return x.join("")},parse:function(g){for(var _=g.length,w=[],x=0;x<_;x+=2)w[x>>>3]|=parseInt(g.substr(x,2),16)<<24-x%8*4;return new l.init(w,_/2)}},f=c.Latin1={stringify:function(g){for(var _=g.words,w=g.sigBytes,x=[],C=0;C<w;C++){var P=_[C>>>2]>>>24-C%4*8&255;x.push(String.fromCharCode(P))}return x.join("")},parse:function(g){for(var _=g.length,w=[],x=0;x<_;x++)w[x>>>2]|=(g.charCodeAt(x)&255)<<24-x%4*8;return new l.init(w,_)}},p=c.Utf8={stringify:function(g){try{return decodeURIComponent(escape(f.stringify(g)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(g){return f.parse(unescape(encodeURIComponent(g)))}},m=s.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(g){typeof g=="string"&&(g=p.parse(g)),this._data.concat(g),this._nDataBytes+=g.sigBytes},_process:function(g){var _,w=this._data,x=w.words,C=w.sigBytes,P=this.blockSize,E=P*4,A=C/E;g?A=e.ceil(A):A=e.max((A|0)-this._minBufferSize,0);var M=A*P,R=e.min(M*4,C);if(M){for(var N=0;N<M;N+=P)this._doProcessBlock(x,N);_=x.splice(0,M),w.sigBytes-=R}return new l.init(_,R)},clone:function(){var g=u.clone.call(this);return g._data=this._data.clone(),g},_minBufferSize:0}),h=s.Hasher=m.extend({cfg:u.extend(),init:function(g){this.cfg=this.cfg.extend(g),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(g){return this._append(g),this._process(),this},finalize:function(g){g&&this._append(g);var _=this._doFinalize();return _},blockSize:512/32,_createHelper:function(g){return function(_,w){return new g.init(w).finalize(_)}},_createHmacHelper:function(g){return function(_,w){return new v.HMAC.init(g,w).finalize(_)}}}),v=a.algo={};return a}(Math);return t})});var R3=b((QQ,F0t)=>{(function(t,e){typeof QQ=="object"?F0t.exports=QQ=e(pn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(QQ,function(t){return function(e){var r=t,n=r.lib,o=n.Base,i=n.WordArray,a=r.x64={},s=a.Word=o.extend({init:function(l,c){this.high=l,this.low=c}}),u=a.WordArray=o.extend({init:function(l,c){l=this.words=l||[],c!=e?this.sigBytes=c:this.sigBytes=l.length*8},toX32:function(){for(var l=this.words,c=l.length,d=[],f=0;f<c;f++){var p=l[f];d.push(p.high),d.push(p.low)}return i.create(d,this.sigBytes)},clone:function(){for(var l=o.clone.call(this),c=l.words=this.words.slice(0),d=c.length,f=0;f<d;f++)c[f]=c[f].clone();return l}})}(),t})});var B0t=b((eee,k0t)=>{(function(t,e){typeof eee=="object"?k0t.exports=eee=e(pn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(eee,function(t){return function(){if(typeof ArrayBuffer=="function"){var e=t,r=e.lib,n=r.WordArray,o=n.init,i=n.init=function(a){if(a instanceof ArrayBuffer&&(a=new Uint8Array(a)),(a instanceof Int8Array||typeof Uint8ClampedArray<"u"&&a instanceof Uint8ClampedArray||a instanceof Int16Array||a instanceof Uint16Array||a instanceof Int32Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array)&&(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength)),a instanceof Uint8Array){for(var s=a.byteLength,u=[],l=0;l<s;l++)u[l>>>2]|=a[l]<<24-l%4*8;o.call(this,u,s)}else o.apply(this,arguments)};i.prototype=n}}(),t.lib.WordArray})});var q0t=b((tee,$0t)=>{(function(t,e){typeof tee=="object"?$0t.exports=tee=e(pn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(tee,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Utf16=o.Utf16BE={stringify:function(s){for(var u=s.words,l=s.sigBytes,c=[],d=0;d<l;d+=2){var f=u[d>>>2]>>>16-d%4*8&65535;c.push(String.fromCharCode(f))}return c.join("")},parse:function(s){for(var u=s.length,l=[],c=0;c<u;c++)l[c>>>1]|=s.charCodeAt(c)<<16-c%2*16;return n.create(l,u*2)}};o.Utf16LE={stringify:function(s){for(var u=s.words,l=s.sigBytes,c=[],d=0;d<l;d+=2){var f=a(u[d>>>2]>>>16-d%4*8&65535);c.push(String.fromCharCode(f))}return c.join("")},parse:function(s){for(var u=s.length,l=[],c=0;c<u;c++)l[c>>>1]|=a(s.charCodeAt(c)<<16-c%2*16);return n.create(l,u*2)}};function a(s){return s<<8&4278255360|s>>>8&16711935}}(),t.enc.Utf16})});var fT=b((ree,U0t)=>{(function(t,e){typeof ree=="object"?U0t.exports=ree=e(pn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(ree,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64={stringify:function(s){var u=s.words,l=s.sigBytes,c=this._map;s.clamp();for(var d=[],f=0;f<l;f+=3)for(var p=u[f>>>2]>>>24-f%4*8&255,m=u[f+1>>>2]>>>24-(f+1)%4*8&255,h=u[f+2>>>2]>>>24-(f+2)%4*8&255,v=p<<16|m<<8|h,g=0;g<4&&f+g*.75<l;g++)d.push(c.charAt(v>>>6*(3-g)&63));var _=c.charAt(64);if(_)for(;d.length%4;)d.push(_);return d.join("")},parse:function(s){var u=s.length,l=this._map,c=this._reverseMap;if(!c){c=this._reverseMap=[];for(var d=0;d<l.length;d++)c[l.charCodeAt(d)]=d}var f=l.charAt(64);if(f){var p=s.indexOf(f);p!==-1&&(u=p)}return a(s,u,c)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,m=l[s.charCodeAt(f)]>>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64})});var H0t=b((nee,z0t)=>{(function(t,e){typeof nee=="object"?z0t.exports=nee=e(pn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(nee,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64url={stringify:function(s,u){u===void 0&&(u=!0);var l=s.words,c=s.sigBytes,d=u?this._safe_map:this._map;s.clamp();for(var f=[],p=0;p<c;p+=3)for(var m=l[p>>>2]>>>24-p%4*8&255,h=l[p+1>>>2]>>>24-(p+1)%4*8&255,v=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=m<<16|h<<8|v,_=0;_<4&&p+_*.75<c;_++)f.push(d.charAt(g>>>6*(3-_)&63));var w=d.charAt(64);if(w)for(;f.length%4;)f.push(w);return f.join("")},parse:function(s,u){u===void 0&&(u=!0);var l=s.length,c=u?this._safe_map:this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f<c.length;f++)d[c.charCodeAt(f)]=f}var p=c.charAt(64);if(p){var m=s.indexOf(p);m!==-1&&(l=m)}return a(s,l,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function a(s,u,l){for(var c=[],d=0,f=0;f<u;f++)if(f%4){var p=l[s.charCodeAt(f-1)]<<f%4*2,m=l[s.charCodeAt(f)]>>>6-f%4*2,h=p|m;c[d>>>2]|=h<<24-d%4*8,d++}return n.create(c,d)}}(),t.enc.Base64url})});var pT=b((oee,V0t)=>{(function(t,e){typeof oee=="object"?V0t.exports=oee=e(pn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(oee,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[];(function(){for(var p=0;p<64;p++)s[p]=e.abs(e.sin(p+1))*4294967296|0})();var u=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,m){for(var h=0;h<16;h++){var v=m+h,g=p[v];p[v]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var _=this._hash.words,w=p[m+0],x=p[m+1],C=p[m+2],P=p[m+3],E=p[m+4],A=p[m+5],M=p[m+6],R=p[m+7],N=p[m+8],L=p[m+9],k=p[m+10],F=p[m+11],$=p[m+12],U=p[m+13],J=p[m+14],V=p[m+15],j=_[0],z=_[1],W=_[2],K=_[3];j=l(j,z,W,K,w,7,s[0]),K=l(K,j,z,W,x,12,s[1]),W=l(W,K,j,z,C,17,s[2]),z=l(z,W,K,j,P,22,s[3]),j=l(j,z,W,K,E,7,s[4]),K=l(K,j,z,W,A,12,s[5]),W=l(W,K,j,z,M,17,s[6]),z=l(z,W,K,j,R,22,s[7]),j=l(j,z,W,K,N,7,s[8]),K=l(K,j,z,W,L,12,s[9]),W=l(W,K,j,z,k,17,s[10]),z=l(z,W,K,j,F,22,s[11]),j=l(j,z,W,K,$,7,s[12]),K=l(K,j,z,W,U,12,s[13]),W=l(W,K,j,z,J,17,s[14]),z=l(z,W,K,j,V,22,s[15]),j=c(j,z,W,K,x,5,s[16]),K=c(K,j,z,W,M,9,s[17]),W=c(W,K,j,z,F,14,s[18]),z=c(z,W,K,j,w,20,s[19]),j=c(j,z,W,K,A,5,s[20]),K=c(K,j,z,W,k,9,s[21]),W=c(W,K,j,z,V,14,s[22]),z=c(z,W,K,j,E,20,s[23]),j=c(j,z,W,K,L,5,s[24]),K=c(K,j,z,W,J,9,s[25]),W=c(W,K,j,z,P,14,s[26]),z=c(z,W,K,j,N,20,s[27]),j=c(j,z,W,K,U,5,s[28]),K=c(K,j,z,W,C,9,s[29]),W=c(W,K,j,z,R,14,s[30]),z=c(z,W,K,j,$,20,s[31]),j=d(j,z,W,K,A,4,s[32]),K=d(K,j,z,W,N,11,s[33]),W=d(W,K,j,z,F,16,s[34]),z=d(z,W,K,j,J,23,s[35]),j=d(j,z,W,K,x,4,s[36]),K=d(K,j,z,W,E,11,s[37]),W=d(W,K,j,z,R,16,s[38]),z=d(z,W,K,j,k,23,s[39]),j=d(j,z,W,K,U,4,s[40]),K=d(K,j,z,W,w,11,s[41]),W=d(W,K,j,z,P,16,s[42]),z=d(z,W,K,j,M,23,s[43]),j=d(j,z,W,K,L,4,s[44]),K=d(K,j,z,W,$,11,s[45]),W=d(W,K,j,z,V,16,s[46]),z=d(z,W,K,j,C,23,s[47]),j=f(j,z,W,K,w,6,s[48]),K=f(K,j,z,W,R,10,s[49]),W=f(W,K,j,z,J,15,s[50]),z=f(z,W,K,j,A,21,s[51]),j=f(j,z,W,K,$,6,s[52]),K=f(K,j,z,W,P,10,s[53]),W=f(W,K,j,z,k,15,s[54]),z=f(z,W,K,j,x,21,s[55]),j=f(j,z,W,K,N,6,s[56]),K=f(K,j,z,W,V,10,s[57]),W=f(W,K,j,z,M,15,s[58]),z=f(z,W,K,j,U,21,s[59]),j=f(j,z,W,K,E,6,s[60]),K=f(K,j,z,W,F,10,s[61]),W=f(W,K,j,z,C,15,s[62]),z=f(z,W,K,j,L,21,s[63]),_[0]=_[0]+j|0,_[1]=_[1]+z|0,_[2]=_[2]+W|0,_[3]=_[3]+K|0},_doFinalize:function(){var p=this._data,m=p.words,h=this._nDataBytes*8,v=p.sigBytes*8;m[v>>>5]|=128<<24-v%32;var g=e.floor(h/4294967296),_=h;m[(v+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,m[(v+64>>>9<<4)+14]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,p.sigBytes=(m.length+1)*4,this._process();for(var w=this._hash,x=w.words,C=0;C<4;C++){var P=x[C];x[C]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360}return w},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,m,h,v,g,_,w){var x=p+(m&h|~m&v)+g+w;return(x<<_|x>>>32-_)+m}function c(p,m,h,v,g,_,w){var x=p+(m&v|h&~v)+g+w;return(x<<_|x>>>32-_)+m}function d(p,m,h,v,g,_,w){var x=p+(m^h^v)+g+w;return(x<<_|x>>>32-_)+m}function f(p,m,h,v,g,_,w){var x=p+(h^(m|~v))+g+w;return(x<<_|x>>>32-_)+m}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var NOe=b((iee,W0t)=>{(function(t,e){typeof iee=="object"?W0t.exports=iee=e(pn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(iee,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.Hasher,i=e.algo,a=[],s=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,l){for(var c=this._hash.words,d=c[0],f=c[1],p=c[2],m=c[3],h=c[4],v=0;v<80;v++){if(v<16)a[v]=u[l+v]|0;else{var g=a[v-3]^a[v-8]^a[v-14]^a[v-16];a[v]=g<<1|g>>>31}var _=(d<<5|d>>>27)+h+a[v];v<20?_+=(f&p|~f&m)+1518500249:v<40?_+=(f^p^m)+1859775393:v<60?_+=(f&p|f&m|p&m)-1894007588:_+=(f^p^m)-899497514,h=m,m=p,p=f<<30|f>>>2,f=d,d=_}c[0]=c[0]+d|0,c[1]=c[1]+f|0,c[2]=c[2]+p|0,c[3]=c[3]+m|0,c[4]=c[4]+h|0},_doFinalize:function(){var u=this._data,l=u.words,c=this._nDataBytes*8,d=u.sigBytes*8;return l[d>>>5]|=128<<24-d%32,l[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),l[(d+64>>>9<<4)+15]=c,u.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var u=o.clone.call(this);return u._hash=this._hash.clone(),u}});e.SHA1=o._createHelper(s),e.HmacSHA1=o._createHmacHelper(s)}(),t.SHA1})});var see=b((aee,K0t)=>{(function(t,e){typeof aee=="object"?K0t.exports=aee=e(pn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(aee,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],u=[];(function(){function d(h){for(var v=e.sqrt(h),g=2;g<=v;g++)if(!(h%g))return!1;return!0}function f(h){return(h-(h|0))*4294967296|0}for(var p=2,m=0;m<64;)d(p)&&(m<8&&(s[m]=f(e.pow(p,1/2))),u[m]=f(e.pow(p,1/3)),m++),p++})();var l=[],c=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(d,f){for(var p=this._hash.words,m=p[0],h=p[1],v=p[2],g=p[3],_=p[4],w=p[5],x=p[6],C=p[7],P=0;P<64;P++){if(P<16)l[P]=d[f+P]|0;else{var E=l[P-15],A=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,M=l[P-2],R=(M<<15|M>>>17)^(M<<13|M>>>19)^M>>>10;l[P]=A+l[P-7]+R+l[P-16]}var N=_&w^~_&x,L=m&h^m&v^h&v,k=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),F=(_<<26|_>>>6)^(_<<21|_>>>11)^(_<<7|_>>>25),$=C+F+N+u[P]+l[P],U=k+L;C=x,x=w,w=_,_=g+$|0,g=v,v=h,h=m,m=$+U|0}p[0]=p[0]+m|0,p[1]=p[1]+h|0,p[2]=p[2]+v|0,p[3]=p[3]+g|0,p[4]=p[4]+_|0,p[5]=p[5]+w|0,p[6]=p[6]+x|0,p[7]=p[7]+C|0},_doFinalize:function(){var d=this._data,f=d.words,p=this._nDataBytes*8,m=d.sigBytes*8;return f[m>>>5]|=128<<24-m%32,f[(m+64>>>9<<4)+14]=e.floor(p/4294967296),f[(m+64>>>9<<4)+15]=p,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=i.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=i._createHelper(c),r.HmacSHA256=i._createHmacHelper(c)}(Math),t.SHA256})});var G0t=b((uee,J0t)=>{(function(t,e,r){typeof uee=="object"?J0t.exports=uee=e(pn(),see()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(uee,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.algo,i=o.SHA256,a=o.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var s=i._doFinalize.call(this);return s.sigBytes-=4,s}});e.SHA224=i._createHelper(a),e.HmacSHA224=i._createHmacHelper(a)}(),t.SHA224})});var LOe=b((lee,Y0t)=>{(function(t,e,r){typeof lee=="object"?Y0t.exports=lee=e(pn(),R3()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(lee,function(t){return function(){var e=t,r=e.lib,n=r.Hasher,o=e.x64,i=o.Word,a=o.WordArray,s=e.algo;function u(){return i.create.apply(i,arguments)}var l=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],c=[];(function(){for(var f=0;f<80;f++)c[f]=u()})();var d=s.SHA512=n.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(f,p){for(var m=this._hash.words,h=m[0],v=m[1],g=m[2],_=m[3],w=m[4],x=m[5],C=m[6],P=m[7],E=h.high,A=h.low,M=v.high,R=v.low,N=g.high,L=g.low,k=_.high,F=_.low,$=w.high,U=w.low,J=x.high,V=x.low,j=C.high,z=C.low,W=P.high,K=P.low,re=E,De=A,Y=M,Q=R,oe=N,Te=L,bt=k,xe=F,Z=$,te=U,Ee=J,Le=V,Ze=j,Ot=z,Yt=W,Wn=K,nr=0;nr<80;nr++){var ve,vn,lt=c[nr];if(nr<16)vn=lt.high=f[p+nr*2]|0,ve=lt.low=f[p+nr*2+1]|0;else{var qe=c[nr-15],ie=qe.high,ce=qe.low,_e=(ie>>>1|ce<<31)^(ie>>>8|ce<<24)^ie>>>7,be=(ce>>>1|ie<<31)^(ce>>>8|ie<<24)^(ce>>>7|ie<<25),Ue=c[nr-2],zr=Ue.high,ia=Ue.low,Hu=(zr>>>19|ia<<13)^(zr<<3|ia>>>29)^zr>>>6,Jh=(ia>>>19|zr<<13)^(ia<<3|zr>>>29)^(ia>>>6|zr<<26),Gh=c[nr-7],Ia=Gh.high,gm=Gh.low,hp=c[nr-16],ym=hp.high,wn=hp.low;ve=be+gm,vn=_e+Ia+(ve>>>0<be>>>0?1:0),ve=ve+Jh,vn=vn+Hu+(ve>>>0<Jh>>>0?1:0),ve=ve+wn,vn=vn+ym+(ve>>>0<wn>>>0?1:0),lt.high=vn,lt.low=ve}var DO=Z&Ee^~Z&Ze,ZA=te&Le^~te&Ot,NO=re&Y^re&oe^Y&oe,Ma=De&Q^De&Te^Q&Te,us=(re>>>28|De<<4)^(re<<30|De>>>2)^(re<<25|De>>>7),aa=(De>>>28|re<<4)^(De<<30|re>>>2)^(De<<25|re>>>7),Od=(Z>>>14|te<<18)^(Z>>>18|te<<14)^(Z<<23|te>>>9),Bc=(te>>>14|Z<<18)^(te>>>18|Z<<14)^(te<<23|Z>>>9),Va=l[nr],df=Va.high,Ed=Va.low,un=Wn+Bc,ze=Yt+Od+(un>>>0<Wn>>>0?1:0),un=un+ZA,ze=ze+DO+(un>>>0<ZA>>>0?1:0),un=un+Ed,ze=ze+df+(un>>>0<Ed>>>0?1:0),un=un+ve,ze=ze+vn+(un>>>0<ve>>>0?1:0),Pd=aa+Ma,gp=us+NO+(Pd>>>0<aa>>>0?1:0);Yt=Ze,Wn=Ot,Ze=Ee,Ot=Le,Ee=Z,Le=te,te=xe+un|0,Z=bt+ze+(te>>>0<xe>>>0?1:0)|0,bt=oe,xe=Te,oe=Y,Te=Q,Y=re,Q=De,De=un+Pd|0,re=ze+gp+(De>>>0<un>>>0?1:0)|0}A=h.low=A+De,h.high=E+re+(A>>>0<De>>>0?1:0),R=v.low=R+Q,v.high=M+Y+(R>>>0<Q>>>0?1:0),L=g.low=L+Te,g.high=N+oe+(L>>>0<Te>>>0?1:0),F=_.low=F+xe,_.high=k+bt+(F>>>0<xe>>>0?1:0),U=w.low=U+te,w.high=$+Z+(U>>>0<te>>>0?1:0),V=x.low=V+Le,x.high=J+Ee+(V>>>0<Le>>>0?1:0),z=C.low=z+Ot,C.high=j+Ze+(z>>>0<Ot>>>0?1:0),K=P.low=K+Wn,P.high=W+Yt+(K>>>0<Wn>>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,m=this._nDataBytes*8,h=f.sigBytes*8;p[h>>>5]|=128<<24-h%32,p[(h+128>>>10<<5)+30]=Math.floor(m/4294967296),p[(h+128>>>10<<5)+31]=m,f.sigBytes=p.length*4,this._process();var v=this._hash.toX32();return v},clone:function(){var f=n.clone.call(this);return f._hash=this._hash.clone(),f},blockSize:1024/32});e.SHA512=n._createHelper(d),e.HmacSHA512=n._createHmacHelper(d)}(),t.SHA512})});var X0t=b((cee,Z0t)=>{(function(t,e,r){typeof cee=="object"?Z0t.exports=cee=e(pn(),R3(),LOe()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(cee,function(t){return function(){var e=t,r=e.x64,n=r.Word,o=r.WordArray,i=e.algo,a=i.SHA512,s=i.SHA384=a.extend({_doReset:function(){this._hash=new o.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var u=a._doFinalize.call(this);return u.sigBytes-=16,u}});e.SHA384=a._createHelper(s),e.HmacSHA384=a._createHmacHelper(s)}(),t.SHA384})});var ewt=b((dee,Q0t)=>{(function(t,e,r){typeof dee=="object"?Q0t.exports=dee=e(pn(),R3()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(dee,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.x64,s=a.Word,u=r.algo,l=[],c=[],d=[];(function(){for(var m=1,h=0,v=0;v<24;v++){l[m+5*h]=(v+1)*(v+2)/2%64;var g=h%5,_=(2*m+3*h)%5;m=g,h=_}for(var m=0;m<5;m++)for(var h=0;h<5;h++)c[m+5*h]=h+(2*m+3*h)%5*5;for(var w=1,x=0;x<24;x++){for(var C=0,P=0,E=0;E<7;E++){if(w&1){var A=(1<<E)-1;A<32?P^=1<<A:C^=1<<A-32}w&128?w=w<<1^113:w<<=1}d[x]=s.create(C,P)}})();var f=[];(function(){for(var m=0;m<25;m++)f[m]=s.create()})();var p=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],h=0;h<25;h++)m[h]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,h){for(var v=this._state,g=this.blockSize/2,_=0;_<g;_++){var w=m[h+2*_],x=m[h+2*_+1];w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,x=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360;var C=v[_];C.high^=x,C.low^=w}for(var P=0;P<24;P++){for(var E=0;E<5;E++){for(var A=0,M=0,R=0;R<5;R++){var C=v[E+5*R];A^=C.high,M^=C.low}var N=f[E];N.high=A,N.low=M}for(var E=0;E<5;E++)for(var L=f[(E+4)%5],k=f[(E+1)%5],F=k.high,$=k.low,A=L.high^(F<<1|$>>>31),M=L.low^($<<1|F>>>31),R=0;R<5;R++){var C=v[E+5*R];C.high^=A,C.low^=M}for(var U=1;U<25;U++){var A,M,C=v[U],J=C.high,V=C.low,j=l[U];j<32?(A=J<<j|V>>>32-j,M=V<<j|J>>>32-j):(A=V<<j-32|J>>>64-j,M=J<<j-32|V>>>64-j);var z=f[c[U]];z.high=A,z.low=M}var W=f[0],K=v[0];W.high=K.high,W.low=K.low;for(var E=0;E<5;E++)for(var R=0;R<5;R++){var U=E+5*R,C=v[U],re=f[U],De=f[(E+1)%5+5*R],Y=f[(E+2)%5+5*R];C.high=re.high^~De.high&Y.high,C.low=re.low^~De.low&Y.low}var C=v[0],Q=d[P];C.high^=Q.high,C.low^=Q.low}},_doFinalize:function(){var m=this._data,h=m.words,v=this._nDataBytes*8,g=m.sigBytes*8,_=this.blockSize*32;h[g>>>5]|=1<<24-g%32,h[(e.ceil((g+1)/_)*_>>>5)-1]|=128,m.sigBytes=h.length*4,this._process();for(var w=this._state,x=this.cfg.outputLength/8,C=x/8,P=[],E=0;E<C;E++){var A=w[E],M=A.high,R=A.low;M=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360,R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,P.push(R),P.push(M)}return new o.init(P,x)},clone:function(){for(var m=i.clone.call(this),h=m._state=this._state.slice(0),v=0;v<25;v++)h[v]=h[v].clone();return m}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var rwt=b((fee,twt)=>{(function(t,e){typeof fee=="object"?twt.exports=fee=e(pn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(fee,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=o.create([0,1518500249,1859775393,2400959708,2840853838]),f=o.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(x,C){for(var P=0;P<16;P++){var E=C+P,A=x[E];x[E]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var M=this._hash.words,R=d.words,N=f.words,L=s.words,k=u.words,F=l.words,$=c.words,U,J,V,j,z,W,K,re,De,Y;W=U=M[0],K=J=M[1],re=V=M[2],De=j=M[3],Y=z=M[4];for(var Q,P=0;P<80;P+=1)Q=U+x[C+L[P]]|0,P<16?Q+=m(J,V,j)+R[0]:P<32?Q+=h(J,V,j)+R[1]:P<48?Q+=v(J,V,j)+R[2]:P<64?Q+=g(J,V,j)+R[3]:Q+=_(J,V,j)+R[4],Q=Q|0,Q=w(Q,F[P]),Q=Q+z|0,U=z,z=j,j=w(V,10),V=J,J=Q,Q=W+x[C+k[P]]|0,P<16?Q+=_(K,re,De)+N[0]:P<32?Q+=g(K,re,De)+N[1]:P<48?Q+=v(K,re,De)+N[2]:P<64?Q+=h(K,re,De)+N[3]:Q+=m(K,re,De)+N[4],Q=Q|0,Q=w(Q,$[P]),Q=Q+Y|0,W=Y,Y=De,De=w(re,10),re=K,K=Q;Q=M[1]+V+De|0,M[1]=M[2]+j+Y|0,M[2]=M[3]+z+W|0,M[3]=M[4]+U+K|0,M[4]=M[0]+J+re|0,M[0]=Q},_doFinalize:function(){var x=this._data,C=x.words,P=this._nDataBytes*8,E=x.sigBytes*8;C[E>>>5]|=128<<24-E%32,C[(E+64>>>9<<4)+14]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,x.sigBytes=(C.length+1)*4,this._process();for(var A=this._hash,M=A.words,R=0;R<5;R++){var N=M[R];M[R]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}return A},clone:function(){var x=i.clone.call(this);return x._hash=this._hash.clone(),x}});function m(x,C,P){return x^C^P}function h(x,C,P){return x&C|~x&P}function v(x,C,P){return(x|~C)^P}function g(x,C,P){return x&P|C&~P}function _(x,C,P){return x^(C|~P)}function w(x,C){return x<<C|x>>>32-C}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var mee=b((pee,nwt)=>{(function(t,e){typeof pee=="object"?nwt.exports=pee=e(pn()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(pee,function(t){(function(){var e=t,r=e.lib,n=r.Base,o=e.enc,i=o.Utf8,a=e.algo,s=a.HMAC=n.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=i.parse(l));var c=u.blockSize,d=c*4;l.sigBytes>d&&(l=u.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),p=this._iKey=l.clone(),m=f.words,h=p.words,v=0;v<c;v++)m[v]^=1549556828,h[v]^=909522486;f.sigBytes=p.sigBytes=d,this.reset()},reset:function(){var u=this._hasher;u.reset(),u.update(this._iKey)},update:function(u){return this._hasher.update(u),this},finalize:function(u){var l=this._hasher,c=l.finalize(u);l.reset();var d=l.finalize(this._oKey.clone().concat(c));return d}})})()})});var iwt=b((hee,owt)=>{(function(t,e,r){typeof hee=="object"?owt.exports=hee=e(pn(),see(),mee()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(hee,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.SHA256,s=i.HMAC,u=i.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,c){for(var d=this.cfg,f=s.create(d.hasher,l),p=o.create(),m=o.create([1]),h=p.words,v=m.words,g=d.keySize,_=d.iterations;h.length<g;){var w=f.update(c).finalize(m);f.reset();for(var x=w.words,C=x.length,P=w,E=1;E<_;E++){P=f.finalize(P),f.reset();for(var A=P.words,M=0;M<C;M++)x[M]^=A[M]}p.concat(w),v[0]++}return p.sigBytes=g*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var bC=b((gee,awt)=>{(function(t,e,r){typeof gee=="object"?awt.exports=gee=e(pn(),NOe(),mee()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(gee,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.MD5,s=i.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,l){for(var c,d=this.cfg,f=d.hasher.create(),p=o.create(),m=p.words,h=d.keySize,v=d.iterations;m.length<h;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var g=1;g<v;g++)c=f.finalize(c),f.reset();p.concat(c)}return p.sigBytes=h*4,p}});e.EvpKDF=function(u,l,c){return s.create(c).compute(u,l)}}(),t.EvpKDF})});var al=b((yee,swt)=>{(function(t,e,r){typeof yee=="object"?swt.exports=yee=e(pn(),bC()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(yee,function(t){t.lib.Cipher||function(e){var r=t,n=r.lib,o=n.Base,i=n.WordArray,a=n.BufferedBlockAlgorithm,s=r.enc,u=s.Utf8,l=s.Base64,c=r.algo,d=c.EvpKDF,f=n.Cipher=a.extend({cfg:o.extend(),createEncryptor:function(N,L){return this.create(this._ENC_XFORM_MODE,N,L)},createDecryptor:function(N,L){return this.create(this._DEC_XFORM_MODE,N,L)},init:function(N,L,k){this.cfg=this.cfg.extend(k),this._xformMode=N,this._key=L,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(N){return this._append(N),this._process()},finalize:function(N){N&&this._append(N);var L=this._doFinalize();return L},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(L){return typeof L=="string"?R:E}return function(L){return{encrypt:function(k,F,$){return N(F).encrypt(L,k,F,$)},decrypt:function(k,F,$){return N(F).decrypt(L,k,F,$)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var N=this._process(!0);return N},blockSize:1}),m=r.mode={},h=n.BlockCipherMode=o.extend({createEncryptor:function(N,L){return this.Encryptor.create(N,L)},createDecryptor:function(N,L){return this.Decryptor.create(N,L)},init:function(N,L){this._cipher=N,this._iv=L}}),v=m.CBC=function(){var N=h.extend();N.Encryptor=N.extend({processBlock:function(k,F){var $=this._cipher,U=$.blockSize;L.call(this,k,F,U),$.encryptBlock(k,F),this._prevBlock=k.slice(F,F+U)}}),N.Decryptor=N.extend({processBlock:function(k,F){var $=this._cipher,U=$.blockSize,J=k.slice(F,F+U);$.decryptBlock(k,F),L.call(this,k,F,U),this._prevBlock=J}});function L(k,F,$){var U,J=this._iv;J?(U=J,this._iv=e):U=this._prevBlock;for(var V=0;V<$;V++)k[F+V]^=U[V]}return N}(),g=r.pad={},_=g.Pkcs7={pad:function(N,L){for(var k=L*4,F=k-N.sigBytes%k,$=F<<24|F<<16|F<<8|F,U=[],J=0;J<F;J+=4)U.push($);var V=i.create(U,F);N.concat(V)},unpad:function(N){var L=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=L}},w=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:v,padding:_}),reset:function(){var N;f.reset.call(this);var L=this.cfg,k=L.iv,F=L.mode;this._xformMode==this._ENC_XFORM_MODE?N=F.createEncryptor:(N=F.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==N?this._mode.init(this,k&&k.words):(this._mode=N.call(F,this,k&&k.words),this._mode.__creator=N)},_doProcessBlock:function(N,L){this._mode.processBlock(N,L)},_doFinalize:function(){var N,L=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(L.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),L.unpad(N)),N},blockSize:128/32}),x=n.CipherParams=o.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),C=r.format={},P=C.OpenSSL={stringify:function(N){var L,k=N.ciphertext,F=N.salt;return F?L=i.create([1398893684,1701076831]).concat(F).concat(k):L=k,L.toString(l)},parse:function(N){var L,k=l.parse(N),F=k.words;return F[0]==1398893684&&F[1]==1701076831&&(L=i.create(F.slice(2,4)),F.splice(0,4),k.sigBytes-=16),x.create({ciphertext:k,salt:L})}},E=n.SerializableCipher=o.extend({cfg:o.extend({format:P}),encrypt:function(N,L,k,F){F=this.cfg.extend(F);var $=N.createEncryptor(k,F),U=$.finalize(L),J=$.cfg;return x.create({ciphertext:U,key:k,iv:J.iv,algorithm:N,mode:J.mode,padding:J.padding,blockSize:N.blockSize,formatter:F.format})},decrypt:function(N,L,k,F){F=this.cfg.extend(F),L=this._parse(L,F.format);var $=N.createDecryptor(k,F).finalize(L.ciphertext);return $},_parse:function(N,L){return typeof N=="string"?L.parse(N,this):N}}),A=r.kdf={},M=A.OpenSSL={execute:function(N,L,k,F,$){if(F||(F=i.random(64/8)),$)var U=d.create({keySize:L+k,hasher:$}).compute(N,F);else var U=d.create({keySize:L+k}).compute(N,F);var J=i.create(U.words.slice(L),k*4);return U.sigBytes=L*4,x.create({key:U,iv:J,salt:F})}},R=n.PasswordBasedCipher=E.extend({cfg:E.cfg.extend({kdf:M}),encrypt:function(N,L,k,F){F=this.cfg.extend(F);var $=F.kdf.execute(k,N.keySize,N.ivSize,F.salt,F.hasher);F.iv=$.iv;var U=E.encrypt.call(this,N,L,$.key,F);return U.mixIn($),U},decrypt:function(N,L,k,F){F=this.cfg.extend(F),L=this._parse(L,F.format);var $=F.kdf.execute(k,N.keySize,N.ivSize,L.salt,F.hasher);F.iv=$.iv;var U=E.decrypt.call(this,N,L,$.key,F);return U}})}()})});var lwt=b((bee,uwt)=>{(function(t,e,r){typeof bee=="object"?uwt.exports=bee=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(bee,function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();e.Encryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize;r.call(this,n,o,a,i),this._prevBlock=n.slice(o,o+a)}}),e.Decryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=n.slice(o,o+a);r.call(this,n,o,a,i),this._prevBlock=s}});function r(n,o,i,a){var s,u=this._iv;u?(s=u.slice(0),this._iv=void 0):s=this._prevBlock,a.encryptBlock(s,0);for(var l=0;l<i;l++)n[o+l]^=s[l]}return e}(),t.mode.CFB})});var dwt=b((_ee,cwt)=>{(function(t,e,r){typeof _ee=="object"?cwt.exports=_ee=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(_ee,function(t){return t.mode.CTR=function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=this._iv,u=this._counter;s&&(u=this._counter=s.slice(0),this._iv=void 0);var l=u.slice(0);i.encryptBlock(l,0),u[a-1]=u[a-1]+1|0;for(var c=0;c<a;c++)n[o+c]^=l[c]}});return e.Decryptor=r,e}(),t.mode.CTR})});var pwt=b((vee,fwt)=>{(function(t,e,r){typeof vee=="object"?fwt.exports=vee=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(vee,function(t){return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function r(i){if((i>>24&255)===255){var a=i>>16&255,s=i>>8&255,u=i&255;a===255?(a=0,s===255?(s=0,u===255?u=0:++u):++s):++a,i=0,i+=a<<16,i+=s<<8,i+=u}else i+=1<<24;return i}function n(i){return(i[0]=r(i[0]))===0&&(i[1]=r(i[1])),i}var o=e.Encryptor=e.extend({processBlock:function(i,a){var s=this._cipher,u=s.blockSize,l=this._iv,c=this._counter;l&&(c=this._counter=l.slice(0),this._iv=void 0),n(c);var d=c.slice(0);s.encryptBlock(d,0);for(var f=0;f<u;f++)i[a+f]^=d[f]}});return e.Decryptor=o,e}(),t.mode.CTRGladman})});var hwt=b((wee,mwt)=>{(function(t,e,r){typeof wee=="object"?mwt.exports=wee=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(wee,function(t){return t.mode.OFB=function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=this._iv,u=this._keystream;s&&(u=this._keystream=s.slice(0),this._iv=void 0),i.encryptBlock(u,0);for(var l=0;l<a;l++)n[o+l]^=u[l]}});return e.Decryptor=r,e}(),t.mode.OFB})});var ywt=b((See,gwt)=>{(function(t,e,r){typeof See=="object"?gwt.exports=See=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(See,function(t){return t.mode.ECB=function(){var e=t.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(r,n){this._cipher.encryptBlock(r,n)}}),e.Decryptor=e.extend({processBlock:function(r,n){this._cipher.decryptBlock(r,n)}}),e}(),t.mode.ECB})});var _wt=b((xee,bwt)=>{(function(t,e,r){typeof xee=="object"?bwt.exports=xee=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(xee,function(t){return t.pad.AnsiX923={pad:function(e,r){var n=e.sigBytes,o=r*4,i=o-n%o,a=n+i-1;e.clamp(),e.words[a>>>2]|=i<<24-a%4*8,e.sigBytes+=i},unpad:function(e){var r=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=r}},t.pad.Ansix923})});var wwt=b((Cee,vwt)=>{(function(t,e,r){typeof Cee=="object"?vwt.exports=Cee=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Cee,function(t){return t.pad.Iso10126={pad:function(e,r){var n=r*4,o=n-e.sigBytes%n;e.concat(t.lib.WordArray.random(o-1)).concat(t.lib.WordArray.create([o<<24],1))},unpad:function(e){var r=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=r}},t.pad.Iso10126})});var xwt=b((Oee,Swt)=>{(function(t,e,r){typeof Oee=="object"?Swt.exports=Oee=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Oee,function(t){return t.pad.Iso97971={pad:function(e,r){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,r)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971})});var Owt=b((Eee,Cwt)=>{(function(t,e,r){typeof Eee=="object"?Cwt.exports=Eee=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Eee,function(t){return t.pad.ZeroPadding={pad:function(e,r){var n=r*4;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){for(var r=e.words,n=e.sigBytes-1,n=e.sigBytes-1;n>=0;n--)if(r[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},t.pad.ZeroPadding})});var Pwt=b((Pee,Ewt)=>{(function(t,e,r){typeof Pee=="object"?Ewt.exports=Pee=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Pee,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var Awt=b((Tee,Twt)=>{(function(t,e,r){typeof Tee=="object"?Twt.exports=Tee=e(pn(),al()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Tee,function(t){return function(e){var r=t,n=r.lib,o=n.CipherParams,i=r.enc,a=i.Hex,s=r.format,u=s.Hex={stringify:function(l){return l.ciphertext.toString(a)},parse:function(l){var c=a.parse(l);return o.create({ciphertext:c})}}}(),t.format.Hex})});var Mwt=b((Aee,Iwt)=>{(function(t,e,r){typeof Aee=="object"?Iwt.exports=Aee=e(pn(),fT(),pT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Aee,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo,i=[],a=[],s=[],u=[],l=[],c=[],d=[],f=[],p=[],m=[];(function(){for(var g=[],_=0;_<256;_++)_<128?g[_]=_<<1:g[_]=_<<1^283;for(var w=0,x=0,_=0;_<256;_++){var C=x^x<<1^x<<2^x<<3^x<<4;C=C>>>8^C&255^99,i[w]=C,a[C]=w;var P=g[w],E=g[P],A=g[E],M=g[C]*257^C*16843008;s[w]=M<<24|M>>>8,u[w]=M<<16|M>>>16,l[w]=M<<8|M>>>24,c[w]=M;var M=A*16843009^E*65537^P*257^w*16843008;d[C]=M<<24|M>>>8,f[C]=M<<16|M>>>16,p[C]=M<<8|M>>>24,m[C]=M,w?(w=P^g[g[g[A^P]]],x^=g[g[x]]):w=x=1}})();var h=[0,1,2,4,8,16,32,64,128,27,54],v=o.AES=n.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,w=_.words,x=_.sigBytes/4,C=this._nRounds=x+6,P=(C+1)*4,E=this._keySchedule=[],A=0;A<P;A++)A<x?E[A]=w[A]:(g=E[A-1],A%x?x>6&&A%x==4&&(g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255]):(g=g<<8|g>>>24,g=i[g>>>24]<<24|i[g>>>16&255]<<16|i[g>>>8&255]<<8|i[g&255],g^=h[A/x|0]<<24),E[A]=E[A-x]^g);for(var M=this._invKeySchedule=[],R=0;R<P;R++){var A=P-R;if(R%4)var g=E[A];else var g=E[A-4];R<4||A<=4?M[R]=g:M[R]=d[i[g>>>24]]^f[i[g>>>16&255]]^p[i[g>>>8&255]]^m[i[g&255]]}}},encryptBlock:function(g,_){this._doCryptBlock(g,_,this._keySchedule,s,u,l,c,i)},decryptBlock:function(g,_){var w=g[_+1];g[_+1]=g[_+3],g[_+3]=w,this._doCryptBlock(g,_,this._invKeySchedule,d,f,p,m,a);var w=g[_+1];g[_+1]=g[_+3],g[_+3]=w},_doCryptBlock:function(g,_,w,x,C,P,E,A){for(var M=this._nRounds,R=g[_]^w[0],N=g[_+1]^w[1],L=g[_+2]^w[2],k=g[_+3]^w[3],F=4,$=1;$<M;$++){var U=x[R>>>24]^C[N>>>16&255]^P[L>>>8&255]^E[k&255]^w[F++],J=x[N>>>24]^C[L>>>16&255]^P[k>>>8&255]^E[R&255]^w[F++],V=x[L>>>24]^C[k>>>16&255]^P[R>>>8&255]^E[N&255]^w[F++],j=x[k>>>24]^C[R>>>16&255]^P[N>>>8&255]^E[L&255]^w[F++];R=U,N=J,L=V,k=j}var U=(A[R>>>24]<<24|A[N>>>16&255]<<16|A[L>>>8&255]<<8|A[k&255])^w[F++],J=(A[N>>>24]<<24|A[L>>>16&255]<<16|A[k>>>8&255]<<8|A[R&255])^w[F++],V=(A[L>>>24]<<24|A[k>>>16&255]<<16|A[R>>>8&255]<<8|A[N&255])^w[F++],j=(A[k>>>24]<<24|A[R>>>16&255]<<16|A[N>>>8&255]<<8|A[L&255])^w[F++];g[_]=U,g[_+1]=J,g[_+2]=V,g[_+3]=j},keySize:256/32});e.AES=n._createHelper(v)}(),t.AES})});var jwt=b((Iee,Rwt)=>{(function(t,e,r){typeof Iee=="object"?Rwt.exports=Iee=e(pn(),fT(),pT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Iee,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.BlockCipher,i=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var h=this._key,v=h.words,g=[],_=0;_<56;_++){var w=a[_]-1;g[_]=v[w>>>5]>>>31-w%32&1}for(var x=this._subKeys=[],C=0;C<16;C++){for(var P=x[C]=[],E=u[C],_=0;_<24;_++)P[_/6|0]|=g[(s[_]-1+E)%28]<<31-_%6,P[4+(_/6|0)]|=g[28+(s[_+24]-1+E)%28]<<31-_%6;P[0]=P[0]<<1|P[0]>>>31;for(var _=1;_<7;_++)P[_]=P[_]>>>(_-1)*4+3;P[7]=P[7]<<5|P[7]>>>27}for(var A=this._invSubKeys=[],_=0;_<16;_++)A[_]=x[15-_]},encryptBlock:function(h,v){this._doCryptBlock(h,v,this._subKeys)},decryptBlock:function(h,v){this._doCryptBlock(h,v,this._invSubKeys)},_doCryptBlock:function(h,v,g){this._lBlock=h[v],this._rBlock=h[v+1],f.call(this,4,252645135),f.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),f.call(this,1,1431655765);for(var _=0;_<16;_++){for(var w=g[_],x=this._lBlock,C=this._rBlock,P=0,E=0;E<8;E++)P|=l[E][((C^w[E])&c[E])>>>0];this._lBlock=C,this._rBlock=x^P}var A=this._lBlock;this._lBlock=this._rBlock,this._rBlock=A,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),h[v]=this._lBlock,h[v+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(h,v){var g=(this._lBlock>>>h^this._rBlock)&v;this._rBlock^=g,this._lBlock^=g<<h}function p(h,v){var g=(this._rBlock>>>h^this._lBlock)&v;this._lBlock^=g,this._rBlock^=g<<h}e.DES=o._createHelper(d);var m=i.TripleDES=o.extend({_doReset:function(){var h=this._key,v=h.words;if(v.length!==2&&v.length!==4&&v.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var g=v.slice(0,2),_=v.length<4?v.slice(0,2):v.slice(2,4),w=v.length<6?v.slice(0,2):v.slice(4,6);this._des1=d.createEncryptor(n.create(g)),this._des2=d.createEncryptor(n.create(_)),this._des3=d.createEncryptor(n.create(w))},encryptBlock:function(h,v){this._des1.encryptBlock(h,v),this._des2.decryptBlock(h,v),this._des3.encryptBlock(h,v)},decryptBlock:function(h,v){this._des3.decryptBlock(h,v),this._des2.encryptBlock(h,v),this._des1.decryptBlock(h,v)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(m)}(),t.TripleDES})});var Nwt=b((Mee,Dwt)=>{(function(t,e,r){typeof Mee=="object"?Dwt.exports=Mee=e(pn(),fT(),pT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Mee,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=o.RC4=n.extend({_doReset:function(){for(var u=this._key,l=u.words,c=u.sigBytes,d=this._S=[],f=0;f<256;f++)d[f]=f;for(var f=0,p=0;f<256;f++){var m=f%c,h=l[m>>>2]>>>24-m%4*8&255;p=(p+d[f]+h)%256;var v=d[f];d[f]=d[p],d[p]=v}this._i=this._j=0},_doProcessBlock:function(u,l){u[l]^=a.call(this)},keySize:256/32,ivSize:0});function a(){for(var u=this._S,l=this._i,c=this._j,d=0,f=0;f<4;f++){l=(l+1)%256,c=(c+u[l])%256;var p=u[l];u[l]=u[c],u[c]=p,d|=u[(u[l]+u[c])%256]<<24-f*8}return this._i=l,this._j=c,d}e.RC4=n._createHelper(i);var s=o.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var u=this.cfg.drop;u>0;u--)a.call(this)}});e.RC4Drop=n._createHelper(s)}(),t.RC4})});var Fwt=b((Ree,Lwt)=>{(function(t,e,r){typeof Ree=="object"?Lwt.exports=Ree=e(pn(),fT(),pT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Ree,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.Rabbit=n.extend({_doReset:function(){for(var c=this._key.words,d=this.cfg.iv,f=0;f<4;f++)c[f]=(c[f]<<8|c[f]>>>24)&16711935|(c[f]<<24|c[f]>>>8)&4278255360;var p=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],m=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)m[f]^=p[f+4&7];if(d){var h=d.words,v=h[0],g=h[1],_=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,w=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=_>>>16|w&4294901760,C=w<<16|_&65535;m[0]^=_,m[1]^=x,m[2]^=w,m[3]^=C,m[4]^=_,m[5]^=x,m[6]^=w,m[7]^=C;for(var f=0;f<4;f++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,v=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=v^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=n._createHelper(u)}(),t.Rabbit})});var Bwt=b((jee,kwt)=>{(function(t,e,r){typeof jee=="object"?kwt.exports=jee=e(pn(),fT(),pT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(jee,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.RabbitLegacy=n.extend({_doReset:function(){var c=this._key.words,d=this.cfg.iv,f=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],p=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var m=0;m<4;m++)l.call(this);for(var m=0;m<8;m++)p[m]^=f[m+4&7];if(d){var h=d.words,v=h[0],g=h[1],_=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,w=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=_>>>16|w&4294901760,C=w<<16|_&65535;p[0]^=_,p[1]^=x,p[2]^=w,p[3]^=C,p[4]^=_,p[5]^=x,p[6]^=w,p[7]^=C;for(var m=0;m<4;m++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,v=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=v^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=n._createHelper(u)}(),t.RabbitLegacy})});var qwt=b((Dee,$wt)=>{(function(t,e,r){typeof Dee=="object"?$wt.exports=Dee=e(pn(),fT(),pT(),bC(),al()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Dee,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo;let i=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function l(m,h){let v=h>>24&255,g=h>>16&255,_=h>>8&255,w=h&255,x=m.sbox[0][v]+m.sbox[1][g];return x=x^m.sbox[2][_],x=x+m.sbox[3][w],x}function c(m,h,v){let g=h,_=v,w;for(let x=0;x<i;++x)g=g^m.pbox[x],_=l(m,g)^_,w=g,g=_,_=w;return w=g,g=_,_=w,_=_^m.pbox[i],g=g^m.pbox[i+1],{left:g,right:_}}function d(m,h,v){let g=h,_=v,w;for(let x=i+1;x>1;--x)g=g^m.pbox[x],_=l(m,g)^_,w=g,g=_,_=w;return w=g,g=_,_=w,_=_^m.pbox[1],g=g^m.pbox[0],{left:g,right:_}}function f(m,h,v){for(let C=0;C<4;C++){m.sbox[C]=[];for(let P=0;P<256;P++)m.sbox[C][P]=s[C][P]}let g=0;for(let C=0;C<i+2;C++)m.pbox[C]=a[C]^h[g],g++,g>=v&&(g=0);let _=0,w=0,x=0;for(let C=0;C<i+2;C+=2)x=c(m,_,w),_=x.left,w=x.right,m.pbox[C]=_,m.pbox[C+1]=w;for(let C=0;C<4;C++)for(let P=0;P<256;P+=2)x=c(m,_,w),_=x.left,w=x.right,m.sbox[C][P]=_,m.sbox[C][P+1]=w;return!0}var p=o.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,h=m.words,v=m.sigBytes/4;f(u,h,v)}},encryptBlock:function(m,h){var v=c(u,m[h],m[h+1]);m[h]=v.left,m[h+1]=v.right},decryptBlock:function(m,h){var v=d(u,m[h],m[h+1]);m[h]=v.left,m[h+1]=v.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(p)}(),t.Blowfish})});var Lee=b((Nee,Uwt)=>{(function(t,e,r){typeof Nee=="object"?Uwt.exports=Nee=e(pn(),R3(),B0t(),q0t(),fT(),H0t(),pT(),NOe(),see(),G0t(),LOe(),X0t(),ewt(),rwt(),mee(),iwt(),bC(),al(),lwt(),dwt(),pwt(),hwt(),ywt(),_wt(),wwt(),xwt(),Owt(),Pwt(),Awt(),Mwt(),jwt(),Nwt(),Fwt(),Bwt(),qwt()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],e):t.CryptoJS=e(t.CryptoJS)})(Nee,function(t){return t})});var vC,Jwt=O(()=>{vC=class{constructor(e){Object.defineProperty(this,"pageContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.pageContent=e.pageContent!==void 0?e.pageContent.toString():"",this.metadata=e.metadata??{},this.id=e.id}}});var ro=b(NEe=>{"use strict";Object.defineProperty(NEe,"__esModule",{value:!0});NEe.pathToFunc=Hzr;var zzr=Object.prototype.hasOwnProperty;function Hzr(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!zzr.call(o,a))throw new Error(`Parameter '${a}' is required`);let s=o[a];if(typeof s!="string"&&typeof s!="number")throw new Error(`Parameter '${a}' must be a string or number`);return e?.charEncoding==="percent"?encodeURIComponent(`${s}`):`${s}`})}}});var Mte=b(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});dh.SDK_METADATA=dh.ServerList=dh.ServerEu=void 0;dh.serverURLFromOptions=Wzr;var Vzr=ro();dh.ServerEu="eu";dh.ServerList={[dh.ServerEu]:"https://api.mistral.ai"};function Wzr(t){let e=t.serverURL,r={};if(!e){let o=t.server??dh.ServerEu;e=dh.ServerList[o]||""}let n=(0,Vzr.pathToFunc)(e)(r);return new URL(n)}dh.SDK_METADATA={language:"typescript",openapiDocVersion:"0.0.2",sdkVersion:"1.5.0",genVersion:"2.497.0",userAgent:"speakeasy-sdk/typescript 1.5.0 2.497.0 0.0.2 @mistralai/mistralai"}});var FEe=b(LEe=>{"use strict";Object.defineProperty(LEe,"__esModule",{value:!0});LEe.readableStreamToArrayBuffer=Kzr;async function Kzr(t){let e=t.getReader(),r=[],n=0,o=!1;for(;!o;){let{value:s,done:u}=await e.read();u?o=!0:(r.push(s),n+=s.length)}let i=new Uint8Array(n),a=0;for(let s of r)i.set(s,a),a+=s.length;return i.buffer}});var txt=b(Rte=>{"use strict";Object.defineProperty(Rte,"__esModule",{value:!0});Rte.CustomUserAgentHook=void 0;var Jzr=Mte(),kEe=class{beforeRequest(e,r){let o=`mistral-client-typescript/${Jzr.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};Rte.CustomUserAgentHook=kEe});var nxt=b(jte=>{"use strict";Object.defineProperty(jte,"__esModule",{value:!0});jte.DeprecationWarningHook=void 0;var rxt="x-model-deprecation-timestamp",BEe=class{afterSuccess(e,r){return r.headers.has(rxt)&&r.clone().json().then(n=>{let o=n.model;console.warn(`WARNING: The model ${o} is deprecated and will be removed on ${r.headers.get(rxt)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};jte.DeprecationWarningHook=BEe});var oxt=b($Ee=>{"use strict";Object.defineProperty($Ee,"__esModule",{value:!0});$Ee.initHooks=Zzr;var Gzr=txt(),Yzr=nxt();function Zzr(t){let e=new Gzr.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new Yzr.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var ixt=b(Dte=>{"use strict";Object.defineProperty(Dte,"__esModule",{value:!0});Dte.SDKHooks=void 0;var Xzr=oxt(),qEe=class{constructor(){this.sdkInitHooks=[],this.beforeCreateRequestHooks=[],this.beforeRequestHooks=[],this.afterSuccessHooks=[],this.afterErrorHooks=[];let e=[];for(let r of e)"sdkInit"in r&&this.registerSDKInitHook(r),"beforeCreateRequest"in r&&this.registerBeforeCreateRequestHook(r),"beforeRequest"in r&&this.registerBeforeRequestHook(r),"afterSuccess"in r&&this.registerAfterSuccessHook(r),"afterError"in r&&this.registerAfterErrorHook(r);(0,Xzr.initHooks)(this)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((r,n)=>n.sdkInit(r),e)}beforeCreateRequest(e,r){let n=r;for(let o of this.beforeCreateRequestHooks)n=o.beforeCreateRequest(e,n);return n}async beforeRequest(e,r){let n=r;for(let o of this.beforeRequestHooks)n=await o.beforeRequest(e,n);return n}async afterSuccess(e,r){let n=r;for(let o of this.afterSuccessHooks)n=await o.afterSuccess(e,n);return n}async afterError(e,r,n){let o=r,i=n;for(let a of this.afterErrorHooks){let s=await a.afterError(e,o,i);o=s.response,i=s.error}return{response:o,error:i}}};Dte.SDKHooks=qEe});var KEe=b(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});ep.ConnectionError=ep.RequestTimeoutError=ep.RequestAbortedError=ep.InvalidRequestError=ep.UnexpectedClientError=ep.HTTPClientError=void 0;var PT=class extends Error{constructor(e,r){let n=e;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="HTTPClientError",typeof this.cause>"u"&&(this.cause=r?.cause)}};ep.HTTPClientError=PT;var UEe=class extends PT{constructor(){super(...arguments),this.name="UnexpectedClientError"}};ep.UnexpectedClientError=UEe;var zEe=class extends PT{constructor(){super(...arguments),this.name="InvalidRequestError"}};ep.InvalidRequestError=zEe;var HEe=class extends PT{constructor(){super(...arguments),this.name="RequestAbortedError"}};ep.RequestAbortedError=HEe;var VEe=class extends PT{constructor(){super(...arguments),this.name="RequestTimeoutError"}};ep.RequestTimeoutError=VEe;var WEe=class extends PT{constructor(){super(...arguments),this.name="ConnectionError"}};ep.ConnectionError=WEe});var fh=b(gB=>{"use strict";Object.defineProperty(gB,"__esModule",{value:!0});gB.OK=Qzr;gB.ERR=e2r;gB.unwrap=t2r;gB.unwrapAsync=r2r;function Qzr(t){return{ok:!0,value:t}}function e2r(t){return{ok:!1,error:t}}function t2r(t){if(!t.ok)throw t.error;return t.value}async function r2r(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var G3=b(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.getParsedType=_i.ZodParsedType=_i.objectUtil=_i.util=void 0;var JEe;(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(JEe||(_i.util=JEe={}));var axt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(axt||(_i.objectUtil=axt={}));_i.ZodParsedType=JEe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var n2r=t=>{switch(typeof t){case"undefined":return _i.ZodParsedType.undefined;case"string":return _i.ZodParsedType.string;case"number":return isNaN(t)?_i.ZodParsedType.nan:_i.ZodParsedType.number;case"boolean":return _i.ZodParsedType.boolean;case"function":return _i.ZodParsedType.function;case"bigint":return _i.ZodParsedType.bigint;case"symbol":return _i.ZodParsedType.symbol;case"object":return Array.isArray(t)?_i.ZodParsedType.array:t===null?_i.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?_i.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?_i.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?_i.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?_i.ZodParsedType.date:_i.ZodParsedType.object;default:return _i.ZodParsedType.unknown}};_i.getParsedType=n2r});var Nte=b(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0});TT.ZodError=TT.quotelessJson=TT.ZodIssueCode=void 0;var sxt=G3();TT.ZodIssueCode=sxt.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var o2r=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");TT.quotelessJson=o2r;var Y3=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,sxt.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};TT.ZodError=Y3;Y3.create=t=>new Y3(t)});var YEe=b(GEe=>{"use strict";Object.defineProperty(GEe,"__esModule",{value:!0});var P1=G3(),hd=Nte(),i2r=(t,e)=>{let r;switch(t.code){case hd.ZodIssueCode.invalid_type:t.received===P1.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case hd.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,P1.util.jsonStringifyReplacer)}`;break;case hd.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${P1.util.joinValues(t.keys,", ")}`;break;case hd.ZodIssueCode.invalid_union:r="Invalid input";break;case hd.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${P1.util.joinValues(t.options)}`;break;case hd.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${P1.util.joinValues(t.options)}, received '${t.received}'`;break;case hd.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case hd.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case hd.ZodIssueCode.invalid_date:r="Invalid date";break;case hd.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:P1.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case hd.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case hd.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case hd.ZodIssueCode.custom:r="Invalid input";break;case hd.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case hd.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case hd.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,P1.util.assertNever(t)}return{message:r}};GEe.default=i2r});var Lte=b(aS=>{"use strict";var a2r=aS&&aS.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(aS,"__esModule",{value:!0});aS.getErrorMap=aS.setErrorMap=aS.defaultErrorMap=void 0;var uxt=a2r(YEe());aS.defaultErrorMap=uxt.default;var lxt=uxt.default;function s2r(t){lxt=t}aS.setErrorMap=s2r;function u2r(){return lxt}aS.getErrorMap=u2r});var XEe=b(qo=>{"use strict";var l2r=qo&&qo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qo,"__esModule",{value:!0});qo.isAsync=qo.isValid=qo.isDirty=qo.isAborted=qo.OK=qo.DIRTY=qo.INVALID=qo.ParseStatus=qo.addIssueToContext=qo.EMPTY_PATH=qo.makeIssue=void 0;var c2r=Lte(),cxt=l2r(YEe()),d2r=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};qo.makeIssue=d2r;qo.EMPTY_PATH=[];function f2r(t,e){let r=(0,c2r.getErrorMap)(),n=(0,qo.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===cxt.default?void 0:cxt.default].filter(o=>!!o)});t.common.issues.push(n)}qo.addIssueToContext=f2r;var ZEe=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return qo.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return qo.INVALID;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}};qo.ParseStatus=ZEe;qo.INVALID=Object.freeze({status:"aborted"});var p2r=t=>({status:"dirty",value:t});qo.DIRTY=p2r;var m2r=t=>({status:"valid",value:t});qo.OK=m2r;var h2r=t=>t.status==="aborted";qo.isAborted=h2r;var g2r=t=>t.status==="dirty";qo.isDirty=g2r;var y2r=t=>t.status==="valid";qo.isValid=y2r;var b2r=t=>typeof Promise<"u"&&t instanceof Promise;qo.isAsync=b2r});var fxt=b(dxt=>{"use strict";Object.defineProperty(dxt,"__esModule",{value:!0})});var mxt=b(Fte=>{"use strict";Object.defineProperty(Fte,"__esModule",{value:!0});Fte.errorUtil=void 0;var pxt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(pxt||(Fte.errorUtil=pxt={}))});var Pxt=b(G=>{"use strict";var Bte=G&&G.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},yxt=G&&G.__classPrivateFieldSet||function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},Z3,X3;Object.defineProperty(G,"__esModule",{value:!0});G.boolean=G.bigint=G.array=G.any=G.coerce=G.ZodFirstPartyTypeKind=G.late=G.ZodSchema=G.Schema=G.custom=G.ZodReadonly=G.ZodPipeline=G.ZodBranded=G.BRAND=G.ZodNaN=G.ZodCatch=G.ZodDefault=G.ZodNullable=G.ZodOptional=G.ZodTransformer=G.ZodEffects=G.ZodPromise=G.ZodNativeEnum=G.ZodEnum=G.ZodLiteral=G.ZodLazy=G.ZodFunction=G.ZodSet=G.ZodMap=G.ZodRecord=G.ZodTuple=G.ZodIntersection=G.ZodDiscriminatedUnion=G.ZodUnion=G.ZodObject=G.ZodArray=G.ZodVoid=G.ZodNever=G.ZodUnknown=G.ZodAny=G.ZodNull=G.ZodUndefined=G.ZodSymbol=G.ZodDate=G.ZodBoolean=G.ZodBigInt=G.ZodNumber=G.ZodString=G.datetimeRegex=G.ZodType=void 0;G.NEVER=G.void=G.unknown=G.union=G.undefined=G.tuple=G.transformer=G.symbol=G.string=G.strictObject=G.set=G.record=G.promise=G.preprocess=G.pipeline=G.ostring=G.optional=G.onumber=G.oboolean=G.object=G.number=G.nullable=G.null=G.never=G.nativeEnum=G.nan=G.map=G.literal=G.lazy=G.intersection=G.instanceof=G.function=G.enum=G.effect=G.discriminatedUnion=G.date=void 0;var kte=Lte(),It=mxt(),ee=XEe(),Ge=G3(),Be=Nte(),mh=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},hxt=(t,e)=>{if((0,ee.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Be.ZodError(t.common.issues);return this._error=r,this._error}}};function Mr(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{var u,l;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}},description:o}}var Rr=class{get description(){return this._def.description}_getType(e){return(0,Ge.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,Ge.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ee.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,Ge.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,ee.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,Ge.getParsedType)(e)},i=this._parseSync({data:e,path:o.path,parent:o});return hxt(o,i)}"~validate"(e){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,Ge.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return(0,ee.isValid)(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>(0,ee.isValid)(i)?{value:i.value}:{issues:o.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,Ge.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,ee.isAsync)(o)?o:Promise.resolve(o));return hxt(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:Be.ZodIssueCode.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Qp({schema:this,typeName:Xt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ph.create(this,this._def)}nullable(){return uS.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return PC.create(this)}promise(){return MT.create(this,this._def)}or(e){return D1.create([this,e],this._def)}and(e){return N1.create(this,e,this._def)}transform(e){return new Qp({...Mr(this._def),schema:this,typeName:Xt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new $1({...Mr(this._def),innerType:this,defaultValue:r,typeName:Xt.ZodDefault})}brand(){return new Q3({typeName:Xt.ZodBranded,type:this,...Mr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new q1({...Mr(this._def),innerType:this,catchValue:r,typeName:Xt.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return eH.create(this,e)}readonly(){return U1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};G.ZodType=Rr;G.Schema=Rr;G.ZodSchema=Rr;var _2r=/^c[^\s-]{8,}$/i,v2r=/^[0-9a-z]+$/,w2r=/^[0-9A-HJKMNP-TV-Z]{26}$/i,S2r=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,x2r=/^[a-z0-9_-]{21}$/i,C2r=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,O2r=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,E2r=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,P2r="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",QEe,T2r=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,A2r=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,I2r=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,M2r=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,R2r=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,j2r=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bxt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",D2r=new RegExp(`^${bxt}$`);function _xt(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function N2r(t){return new RegExp(`^${_xt(t)}$`)}function vxt(t){let e=`${bxt}T${_xt(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}G.datetimeRegex=vxt;function L2r(t,e){return!!((e==="v4"||!e)&&T2r.test(t)||(e==="v6"||!e)&&I2r.test(t))}function F2r(t,e){if(!C2r.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function k2r(t,e){return!!((e==="v4"||!e)&&A2r.test(t)||(e==="v6"||!e)&&M2r.test(t))}var AT=class t extends Rr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ge.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(i,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.string,received:i.parsedType}),ee.INVALID}let n=new ee.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")E2r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"email",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")QEe||(QEe=new RegExp(P2r,"u")),QEe.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"emoji",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")S2r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"uuid",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")x2r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"nanoid",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")_2r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"cuid",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")v2r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"cuid2",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")w2r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"ulid",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"url",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"regex",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?vxt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?D2r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?N2r(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?O2r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"duration",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?L2r(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"ip",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?F2r(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"jwt",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?k2r(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"cidr",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?R2r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"base64",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?j2r.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{validation:"base64url",code:Be.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):Ge.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Be.ZodIssueCode.invalid_string,...It.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...It.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...It.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...It.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...It.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...It.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...It.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...It.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...It.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...It.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...It.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...It.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...It.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...It.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...It.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...It.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...It.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...It.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...It.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...It.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...It.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...It.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...It.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...It.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,It.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};G.ZodString=AT;AT.create=t=>{var e;return new AT({checks:[],typeName:Xt.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Mr(t)})};function B2r(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(t.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}var T1=class t extends Rr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ge.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(i,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.number,received:i.parsedType}),ee.INVALID}let n,o=new ee.ParseStatus;for(let i of this._def.checks)i.kind==="int"?Ge.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?B2r(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.not_finite,message:i.message}),o.dirty()):Ge.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,It.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,It.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,It.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,It.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:It.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:It.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:It.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:It.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:It.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:It.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:It.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:It.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:It.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:It.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ge.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};G.ZodNumber=T1;T1.create=t=>new T1({checks:[],typeName:Xt.ZodNumber,coerce:t?.coerce||!1,...Mr(t)});var A1=class t extends Rr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ge.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new ee.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ge.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.bigint,received:r.parsedType}),ee.INVALID}gte(e,r){return this.setLimit("min",e,!0,It.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,It.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,It.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,It.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:It.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:It.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:It.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:It.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:It.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:It.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};G.ZodBigInt=A1;A1.create=t=>{var e;return new A1({checks:[],typeName:Xt.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Mr(t)})};var I1=class extends Rr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ge.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.boolean,received:n.parsedType}),ee.INVALID}return(0,ee.OK)(e.data)}};G.ZodBoolean=I1;I1.create=t=>new I1({typeName:Xt.ZodBoolean,coerce:t?.coerce||!1,...Mr(t)});var M1=class t extends Rr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ge.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(i,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.date,received:i.parsedType}),ee.INVALID}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(i,{code:Be.ZodIssueCode.invalid_date}),ee.INVALID}let n=new ee.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ge.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:It.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:It.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};G.ZodDate=M1;M1.create=t=>new M1({checks:[],coerce:t?.coerce||!1,typeName:Xt.ZodDate,...Mr(t)});var bB=class extends Rr{_parse(e){if(this._getType(e)!==Ge.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.symbol,received:n.parsedType}),ee.INVALID}return(0,ee.OK)(e.data)}};G.ZodSymbol=bB;bB.create=t=>new bB({typeName:Xt.ZodSymbol,...Mr(t)});var R1=class extends Rr{_parse(e){if(this._getType(e)!==Ge.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.undefined,received:n.parsedType}),ee.INVALID}return(0,ee.OK)(e.data)}};G.ZodUndefined=R1;R1.create=t=>new R1({typeName:Xt.ZodUndefined,...Mr(t)});var j1=class extends Rr{_parse(e){if(this._getType(e)!==Ge.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.null,received:n.parsedType}),ee.INVALID}return(0,ee.OK)(e.data)}};G.ZodNull=j1;j1.create=t=>new j1({typeName:Xt.ZodNull,...Mr(t)});var IT=class extends Rr{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,ee.OK)(e.data)}};G.ZodAny=IT;IT.create=t=>new IT({typeName:Xt.ZodAny,...Mr(t)});var EC=class extends Rr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,ee.OK)(e.data)}};G.ZodUnknown=EC;EC.create=t=>new EC({typeName:Xt.ZodUnknown,...Mr(t)});var Hg=class extends Rr{_parse(e){let r=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.never,received:r.parsedType}),ee.INVALID}};G.ZodNever=Hg;Hg.create=t=>new Hg({typeName:Xt.ZodNever,...Mr(t)});var _B=class extends Rr{_parse(e){if(this._getType(e)!==Ge.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.void,received:n.parsedType}),ee.INVALID}return(0,ee.OK)(e.data)}};G.ZodVoid=_B;_B.create=t=>new _B({typeName:Xt.ZodVoid,...Mr(t)});var PC=class t extends Rr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==Ge.ZodParsedType.array)return(0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.array,received:r.parsedType}),ee.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,ee.addIssueToContext)(r,{code:a?Be.ZodIssueCode.too_big:Be.ZodIssueCode.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new mh(r,a,r.path,s)))).then(a=>ee.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new mh(r,a,r.path,s)));return ee.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:It.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:It.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:It.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};G.ZodArray=PC;PC.create=(t,e)=>new PC({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Xt.ZodArray,...Mr(e)});function yB(t){if(t instanceof tp){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ph.create(yB(n))}return new tp({...t._def,shape:()=>e})}else return t instanceof PC?new PC({...t._def,type:yB(t.element)}):t instanceof ph?ph.create(yB(t.unwrap())):t instanceof uS?uS.create(yB(t.unwrap())):t instanceof sS?sS.create(t.items.map(e=>yB(e))):t}var tp=class t extends Rr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Ge.util.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Ge.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(l,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.object,received:l.parsedType}),ee.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Hg&&this._def.unknownKeys==="strip"))for(let l in o.data)a.includes(l)||s.push(l);let u=[];for(let l of a){let c=i[l],d=o.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new mh(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Hg){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of s)u.push({key:{status:"valid",value:c},value:{status:"valid",value:o.data[c]}});else if(l==="strict")s.length>0&&((0,ee.addIssueToContext)(o,{code:Be.ZodIssueCode.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let c of s){let d=o.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new mh(o,d,o.path,c)),alwaysSet:c in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let c of u){let d=await c.key,f=await c.value;l.push({key:d,value:f,alwaysSet:c.alwaysSet})}return l}).then(l=>ee.ParseStatus.mergeObjectSync(n,l)):ee.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return It.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=It.errorUtil.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Xt.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Ge.util.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Ge.util.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return yB(this)}partial(e){let r={};return Ge.util.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return Ge.util.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ph;)i=i._def.innerType;r[n]=i}}),new t({...this._def,shape:()=>r})}keyof(){return wxt(Ge.util.objectKeys(this.shape))}};G.ZodObject=tp;tp.create=(t,e)=>new tp({shape:()=>t,unknownKeys:"strip",catchall:Hg.create(),typeName:Xt.ZodObject,...Mr(e)});tp.strictCreate=(t,e)=>new tp({shape:()=>t,unknownKeys:"strict",catchall:Hg.create(),typeName:Xt.ZodObject,...Mr(e)});tp.lazycreate=(t,e)=>new tp({shape:t,unknownKeys:"strip",catchall:Hg.create(),typeName:Xt.ZodObject,...Mr(e)});var D1=class extends Rr{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Be.ZodError(s.ctx.common.issues));return(0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.invalid_union,unionErrors:a}),ee.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},c=u._parseSync({data:r.data,path:r.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new Be.ZodError(u));return(0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.invalid_union,unionErrors:s}),ee.INVALID}}get options(){return this._def.options}};G.ZodUnion=D1;D1.create=(t,e)=>new D1({options:t,typeName:Xt.ZodUnion,...Mr(e)});var OC=t=>t instanceof L1?OC(t.schema):t instanceof Qp?OC(t.innerType()):t instanceof F1?[t.value]:t instanceof k1?t.options:t instanceof B1?Ge.util.objectValues(t.enum):t instanceof $1?OC(t._def.innerType):t instanceof R1?[void 0]:t instanceof j1?[null]:t instanceof ph?[void 0,...OC(t.unwrap())]:t instanceof uS?[null,...OC(t.unwrap())]:t instanceof Q3||t instanceof U1?OC(t.unwrap()):t instanceof q1?OC(t._def.innerType):[],$te=class t extends Rr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ge.ZodParsedType.object)return(0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.object,received:r.parsedType}),ee.INVALID;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ee.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=OC(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:Xt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Mr(n)})}};G.ZodDiscriminatedUnion=$te;function ePe(t,e){let r=(0,Ge.getParsedType)(t),n=(0,Ge.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===Ge.ZodParsedType.object&&n===Ge.ZodParsedType.object){let o=Ge.util.objectKeys(e),i=Ge.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=ePe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===Ge.ZodParsedType.array&&n===Ge.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],u=ePe(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===Ge.ZodParsedType.date&&n===Ge.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var N1=class extends Rr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,ee.isAborted)(i)||(0,ee.isAborted)(a))return ee.INVALID;let s=ePe(i.value,a.value);return s.valid?(((0,ee.isDirty)(i)||(0,ee.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_intersection_types}),ee.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};G.ZodIntersection=N1;N1.create=(t,e,r)=>new N1({left:t,right:e,typeName:Xt.ZodIntersection,...Mr(r)});var sS=class t extends Rr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.ZodParsedType.array)return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.array,received:n.parsedType}),ee.INVALID;if(n.data.length<this._def.items.length)return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ee.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new mh(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>ee.ParseStatus.mergeArray(r,a)):ee.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};G.ZodTuple=sS;sS.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new sS({items:t,typeName:Xt.ZodTuple,rest:null,...Mr(e)})};var qte=class t extends Rr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.ZodParsedType.object)return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.object,received:n.parsedType}),ee.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new mh(n,s,n.path,s)),value:a._parse(new mh(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?ee.ParseStatus.mergeObjectAsync(r,o):ee.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Rr?new t({keyType:e,valueType:r,typeName:Xt.ZodRecord,...Mr(n)}):new t({keyType:AT.create(),valueType:e,typeName:Xt.ZodRecord,...Mr(r)})}};G.ZodRecord=qte;var vB=class extends Rr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.ZodParsedType.map)return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.map,received:n.parsedType}),ee.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new mh(n,s,n.path,[l,"key"])),value:i._parse(new mh(n,u,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,c=await u.value;if(l.status==="aborted"||c.status==="aborted")return ee.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let u of a){let l=u.key,c=u.value;if(l.status==="aborted"||c.status==="aborted")return ee.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};G.ZodMap=vB;vB.create=(t,e,r)=>new vB({valueType:e,keyType:t,typeName:Xt.ZodMap,...Mr(r)});var wB=class t extends Rr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.ZodParsedType.set)return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.set,received:n.parsedType}),ee.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let l=new Set;for(let c of u){if(c.status==="aborted")return ee.INVALID;c.status==="dirty"&&r.dirty(),l.add(c.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((u,l)=>i._parse(new mh(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:It.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:It.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};G.ZodSet=wB;wB.create=(t,e)=>new wB({valueType:t,minSize:null,maxSize:null,typeName:Xt.ZodSet,...Mr(e)});var Ute=class t extends Rr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ge.ZodParsedType.function)return(0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.function,received:r.parsedType}),ee.INVALID;function n(s,u){return(0,ee.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,kte.getErrorMap)(),kte.defaultErrorMap].filter(l=>!!l),issueData:{code:Be.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,ee.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,kte.getErrorMap)(),kte.defaultErrorMap].filter(l=>!!l),issueData:{code:Be.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof MT){let s=this;return(0,ee.OK)(async function(...u){let l=new Be.ZodError([]),c=await s._def.args.parseAsync(u,i).catch(p=>{throw l.addIssue(n(u,p)),l}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw l.addIssue(o(d,p)),l})})}else{let s=this;return(0,ee.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new Be.ZodError([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new Be.ZodError([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:sS.create(e).rest(EC.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||sS.create([]).rest(EC.create()),returns:r||EC.create(),typeName:Xt.ZodFunction,...Mr(n)})}};G.ZodFunction=Ute;var L1=class extends Rr{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};G.ZodLazy=L1;L1.create=(t,e)=>new L1({getter:t,typeName:Xt.ZodLazy,...Mr(e)});var F1=class extends Rr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(r,{received:r.data,code:Be.ZodIssueCode.invalid_literal,expected:this._def.value}),ee.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};G.ZodLiteral=F1;F1.create=(t,e)=>new F1({value:t,typeName:Xt.ZodLiteral,...Mr(e)});function wxt(t,e){return new k1({values:t,typeName:Xt.ZodEnum,...Mr(e)})}var k1=class t extends Rr{constructor(){super(...arguments),Z3.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ee.addIssueToContext)(r,{expected:Ge.util.joinValues(n),received:r.parsedType,code:Be.ZodIssueCode.invalid_type}),ee.INVALID}if(Bte(this,Z3,"f")||yxt(this,Z3,new Set(this._def.values),"f"),!Bte(this,Z3,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ee.addIssueToContext)(r,{received:r.data,code:Be.ZodIssueCode.invalid_enum_value,options:n}),ee.INVALID}return(0,ee.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};G.ZodEnum=k1;Z3=new WeakMap;k1.create=wxt;var B1=class extends Rr{constructor(){super(...arguments),X3.set(this,void 0)}_parse(e){let r=Ge.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Ge.ZodParsedType.string&&n.parsedType!==Ge.ZodParsedType.number){let o=Ge.util.objectValues(r);return(0,ee.addIssueToContext)(n,{expected:Ge.util.joinValues(o),received:n.parsedType,code:Be.ZodIssueCode.invalid_type}),ee.INVALID}if(Bte(this,X3,"f")||yxt(this,X3,new Set(Ge.util.getValidEnumValues(this._def.values)),"f"),!Bte(this,X3,"f").has(e.data)){let o=Ge.util.objectValues(r);return(0,ee.addIssueToContext)(n,{received:n.data,code:Be.ZodIssueCode.invalid_enum_value,options:o}),ee.INVALID}return(0,ee.OK)(e.data)}get enum(){return this._def.values}};G.ZodNativeEnum=B1;X3=new WeakMap;B1.create=(t,e)=>new B1({values:t,typeName:Xt.ZodNativeEnum,...Mr(e)});var MT=class extends Rr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ge.ZodParsedType.promise&&r.common.async===!1)return(0,ee.addIssueToContext)(r,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.promise,received:r.parsedType}),ee.INVALID;let n=r.parsedType===Ge.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,ee.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};G.ZodPromise=MT;MT.create=(t,e)=>new MT({type:t,typeName:Xt.ZodPromise,...Mr(e)});var Qp=class extends Rr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Xt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{(0,ee.addIssueToContext)(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return ee.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?ee.INVALID:u.status==="dirty"||r.value==="dirty"?(0,ee.DIRTY)(u.value):u});{if(r.value==="aborted")return ee.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?ee.INVALID:s.status==="dirty"||r.value==="dirty"?(0,ee.DIRTY)(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ee.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?ee.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,ee.isValid)(a))return a;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,ee.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);Ge.util.assertNever(o)}};G.ZodEffects=Qp;G.ZodTransformer=Qp;Qp.create=(t,e,r)=>new Qp({schema:t,typeName:Xt.ZodEffects,effect:e,...Mr(r)});Qp.createWithPreprocess=(t,e,r)=>new Qp({schema:e,effect:{type:"preprocess",transform:t},typeName:Xt.ZodEffects,...Mr(r)});var ph=class extends Rr{_parse(e){return this._getType(e)===Ge.ZodParsedType.undefined?(0,ee.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};G.ZodOptional=ph;ph.create=(t,e)=>new ph({innerType:t,typeName:Xt.ZodOptional,...Mr(e)});var uS=class extends Rr{_parse(e){return this._getType(e)===Ge.ZodParsedType.null?(0,ee.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};G.ZodNullable=uS;uS.create=(t,e)=>new uS({innerType:t,typeName:Xt.ZodNullable,...Mr(e)});var $1=class extends Rr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Ge.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};G.ZodDefault=$1;$1.create=(t,e)=>new $1({innerType:t,typeName:Xt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Mr(e)});var q1=class extends Rr{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,ee.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Be.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Be.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};G.ZodCatch=q1;q1.create=(t,e)=>new q1({innerType:t,typeName:Xt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Mr(e)});var SB=class extends Rr{_parse(e){if(this._getType(e)!==Ge.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,ee.addIssueToContext)(n,{code:Be.ZodIssueCode.invalid_type,expected:Ge.ZodParsedType.nan,received:n.parsedType}),ee.INVALID}return{status:"valid",value:e.data}}};G.ZodNaN=SB;SB.create=t=>new SB({typeName:Xt.ZodNaN,...Mr(t)});G.BRAND=Symbol("zod_brand");var Q3=class extends Rr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};G.ZodBranded=Q3;var eH=class t extends Rr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ee.INVALID:i.status==="dirty"?(r.dirty(),(0,ee.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ee.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Xt.ZodPipeline})}};G.ZodPipeline=eH;var U1=class extends Rr{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,ee.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,ee.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};G.ZodReadonly=U1;U1.create=(t,e)=>new U1({innerType:t,typeName:Xt.ZodReadonly,...Mr(e)});function gxt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Sxt(t,e={},r){return t?IT.create().superRefine((n,o)=>{var i,a;let s=t(n);if(s instanceof Promise)return s.then(u=>{var l,c;if(!u){let d=gxt(e,n),f=(c=(l=d.fatal)!==null&&l!==void 0?l:r)!==null&&c!==void 0?c:!0;o.addIssue({code:"custom",...d,fatal:f})}});if(!s){let u=gxt(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0;o.addIssue({code:"custom",...u,fatal:l})}}):IT.create()}G.custom=Sxt;G.late={object:tp.lazycreate};var Xt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Xt||(G.ZodFirstPartyTypeKind=Xt={}));var $2r=(t,e={message:`Input not instance of ${t.name}`})=>Sxt(r=>r instanceof t,e);G.instanceof=$2r;var xxt=AT.create;G.string=xxt;var Cxt=T1.create;G.number=Cxt;var q2r=SB.create;G.nan=q2r;var U2r=A1.create;G.bigint=U2r;var Oxt=I1.create;G.boolean=Oxt;var z2r=M1.create;G.date=z2r;var H2r=bB.create;G.symbol=H2r;var V2r=R1.create;G.undefined=V2r;var W2r=j1.create;G.null=W2r;var K2r=IT.create;G.any=K2r;var J2r=EC.create;G.unknown=J2r;var G2r=Hg.create;G.never=G2r;var Y2r=_B.create;G.void=Y2r;var Z2r=PC.create;G.array=Z2r;var X2r=tp.create;G.object=X2r;var Q2r=tp.strictCreate;G.strictObject=Q2r;var e4r=D1.create;G.union=e4r;var t4r=$te.create;G.discriminatedUnion=t4r;var r4r=N1.create;G.intersection=r4r;var n4r=sS.create;G.tuple=n4r;var o4r=qte.create;G.record=o4r;var i4r=vB.create;G.map=i4r;var a4r=wB.create;G.set=a4r;var s4r=Ute.create;G.function=s4r;var u4r=L1.create;G.lazy=u4r;var l4r=F1.create;G.literal=l4r;var c4r=k1.create;G.enum=c4r;var d4r=B1.create;G.nativeEnum=d4r;var f4r=MT.create;G.promise=f4r;var Ext=Qp.create;G.effect=Ext;G.transformer=Ext;var p4r=ph.create;G.optional=p4r;var m4r=uS.create;G.nullable=m4r;var h4r=Qp.createWithPreprocess;G.preprocess=h4r;var g4r=eH.create;G.pipeline=g4r;var y4r=()=>xxt().optional();G.ostring=y4r;var b4r=()=>Cxt().optional();G.onumber=b4r;var _4r=()=>Oxt().optional();G.oboolean=_4r;G.coerce={string:t=>AT.create({...t,coerce:!0}),number:t=>T1.create({...t,coerce:!0}),boolean:t=>I1.create({...t,coerce:!0}),bigint:t=>A1.create({...t,coerce:!0}),date:t=>M1.create({...t,coerce:!0})};G.NEVER=ee.INVALID});var tPe=b(hh=>{"use strict";var v4r=hh&&hh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xB=hh&&hh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&v4r(e,t,r)};Object.defineProperty(hh,"__esModule",{value:!0});xB(Lte(),hh);xB(XEe(),hh);xB(fxt(),hh);xB(G3(),hh);xB(Pxt(),hh);xB(Nte(),hh)});var ye=b(rp=>{"use strict";var Txt=rp&&rp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w4r=rp&&rp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S4r=rp&&rp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Txt(e,t,r);return w4r(e,t),e},x4r=rp&&rp.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Txt(e,t,r)};Object.defineProperty(rp,"__esModule",{value:!0});rp.z=void 0;var Axt=S4r(tPe());rp.z=Axt;x4r(tPe(),rp);rp.default=Axt});var oPe=b(Dl=>{"use strict";var C4r=Dl&&Dl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O4r=Dl&&Dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E4r=Dl&&Dl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C4r(e,t,r);return O4r(e,t),e};Object.defineProperty(Dl,"__esModule",{value:!0});Dl.zodInbound=Dl.zodOutbound=void 0;Dl.bytesToBase64=Ixt;Dl.bytesFromBase64=rPe;Dl.stringToBytes=nPe;Dl.stringFromBytes=Mxt;Dl.stringToBase64=P4r;Dl.stringFromBase64=T4r;var zte=E4r(ye());function Ixt(t){return btoa(String.fromCodePoint(...t))}function rPe(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function nPe(t){return new TextEncoder().encode(t)}function Mxt(t){return new TextDecoder().decode(t)}function P4r(t){return Ixt(nPe(t))}function T4r(t){return Mxt(rPe(t))}Dl.zodOutbound=zte.instanceof(Uint8Array).or(zte.string().transform(nPe));Dl.zodInbound=zte.instanceof(Uint8Array).or(zte.string().transform(rPe))});var aPe=b(iPe=>{"use strict";Object.defineProperty(iPe,"__esModule",{value:!0});iPe.isPlainObject=A4r;function A4r(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}});var jo=b(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.encodeDeepObjectQuery=Nn.encodePipeDelimitedQuery=Nn.encodeSpaceDelimitedQuery=Nn.encodeFormQuery=Nn.encodeJSONQuery=Nn.encodeSimple=Nn.encodePipeDelimited=Nn.encodeSpaceDelimited=Nn.encodeForm=Nn.EncodingError=void 0;Nn.encodeMatrix=I4r;Nn.encodeLabel=M4r;Nn.encodeBodyForm=R4r;Nn.encodeDeepObject=jxt;Nn.encodeDeepObjectObject=uPe;Nn.encodeJSON=Dxt;Nn.queryJoin=Nxt;Nn.queryEncoder=OB;Nn.appendForm=D4r;var Rxt=oPe(),Vg=aPe(),tH=class extends Error{constructor(e){super(e),this.name="EncodingError"}};Nn.EncodingError=tH;function I4r(t,e,r){let n="",o=r?.explode?rH(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CB(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=nH(u,f=>`${a(f)}`)?.join(","):(0,Vg.isPlainObject)(u)?c=Vte(Object.entries(u),([p,m])=>`,${i(p)},${a(m)}`)?.join("").slice(1):c=`${a(u)}`,c==null))return;let d=i(s);l=`${d}=${c}`,l===`${d}=`&&(l=l.slice(0,-1)),l&&(n+=`;${l}`)}),n}function M4r(t,e,r){let n="",o=r?.explode?rH(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CB(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=nH(u,c=>`${a(c)}`)?.join("."):(0,Vg.isPlainObject)(u)?l=Vte(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,Vg.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function sPe(t){return(e,r,n)=>{let o="",i=n?.explode?rH(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(CB(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=nH(c,p=>`${s(p)}`)?.join(u):(0,Vg.isPlainObject)(c)?f=Vte(Object.entries(c),([p,m])=>`${a(p)}${u}${s(m)}`)?.join(u):f=`${s(c)}`,f!=null&&(d=`${a(l)}=${f}`,!(!d||d==="=")&&(o+=`&${d}`)))}),o.slice(1)}}Nn.encodeForm=sPe(",");Nn.encodeSpaceDelimited=sPe(" ");Nn.encodePipeDelimited=sPe("|");function R4r(t,e,r){let n="",o=r?.explode?rH(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CB(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,Vg.isPlainObject)(u)?c=JSON.stringify(u,Hte):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function jxt(t,e,r){if(e!=null){if(!(0,Vg.isPlainObject)(e))throw new tH(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return uPe(t,e,r)}}function uPe(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,Vg.isPlainObject)(e))throw new tH(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,Vg.isPlainObject)(a)){let c=uPe(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=nH(u,c=>`${o(s)}=${o(CB(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function Dxt(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,Hte));return r?.explode?o:`${n(t)}=${o}`}var j4r=(t,e,r)=>{let n="",o=r?.explode?rH(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CB(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=nH(u,c=>`${a(c)}`)?.join(","):(0,Vg.isPlainObject)(u)?l=Vte(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,Vg.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};Nn.encodeSimple=j4r;function rH(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,Vg.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function CB(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,Rxt.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,Hte):`${t}`}function Hte(t,e){return e instanceof Uint8Array?(0,Rxt.bytesToBase64)(e):e}function nH(t,e){let r=t.reduce((n,o)=>{if(o==null)return n;let i=e(o);return i==null||n.push(i),n},[]);return r.length?r:null}function Vte(t,e){let r=[];for(let[n,o]of t){if(o==null)continue;let i=e([n,o]);i!=null&&r.push(i)}return r.length?r:null}function Nxt(...t){return t.filter(Boolean).join("&")}function OB(t){return function(r,n){let o={...n,explode:n?.explode??!0,charEncoding:n?.charEncoding??"percent"},i=Object.entries(r).map(([a,s])=>t(a,s,o));return Nxt(...i)}}Nn.encodeJSONQuery=OB(Dxt);Nn.encodeFormQuery=OB(Nn.encodeForm);Nn.encodeSpaceDelimitedQuery=OB(Nn.encodeSpaceDelimited);Nn.encodePipeDelimitedQuery=OB(Nn.encodePipeDelimited);Nn.encodeDeepObjectQuery=OB(jxt);function D4r(t,e,r,n){r!=null&&(r instanceof Blob&&n?t.append(e,r,n):r instanceof Blob?t.append(e,r):t.append(e,String(r)))}});var Lxt=b(lPe=>{"use strict";Object.defineProperty(lPe,"__esModule",{value:!0});lPe.dlv=N4r;function N4r(t,e,r,n,o){for(e=Array.isArray(e)?e:e.split("."),n=0;n<e.length;n++){let i=e[n];t=i!=null&&t?t[i]:o}return t===o?r:t}});var dPe=b(em=>{"use strict";var L4r=em&&em.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F4r=em&&em.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k4r=em&&em.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L4r(e,t,r);return F4r(e,t),e};Object.defineProperty(em,"__esModule",{value:!0});em.envSchema=void 0;em.env=B4r;em.resetEnv=$4r;var Fxt=Lxt(),cPe=k4r(ye());em.envSchema=cPe.object({MISTRAL_API_KEY:cPe.string().optional(),MISTRAL_DEBUG:cPe.coerce.boolean().optional()});var oH;function B4r(){return oH||(oH=em.envSchema.parse((0,Fxt.dlv)(globalThis,"process.env")??(0,Fxt.dlv)(globalThis,"Deno.env")??{}),oH)}function $4r(){oH=void 0}});var iH=b(lS=>{"use strict";Object.defineProperty(lS,"__esModule",{value:!0});lS.HTTPClient=void 0;lS.matchContentType=Bxt;lS.matchStatusCode=$xt;lS.matchResponse=z4r;lS.isConnectionError=H4r;lS.isTimeoutError=V4r;lS.isAbortError=W4r;var q4r=(t,e)=>e==null?fetch(t):fetch(t,e),fPe=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||q4r}async request(e){let r=e;for(let n of this.requestHooks){let o=await n(r);o&&(r=o)}try{let n=await this.fetcher(r);for(let o of this.responseHooks)await o(n,r);return n}catch(n){for(let o of this.requestErrorHooks)await o(n,r);throw n}}addHook(...e){if(e[0]==="beforeRequest")this.requestHooks.push(e[1]);else if(e[0]==="requestError")this.requestErrorHooks.push(e[1]);else if(e[0]==="response")this.responseHooks.push(e[1]);else throw new Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let r;if(e[0]==="beforeRequest")r=this.requestHooks;else if(e[0]==="requestError")r=this.requestErrorHooks;else if(e[0]==="response")r=this.responseHooks;else throw new Error(`Invalid hook type: ${e[0]}`);let n=r.findIndex(o=>o===e[1]);return n>=0&&r.splice(n,1),this}clone(){let e=new t(this.options);return e.requestHooks=this.requestHooks.slice(),e.requestErrorHooks=this.requestErrorHooks.slice(),e.responseHooks=this.responseHooks.slice(),e}};lS.HTTPClient=fPe;var kxt=/\s*;\s*/g;function Bxt(t,e){if(e==="*")return!0;let r=t.headers.get("content-type")?.trim()||"application/octet-stream";r=r.toLowerCase();let n=e.toLowerCase().trim().split(kxt),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(kxt),[s="",...u]=a,[l="",c=""]=s.split("/");if(!l||!c||o!=="*/*"&&s!==o&&`${l}/*`!==o&&`*/${c}`!==o||u.length<i.length)return!1;let d=new Set(u);for(let f of i)if(!d.has(f))return!1;return!0}var U4r=new RegExp("^[0-9]xx$","i");function $xt(t,e){let r=`${t.status}`,n=Array.isArray(e)?e:[e];return n.length?n.some(o=>{let i=`${o}`;if(i==="default")return!0;if(!U4r.test(`${i}`))return i===r;let a=i.charAt(0);if(!a)throw new Error("Invalid status code range");let s=r.charAt(0);if(!s)throw new Error(`Invalid response status code: ${r}`);return s===a}):!1}function z4r(t,e,r){return $xt(t,e)&&Bxt(t,r)}function H4r(t){if(typeof t!="object"||t==null)return!1;let e=t instanceof TypeError&&t.message.toLowerCase().startsWith("failed to fetch"),r=t instanceof TypeError&&t.message.toLowerCase().startsWith("fetch failed"),n="name"in t&&t.name==="ConnectionError",o="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnreset";return e||r||o||n}function V4r(t){if(typeof t!="object"||t==null)return!1;let e="name"in t&&t.name==="TimeoutError",r="code"in t&&t.code===23,n="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnaborted";return e||r||n}function W4r(t){if(typeof t!="object"||t==null)return!1;let e="name"in t&&t.name==="AbortError",r="code"in t&&t.code===20,n="code"in t&&typeof t.code=="string"&&t.code.toLowerCase()==="econnaborted";return e||r||n}});var Uxt=b(H1=>{"use strict";Object.defineProperty(H1,"__esModule",{value:!0});H1.TemporaryError=H1.PermanentError=void 0;H1.retry=J4r;var qxt=iH(),K4r={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},aH=class t extends Error{constructor(e,r){let n=e;r?.cause&&(n+=`: ${r.cause}`),super(n,r),this.name="PermanentError",typeof this.cause>"u"&&(this.cause=r?.cause),Object.setPrototypeOf(this,t.prototype)}};H1.PermanentError=aH;var z1=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};H1.TemporaryError=z1;async function J4r(t,e){switch(e.config.strategy){case"backoff":return X4r(G4r(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??K4r);default:return await t()}}function G4r(t,e){return async()=>{try{let r=await t();if(Z4r(r,e.statusCodes))throw new z1("Response failed with retryable status code",r);return r}catch(r){throw r instanceof z1||e.retryConnectionErrors&&((0,qxt.isTimeoutError)(r)||(0,qxt.isConnectionError)(r))?r:new aH("Permanent error",{cause:r})}}}var Y4r=new RegExp("^[0-9]xx$","i");function Z4r(t,e){let r=`${t.status}`;return e.some(n=>{if(!Y4r.test(n))return n===r;let o=n.charAt(0);if(!o)throw new Error("Invalid status code range");let i=r.charAt(0);if(!i)throw new Error(`Invalid response status code: ${r}`);return i===o})}async function X4r(t,e){let{maxElapsedTime:r,initialInterval:n,exponent:o,maxInterval:i}=e,a=Date.now(),s=0;for(;;)try{return await t()}catch(u){if(u instanceof aH)throw u.cause;if(Date.now()-a>r){if(u instanceof z1)return u.response;throw u}let c=0;u instanceof z1&&(c=Q4r(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await e3r(d),s++}}function Q4r(t){let e=t.headers.get("retry-after")||"";if(!e)return 0;let r=Number(e);if(Number.isInteger(r))return r*1e3;let n=Date.parse(e);if(Number.isInteger(n)){let o=n-Date.now();return o>0?Math.ceil(o):0}return 0}async function e3r(t){return new Promise(e=>setTimeout(e,t))}});var tm=b(jT=>{"use strict";var sH=jT&&jT.__classPrivateFieldSet||function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},gh=jT&&jT.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Kte,cS,TC;Object.defineProperty(jT,"__esModule",{value:!0});jT.ClientSDK=void 0;var zxt=ixt(),EB=KEe(),RT=fh(),t3r=oPe(),Hxt=Mte(),r3r=jo(),n3r=dPe(),AC=iH(),o3r=Uxt(),Wte=typeof globalThis>"u"?null:globalThis,i3r=typeof Wte=="object"&&Wte!=null&&"importScripts"in Wte&&typeof Wte.importScripts=="function",a3r=i3r||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",pPe=class{constructor(e={}){Kte.set(this,void 0),cS.set(this,void 0),TC.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof zxt.SDKHooks?sH(this,cS,r.hooks,"f"):sH(this,cS,new zxt.SDKHooks,"f"),this._options={...e,hooks:gh(this,cS,"f")};let n=(0,Hxt.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=gh(this,cS,"f").sdkInit({baseURL:n,client:e.httpClient||new AC.HTTPClient});this._baseURL=o,sH(this,Kte,i,"f"),sH(this,TC,e.debugLogger,"f"),!gh(this,TC,"f")&&(0,n3r.env)().MISTRAL_DEBUG&&sH(this,TC,console,"f")}_createRequest(e,r,n){let{method:o,path:i,query:a,headers:s,security:u}=r,l=r.baseURL??this._baseURL;if(!l)return(0,RT.ERR)(new EB.InvalidRequestError("No base URL provided for operation"));let c=new URL(l),d=new URL(i,c);i&&(c.pathname+=c.pathname.endsWith("/")?"":"/",c.pathname+=d.pathname.replace(/^\/+/,""));let f=a||"",p=[];for(let[P,E]of Object.entries(u?.queryParams||{})){let A=(0,r3r.encodeForm)(P,E,{charEncoding:"percent"});typeof A<"u"&&p.push(A)}if(p.length&&(f+=`&${p.join("&")}`),f){let P=f.startsWith("&")?f.slice(1):f;c.search=`?${P}`}let m=new Headers(s),h=u?.basic.username,v=u?.basic.password;if(h!=null||v!=null){let P=(0,t3r.stringToBase64)([h||"",v||""].join(":"));m.set("Authorization",`Basic ${P}`)}let g=new Headers(u?.headers||{});for(let[P,E]of g)m.set(P,E);let _=m.get("cookie")||"";for(let[P,E]of Object.entries(u?.cookies||{}))_+=`; ${P}=${E}`;_=_.startsWith("; ")?_.slice(2):_,m.set("cookie",_);let w=new Headers(n?.fetchOptions?.headers);for(let[P,E]of w)m.set(P,E);a3r||m.set(r.uaHeader??"user-agent",Hxt.SDK_METADATA.userAgent);let x=n?.fetchOptions;if(!x?.signal&&r.timeoutMs&&r.timeoutMs>0){let P=AbortSignal.timeout(r.timeoutMs);x?x.signal=P:x={signal:P}}r.body instanceof ReadableStream&&(x?x.duplex="half":x={duplex:"half"});let C;try{C=gh(this,cS,"f").beforeCreateRequest(e,{url:c,options:{...x,body:r.body??null,headers:m,method:o}})}catch(P){return(0,RT.ERR)(new EB.UnexpectedClientError("Create request hook failed to execute",{cause:P}))}return(0,RT.OK)(new Request(C.url,C.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,o3r.retry)(async()=>{let i=await gh(this,cS,"f").beforeRequest(n,e.clone());await s3r(gh(this,TC,"f"),i).catch(s=>gh(this,TC,"f")?.log("Failed to log request:",s));let a=await gh(this,Kte,"f").request(i);try{if((0,AC.matchStatusCode)(a,o)){let s=await gh(this,cS,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await gh(this,cS,"f").afterSuccess(n,a)}finally{await u3r(gh(this,TC,"f"),a,i).catch(s=>gh(this,TC,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,RT.OK)(i),i=>{switch(!0){case(0,AC.isAbortError)(i):return(0,RT.ERR)(new EB.RequestAbortedError("Request aborted by client",{cause:i}));case(0,AC.isTimeoutError)(i):return(0,RT.ERR)(new EB.RequestTimeoutError("Request timed out",{cause:i}));case(0,AC.isConnectionError)(i):return(0,RT.ERR)(new EB.ConnectionError("Unable to make request",{cause:i}));default:return(0,RT.ERR)(new EB.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};jT.ClientSDK=pPe;Kte=new WeakMap,cS=new WeakMap,TC=new WeakMap;var Vxt=/^application\/(?:.{0,100}\+)?json/;async function s3r(t,e){if(!t)return;let r=e.headers.get("content-type"),n=r?.split(";")[0]||"";t.group(`> Request: ${e.method} ${e.url}`),t.group("Headers:");for(let[o,i]of e.headers.entries())t.log(`${o}: ${i}`);switch(t.groupEnd(),t.group("Body:"),!0){case Vxt.test(n):t.log(await e.clone().json());break;case n.startsWith("text/"):t.log(await e.clone().text());break;case n==="multipart/form-data":{let o=await e.clone().formData();for(let[i,a]of o){let s=a instanceof Blob?"<Blob>":a;t.log(`${i}: ${s}`)}break}default:t.log(`<${r}>`);break}t.groupEnd(),t.groupEnd()}async function u3r(t,e,r){if(!t)return;let n=e.headers.get("content-type"),o=n?.split(";")[0]||"";t.group(`< Response: ${r.method} ${r.url}`),t.log("Status Code:",e.status,e.statusText),t.group("Headers:");for(let[i,a]of e.headers.entries())t.log(`${i}: ${a}`);switch(t.groupEnd(),t.group("Body:"),!0){case((0,AC.matchContentType)(e,"application/json")||Vxt.test(o)):t.log(await e.clone().json());break;case(0,AC.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,AC.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,AC.matchContentType)(e,"multipart/form-data"):{let i=await e.clone().formData();for(let[a,s]of i){let u=s instanceof Blob?"<Blob>":s;t.log(`${a}: ${u}`)}break}default:t.log(`<${n}>`);break}t.groupEnd(),t.groupEnd()}});var hPe=b(Jte=>{"use strict";Object.defineProperty(Jte,"__esModule",{value:!0});Jte.SDKError=void 0;var mPe=class extends Error{constructor(e,r,n=""){let o=r.status,i=r.headers.get("content-type")||"",a=n.length>0?`
${n}`:"";super(`${e}: Status ${o} Content-Type ${i} Body ${a}`),this.rawResponse=r,this.body=n,this.statusCode=o,this.contentType=i,this.name="SDKError"}};Jte.SDKError=mPe});var dH=b(cH=>{"use strict";Object.defineProperty(cH,"__esModule",{value:!0});cH.EventStream=void 0;cH.discardSentinel=d3r;var uH=10,lH=13,Wxt=new Set([uH,lH]),l3r=[new Uint8Array([lH,uH,lH,uH]),new Uint8Array([lH,lH]),new Uint8Array([uH,uH])],gPe=class{constructor(e){this.stream=e.stream,this.decoder=e.decoder}async*[Symbol.asyncIterator](){let e=this.stream.getReader(),r=new Uint8Array([]),n=0;try{for(;;){let{done:o,value:i}=await e.read();if(o)break;let a=new Uint8Array(r.length+i.length);a.set(r),a.set(i,r.length),r=a;for(let s=n;s<r.length;s++){let u=Kxt(r,s);if(u==null)continue;let l=r.slice(n,s);n=s+u.length;let c=yPe(l,this.decoder);c!=null&&(yield c)}n>0&&(r=r.slice(n),n=0)}if(r.length>0){let o=yPe(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{e.releaseLock()}}};cH.EventStream=gPe;function Kxt(t,e){let r=t[e],n=t[e+1];if(r==null||n==null||!Wxt.has(r)||!Wxt.has(n))return null;for(let o of l3r){let i=c3r(e,t,o);if(i!=null)return i}return null}function c3r(t,e,r){if(r.length>e.length-t)return null;for(let n=0;n<r.length;n++)if(e[t+n]!==r[n])return null;return r}function yPe(t,e){if(!t.length)return null;let o=new TextDecoder().decode(t).split(/\r?\n|\r/g),i=!1,a={};for(let s of o){if(!s)continue;let u=s.indexOf(":");if(u===0)continue;let l=u>0?s.substring(0,u):"",c=u>0?s.substring(u+1):"";switch(c.charAt(0)===" "&&(c=c.substring(1)),l){case"event":{i=!0,a.event=c;break}case"data":{i=!0,a.data??(a.data=""),a.data+=c+`
`;break}case"id":{i=!0,a.id=c;break}case"retry":{let d=parseInt(c,10);Number.isNaN(d)||(i=!0,a.retry=d);break}}}return i?(a.data!=null&&(a.data=a.data.slice(0,-1)),e(a)):null}function d3r(t,e){return new ReadableStream({async start(r){let n=new Uint8Array([]),o=0,i=!1,a=!1,s=t.getReader();try{for(;!i;){let u=await s.read(),l=u.value;if(i=i||u.done,a||typeof l>"u")continue;let c=new Uint8Array(n.length+l.length);c.set(n),c.set(l,n.length),n=c;for(let d=o;d<n.length;d++){let f=Kxt(n,d);if(f==null)continue;let p=o,m=n.slice(p,d);o=d+f.length,yPe(m,f3r)?.data===e?(r.enqueue(n.slice(0,p)),a=!0):(r.enqueue(n.slice(0,o)),n=n.slice(o),o=0)}}}catch(u){r.error(u)}finally{r.close(),s.releaseLock()}}})}function f3r(t){return t}});var vPe=b(Wg=>{"use strict";var p3r=Wg&&Wg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m3r=Wg&&Wg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h3r=Wg&&Wg.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&p3r(e,t,r);return m3r(e,t),e};Object.defineProperty(Wg,"__esModule",{value:!0});Wg.SDKValidationError=void 0;Wg.formatZodError=_Pe;var g3r=h3r(ye()),bPe=class extends Error{constructor(e,r,n){super(`${e}: ${r}`),this.name="SDKValidationError",this.cause=r,this.rawValue=n,this.rawMessage=e}pretty(){return this.cause instanceof g3r.ZodError?`${this.rawMessage}
${_Pe(this.cause)}`:this.toString()}};Wg.SDKValidationError=bPe;function _Pe(t,e=0){let r=" ".repeat(e);r=e>0?`\u2502${r}`:r,r+=" ".repeat(e);let n="",o=s=>n+=`
${r}${s}`,i=t.issues.length,a=i===1?`${i} issue found`:`${i} issues found`;i&&o(`\u250C ${a}:`);for(let s of t.issues){let u=s.path.join(".");switch(u=u?`<root>.${u}`:"<root>",o(`\u2502 \u2022 [${u}]: ${s.message} (${s.code})`),s.code){case"invalid_literal":case"invalid_type":{o(`\u2502 Want: ${s.expected}`),o(`\u2502 Got: ${s.received}`);break}case"unrecognized_keys":{o(`\u2502 Keys: ${s.keys.join(", ")}`);break}case"invalid_enum_value":{o(`\u2502 Allowed: ${s.options.join(", ")}`),o(`\u2502 Got: ${s.received}`);break}case"invalid_union_discriminator":{o(`\u2502 Allowed: ${s.options.join(", ")}`);break}case"invalid_union":{let l=s.unionErrors.length;o(`\u2502 \u2716\uFE0E Attemped to deserialize into one of ${l} union members:`),s.unionErrors.forEach((c,d)=>{o(`\u2502 \u2716\uFE0E Member ${d+1} of ${l}`),o(`${_Pe(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var pe=b(fH=>{"use strict";Object.defineProperty(fH,"__esModule",{value:!0});fH.parse=b3r;fH.safeParse=_3r;fH.collectExtraKeys=v3r;var y3r=ye(),Gxt=vPe(),Jxt=fh();function b3r(t,e,r){try{return e(t)}catch(n){throw n instanceof y3r.ZodError?new Gxt.SDKValidationError(r,n,t):n}}function _3r(t,e,r){try{return(0,Jxt.OK)(e(t))}catch(n){return(0,Jxt.ERR)(new Gxt.SDKValidationError(r,n,t))}}function v3r(t,e,r){return t.transform(n=>{let o={},{shape:i}=t;for(let[a]of Object.entries(n)){if(a in i)continue;let s=n[a];typeof s>"u"||(o[a]=s,delete n[a])}return r&&Object.keys(o).length===0?n:{...n,[e]:o}})}});var Do=b(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.jsonErr=x3r;Nl.json=C3r;Nl.textErr=O3r;Nl.text=E3r;Nl.bytesErr=P3r;Nl.bytes=T3r;Nl.streamErr=A3r;Nl.stream=I3r;Nl.sseErr=M3r;Nl.sse=R3r;Nl.nilErr=j3r;Nl.nil=D3r;Nl.fail=N3r;Nl.match=L3r;Nl.unpackHeaders=Gte;Nl.discardResponseBody=eCt;var Yxt=hPe(),w3r=dH(),Zxt=iH(),Xxt=aPe(),Qxt=pe(),S3r={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function x3r(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function C3r(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function O3r(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function E3r(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function P3r(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function T3r(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function A3r(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function I3r(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function M3r(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function R3r(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function j3r(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function D3r(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function N3r(t){return{enc:"fail",codes:t}}function L3r(...t){return async function(r,n){let o,i;for(let l of t){let{codes:c}=l,d="ctype"in l?l.ctype:S3r[l.enc];if(d&&(0,Zxt.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,Zxt.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new Yxt.SDKError("Unexpected API response status or content-type",r,l)},l]}let a=i.enc;switch(a){case"json":o=await r.json();break;case"bytes":o=new Uint8Array(await r.arrayBuffer());break;case"stream":o=r.body;break;case"text":o=await r.text();break;case"sse":o=r.body&&i.sseSentinel?(0,w3r.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await eCt(r);break;case"fail":o=await r.text();break;default:throw new Error(`Unsupported response type: ${a}`)}if(i.enc==="fail")return[{ok:!1,error:new Yxt.SDKError("API error occurred",r,typeof o=="string"?o:"")},o];let s=i.key||n?.resultKey,u;if("err"in i?u={...n?.extraFields,...i.hdrs?{Headers:Gte(r.headers)}:null,...(0,Xxt.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:Gte(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:Gte(r.headers)}:null,...(0,Xxt.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,Qxt.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,Qxt.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var F3r=/, */;function Gte(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(F3r);return e}async function eCt(t){let e=t.body?.getReader();if(e!=null)try{let r=!1;for(;!r;)r=(await e.read()).done}finally{e.releaseLock()}}});var Re=b(V1=>{"use strict";Object.defineProperty(V1,"__esModule",{value:!0});V1.invariant=k3r;V1.remap=B3r;V1.combineSignals=$3r;V1.abortSignalAny=tCt;V1.compactMap=q3r;var wPe=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function k3r(t,e){if(!t)throw new wPe(e)}function B3r(t,e){let r={};if(!Object.keys(e).length)return r=t,r;for(let[n,o]of Object.entries(t)){let i=e[n];i!==null&&(r[i??n]=o)}return r}function $3r(...t){let e=[];for(let r of t)r&&e.push(r);switch(e.length){case 0:case 1:return e[0]||null;default:return"any"in AbortSignal&&typeof AbortSignal.any=="function"?AbortSignal.any(e):tCt(e)}}function tCt(t){let e=new AbortController,r=e.signal;if(!t.length)return e.signal;if(t.length===1)return t[0]||e.signal;for(let a of t)if(a.aborted)return a;function n(){e.abort(this.reason),i()}let o=[];function i(){for(let a of o){let s=a.deref();s&&s.removeEventListener("abort",n)}}for(let a of t)o.push(new WeakRef(a)),a.addEventListener("abort",n);return r}function q3r(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}});var No=b(IC=>{"use strict";Object.defineProperty(IC,"__esModule",{value:!0});IC.SecurityError=IC.SecurityErrorCode=void 0;IC.resolveSecurity=rCt;IC.resolveGlobalSecurity=H3r;IC.extractSecurity=V3r;var U3r=dPe(),Zte;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(Zte||(IC.SecurityErrorCode=Zte={}));var Xte=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(Zte.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(Zte.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};IC.SecurityError=Xte;function rCt(...t){let e={basic:{},headers:{},queryParams:{},cookies:{},oauth2:{type:"none"}},r=t.find(n=>n.every(o=>{if(o.value==null)return!1;if(o.type==="http:basic")return o.value.username!=null||o.value.password!=null;if(o.type==="http:custom")return null;if(o.type==="oauth2:password")return typeof o.value=="string"&&!!o.value;if(o.type==="oauth2:client_credentials")return o.value.clientID!=null||o.value.clientSecret!=null;if(typeof o.value=="string")return!!o.value;throw new Error(`Unrecognized security type: ${o.type} (value type: ${typeof o.value})`)}));return r==null?null:(r.forEach(n=>{if(n.value==null)return;let{type:o}=n;switch(o){case"apiKey:header":e.headers[n.fieldName]=n.value;break;case"apiKey:query":e.queryParams[n.fieldName]=n.value;break;case"apiKey:cookie":e.cookies[n.fieldName]=n.value;break;case"http:basic":z3r(e,n);break;case"http:custom":break;case"http:bearer":Yte(e,n);break;case"oauth2":Yte(e,n);break;case"oauth2:password":Yte(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":Yte(e,n);break;default:throw Xte.unrecognizedType(o)}}),e)}function z3r(t,e){e.value!=null&&(t.basic=e.value)}function Yte(t,e){if(typeof e.value!="string"||!e.value)return;let r=e.value;r.slice(0,7).toLowerCase()!=="bearer "&&(r=`Bearer ${r}`),t.headers[e.fieldName]=r}function H3r(t){return rCt([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,U3r.env)().MISTRAL_API_KEY}])}async function V3r(t){if(t!=null)return typeof t=="function"?t():t}});var SPe=b(Cs=>{"use strict";var W3r=Cs&&Cs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K3r=Cs&&Cs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J3r=Cs&&Cs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&W3r(e,t,r);return K3r(e,t),e};Object.defineProperty(Cs,"__esModule",{value:!0});Cs.ImageURL$=Cs.ImageURL$outboundSchema=Cs.ImageURL$inboundSchema=void 0;Cs.imageURLToJSON=Y3r;Cs.imageURLFromJSON=Z3r;var DT=J3r(ye()),G3r=pe();Cs.ImageURL$inboundSchema=DT.object({url:DT.string(),detail:DT.nullable(DT.string()).optional()});Cs.ImageURL$outboundSchema=DT.object({url:DT.string(),detail:DT.nullable(DT.string()).optional()});var nCt;(function(t){t.inboundSchema=Cs.ImageURL$inboundSchema,t.outboundSchema=Cs.ImageURL$outboundSchema})(nCt||(Cs.ImageURL$=nCt={}));function Y3r(t){return JSON.stringify(Cs.ImageURL$outboundSchema.parse(t))}function Z3r(t){return(0,G3r.safeParse)(t,e=>Cs.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var xPe=b(ur=>{"use strict";var X3r=ur&&ur.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q3r=ur&&ur.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eHr=ur&&ur.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X3r(e,t,r);return Q3r(e,t),e};Object.defineProperty(ur,"__esModule",{value:!0});ur.ImageURLChunk$=ur.ImageURLChunk$outboundSchema=ur.ImageURLChunk$inboundSchema=ur.ImageURLChunkType$=ur.ImageURLChunkType$outboundSchema=ur.ImageURLChunkType$inboundSchema=ur.ImageURLChunkImageURL$=ur.ImageURLChunkImageURL$outboundSchema=ur.ImageURLChunkImageURL$inboundSchema=ur.ImageURLChunkType=void 0;ur.imageURLChunkImageURLToJSON=tHr;ur.imageURLChunkImageURLFromJSON=rHr;ur.imageURLChunkToJSON=nHr;ur.imageURLChunkFromJSON=oHr;var Kg=eHr(ye()),sCt=Re(),uCt=pe(),Qte=SPe();ur.ImageURLChunkType={ImageUrl:"image_url"};ur.ImageURLChunkImageURL$inboundSchema=Kg.union([Qte.ImageURL$inboundSchema,Kg.string()]);ur.ImageURLChunkImageURL$outboundSchema=Kg.union([Qte.ImageURL$outboundSchema,Kg.string()]);var oCt;(function(t){t.inboundSchema=ur.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=ur.ImageURLChunkImageURL$outboundSchema})(oCt||(ur.ImageURLChunkImageURL$=oCt={}));function tHr(t){return JSON.stringify(ur.ImageURLChunkImageURL$outboundSchema.parse(t))}function rHr(t){return(0,uCt.safeParse)(t,e=>ur.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}ur.ImageURLChunkType$inboundSchema=Kg.nativeEnum(ur.ImageURLChunkType);ur.ImageURLChunkType$outboundSchema=ur.ImageURLChunkType$inboundSchema;var iCt;(function(t){t.inboundSchema=ur.ImageURLChunkType$inboundSchema,t.outboundSchema=ur.ImageURLChunkType$outboundSchema})(iCt||(ur.ImageURLChunkType$=iCt={}));ur.ImageURLChunk$inboundSchema=Kg.object({image_url:Kg.union([Qte.ImageURL$inboundSchema,Kg.string()]),type:ur.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,sCt.remap)(t,{image_url:"imageUrl"}));ur.ImageURLChunk$outboundSchema=Kg.object({imageUrl:Kg.union([Qte.ImageURL$outboundSchema,Kg.string()]),type:ur.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,sCt.remap)(t,{imageUrl:"image_url"}));var aCt;(function(t){t.inboundSchema=ur.ImageURLChunk$inboundSchema,t.outboundSchema=ur.ImageURLChunk$outboundSchema})(aCt||(ur.ImageURLChunk$=aCt={}));function nHr(t){return JSON.stringify(ur.ImageURLChunk$outboundSchema.parse(t))}function oHr(t){return(0,uCt.safeParse)(t,e=>ur.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var CPe=b(Ln=>{"use strict";var iHr=Ln&&Ln.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aHr=Ln&&Ln.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sHr=Ln&&Ln.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iHr(e,t,r);return aHr(e,t),e};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.ReferenceChunk$=Ln.ReferenceChunk$outboundSchema=Ln.ReferenceChunk$inboundSchema=Ln.ReferenceChunkType$=Ln.ReferenceChunkType$outboundSchema=Ln.ReferenceChunkType$inboundSchema=Ln.ReferenceChunkType=void 0;Ln.referenceChunkToJSON=lHr;Ln.referenceChunkFromJSON=cHr;var W1=sHr(ye()),dCt=Re(),uHr=pe();Ln.ReferenceChunkType={Reference:"reference"};Ln.ReferenceChunkType$inboundSchema=W1.nativeEnum(Ln.ReferenceChunkType);Ln.ReferenceChunkType$outboundSchema=Ln.ReferenceChunkType$inboundSchema;var lCt;(function(t){t.inboundSchema=Ln.ReferenceChunkType$inboundSchema,t.outboundSchema=Ln.ReferenceChunkType$outboundSchema})(lCt||(Ln.ReferenceChunkType$=lCt={}));Ln.ReferenceChunk$inboundSchema=W1.object({reference_ids:W1.array(W1.number().int()),type:Ln.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,dCt.remap)(t,{reference_ids:"referenceIds"}));Ln.ReferenceChunk$outboundSchema=W1.object({referenceIds:W1.array(W1.number().int()),type:Ln.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,dCt.remap)(t,{referenceIds:"reference_ids"}));var cCt;(function(t){t.inboundSchema=Ln.ReferenceChunk$inboundSchema,t.outboundSchema=Ln.ReferenceChunk$outboundSchema})(cCt||(Ln.ReferenceChunk$=cCt={}));function lHr(t){return JSON.stringify(Ln.ReferenceChunk$outboundSchema.parse(t))}function cHr(t){return(0,uHr.safeParse)(t,e=>Ln.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var ere=b(Fn=>{"use strict";var dHr=Fn&&Fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fHr=Fn&&Fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pHr=Fn&&Fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dHr(e,t,r);return fHr(e,t),e};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.TextChunk$=Fn.TextChunk$outboundSchema=Fn.TextChunk$inboundSchema=Fn.TextChunkType$=Fn.TextChunkType$outboundSchema=Fn.TextChunkType$inboundSchema=Fn.TextChunkType=void 0;Fn.textChunkToJSON=hHr;Fn.textChunkFromJSON=gHr;var pH=pHr(ye()),mHr=pe();Fn.TextChunkType={Text:"text"};Fn.TextChunkType$inboundSchema=pH.nativeEnum(Fn.TextChunkType);Fn.TextChunkType$outboundSchema=Fn.TextChunkType$inboundSchema;var fCt;(function(t){t.inboundSchema=Fn.TextChunkType$inboundSchema,t.outboundSchema=Fn.TextChunkType$outboundSchema})(fCt||(Fn.TextChunkType$=fCt={}));Fn.TextChunk$inboundSchema=pH.object({text:pH.string(),type:Fn.TextChunkType$inboundSchema.default("text")});Fn.TextChunk$outboundSchema=pH.object({text:pH.string(),type:Fn.TextChunkType$outboundSchema.default("text")});var pCt;(function(t){t.inboundSchema=Fn.TextChunk$inboundSchema,t.outboundSchema=Fn.TextChunk$outboundSchema})(pCt||(Fn.TextChunk$=pCt={}));function hHr(t){return JSON.stringify(Fn.TextChunk$outboundSchema.parse(t))}function gHr(t){return(0,mHr.safeParse)(t,e=>Fn.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var PB=b(Os=>{"use strict";var yHr=Os&&Os.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bHr=Os&&Os.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Hr=Os&&Os.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yHr(e,t,r);return bHr(e,t),e};Object.defineProperty(Os,"__esModule",{value:!0});Os.ContentChunk$=Os.ContentChunk$outboundSchema=Os.ContentChunk$inboundSchema=void 0;Os.contentChunkToJSON=wHr;Os.contentChunkFromJSON=SHr;var np=_Hr(ye()),vHr=pe(),hCt=xPe(),gCt=CPe(),yCt=ere();Os.ContentChunk$inboundSchema=np.union([hCt.ImageURLChunk$inboundSchema.and(np.object({type:np.literal("image_url")}).transform(t=>({type:t.type}))),yCt.TextChunk$inboundSchema.and(np.object({type:np.literal("text")}).transform(t=>({type:t.type}))),gCt.ReferenceChunk$inboundSchema.and(np.object({type:np.literal("reference")}).transform(t=>({type:t.type})))]);Os.ContentChunk$outboundSchema=np.union([hCt.ImageURLChunk$outboundSchema.and(np.object({type:np.literal("image_url")}).transform(t=>({type:t.type}))),yCt.TextChunk$outboundSchema.and(np.object({type:np.literal("text")}).transform(t=>({type:t.type}))),gCt.ReferenceChunk$outboundSchema.and(np.object({type:np.literal("reference")}).transform(t=>({type:t.type})))]);var mCt;(function(t){t.inboundSchema=Os.ContentChunk$inboundSchema,t.outboundSchema=Os.ContentChunk$outboundSchema})(mCt||(Os.ContentChunk$=mCt={}));function wHr(t){return JSON.stringify(Os.ContentChunk$outboundSchema.parse(t))}function SHr(t){return(0,vHr.safeParse)(t,e=>Os.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var OPe=b(no=>{"use strict";var xHr=no&&no.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CHr=no&&no.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OHr=no&&no.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xHr(e,t,r);return CHr(e,t),e};Object.defineProperty(no,"__esModule",{value:!0});no.FunctionCall$=no.FunctionCall$outboundSchema=no.FunctionCall$inboundSchema=no.Arguments$=no.Arguments$outboundSchema=no.Arguments$inboundSchema=void 0;no.argumentsToJSON=EHr;no.argumentsFromJSON=PHr;no.functionCallToJSON=THr;no.functionCallFromJSON=AHr;var Es=OHr(ye()),vCt=pe();no.Arguments$inboundSchema=Es.union([Es.record(Es.any()),Es.string()]);no.Arguments$outboundSchema=Es.union([Es.record(Es.any()),Es.string()]);var bCt;(function(t){t.inboundSchema=no.Arguments$inboundSchema,t.outboundSchema=no.Arguments$outboundSchema})(bCt||(no.Arguments$=bCt={}));function EHr(t){return JSON.stringify(no.Arguments$outboundSchema.parse(t))}function PHr(t){return(0,vCt.safeParse)(t,e=>no.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}no.FunctionCall$inboundSchema=Es.object({name:Es.string(),arguments:Es.union([Es.record(Es.any()),Es.string()])});no.FunctionCall$outboundSchema=Es.object({name:Es.string(),arguments:Es.union([Es.record(Es.any()),Es.string()])});var _Ct;(function(t){t.inboundSchema=no.FunctionCall$inboundSchema,t.outboundSchema=no.FunctionCall$outboundSchema})(_Ct||(no.FunctionCall$=_Ct={}));function THr(t){return JSON.stringify(no.FunctionCall$outboundSchema.parse(t))}function AHr(t){return(0,vCt.safeParse)(t,e=>no.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var NT=b(EPe=>{"use strict";Object.defineProperty(EPe,"__esModule",{value:!0});EPe.catchUnrecognizedEnum=IHr;function IHr(t){return t}});var mH=b(Ps=>{"use strict";var MHr=Ps&&Ps.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RHr=Ps&&Ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jHr=Ps&&Ps.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MHr(e,t,r);return RHr(e,t),e};Object.defineProperty(Ps,"__esModule",{value:!0});Ps.ToolTypes$=Ps.ToolTypes$outboundSchema=Ps.ToolTypes$inboundSchema=Ps.ToolTypes=void 0;var K1=jHr(ye()),DHr=NT();Ps.ToolTypes={Function:"function"};Ps.ToolTypes$inboundSchema=K1.union([K1.nativeEnum(Ps.ToolTypes),K1.string().transform(DHr.catchUnrecognizedEnum)]);Ps.ToolTypes$outboundSchema=K1.union([K1.nativeEnum(Ps.ToolTypes),K1.string().and(K1.custom())]);var wCt;(function(t){t.inboundSchema=Ps.ToolTypes$inboundSchema,t.outboundSchema=Ps.ToolTypes$outboundSchema})(wCt||(Ps.ToolTypes$=wCt={}))});var tre=b(Ts=>{"use strict";var NHr=Ts&&Ts.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LHr=Ts&&Ts.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FHr=Ts&&Ts.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NHr(e,t,r);return LHr(e,t),e};Object.defineProperty(Ts,"__esModule",{value:!0});Ts.ToolCall$=Ts.ToolCall$outboundSchema=Ts.ToolCall$inboundSchema=void 0;Ts.toolCallToJSON=BHr;Ts.toolCallFromJSON=$Hr;var TB=FHr(ye()),kHr=pe(),xCt=OPe(),CCt=mH();Ts.ToolCall$inboundSchema=TB.object({id:TB.string().default("null"),type:CCt.ToolTypes$inboundSchema.optional(),function:xCt.FunctionCall$inboundSchema,index:TB.number().int().default(0)});Ts.ToolCall$outboundSchema=TB.object({id:TB.string().default("null"),type:CCt.ToolTypes$outboundSchema.optional(),function:xCt.FunctionCall$outboundSchema,index:TB.number().int().default(0)});var SCt;(function(t){t.inboundSchema=Ts.ToolCall$inboundSchema,t.outboundSchema=Ts.ToolCall$outboundSchema})(SCt||(Ts.ToolCall$=SCt={}));function BHr(t){return JSON.stringify(Ts.ToolCall$outboundSchema.parse(t))}function $Hr(t){return(0,kHr.safeParse)(t,e=>Ts.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var LT=b(lr=>{"use strict";var qHr=lr&&lr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UHr=lr&&lr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zHr=lr&&lr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qHr(e,t,r);return UHr(e,t),e};Object.defineProperty(lr,"__esModule",{value:!0});lr.AssistantMessage$=lr.AssistantMessage$outboundSchema=lr.AssistantMessage$inboundSchema=lr.AssistantMessageRole$=lr.AssistantMessageRole$outboundSchema=lr.AssistantMessageRole$inboundSchema=lr.AssistantMessageContent$=lr.AssistantMessageContent$outboundSchema=lr.AssistantMessageContent$inboundSchema=lr.AssistantMessageRole=void 0;lr.assistantMessageContentToJSON=HHr;lr.assistantMessageContentFromJSON=VHr;lr.assistantMessageToJSON=WHr;lr.assistantMessageFromJSON=KHr;var wa=zHr(ye()),TCt=Re(),ACt=pe(),rre=PB(),ICt=tre();lr.AssistantMessageRole={Assistant:"assistant"};lr.AssistantMessageContent$inboundSchema=wa.union([wa.string(),wa.array(rre.ContentChunk$inboundSchema)]);lr.AssistantMessageContent$outboundSchema=wa.union([wa.string(),wa.array(rre.ContentChunk$outboundSchema)]);var OCt;(function(t){t.inboundSchema=lr.AssistantMessageContent$inboundSchema,t.outboundSchema=lr.AssistantMessageContent$outboundSchema})(OCt||(lr.AssistantMessageContent$=OCt={}));function HHr(t){return JSON.stringify(lr.AssistantMessageContent$outboundSchema.parse(t))}function VHr(t){return(0,ACt.safeParse)(t,e=>lr.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}lr.AssistantMessageRole$inboundSchema=wa.nativeEnum(lr.AssistantMessageRole);lr.AssistantMessageRole$outboundSchema=lr.AssistantMessageRole$inboundSchema;var ECt;(function(t){t.inboundSchema=lr.AssistantMessageRole$inboundSchema,t.outboundSchema=lr.AssistantMessageRole$outboundSchema})(ECt||(lr.AssistantMessageRole$=ECt={}));lr.AssistantMessage$inboundSchema=wa.object({content:wa.nullable(wa.union([wa.string(),wa.array(rre.ContentChunk$inboundSchema)])).optional(),tool_calls:wa.nullable(wa.array(ICt.ToolCall$inboundSchema)).optional(),prefix:wa.boolean().default(!1),role:lr.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,TCt.remap)(t,{tool_calls:"toolCalls"}));lr.AssistantMessage$outboundSchema=wa.object({content:wa.nullable(wa.union([wa.string(),wa.array(rre.ContentChunk$outboundSchema)])).optional(),toolCalls:wa.nullable(wa.array(ICt.ToolCall$outboundSchema)).optional(),prefix:wa.boolean().default(!1),role:lr.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,TCt.remap)(t,{toolCalls:"tool_calls"}));var PCt;(function(t){t.inboundSchema=lr.AssistantMessage$inboundSchema,t.outboundSchema=lr.AssistantMessage$outboundSchema})(PCt||(lr.AssistantMessage$=PCt={}));function WHr(t){return JSON.stringify(lr.AssistantMessage$outboundSchema.parse(t))}function KHr(t){return(0,ACt.safeParse)(t,e=>lr.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var AB=b(oo=>{"use strict";var JHr=oo&&oo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GHr=oo&&oo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YHr=oo&&oo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JHr(e,t,r);return GHr(e,t),e};Object.defineProperty(oo,"__esModule",{value:!0});oo.Prediction$=oo.Prediction$outboundSchema=oo.Prediction$inboundSchema=oo.PredictionType$=oo.PredictionType$outboundSchema=oo.PredictionType$inboundSchema=oo.PredictionType=void 0;oo.predictionToJSON=XHr;oo.predictionFromJSON=QHr;var J1=YHr(ye()),ZHr=pe();oo.PredictionType={Content:"content"};oo.PredictionType$inboundSchema=J1.nativeEnum(oo.PredictionType);oo.PredictionType$outboundSchema=oo.PredictionType$inboundSchema;var MCt;(function(t){t.inboundSchema=oo.PredictionType$inboundSchema,t.outboundSchema=oo.PredictionType$outboundSchema})(MCt||(oo.PredictionType$=MCt={}));oo.Prediction$inboundSchema=J1.object({type:J1.literal("content").default("content"),content:J1.string().default("")});oo.Prediction$outboundSchema=J1.object({type:J1.literal("content").default("content"),content:J1.string().default("")});var RCt;(function(t){t.inboundSchema=oo.Prediction$inboundSchema,t.outboundSchema=oo.Prediction$outboundSchema})(RCt||(oo.Prediction$=RCt={}));function XHr(t){return JSON.stringify(oo.Prediction$outboundSchema.parse(t))}function QHr(t){return(0,ZHr.safeParse)(t,e=>oo.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var PPe=b(As=>{"use strict";var e8r=As&&As.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t8r=As&&As.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r8r=As&&As.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e8r(e,t,r);return t8r(e,t),e};Object.defineProperty(As,"__esModule",{value:!0});As.JsonSchema$=As.JsonSchema$outboundSchema=As.JsonSchema$inboundSchema=void 0;As.jsonSchemaToJSON=o8r;As.jsonSchemaFromJSON=i8r;var op=r8r(ye()),DCt=Re(),n8r=pe();As.JsonSchema$inboundSchema=op.object({name:op.string(),description:op.nullable(op.string()).optional(),schema:op.record(op.any()),strict:op.boolean().default(!1)}).transform(t=>(0,DCt.remap)(t,{schema:"schemaDefinition"}));As.JsonSchema$outboundSchema=op.object({name:op.string(),description:op.nullable(op.string()).optional(),schemaDefinition:op.record(op.any()),strict:op.boolean().default(!1)}).transform(t=>(0,DCt.remap)(t,{schemaDefinition:"schema"}));var jCt;(function(t){t.inboundSchema=As.JsonSchema$inboundSchema,t.outboundSchema=As.JsonSchema$outboundSchema})(jCt||(As.JsonSchema$=jCt={}));function o8r(t){return JSON.stringify(As.JsonSchema$outboundSchema.parse(t))}function i8r(t){return(0,n8r.safeParse)(t,e=>As.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var TPe=b(Is=>{"use strict";var a8r=Is&&Is.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s8r=Is&&Is.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u8r=Is&&Is.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&a8r(e,t,r);return s8r(e,t),e};Object.defineProperty(Is,"__esModule",{value:!0});Is.ResponseFormats$=Is.ResponseFormats$outboundSchema=Is.ResponseFormats$inboundSchema=Is.ResponseFormats=void 0;var l8r=u8r(ye());Is.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};Is.ResponseFormats$inboundSchema=l8r.nativeEnum(Is.ResponseFormats);Is.ResponseFormats$outboundSchema=Is.ResponseFormats$inboundSchema;var NCt;(function(t){t.inboundSchema=Is.ResponseFormats$inboundSchema,t.outboundSchema=Is.ResponseFormats$outboundSchema})(NCt||(Is.ResponseFormats$=NCt={}))});var IB=b(Ms=>{"use strict";var c8r=Ms&&Ms.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d8r=Ms&&Ms.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f8r=Ms&&Ms.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&c8r(e,t,r);return d8r(e,t),e};Object.defineProperty(Ms,"__esModule",{value:!0});Ms.ResponseFormat$=Ms.ResponseFormat$outboundSchema=Ms.ResponseFormat$inboundSchema=void 0;Ms.responseFormatToJSON=m8r;Ms.responseFormatFromJSON=h8r;var nre=f8r(ye()),FCt=Re(),p8r=pe(),kCt=PPe(),BCt=TPe();Ms.ResponseFormat$inboundSchema=nre.object({type:BCt.ResponseFormats$inboundSchema.optional(),json_schema:nre.nullable(kCt.JsonSchema$inboundSchema).optional()}).transform(t=>(0,FCt.remap)(t,{json_schema:"jsonSchema"}));Ms.ResponseFormat$outboundSchema=nre.object({type:BCt.ResponseFormats$outboundSchema.optional(),jsonSchema:nre.nullable(kCt.JsonSchema$outboundSchema).optional()}).transform(t=>(0,FCt.remap)(t,{jsonSchema:"json_schema"}));var LCt;(function(t){t.inboundSchema=Ms.ResponseFormat$inboundSchema,t.outboundSchema=Ms.ResponseFormat$outboundSchema})(LCt||(Ms.ResponseFormat$=LCt={}));function m8r(t){return JSON.stringify(Ms.ResponseFormat$outboundSchema.parse(t))}function h8r(t){return(0,p8r.safeParse)(t,e=>Ms.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var G1=b(cr=>{"use strict";var g8r=cr&&cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y8r=cr&&cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b8r=cr&&cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g8r(e,t,r);return y8r(e,t),e};Object.defineProperty(cr,"__esModule",{value:!0});cr.SystemMessage$=cr.SystemMessage$outboundSchema=cr.SystemMessage$inboundSchema=cr.Role$=cr.Role$outboundSchema=cr.Role$inboundSchema=cr.SystemMessageContent$=cr.SystemMessageContent$outboundSchema=cr.SystemMessageContent$inboundSchema=cr.Role=void 0;cr.systemMessageContentToJSON=_8r;cr.systemMessageContentFromJSON=v8r;cr.systemMessageToJSON=w8r;cr.systemMessageFromJSON=S8r;var tf=b8r(ye()),zCt=pe(),ore=ere();cr.Role={System:"system"};cr.SystemMessageContent$inboundSchema=tf.union([tf.string(),tf.array(ore.TextChunk$inboundSchema)]);cr.SystemMessageContent$outboundSchema=tf.union([tf.string(),tf.array(ore.TextChunk$outboundSchema)]);var $Ct;(function(t){t.inboundSchema=cr.SystemMessageContent$inboundSchema,t.outboundSchema=cr.SystemMessageContent$outboundSchema})($Ct||(cr.SystemMessageContent$=$Ct={}));function _8r(t){return JSON.stringify(cr.SystemMessageContent$outboundSchema.parse(t))}function v8r(t){return(0,zCt.safeParse)(t,e=>cr.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}cr.Role$inboundSchema=tf.nativeEnum(cr.Role);cr.Role$outboundSchema=cr.Role$inboundSchema;var qCt;(function(t){t.inboundSchema=cr.Role$inboundSchema,t.outboundSchema=cr.Role$outboundSchema})(qCt||(cr.Role$=qCt={}));cr.SystemMessage$inboundSchema=tf.object({content:tf.union([tf.string(),tf.array(ore.TextChunk$inboundSchema)]),role:cr.Role$inboundSchema.default("system")});cr.SystemMessage$outboundSchema=tf.object({content:tf.union([tf.string(),tf.array(ore.TextChunk$outboundSchema)]),role:cr.Role$outboundSchema.default("system")});var UCt;(function(t){t.inboundSchema=cr.SystemMessage$inboundSchema,t.outboundSchema=cr.SystemMessage$outboundSchema})(UCt||(cr.SystemMessage$=UCt={}));function w8r(t){return JSON.stringify(cr.SystemMessage$outboundSchema.parse(t))}function S8r(t){return(0,zCt.safeParse)(t,e=>cr.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var APe=b(Rs=>{"use strict";var x8r=Rs&&Rs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C8r=Rs&&Rs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O8r=Rs&&Rs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&x8r(e,t,r);return C8r(e,t),e};Object.defineProperty(Rs,"__esModule",{value:!0});Rs.FunctionT$=Rs.FunctionT$outboundSchema=Rs.FunctionT$inboundSchema=void 0;Rs.functionToJSON=P8r;Rs.functionFromJSON=T8r;var yh=O8r(ye()),E8r=pe();Rs.FunctionT$inboundSchema=yh.object({name:yh.string(),description:yh.string().default(""),strict:yh.boolean().default(!1),parameters:yh.record(yh.any())});Rs.FunctionT$outboundSchema=yh.object({name:yh.string(),description:yh.string().default(""),strict:yh.boolean().default(!1),parameters:yh.record(yh.any())});var HCt;(function(t){t.inboundSchema=Rs.FunctionT$inboundSchema,t.outboundSchema=Rs.FunctionT$outboundSchema})(HCt||(Rs.FunctionT$=HCt={}));function P8r(t){return JSON.stringify(Rs.FunctionT$outboundSchema.parse(t))}function T8r(t){return(0,E8r.safeParse)(t,e=>Rs.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var MB=b(js=>{"use strict";var A8r=js&&js.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),I8r=js&&js.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M8r=js&&js.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&A8r(e,t,r);return I8r(e,t),e};Object.defineProperty(js,"__esModule",{value:!0});js.Tool$=js.Tool$outboundSchema=js.Tool$inboundSchema=void 0;js.toolToJSON=j8r;js.toolFromJSON=D8r;var WCt=M8r(ye()),R8r=pe(),KCt=APe(),JCt=mH();js.Tool$inboundSchema=WCt.object({type:JCt.ToolTypes$inboundSchema.optional(),function:KCt.FunctionT$inboundSchema});js.Tool$outboundSchema=WCt.object({type:JCt.ToolTypes$outboundSchema.optional(),function:KCt.FunctionT$outboundSchema});var VCt;(function(t){t.inboundSchema=js.Tool$inboundSchema,t.outboundSchema=js.Tool$outboundSchema})(VCt||(js.Tool$=VCt={}));function j8r(t){return JSON.stringify(js.Tool$outboundSchema.parse(t))}function D8r(t){return(0,R8r.safeParse)(t,e=>js.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var IPe=b(Ds=>{"use strict";var N8r=Ds&&Ds.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L8r=Ds&&Ds.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F8r=Ds&&Ds.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&N8r(e,t,r);return L8r(e,t),e};Object.defineProperty(Ds,"__esModule",{value:!0});Ds.FunctionName$=Ds.FunctionName$outboundSchema=Ds.FunctionName$inboundSchema=void 0;Ds.functionNameToJSON=B8r;Ds.functionNameFromJSON=$8r;var ire=F8r(ye()),k8r=pe();Ds.FunctionName$inboundSchema=ire.object({name:ire.string()});Ds.FunctionName$outboundSchema=ire.object({name:ire.string()});var GCt;(function(t){t.inboundSchema=Ds.FunctionName$inboundSchema,t.outboundSchema=Ds.FunctionName$outboundSchema})(GCt||(Ds.FunctionName$=GCt={}));function B8r(t){return JSON.stringify(Ds.FunctionName$outboundSchema.parse(t))}function $8r(t){return(0,k8r.safeParse)(t,e=>Ds.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var RB=b(Ns=>{"use strict";var q8r=Ns&&Ns.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U8r=Ns&&Ns.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z8r=Ns&&Ns.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q8r(e,t,r);return U8r(e,t),e};Object.defineProperty(Ns,"__esModule",{value:!0});Ns.ToolChoice$=Ns.ToolChoice$outboundSchema=Ns.ToolChoice$inboundSchema=void 0;Ns.toolChoiceToJSON=V8r;Ns.toolChoiceFromJSON=W8r;var ZCt=z8r(ye()),H8r=pe(),XCt=IPe(),QCt=mH();Ns.ToolChoice$inboundSchema=ZCt.object({type:QCt.ToolTypes$inboundSchema.optional(),function:XCt.FunctionName$inboundSchema});Ns.ToolChoice$outboundSchema=ZCt.object({type:QCt.ToolTypes$outboundSchema.optional(),function:XCt.FunctionName$outboundSchema});var YCt;(function(t){t.inboundSchema=Ns.ToolChoice$inboundSchema,t.outboundSchema=Ns.ToolChoice$outboundSchema})(YCt||(Ns.ToolChoice$=YCt={}));function V8r(t){return JSON.stringify(Ns.ToolChoice$outboundSchema.parse(t))}function W8r(t){return(0,H8r.safeParse)(t,e=>Ns.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var jB=b(Ls=>{"use strict";var K8r=Ls&&Ls.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J8r=Ls&&Ls.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G8r=Ls&&Ls.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K8r(e,t,r);return J8r(e,t),e};Object.defineProperty(Ls,"__esModule",{value:!0});Ls.ToolChoiceEnum$=Ls.ToolChoiceEnum$outboundSchema=Ls.ToolChoiceEnum$inboundSchema=Ls.ToolChoiceEnum=void 0;var Y8r=G8r(ye());Ls.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};Ls.ToolChoiceEnum$inboundSchema=Y8r.nativeEnum(Ls.ToolChoiceEnum);Ls.ToolChoiceEnum$outboundSchema=Ls.ToolChoiceEnum$inboundSchema;var eOt;(function(t){t.inboundSchema=Ls.ToolChoiceEnum$inboundSchema,t.outboundSchema=Ls.ToolChoiceEnum$outboundSchema})(eOt||(Ls.ToolChoiceEnum$=eOt={}))});var Y1=b(dr=>{"use strict";var Z8r=dr&&dr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X8r=dr&&dr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q8r=dr&&dr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Z8r(e,t,r);return X8r(e,t),e};Object.defineProperty(dr,"__esModule",{value:!0});dr.ToolMessage$=dr.ToolMessage$outboundSchema=dr.ToolMessage$inboundSchema=dr.ToolMessageRole$=dr.ToolMessageRole$outboundSchema=dr.ToolMessageRole$inboundSchema=dr.ToolMessageContent$=dr.ToolMessageContent$outboundSchema=dr.ToolMessageContent$inboundSchema=dr.ToolMessageRole=void 0;dr.toolMessageContentToJSON=eVr;dr.toolMessageContentFromJSON=tVr;dr.toolMessageToJSON=rVr;dr.toolMessageFromJSON=nVr;var Fi=Q8r(ye()),oOt=Re(),iOt=pe(),are=PB();dr.ToolMessageRole={Tool:"tool"};dr.ToolMessageContent$inboundSchema=Fi.union([Fi.string(),Fi.array(are.ContentChunk$inboundSchema)]);dr.ToolMessageContent$outboundSchema=Fi.union([Fi.string(),Fi.array(are.ContentChunk$outboundSchema)]);var tOt;(function(t){t.inboundSchema=dr.ToolMessageContent$inboundSchema,t.outboundSchema=dr.ToolMessageContent$outboundSchema})(tOt||(dr.ToolMessageContent$=tOt={}));function eVr(t){return JSON.stringify(dr.ToolMessageContent$outboundSchema.parse(t))}function tVr(t){return(0,iOt.safeParse)(t,e=>dr.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}dr.ToolMessageRole$inboundSchema=Fi.nativeEnum(dr.ToolMessageRole);dr.ToolMessageRole$outboundSchema=dr.ToolMessageRole$inboundSchema;var rOt;(function(t){t.inboundSchema=dr.ToolMessageRole$inboundSchema,t.outboundSchema=dr.ToolMessageRole$outboundSchema})(rOt||(dr.ToolMessageRole$=rOt={}));dr.ToolMessage$inboundSchema=Fi.object({content:Fi.nullable(Fi.union([Fi.string(),Fi.array(are.ContentChunk$inboundSchema)])),tool_call_id:Fi.nullable(Fi.string()).optional(),name:Fi.nullable(Fi.string()).optional(),role:dr.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,oOt.remap)(t,{tool_call_id:"toolCallId"}));dr.ToolMessage$outboundSchema=Fi.object({content:Fi.nullable(Fi.union([Fi.string(),Fi.array(are.ContentChunk$outboundSchema)])),toolCallId:Fi.nullable(Fi.string()).optional(),name:Fi.nullable(Fi.string()).optional(),role:dr.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,oOt.remap)(t,{toolCallId:"tool_call_id"}));var nOt;(function(t){t.inboundSchema=dr.ToolMessage$inboundSchema,t.outboundSchema=dr.ToolMessage$outboundSchema})(nOt||(dr.ToolMessage$=nOt={}));function rVr(t){return JSON.stringify(dr.ToolMessage$outboundSchema.parse(t))}function nVr(t){return(0,iOt.safeParse)(t,e=>dr.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var Z1=b(fr=>{"use strict";var oVr=fr&&fr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iVr=fr&&fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aVr=fr&&fr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oVr(e,t,r);return iVr(e,t),e};Object.defineProperty(fr,"__esModule",{value:!0});fr.UserMessage$=fr.UserMessage$outboundSchema=fr.UserMessage$inboundSchema=fr.UserMessageRole$=fr.UserMessageRole$outboundSchema=fr.UserMessageRole$inboundSchema=fr.UserMessageContent$=fr.UserMessageContent$outboundSchema=fr.UserMessageContent$inboundSchema=fr.UserMessageRole=void 0;fr.userMessageContentToJSON=sVr;fr.userMessageContentFromJSON=uVr;fr.userMessageToJSON=lVr;fr.userMessageFromJSON=cVr;var wc=aVr(ye()),lOt=pe(),sre=PB();fr.UserMessageRole={User:"user"};fr.UserMessageContent$inboundSchema=wc.union([wc.string(),wc.array(sre.ContentChunk$inboundSchema)]);fr.UserMessageContent$outboundSchema=wc.union([wc.string(),wc.array(sre.ContentChunk$outboundSchema)]);var aOt;(function(t){t.inboundSchema=fr.UserMessageContent$inboundSchema,t.outboundSchema=fr.UserMessageContent$outboundSchema})(aOt||(fr.UserMessageContent$=aOt={}));function sVr(t){return JSON.stringify(fr.UserMessageContent$outboundSchema.parse(t))}function uVr(t){return(0,lOt.safeParse)(t,e=>fr.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}fr.UserMessageRole$inboundSchema=wc.nativeEnum(fr.UserMessageRole);fr.UserMessageRole$outboundSchema=fr.UserMessageRole$inboundSchema;var sOt;(function(t){t.inboundSchema=fr.UserMessageRole$inboundSchema,t.outboundSchema=fr.UserMessageRole$outboundSchema})(sOt||(fr.UserMessageRole$=sOt={}));fr.UserMessage$inboundSchema=wc.object({content:wc.nullable(wc.union([wc.string(),wc.array(sre.ContentChunk$inboundSchema)])),role:fr.UserMessageRole$inboundSchema.default("user")});fr.UserMessage$outboundSchema=wc.object({content:wc.nullable(wc.union([wc.string(),wc.array(sre.ContentChunk$outboundSchema)])),role:fr.UserMessageRole$outboundSchema.default("user")});var uOt;(function(t){t.inboundSchema=fr.UserMessage$inboundSchema,t.outboundSchema=fr.UserMessage$outboundSchema})(uOt||(fr.UserMessage$=uOt={}));function lVr(t){return JSON.stringify(fr.UserMessage$outboundSchema.parse(t))}function cVr(t){return(0,lOt.safeParse)(t,e=>fr.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var bOt=b(Nt=>{"use strict";var dVr=Nt&&Nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fVr=Nt&&Nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pVr=Nt&&Nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dVr(e,t,r);return fVr(e,t),e};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.AgentsCompletionRequest$=Nt.AgentsCompletionRequest$outboundSchema=Nt.AgentsCompletionRequest$inboundSchema=Nt.AgentsCompletionRequestToolChoice$=Nt.AgentsCompletionRequestToolChoice$outboundSchema=Nt.AgentsCompletionRequestToolChoice$inboundSchema=Nt.AgentsCompletionRequestMessages$=Nt.AgentsCompletionRequestMessages$outboundSchema=Nt.AgentsCompletionRequestMessages$inboundSchema=Nt.AgentsCompletionRequestStop$=Nt.AgentsCompletionRequestStop$outboundSchema=Nt.AgentsCompletionRequestStop$inboundSchema=void 0;Nt.agentsCompletionRequestStopToJSON=mVr;Nt.agentsCompletionRequestStopFromJSON=hVr;Nt.agentsCompletionRequestMessagesToJSON=gVr;Nt.agentsCompletionRequestMessagesFromJSON=yVr;Nt.agentsCompletionRequestToolChoiceToJSON=bVr;Nt.agentsCompletionRequestToolChoiceFromJSON=_Vr;Nt.agentsCompletionRequestToJSON=vVr;Nt.agentsCompletionRequestFromJSON=wVr;var Ve=pVr(ye()),mOt=Re(),ure=pe(),lre=LT(),hOt=AB(),gOt=IB(),cre=G1(),yOt=MB(),dre=RB(),fre=jB(),pre=Y1(),mre=Z1();Nt.AgentsCompletionRequestStop$inboundSchema=Ve.union([Ve.string(),Ve.array(Ve.string())]);Nt.AgentsCompletionRequestStop$outboundSchema=Ve.union([Ve.string(),Ve.array(Ve.string())]);var cOt;(function(t){t.inboundSchema=Nt.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=Nt.AgentsCompletionRequestStop$outboundSchema})(cOt||(Nt.AgentsCompletionRequestStop$=cOt={}));function mVr(t){return JSON.stringify(Nt.AgentsCompletionRequestStop$outboundSchema.parse(t))}function hVr(t){return(0,ure.safeParse)(t,e=>Nt.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}Nt.AgentsCompletionRequestMessages$inboundSchema=Ve.union([cre.SystemMessage$inboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),mre.UserMessage$inboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),lre.AssistantMessage$inboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),pre.ToolMessage$inboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))]);Nt.AgentsCompletionRequestMessages$outboundSchema=Ve.union([cre.SystemMessage$outboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),mre.UserMessage$outboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),lre.AssistantMessage$outboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),pre.ToolMessage$outboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))]);var dOt;(function(t){t.inboundSchema=Nt.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=Nt.AgentsCompletionRequestMessages$outboundSchema})(dOt||(Nt.AgentsCompletionRequestMessages$=dOt={}));function gVr(t){return JSON.stringify(Nt.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function yVr(t){return(0,ure.safeParse)(t,e=>Nt.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}Nt.AgentsCompletionRequestToolChoice$inboundSchema=Ve.union([dre.ToolChoice$inboundSchema,fre.ToolChoiceEnum$inboundSchema]);Nt.AgentsCompletionRequestToolChoice$outboundSchema=Ve.union([dre.ToolChoice$outboundSchema,fre.ToolChoiceEnum$outboundSchema]);var fOt;(function(t){t.inboundSchema=Nt.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Nt.AgentsCompletionRequestToolChoice$outboundSchema})(fOt||(Nt.AgentsCompletionRequestToolChoice$=fOt={}));function bVr(t){return JSON.stringify(Nt.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function _Vr(t){return(0,ure.safeParse)(t,e=>Nt.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}Nt.AgentsCompletionRequest$inboundSchema=Ve.object({max_tokens:Ve.nullable(Ve.number().int()).optional(),stream:Ve.boolean().default(!1),stop:Ve.union([Ve.string(),Ve.array(Ve.string())]).optional(),random_seed:Ve.nullable(Ve.number().int()).optional(),messages:Ve.array(Ve.union([cre.SystemMessage$inboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),mre.UserMessage$inboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),lre.AssistantMessage$inboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),pre.ToolMessage$inboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))])),response_format:gOt.ResponseFormat$inboundSchema.optional(),tools:Ve.nullable(Ve.array(yOt.Tool$inboundSchema)).optional(),tool_choice:Ve.union([dre.ToolChoice$inboundSchema,fre.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ve.number().optional(),frequency_penalty:Ve.number().optional(),n:Ve.nullable(Ve.number().int()).optional(),prediction:hOt.Prediction$inboundSchema.optional(),agent_id:Ve.string()}).transform(t=>(0,mOt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));Nt.AgentsCompletionRequest$outboundSchema=Ve.object({maxTokens:Ve.nullable(Ve.number().int()).optional(),stream:Ve.boolean().default(!1),stop:Ve.union([Ve.string(),Ve.array(Ve.string())]).optional(),randomSeed:Ve.nullable(Ve.number().int()).optional(),messages:Ve.array(Ve.union([cre.SystemMessage$outboundSchema.and(Ve.object({role:Ve.literal("system")}).transform(t=>({role:t.role}))),mre.UserMessage$outboundSchema.and(Ve.object({role:Ve.literal("user")}).transform(t=>({role:t.role}))),lre.AssistantMessage$outboundSchema.and(Ve.object({role:Ve.literal("assistant")}).transform(t=>({role:t.role}))),pre.ToolMessage$outboundSchema.and(Ve.object({role:Ve.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:gOt.ResponseFormat$outboundSchema.optional(),tools:Ve.nullable(Ve.array(yOt.Tool$outboundSchema)).optional(),toolChoice:Ve.union([dre.ToolChoice$outboundSchema,fre.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ve.number().optional(),frequencyPenalty:Ve.number().optional(),n:Ve.nullable(Ve.number().int()).optional(),prediction:hOt.Prediction$outboundSchema.optional(),agentId:Ve.string()}).transform(t=>(0,mOt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var pOt;(function(t){t.inboundSchema=Nt.AgentsCompletionRequest$inboundSchema,t.outboundSchema=Nt.AgentsCompletionRequest$outboundSchema})(pOt||(Nt.AgentsCompletionRequest$=pOt={}));function vVr(t){return JSON.stringify(Nt.AgentsCompletionRequest$outboundSchema.parse(t))}function wVr(t){return(0,ure.safeParse)(t,e=>Nt.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var POt=b(Lt=>{"use strict";var SVr=Lt&&Lt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xVr=Lt&&Lt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CVr=Lt&&Lt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SVr(e,t,r);return xVr(e,t),e};Object.defineProperty(Lt,"__esModule",{value:!0});Lt.AgentsCompletionStreamRequest$=Lt.AgentsCompletionStreamRequest$outboundSchema=Lt.AgentsCompletionStreamRequest$inboundSchema=Lt.AgentsCompletionStreamRequestToolChoice$=Lt.AgentsCompletionStreamRequestToolChoice$outboundSchema=Lt.AgentsCompletionStreamRequestToolChoice$inboundSchema=Lt.AgentsCompletionStreamRequestMessages$=Lt.AgentsCompletionStreamRequestMessages$outboundSchema=Lt.AgentsCompletionStreamRequestMessages$inboundSchema=Lt.AgentsCompletionStreamRequestStop$=Lt.AgentsCompletionStreamRequestStop$outboundSchema=Lt.AgentsCompletionStreamRequestStop$inboundSchema=void 0;Lt.agentsCompletionStreamRequestStopToJSON=OVr;Lt.agentsCompletionStreamRequestStopFromJSON=EVr;Lt.agentsCompletionStreamRequestMessagesToJSON=PVr;Lt.agentsCompletionStreamRequestMessagesFromJSON=TVr;Lt.agentsCompletionStreamRequestToolChoiceToJSON=AVr;Lt.agentsCompletionStreamRequestToolChoiceFromJSON=IVr;Lt.agentsCompletionStreamRequestToJSON=MVr;Lt.agentsCompletionStreamRequestFromJSON=RVr;var We=CVr(ye()),xOt=Re(),hre=pe(),gre=LT(),COt=AB(),OOt=IB(),yre=G1(),EOt=MB(),bre=RB(),_re=jB(),vre=Y1(),wre=Z1();Lt.AgentsCompletionStreamRequestStop$inboundSchema=We.union([We.string(),We.array(We.string())]);Lt.AgentsCompletionStreamRequestStop$outboundSchema=We.union([We.string(),We.array(We.string())]);var _Ot;(function(t){t.inboundSchema=Lt.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Lt.AgentsCompletionStreamRequestStop$outboundSchema})(_Ot||(Lt.AgentsCompletionStreamRequestStop$=_Ot={}));function OVr(t){return JSON.stringify(Lt.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function EVr(t){return(0,hre.safeParse)(t,e=>Lt.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}Lt.AgentsCompletionStreamRequestMessages$inboundSchema=We.union([yre.SystemMessage$inboundSchema.and(We.object({role:We.literal("system")}).transform(t=>({role:t.role}))),wre.UserMessage$inboundSchema.and(We.object({role:We.literal("user")}).transform(t=>({role:t.role}))),gre.AssistantMessage$inboundSchema.and(We.object({role:We.literal("assistant")}).transform(t=>({role:t.role}))),vre.ToolMessage$inboundSchema.and(We.object({role:We.literal("tool")}).transform(t=>({role:t.role})))]);Lt.AgentsCompletionStreamRequestMessages$outboundSchema=We.union([yre.SystemMessage$outboundSchema.and(We.object({role:We.literal("system")}).transform(t=>({role:t.role}))),wre.UserMessage$outboundSchema.and(We.object({role:We.literal("user")}).transform(t=>({role:t.role}))),gre.AssistantMessage$outboundSchema.and(We.object({role:We.literal("assistant")}).transform(t=>({role:t.role}))),vre.ToolMessage$outboundSchema.and(We.object({role:We.literal("tool")}).transform(t=>({role:t.role})))]);var vOt;(function(t){t.inboundSchema=Lt.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Lt.AgentsCompletionStreamRequestMessages$outboundSchema})(vOt||(Lt.AgentsCompletionStreamRequestMessages$=vOt={}));function PVr(t){return JSON.stringify(Lt.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function TVr(t){return(0,hre.safeParse)(t,e=>Lt.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}Lt.AgentsCompletionStreamRequestToolChoice$inboundSchema=We.union([bre.ToolChoice$inboundSchema,_re.ToolChoiceEnum$inboundSchema]);Lt.AgentsCompletionStreamRequestToolChoice$outboundSchema=We.union([bre.ToolChoice$outboundSchema,_re.ToolChoiceEnum$outboundSchema]);var wOt;(function(t){t.inboundSchema=Lt.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Lt.AgentsCompletionStreamRequestToolChoice$outboundSchema})(wOt||(Lt.AgentsCompletionStreamRequestToolChoice$=wOt={}));function AVr(t){return JSON.stringify(Lt.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function IVr(t){return(0,hre.safeParse)(t,e=>Lt.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}Lt.AgentsCompletionStreamRequest$inboundSchema=We.object({max_tokens:We.nullable(We.number().int()).optional(),stream:We.boolean().default(!0),stop:We.union([We.string(),We.array(We.string())]).optional(),random_seed:We.nullable(We.number().int()).optional(),messages:We.array(We.union([yre.SystemMessage$inboundSchema.and(We.object({role:We.literal("system")}).transform(t=>({role:t.role}))),wre.UserMessage$inboundSchema.and(We.object({role:We.literal("user")}).transform(t=>({role:t.role}))),gre.AssistantMessage$inboundSchema.and(We.object({role:We.literal("assistant")}).transform(t=>({role:t.role}))),vre.ToolMessage$inboundSchema.and(We.object({role:We.literal("tool")}).transform(t=>({role:t.role})))])),response_format:OOt.ResponseFormat$inboundSchema.optional(),tools:We.nullable(We.array(EOt.Tool$inboundSchema)).optional(),tool_choice:We.union([bre.ToolChoice$inboundSchema,_re.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:We.number().optional(),frequency_penalty:We.number().optional(),n:We.nullable(We.number().int()).optional(),prediction:COt.Prediction$inboundSchema.optional(),agent_id:We.string()}).transform(t=>(0,xOt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));Lt.AgentsCompletionStreamRequest$outboundSchema=We.object({maxTokens:We.nullable(We.number().int()).optional(),stream:We.boolean().default(!0),stop:We.union([We.string(),We.array(We.string())]).optional(),randomSeed:We.nullable(We.number().int()).optional(),messages:We.array(We.union([yre.SystemMessage$outboundSchema.and(We.object({role:We.literal("system")}).transform(t=>({role:t.role}))),wre.UserMessage$outboundSchema.and(We.object({role:We.literal("user")}).transform(t=>({role:t.role}))),gre.AssistantMessage$outboundSchema.and(We.object({role:We.literal("assistant")}).transform(t=>({role:t.role}))),vre.ToolMessage$outboundSchema.and(We.object({role:We.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:OOt.ResponseFormat$outboundSchema.optional(),tools:We.nullable(We.array(EOt.Tool$outboundSchema)).optional(),toolChoice:We.union([bre.ToolChoice$outboundSchema,_re.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:We.number().optional(),frequencyPenalty:We.number().optional(),n:We.nullable(We.number().int()).optional(),prediction:COt.Prediction$outboundSchema.optional(),agentId:We.string()}).transform(t=>(0,xOt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var SOt;(function(t){t.inboundSchema=Lt.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=Lt.AgentsCompletionStreamRequest$outboundSchema})(SOt||(Lt.AgentsCompletionStreamRequest$=SOt={}));function MVr(t){return JSON.stringify(Lt.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function RVr(t){return(0,hre.safeParse)(t,e=>Lt.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var MPe=b(Fs=>{"use strict";var jVr=Fs&&Fs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DVr=Fs&&Fs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NVr=Fs&&Fs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jVr(e,t,r);return DVr(e,t),e};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.ApiEndpoint$=Fs.ApiEndpoint$outboundSchema=Fs.ApiEndpoint$inboundSchema=Fs.ApiEndpoint=void 0;var X1=NVr(ye()),LVr=NT();Fs.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};Fs.ApiEndpoint$inboundSchema=X1.union([X1.nativeEnum(Fs.ApiEndpoint),X1.string().transform(LVr.catchUnrecognizedEnum)]);Fs.ApiEndpoint$outboundSchema=X1.union([X1.nativeEnum(Fs.ApiEndpoint),X1.string().and(X1.custom())]);var TOt;(function(t){t.inboundSchema=Fs.ApiEndpoint$inboundSchema,t.outboundSchema=Fs.ApiEndpoint$outboundSchema})(TOt||(Fs.ApiEndpoint$=TOt={}))});var MOt=b(io=>{"use strict";var FVr=io&&io.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kVr=io&&io.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BVr=io&&io.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FVr(e,t,r);return kVr(e,t),e};Object.defineProperty(io,"__esModule",{value:!0});io.ArchiveFTModelOut$=io.ArchiveFTModelOut$outboundSchema=io.ArchiveFTModelOut$inboundSchema=io.ArchiveFTModelOutObject$=io.ArchiveFTModelOutObject$outboundSchema=io.ArchiveFTModelOutObject$inboundSchema=io.ArchiveFTModelOutObject=void 0;io.archiveFTModelOutToJSON=qVr;io.archiveFTModelOutFromJSON=UVr;var MC=BVr(ye()),$Vr=pe();io.ArchiveFTModelOutObject={Model:"model"};io.ArchiveFTModelOutObject$inboundSchema=MC.nativeEnum(io.ArchiveFTModelOutObject);io.ArchiveFTModelOutObject$outboundSchema=io.ArchiveFTModelOutObject$inboundSchema;var AOt;(function(t){t.inboundSchema=io.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=io.ArchiveFTModelOutObject$outboundSchema})(AOt||(io.ArchiveFTModelOutObject$=AOt={}));io.ArchiveFTModelOut$inboundSchema=MC.object({id:MC.string(),object:MC.literal("model").default("model"),archived:MC.boolean().default(!0)});io.ArchiveFTModelOut$outboundSchema=MC.object({id:MC.string(),object:MC.literal("model").default("model"),archived:MC.boolean().default(!0)});var IOt;(function(t){t.inboundSchema=io.ArchiveFTModelOut$inboundSchema,t.outboundSchema=io.ArchiveFTModelOut$outboundSchema})(IOt||(io.ArchiveFTModelOut$=IOt={}));function qVr(t){return JSON.stringify(io.ArchiveFTModelOut$outboundSchema.parse(t))}function UVr(t){return(0,$Vr.safeParse)(t,e=>io.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var Sre=b(ks=>{"use strict";var zVr=ks&&ks.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HVr=ks&&ks.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VVr=ks&&ks.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zVr(e,t,r);return HVr(e,t),e};Object.defineProperty(ks,"__esModule",{value:!0});ks.ModelCapabilities$=ks.ModelCapabilities$outboundSchema=ks.ModelCapabilities$inboundSchema=void 0;ks.modelCapabilitiesToJSON=KVr;ks.modelCapabilitiesFromJSON=JVr;var bh=VVr(ye()),jOt=Re(),WVr=pe();ks.ModelCapabilities$inboundSchema=bh.object({completion_chat:bh.boolean().default(!0),completion_fim:bh.boolean().default(!1),function_calling:bh.boolean().default(!0),fine_tuning:bh.boolean().default(!1),vision:bh.boolean().default(!1)}).transform(t=>(0,jOt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));ks.ModelCapabilities$outboundSchema=bh.object({completionChat:bh.boolean().default(!0),completionFim:bh.boolean().default(!1),functionCalling:bh.boolean().default(!0),fineTuning:bh.boolean().default(!1),vision:bh.boolean().default(!1)}).transform(t=>(0,jOt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var ROt;(function(t){t.inboundSchema=ks.ModelCapabilities$inboundSchema,t.outboundSchema=ks.ModelCapabilities$outboundSchema})(ROt||(ks.ModelCapabilities$=ROt={}));function KVr(t){return JSON.stringify(ks.ModelCapabilities$outboundSchema.parse(t))}function JVr(t){return(0,WVr.safeParse)(t,e=>ks.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var RPe=b(ao=>{"use strict";var GVr=ao&&ao.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YVr=ao&&ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZVr=ao&&ao.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GVr(e,t,r);return YVr(e,t),e};Object.defineProperty(ao,"__esModule",{value:!0});ao.BaseModelCard$=ao.BaseModelCard$outboundSchema=ao.BaseModelCard$inboundSchema=ao.Type$=ao.Type$outboundSchema=ao.Type$inboundSchema=ao.Type=void 0;ao.baseModelCardToJSON=QVr;ao.baseModelCardFromJSON=e6r;var Pn=ZVr(ye()),LOt=Re(),XVr=pe(),FOt=Sre();ao.Type={Base:"base"};ao.Type$inboundSchema=Pn.nativeEnum(ao.Type);ao.Type$outboundSchema=ao.Type$inboundSchema;var DOt;(function(t){t.inboundSchema=ao.Type$inboundSchema,t.outboundSchema=ao.Type$outboundSchema})(DOt||(ao.Type$=DOt={}));ao.BaseModelCard$inboundSchema=Pn.object({id:Pn.string(),object:Pn.string().default("model"),created:Pn.number().int().optional(),owned_by:Pn.string().default("mistralai"),capabilities:FOt.ModelCapabilities$inboundSchema,name:Pn.nullable(Pn.string()).optional(),description:Pn.nullable(Pn.string()).optional(),max_context_length:Pn.number().int().default(32768),aliases:Pn.array(Pn.string()).optional(),deprecation:Pn.nullable(Pn.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:Pn.nullable(Pn.number()).optional(),type:Pn.literal("base").default("base")}).transform(t=>(0,LOt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));ao.BaseModelCard$outboundSchema=Pn.object({id:Pn.string(),object:Pn.string().default("model"),created:Pn.number().int().optional(),ownedBy:Pn.string().default("mistralai"),capabilities:FOt.ModelCapabilities$outboundSchema,name:Pn.nullable(Pn.string()).optional(),description:Pn.nullable(Pn.string()).optional(),maxContextLength:Pn.number().int().default(32768),aliases:Pn.array(Pn.string()).optional(),deprecation:Pn.nullable(Pn.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:Pn.nullable(Pn.number()).optional(),type:Pn.literal("base").default("base")}).transform(t=>(0,LOt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var NOt;(function(t){t.inboundSchema=ao.BaseModelCard$inboundSchema,t.outboundSchema=ao.BaseModelCard$outboundSchema})(NOt||(ao.BaseModelCard$=NOt={}));function QVr(t){return JSON.stringify(ao.BaseModelCard$outboundSchema.parse(t))}function e6r(t){return(0,XVr.safeParse)(t,e=>ao.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var jPe=b(Bs=>{"use strict";var t6r=Bs&&Bs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r6r=Bs&&Bs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n6r=Bs&&Bs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&t6r(e,t,r);return r6r(e,t),e};Object.defineProperty(Bs,"__esModule",{value:!0});Bs.BatchError$=Bs.BatchError$outboundSchema=Bs.BatchError$inboundSchema=void 0;Bs.batchErrorToJSON=i6r;Bs.batchErrorFromJSON=a6r;var DB=n6r(ye()),o6r=pe();Bs.BatchError$inboundSchema=DB.object({message:DB.string(),count:DB.number().int().default(1)});Bs.BatchError$outboundSchema=DB.object({message:DB.string(),count:DB.number().int().default(1)});var kOt;(function(t){t.inboundSchema=Bs.BatchError$inboundSchema,t.outboundSchema=Bs.BatchError$outboundSchema})(kOt||(Bs.BatchError$=kOt={}));function i6r(t){return JSON.stringify(Bs.BatchError$outboundSchema.parse(t))}function a6r(t){return(0,o6r.safeParse)(t,e=>Bs.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var UOt=b($s=>{"use strict";var s6r=$s&&$s.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u6r=$s&&$s.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l6r=$s&&$s.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&s6r(e,t,r);return u6r(e,t),e};Object.defineProperty($s,"__esModule",{value:!0});$s.BatchJobIn$=$s.BatchJobIn$outboundSchema=$s.BatchJobIn$inboundSchema=void 0;$s.batchJobInToJSON=d6r;$s.batchJobInFromJSON=f6r;var gd=l6r(ye()),$Ot=Re(),c6r=pe(),qOt=MPe();$s.BatchJobIn$inboundSchema=gd.object({input_files:gd.array(gd.string()),endpoint:qOt.ApiEndpoint$inboundSchema,model:gd.string(),metadata:gd.nullable(gd.record(gd.string())).optional(),timeout_hours:gd.number().int().default(24)}).transform(t=>(0,$Ot.remap)(t,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));$s.BatchJobIn$outboundSchema=gd.object({inputFiles:gd.array(gd.string()),endpoint:qOt.ApiEndpoint$outboundSchema,model:gd.string(),metadata:gd.nullable(gd.record(gd.string())).optional(),timeoutHours:gd.number().int().default(24)}).transform(t=>(0,$Ot.remap)(t,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var BOt;(function(t){t.inboundSchema=$s.BatchJobIn$inboundSchema,t.outboundSchema=$s.BatchJobIn$outboundSchema})(BOt||($s.BatchJobIn$=BOt={}));function d6r(t){return JSON.stringify($s.BatchJobIn$outboundSchema.parse(t))}function f6r(t){return(0,c6r.safeParse)(t,e=>$s.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var DPe=b(qs=>{"use strict";var p6r=qs&&qs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m6r=qs&&qs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h6r=qs&&qs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&p6r(e,t,r);return m6r(e,t),e};Object.defineProperty(qs,"__esModule",{value:!0});qs.BatchJobStatus$=qs.BatchJobStatus$outboundSchema=qs.BatchJobStatus$inboundSchema=qs.BatchJobStatus=void 0;var g6r=h6r(ye());qs.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};qs.BatchJobStatus$inboundSchema=g6r.nativeEnum(qs.BatchJobStatus);qs.BatchJobStatus$outboundSchema=qs.BatchJobStatus$inboundSchema;var zOt;(function(t){t.inboundSchema=qs.BatchJobStatus$inboundSchema,t.outboundSchema=qs.BatchJobStatus$outboundSchema})(zOt||(qs.BatchJobStatus$=zOt={}))});var NPe=b(so=>{"use strict";var y6r=so&&so.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b6r=so&&so.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_6r=so&&so.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&y6r(e,t,r);return b6r(e,t),e};Object.defineProperty(so,"__esModule",{value:!0});so.BatchJobOut$=so.BatchJobOut$outboundSchema=so.BatchJobOut$inboundSchema=so.BatchJobOutObject$=so.BatchJobOutObject$outboundSchema=so.BatchJobOutObject$inboundSchema=so.BatchJobOutObject=void 0;so.batchJobOutToJSON=w6r;so.batchJobOutFromJSON=S6r;var Gt=_6r(ye()),WOt=Re(),v6r=pe(),KOt=jPe(),JOt=DPe();so.BatchJobOutObject={Batch:"batch"};so.BatchJobOutObject$inboundSchema=Gt.nativeEnum(so.BatchJobOutObject);so.BatchJobOutObject$outboundSchema=so.BatchJobOutObject$inboundSchema;var HOt;(function(t){t.inboundSchema=so.BatchJobOutObject$inboundSchema,t.outboundSchema=so.BatchJobOutObject$outboundSchema})(HOt||(so.BatchJobOutObject$=HOt={}));so.BatchJobOut$inboundSchema=Gt.object({id:Gt.string(),object:Gt.literal("batch").default("batch"),input_files:Gt.array(Gt.string()),metadata:Gt.nullable(Gt.record(Gt.any())).optional(),endpoint:Gt.string(),model:Gt.string(),output_file:Gt.nullable(Gt.string()).optional(),error_file:Gt.nullable(Gt.string()).optional(),errors:Gt.array(KOt.BatchError$inboundSchema),status:JOt.BatchJobStatus$inboundSchema,created_at:Gt.number().int(),total_requests:Gt.number().int(),completed_requests:Gt.number().int(),succeeded_requests:Gt.number().int(),failed_requests:Gt.number().int(),started_at:Gt.nullable(Gt.number().int()).optional(),completed_at:Gt.nullable(Gt.number().int()).optional()}).transform(t=>(0,WOt.remap)(t,{input_files:"inputFiles",output_file:"outputFile",error_file:"errorFile",created_at:"createdAt",total_requests:"totalRequests",completed_requests:"completedRequests",succeeded_requests:"succeededRequests",failed_requests:"failedRequests",started_at:"startedAt",completed_at:"completedAt"}));so.BatchJobOut$outboundSchema=Gt.object({id:Gt.string(),object:Gt.literal("batch").default("batch"),inputFiles:Gt.array(Gt.string()),metadata:Gt.nullable(Gt.record(Gt.any())).optional(),endpoint:Gt.string(),model:Gt.string(),outputFile:Gt.nullable(Gt.string()).optional(),errorFile:Gt.nullable(Gt.string()).optional(),errors:Gt.array(KOt.BatchError$outboundSchema),status:JOt.BatchJobStatus$outboundSchema,createdAt:Gt.number().int(),totalRequests:Gt.number().int(),completedRequests:Gt.number().int(),succeededRequests:Gt.number().int(),failedRequests:Gt.number().int(),startedAt:Gt.nullable(Gt.number().int()).optional(),completedAt:Gt.nullable(Gt.number().int()).optional()}).transform(t=>(0,WOt.remap)(t,{inputFiles:"input_files",outputFile:"output_file",errorFile:"error_file",createdAt:"created_at",totalRequests:"total_requests",completedRequests:"completed_requests",succeededRequests:"succeeded_requests",failedRequests:"failed_requests",startedAt:"started_at",completedAt:"completed_at"}));var VOt;(function(t){t.inboundSchema=so.BatchJobOut$inboundSchema,t.outboundSchema=so.BatchJobOut$outboundSchema})(VOt||(so.BatchJobOut$=VOt={}));function w6r(t){return JSON.stringify(so.BatchJobOut$outboundSchema.parse(t))}function S6r(t){return(0,v6r.safeParse)(t,e=>so.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var XOt=b(uo=>{"use strict";var x6r=uo&&uo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C6r=uo&&uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O6r=uo&&uo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&x6r(e,t,r);return C6r(e,t),e};Object.defineProperty(uo,"__esModule",{value:!0});uo.BatchJobsOut$=uo.BatchJobsOut$outboundSchema=uo.BatchJobsOut$inboundSchema=uo.BatchJobsOutObject$=uo.BatchJobsOutObject$outboundSchema=uo.BatchJobsOutObject$inboundSchema=uo.BatchJobsOutObject=void 0;uo.batchJobsOutToJSON=P6r;uo.batchJobsOutFromJSON=T6r;var RC=O6r(ye()),E6r=pe(),ZOt=NPe();uo.BatchJobsOutObject={List:"list"};uo.BatchJobsOutObject$inboundSchema=RC.nativeEnum(uo.BatchJobsOutObject);uo.BatchJobsOutObject$outboundSchema=uo.BatchJobsOutObject$inboundSchema;var GOt;(function(t){t.inboundSchema=uo.BatchJobsOutObject$inboundSchema,t.outboundSchema=uo.BatchJobsOutObject$outboundSchema})(GOt||(uo.BatchJobsOutObject$=GOt={}));uo.BatchJobsOut$inboundSchema=RC.object({data:RC.array(ZOt.BatchJobOut$inboundSchema).optional(),object:RC.literal("list").default("list"),total:RC.number().int()});uo.BatchJobsOut$outboundSchema=RC.object({data:RC.array(ZOt.BatchJobOut$outboundSchema).optional(),object:RC.literal("list").default("list"),total:RC.number().int()});var YOt;(function(t){t.inboundSchema=uo.BatchJobsOut$inboundSchema,t.outboundSchema=uo.BatchJobsOut$outboundSchema})(YOt||(uo.BatchJobsOut$=YOt={}));function P6r(t){return JSON.stringify(uo.BatchJobsOut$outboundSchema.parse(t))}function T6r(t){return(0,E6r.safeParse)(t,e=>uo.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var oEt=b(Ft=>{"use strict";var A6r=Ft&&Ft.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),I6r=Ft&&Ft.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M6r=Ft&&Ft.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&A6r(e,t,r);return I6r(e,t),e};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.ChatClassificationRequest$=Ft.ChatClassificationRequest$outboundSchema=Ft.ChatClassificationRequest$inboundSchema=Ft.ChatClassificationRequestInputs$=Ft.ChatClassificationRequestInputs$outboundSchema=Ft.ChatClassificationRequestInputs$inboundSchema=Ft.One$=Ft.One$outboundSchema=Ft.One$inboundSchema=Ft.Two$=Ft.Two$outboundSchema=Ft.Two$inboundSchema=void 0;Ft.twoToJSON=R6r;Ft.twoFromJSON=j6r;Ft.oneToJSON=D6r;Ft.oneFromJSON=N6r;Ft.chatClassificationRequestInputsToJSON=L6r;Ft.chatClassificationRequestInputsFromJSON=F6r;Ft.chatClassificationRequestToJSON=k6r;Ft.chatClassificationRequestFromJSON=B6r;var le=M6r(ye()),nEt=Re(),xre=pe(),_h=LT(),vh=G1(),wh=Y1(),Sh=Z1();Ft.Two$inboundSchema=le.union([vh.SystemMessage$inboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$inboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$inboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$inboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))]);Ft.Two$outboundSchema=le.union([vh.SystemMessage$outboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$outboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$outboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$outboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))]);var QOt;(function(t){t.inboundSchema=Ft.Two$inboundSchema,t.outboundSchema=Ft.Two$outboundSchema})(QOt||(Ft.Two$=QOt={}));function R6r(t){return JSON.stringify(Ft.Two$outboundSchema.parse(t))}function j6r(t){return(0,xre.safeParse)(t,e=>Ft.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}Ft.One$inboundSchema=le.union([vh.SystemMessage$inboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$inboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$inboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$inboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))]);Ft.One$outboundSchema=le.union([vh.SystemMessage$outboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$outboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$outboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$outboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))]);var eEt;(function(t){t.inboundSchema=Ft.One$inboundSchema,t.outboundSchema=Ft.One$outboundSchema})(eEt||(Ft.One$=eEt={}));function D6r(t){return JSON.stringify(Ft.One$outboundSchema.parse(t))}function N6r(t){return(0,xre.safeParse)(t,e=>Ft.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Ft.ChatClassificationRequestInputs$inboundSchema=le.union([le.array(le.union([vh.SystemMessage$inboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$inboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$inboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$inboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))])),le.array(le.array(le.union([vh.SystemMessage$inboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$inboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$inboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$inboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))])))]);Ft.ChatClassificationRequestInputs$outboundSchema=le.union([le.array(le.union([vh.SystemMessage$outboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$outboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$outboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$outboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))])),le.array(le.array(le.union([vh.SystemMessage$outboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$outboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$outboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$outboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))])))]);var tEt;(function(t){t.inboundSchema=Ft.ChatClassificationRequestInputs$inboundSchema,t.outboundSchema=Ft.ChatClassificationRequestInputs$outboundSchema})(tEt||(Ft.ChatClassificationRequestInputs$=tEt={}));function L6r(t){return JSON.stringify(Ft.ChatClassificationRequestInputs$outboundSchema.parse(t))}function F6r(t){return(0,xre.safeParse)(t,e=>Ft.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}Ft.ChatClassificationRequest$inboundSchema=le.object({input:le.union([le.array(le.union([vh.SystemMessage$inboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$inboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$inboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$inboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))])),le.array(le.array(le.union([vh.SystemMessage$inboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$inboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$inboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$inboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))])))]),model:le.nullable(le.string())}).transform(t=>(0,nEt.remap)(t,{input:"inputs"}));Ft.ChatClassificationRequest$outboundSchema=le.object({inputs:le.union([le.array(le.union([vh.SystemMessage$outboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$outboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$outboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$outboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))])),le.array(le.array(le.union([vh.SystemMessage$outboundSchema.and(le.object({role:le.literal("system")}).transform(t=>({role:t.role}))),Sh.UserMessage$outboundSchema.and(le.object({role:le.literal("user")}).transform(t=>({role:t.role}))),_h.AssistantMessage$outboundSchema.and(le.object({role:le.literal("assistant")}).transform(t=>({role:t.role}))),wh.ToolMessage$outboundSchema.and(le.object({role:le.literal("tool")}).transform(t=>({role:t.role})))])))]),model:le.nullable(le.string())}).transform(t=>(0,nEt.remap)(t,{inputs:"input"}));var rEt;(function(t){t.inboundSchema=Ft.ChatClassificationRequest$inboundSchema,t.outboundSchema=Ft.ChatClassificationRequest$outboundSchema})(rEt||(Ft.ChatClassificationRequest$=rEt={}));function k6r(t){return JSON.stringify(Ft.ChatClassificationRequest$outboundSchema.parse(t))}function B6r(t){return(0,xre.safeParse)(t,e=>Ft.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var Cre=b(kn=>{"use strict";var $6r=kn&&kn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q6r=kn&&kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U6r=kn&&kn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$6r(e,t,r);return q6r(e,t),e};Object.defineProperty(kn,"__esModule",{value:!0});kn.ChatCompletionChoice$=kn.ChatCompletionChoice$outboundSchema=kn.ChatCompletionChoice$inboundSchema=kn.FinishReason$=kn.FinishReason$outboundSchema=kn.FinishReason$inboundSchema=kn.FinishReason=void 0;kn.chatCompletionChoiceToJSON=V6r;kn.chatCompletionChoiceFromJSON=W6r;var Jg=U6r(ye()),sEt=Re(),z6r=pe(),H6r=NT(),uEt=LT();kn.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};kn.FinishReason$inboundSchema=Jg.union([Jg.nativeEnum(kn.FinishReason),Jg.string().transform(H6r.catchUnrecognizedEnum)]);kn.FinishReason$outboundSchema=Jg.union([Jg.nativeEnum(kn.FinishReason),Jg.string().and(Jg.custom())]);var iEt;(function(t){t.inboundSchema=kn.FinishReason$inboundSchema,t.outboundSchema=kn.FinishReason$outboundSchema})(iEt||(kn.FinishReason$=iEt={}));kn.ChatCompletionChoice$inboundSchema=Jg.object({index:Jg.number().int(),message:uEt.AssistantMessage$inboundSchema,finish_reason:kn.FinishReason$inboundSchema}).transform(t=>(0,sEt.remap)(t,{finish_reason:"finishReason"}));kn.ChatCompletionChoice$outboundSchema=Jg.object({index:Jg.number().int(),message:uEt.AssistantMessage$outboundSchema,finishReason:kn.FinishReason$outboundSchema}).transform(t=>(0,sEt.remap)(t,{finishReason:"finish_reason"}));var aEt;(function(t){t.inboundSchema=kn.ChatCompletionChoice$inboundSchema,t.outboundSchema=kn.ChatCompletionChoice$outboundSchema})(aEt||(kn.ChatCompletionChoice$=aEt={}));function V6r(t){return JSON.stringify(kn.ChatCompletionChoice$outboundSchema.parse(t))}function W6r(t){return(0,z6r.safeParse)(t,e=>kn.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var yEt=b(kt=>{"use strict";var K6r=kt&&kt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J6r=kt&&kt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G6r=kt&&kt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K6r(e,t,r);return J6r(e,t),e};Object.defineProperty(kt,"__esModule",{value:!0});kt.ChatCompletionRequest$=kt.ChatCompletionRequest$outboundSchema=kt.ChatCompletionRequest$inboundSchema=kt.ChatCompletionRequestToolChoice$=kt.ChatCompletionRequestToolChoice$outboundSchema=kt.ChatCompletionRequestToolChoice$inboundSchema=kt.Messages$=kt.Messages$outboundSchema=kt.Messages$inboundSchema=kt.Stop$=kt.Stop$outboundSchema=kt.Stop$inboundSchema=void 0;kt.stopToJSON=Y6r;kt.stopFromJSON=Z6r;kt.messagesToJSON=X6r;kt.messagesFromJSON=Q6r;kt.chatCompletionRequestToolChoiceToJSON=e5r;kt.chatCompletionRequestToolChoiceFromJSON=t5r;kt.chatCompletionRequestToJSON=r5r;kt.chatCompletionRequestFromJSON=n5r;var Ae=G6r(ye()),pEt=Re(),Ore=pe(),Ere=LT(),mEt=AB(),hEt=IB(),Pre=G1(),gEt=MB(),Tre=RB(),Are=jB(),Ire=Y1(),Mre=Z1();kt.Stop$inboundSchema=Ae.union([Ae.string(),Ae.array(Ae.string())]);kt.Stop$outboundSchema=Ae.union([Ae.string(),Ae.array(Ae.string())]);var lEt;(function(t){t.inboundSchema=kt.Stop$inboundSchema,t.outboundSchema=kt.Stop$outboundSchema})(lEt||(kt.Stop$=lEt={}));function Y6r(t){return JSON.stringify(kt.Stop$outboundSchema.parse(t))}function Z6r(t){return(0,Ore.safeParse)(t,e=>kt.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}kt.Messages$inboundSchema=Ae.union([Pre.SystemMessage$inboundSchema.and(Ae.object({role:Ae.literal("system")}).transform(t=>({role:t.role}))),Mre.UserMessage$inboundSchema.and(Ae.object({role:Ae.literal("user")}).transform(t=>({role:t.role}))),Ere.AssistantMessage$inboundSchema.and(Ae.object({role:Ae.literal("assistant")}).transform(t=>({role:t.role}))),Ire.ToolMessage$inboundSchema.and(Ae.object({role:Ae.literal("tool")}).transform(t=>({role:t.role})))]);kt.Messages$outboundSchema=Ae.union([Pre.SystemMessage$outboundSchema.and(Ae.object({role:Ae.literal("system")}).transform(t=>({role:t.role}))),Mre.UserMessage$outboundSchema.and(Ae.object({role:Ae.literal("user")}).transform(t=>({role:t.role}))),Ere.AssistantMessage$outboundSchema.and(Ae.object({role:Ae.literal("assistant")}).transform(t=>({role:t.role}))),Ire.ToolMessage$outboundSchema.and(Ae.object({role:Ae.literal("tool")}).transform(t=>({role:t.role})))]);var cEt;(function(t){t.inboundSchema=kt.Messages$inboundSchema,t.outboundSchema=kt.Messages$outboundSchema})(cEt||(kt.Messages$=cEt={}));function X6r(t){return JSON.stringify(kt.Messages$outboundSchema.parse(t))}function Q6r(t){return(0,Ore.safeParse)(t,e=>kt.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}kt.ChatCompletionRequestToolChoice$inboundSchema=Ae.union([Tre.ToolChoice$inboundSchema,Are.ToolChoiceEnum$inboundSchema]);kt.ChatCompletionRequestToolChoice$outboundSchema=Ae.union([Tre.ToolChoice$outboundSchema,Are.ToolChoiceEnum$outboundSchema]);var dEt;(function(t){t.inboundSchema=kt.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=kt.ChatCompletionRequestToolChoice$outboundSchema})(dEt||(kt.ChatCompletionRequestToolChoice$=dEt={}));function e5r(t){return JSON.stringify(kt.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function t5r(t){return(0,Ore.safeParse)(t,e=>kt.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}kt.ChatCompletionRequest$inboundSchema=Ae.object({model:Ae.nullable(Ae.string()),temperature:Ae.nullable(Ae.number()).optional(),top_p:Ae.number().optional(),max_tokens:Ae.nullable(Ae.number().int()).optional(),stream:Ae.boolean().default(!1),stop:Ae.union([Ae.string(),Ae.array(Ae.string())]).optional(),random_seed:Ae.nullable(Ae.number().int()).optional(),messages:Ae.array(Ae.union([Pre.SystemMessage$inboundSchema.and(Ae.object({role:Ae.literal("system")}).transform(t=>({role:t.role}))),Mre.UserMessage$inboundSchema.and(Ae.object({role:Ae.literal("user")}).transform(t=>({role:t.role}))),Ere.AssistantMessage$inboundSchema.and(Ae.object({role:Ae.literal("assistant")}).transform(t=>({role:t.role}))),Ire.ToolMessage$inboundSchema.and(Ae.object({role:Ae.literal("tool")}).transform(t=>({role:t.role})))])),response_format:hEt.ResponseFormat$inboundSchema.optional(),tools:Ae.nullable(Ae.array(gEt.Tool$inboundSchema)).optional(),tool_choice:Ae.union([Tre.ToolChoice$inboundSchema,Are.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ae.number().optional(),frequency_penalty:Ae.number().optional(),n:Ae.nullable(Ae.number().int()).optional(),prediction:mEt.Prediction$inboundSchema.optional(),safe_prompt:Ae.boolean().optional()}).transform(t=>(0,pEt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));kt.ChatCompletionRequest$outboundSchema=Ae.object({model:Ae.nullable(Ae.string()),temperature:Ae.nullable(Ae.number()).optional(),topP:Ae.number().optional(),maxTokens:Ae.nullable(Ae.number().int()).optional(),stream:Ae.boolean().default(!1),stop:Ae.union([Ae.string(),Ae.array(Ae.string())]).optional(),randomSeed:Ae.nullable(Ae.number().int()).optional(),messages:Ae.array(Ae.union([Pre.SystemMessage$outboundSchema.and(Ae.object({role:Ae.literal("system")}).transform(t=>({role:t.role}))),Mre.UserMessage$outboundSchema.and(Ae.object({role:Ae.literal("user")}).transform(t=>({role:t.role}))),Ere.AssistantMessage$outboundSchema.and(Ae.object({role:Ae.literal("assistant")}).transform(t=>({role:t.role}))),Ire.ToolMessage$outboundSchema.and(Ae.object({role:Ae.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:hEt.ResponseFormat$outboundSchema.optional(),tools:Ae.nullable(Ae.array(gEt.Tool$outboundSchema)).optional(),toolChoice:Ae.union([Tre.ToolChoice$outboundSchema,Are.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ae.number().optional(),frequencyPenalty:Ae.number().optional(),n:Ae.nullable(Ae.number().int()).optional(),prediction:mEt.Prediction$outboundSchema.optional(),safePrompt:Ae.boolean().optional()}).transform(t=>(0,pEt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",safePrompt:"safe_prompt"}));var fEt;(function(t){t.inboundSchema=kt.ChatCompletionRequest$inboundSchema,t.outboundSchema=kt.ChatCompletionRequest$outboundSchema})(fEt||(kt.ChatCompletionRequest$=fEt={}));function r5r(t){return JSON.stringify(kt.ChatCompletionRequest$outboundSchema.parse(t))}function n5r(t){return(0,Ore.safeParse)(t,e=>kt.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var NB=b(Us=>{"use strict";var o5r=Us&&Us.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i5r=Us&&Us.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a5r=Us&&Us.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o5r(e,t,r);return i5r(e,t),e};Object.defineProperty(Us,"__esModule",{value:!0});Us.UsageInfo$=Us.UsageInfo$outboundSchema=Us.UsageInfo$inboundSchema=void 0;Us.usageInfoToJSON=u5r;Us.usageInfoFromJSON=l5r;var FT=a5r(ye()),_Et=Re(),s5r=pe();Us.UsageInfo$inboundSchema=FT.object({prompt_tokens:FT.number().int(),completion_tokens:FT.number().int(),total_tokens:FT.number().int()}).transform(t=>(0,_Et.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));Us.UsageInfo$outboundSchema=FT.object({promptTokens:FT.number().int(),completionTokens:FT.number().int(),totalTokens:FT.number().int()}).transform(t=>(0,_Et.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var bEt;(function(t){t.inboundSchema=Us.UsageInfo$inboundSchema,t.outboundSchema=Us.UsageInfo$outboundSchema})(bEt||(Us.UsageInfo$=bEt={}));function u5r(t){return JSON.stringify(Us.UsageInfo$outboundSchema.parse(t))}function l5r(t){return(0,s5r.safeParse)(t,e=>Us.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var xEt=b(zs=>{"use strict";var c5r=zs&&zs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d5r=zs&&zs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f5r=zs&&zs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&c5r(e,t,r);return d5r(e,t),e};Object.defineProperty(zs,"__esModule",{value:!0});zs.ChatCompletionResponse$=zs.ChatCompletionResponse$outboundSchema=zs.ChatCompletionResponse$inboundSchema=void 0;zs.chatCompletionResponseToJSON=m5r;zs.chatCompletionResponseFromJSON=h5r;var xh=f5r(ye()),p5r=pe(),wEt=Cre(),SEt=NB();zs.ChatCompletionResponse$inboundSchema=xh.object({id:xh.string(),object:xh.string(),model:xh.string(),usage:SEt.UsageInfo$inboundSchema,created:xh.number().int().optional(),choices:xh.array(wEt.ChatCompletionChoice$inboundSchema).optional()});zs.ChatCompletionResponse$outboundSchema=xh.object({id:xh.string(),object:xh.string(),model:xh.string(),usage:SEt.UsageInfo$outboundSchema,created:xh.number().int().optional(),choices:xh.array(wEt.ChatCompletionChoice$outboundSchema).optional()});var vEt;(function(t){t.inboundSchema=zs.ChatCompletionResponse$inboundSchema,t.outboundSchema=zs.ChatCompletionResponse$outboundSchema})(vEt||(zs.ChatCompletionResponse$=vEt={}));function m5r(t){return JSON.stringify(zs.ChatCompletionResponse$outboundSchema.parse(t))}function h5r(t){return(0,p5r.safeParse)(t,e=>zs.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var REt=b(Bt=>{"use strict";var g5r=Bt&&Bt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y5r=Bt&&Bt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b5r=Bt&&Bt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g5r(e,t,r);return y5r(e,t),e};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.ChatCompletionStreamRequest$=Bt.ChatCompletionStreamRequest$outboundSchema=Bt.ChatCompletionStreamRequest$inboundSchema=Bt.ChatCompletionStreamRequestToolChoice$=Bt.ChatCompletionStreamRequestToolChoice$outboundSchema=Bt.ChatCompletionStreamRequestToolChoice$inboundSchema=Bt.ChatCompletionStreamRequestMessages$=Bt.ChatCompletionStreamRequestMessages$outboundSchema=Bt.ChatCompletionStreamRequestMessages$inboundSchema=Bt.ChatCompletionStreamRequestStop$=Bt.ChatCompletionStreamRequestStop$outboundSchema=Bt.ChatCompletionStreamRequestStop$inboundSchema=void 0;Bt.chatCompletionStreamRequestStopToJSON=_5r;Bt.chatCompletionStreamRequestStopFromJSON=v5r;Bt.chatCompletionStreamRequestMessagesToJSON=w5r;Bt.chatCompletionStreamRequestMessagesFromJSON=S5r;Bt.chatCompletionStreamRequestToolChoiceToJSON=x5r;Bt.chatCompletionStreamRequestToolChoiceFromJSON=C5r;Bt.chatCompletionStreamRequestToJSON=O5r;Bt.chatCompletionStreamRequestFromJSON=E5r;var Ie=b5r(ye()),TEt=Re(),Rre=pe(),jre=LT(),AEt=AB(),IEt=IB(),Dre=G1(),MEt=MB(),Nre=RB(),Lre=jB(),Fre=Y1(),kre=Z1();Bt.ChatCompletionStreamRequestStop$inboundSchema=Ie.union([Ie.string(),Ie.array(Ie.string())]);Bt.ChatCompletionStreamRequestStop$outboundSchema=Ie.union([Ie.string(),Ie.array(Ie.string())]);var CEt;(function(t){t.inboundSchema=Bt.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Bt.ChatCompletionStreamRequestStop$outboundSchema})(CEt||(Bt.ChatCompletionStreamRequestStop$=CEt={}));function _5r(t){return JSON.stringify(Bt.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function v5r(t){return(0,Rre.safeParse)(t,e=>Bt.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}Bt.ChatCompletionStreamRequestMessages$inboundSchema=Ie.union([Dre.SystemMessage$inboundSchema.and(Ie.object({role:Ie.literal("system")}).transform(t=>({role:t.role}))),kre.UserMessage$inboundSchema.and(Ie.object({role:Ie.literal("user")}).transform(t=>({role:t.role}))),jre.AssistantMessage$inboundSchema.and(Ie.object({role:Ie.literal("assistant")}).transform(t=>({role:t.role}))),Fre.ToolMessage$inboundSchema.and(Ie.object({role:Ie.literal("tool")}).transform(t=>({role:t.role})))]);Bt.ChatCompletionStreamRequestMessages$outboundSchema=Ie.union([Dre.SystemMessage$outboundSchema.and(Ie.object({role:Ie.literal("system")}).transform(t=>({role:t.role}))),kre.UserMessage$outboundSchema.and(Ie.object({role:Ie.literal("user")}).transform(t=>({role:t.role}))),jre.AssistantMessage$outboundSchema.and(Ie.object({role:Ie.literal("assistant")}).transform(t=>({role:t.role}))),Fre.ToolMessage$outboundSchema.and(Ie.object({role:Ie.literal("tool")}).transform(t=>({role:t.role})))]);var OEt;(function(t){t.inboundSchema=Bt.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Bt.ChatCompletionStreamRequestMessages$outboundSchema})(OEt||(Bt.ChatCompletionStreamRequestMessages$=OEt={}));function w5r(t){return JSON.stringify(Bt.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function S5r(t){return(0,Rre.safeParse)(t,e=>Bt.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}Bt.ChatCompletionStreamRequestToolChoice$inboundSchema=Ie.union([Nre.ToolChoice$inboundSchema,Lre.ToolChoiceEnum$inboundSchema]);Bt.ChatCompletionStreamRequestToolChoice$outboundSchema=Ie.union([Nre.ToolChoice$outboundSchema,Lre.ToolChoiceEnum$outboundSchema]);var EEt;(function(t){t.inboundSchema=Bt.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Bt.ChatCompletionStreamRequestToolChoice$outboundSchema})(EEt||(Bt.ChatCompletionStreamRequestToolChoice$=EEt={}));function x5r(t){return JSON.stringify(Bt.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function C5r(t){return(0,Rre.safeParse)(t,e=>Bt.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}Bt.ChatCompletionStreamRequest$inboundSchema=Ie.object({model:Ie.nullable(Ie.string()),temperature:Ie.nullable(Ie.number()).optional(),top_p:Ie.number().optional(),max_tokens:Ie.nullable(Ie.number().int()).optional(),stream:Ie.boolean().default(!0),stop:Ie.union([Ie.string(),Ie.array(Ie.string())]).optional(),random_seed:Ie.nullable(Ie.number().int()).optional(),messages:Ie.array(Ie.union([Dre.SystemMessage$inboundSchema.and(Ie.object({role:Ie.literal("system")}).transform(t=>({role:t.role}))),kre.UserMessage$inboundSchema.and(Ie.object({role:Ie.literal("user")}).transform(t=>({role:t.role}))),jre.AssistantMessage$inboundSchema.and(Ie.object({role:Ie.literal("assistant")}).transform(t=>({role:t.role}))),Fre.ToolMessage$inboundSchema.and(Ie.object({role:Ie.literal("tool")}).transform(t=>({role:t.role})))])),response_format:IEt.ResponseFormat$inboundSchema.optional(),tools:Ie.nullable(Ie.array(MEt.Tool$inboundSchema)).optional(),tool_choice:Ie.union([Nre.ToolChoice$inboundSchema,Lre.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ie.number().optional(),frequency_penalty:Ie.number().optional(),n:Ie.nullable(Ie.number().int()).optional(),prediction:AEt.Prediction$inboundSchema.optional(),safe_prompt:Ie.boolean().optional()}).transform(t=>(0,TEt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",safe_prompt:"safePrompt"}));Bt.ChatCompletionStreamRequest$outboundSchema=Ie.object({model:Ie.nullable(Ie.string()),temperature:Ie.nullable(Ie.number()).optional(),topP:Ie.number().optional(),maxTokens:Ie.nullable(Ie.number().int()).optional(),stream:Ie.boolean().default(!0),stop:Ie.union([Ie.string(),Ie.array(Ie.string())]).optional(),randomSeed:Ie.nullable(Ie.number().int()).optional(),messages:Ie.array(Ie.union([Dre.SystemMessage$outboundSchema.and(Ie.object({role:Ie.literal("system")}).transform(t=>({role:t.role}))),kre.UserMessage$outboundSchema.and(Ie.object({role:Ie.literal("user")}).transform(t=>({role:t.role}))),jre.AssistantMessage$outboundSchema.and(Ie.object({role:Ie.literal("assistant")}).transform(t=>({role:t.role}))),Fre.ToolMessage$outboundSchema.and(Ie.object({role:Ie.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:IEt.ResponseFormat$outboundSchema.optional(),tools:Ie.nullable(Ie.array(MEt.Tool$outboundSchema)).optional(),toolChoice:Ie.union([Nre.ToolChoice$outboundSchema,Lre.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ie.number().optional(),frequencyPenalty:Ie.number().optional(),n:Ie.nullable(Ie.number().int()).optional(),prediction:AEt.Prediction$outboundSchema.optional(),safePrompt:Ie.boolean().optional()}).transform(t=>(0,TEt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",safePrompt:"safe_prompt"}));var PEt;(function(t){t.inboundSchema=Bt.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=Bt.ChatCompletionStreamRequest$outboundSchema})(PEt||(Bt.ChatCompletionStreamRequest$=PEt={}));function O5r(t){return JSON.stringify(Bt.ChatCompletionStreamRequest$outboundSchema.parse(t))}function E5r(t){return(0,Rre.safeParse)(t,e=>Bt.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var LPe=b(Hs=>{"use strict";var P5r=Hs&&Hs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T5r=Hs&&Hs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A5r=Hs&&Hs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P5r(e,t,r);return T5r(e,t),e};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.MetricOut$=Hs.MetricOut$outboundSchema=Hs.MetricOut$inboundSchema=void 0;Hs.metricOutToJSON=M5r;Hs.metricOutFromJSON=R5r;var ip=A5r(ye()),DEt=Re(),I5r=pe();Hs.MetricOut$inboundSchema=ip.object({train_loss:ip.nullable(ip.number()).optional(),valid_loss:ip.nullable(ip.number()).optional(),valid_mean_token_accuracy:ip.nullable(ip.number()).optional()}).transform(t=>(0,DEt.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));Hs.MetricOut$outboundSchema=ip.object({trainLoss:ip.nullable(ip.number()).optional(),validLoss:ip.nullable(ip.number()).optional(),validMeanTokenAccuracy:ip.nullable(ip.number()).optional()}).transform(t=>(0,DEt.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var jEt;(function(t){t.inboundSchema=Hs.MetricOut$inboundSchema,t.outboundSchema=Hs.MetricOut$outboundSchema})(jEt||(Hs.MetricOut$=jEt={}));function M5r(t){return JSON.stringify(Hs.MetricOut$outboundSchema.parse(t))}function R5r(t){return(0,I5r.safeParse)(t,e=>Hs.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var FPe=b(Vs=>{"use strict";var j5r=Vs&&Vs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D5r=Vs&&Vs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N5r=Vs&&Vs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&j5r(e,t,r);return D5r(e,t),e};Object.defineProperty(Vs,"__esModule",{value:!0});Vs.CheckpointOut$=Vs.CheckpointOut$outboundSchema=Vs.CheckpointOut$inboundSchema=void 0;Vs.checkpointOutToJSON=F5r;Vs.checkpointOutFromJSON=k5r;var LB=N5r(ye()),LEt=Re(),L5r=pe(),FEt=LPe();Vs.CheckpointOut$inboundSchema=LB.object({metrics:FEt.MetricOut$inboundSchema,step_number:LB.number().int(),created_at:LB.number().int()}).transform(t=>(0,LEt.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));Vs.CheckpointOut$outboundSchema=LB.object({metrics:FEt.MetricOut$outboundSchema,stepNumber:LB.number().int(),createdAt:LB.number().int()}).transform(t=>(0,LEt.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var NEt;(function(t){t.inboundSchema=Vs.CheckpointOut$inboundSchema,t.outboundSchema=Vs.CheckpointOut$outboundSchema})(NEt||(Vs.CheckpointOut$=NEt={}));function F5r(t){return JSON.stringify(Vs.CheckpointOut$outboundSchema.parse(t))}function k5r(t){return(0,L5r.safeParse)(t,e=>Vs.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var kPe=b(Ws=>{"use strict";var B5r=Ws&&Ws.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$5r=Ws&&Ws.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q5r=Ws&&Ws.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&B5r(e,t,r);return $5r(e,t),e};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.ClassificationObject$=Ws.ClassificationObject$outboundSchema=Ws.ClassificationObject$inboundSchema=void 0;Ws.classificationObjectToJSON=z5r;Ws.classificationObjectFromJSON=H5r;var dS=q5r(ye()),BEt=Re(),U5r=pe();Ws.ClassificationObject$inboundSchema=dS.object({categories:dS.record(dS.boolean()).optional(),category_scores:dS.record(dS.number()).optional()}).transform(t=>(0,BEt.remap)(t,{category_scores:"categoryScores"}));Ws.ClassificationObject$outboundSchema=dS.object({categories:dS.record(dS.boolean()).optional(),categoryScores:dS.record(dS.number()).optional()}).transform(t=>(0,BEt.remap)(t,{categoryScores:"category_scores"}));var kEt;(function(t){t.inboundSchema=Ws.ClassificationObject$inboundSchema,t.outboundSchema=Ws.ClassificationObject$outboundSchema})(kEt||(Ws.ClassificationObject$=kEt={}));function z5r(t){return JSON.stringify(Ws.ClassificationObject$outboundSchema.parse(t))}function H5r(t){return(0,U5r.safeParse)(t,e=>Ws.ClassificationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationObject' from JSON")}});var HEt=b(lo=>{"use strict";var V5r=lo&&lo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W5r=lo&&lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K5r=lo&&lo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&V5r(e,t,r);return W5r(e,t),e};Object.defineProperty(lo,"__esModule",{value:!0});lo.ClassificationRequest$=lo.ClassificationRequest$outboundSchema=lo.ClassificationRequest$inboundSchema=lo.ClassificationRequestInputs$=lo.ClassificationRequestInputs$outboundSchema=lo.ClassificationRequestInputs$inboundSchema=void 0;lo.classificationRequestInputsToJSON=J5r;lo.classificationRequestInputsFromJSON=G5r;lo.classificationRequestToJSON=Y5r;lo.classificationRequestFromJSON=Z5r;var qa=K5r(ye()),UEt=Re(),zEt=pe();lo.ClassificationRequestInputs$inboundSchema=qa.union([qa.string(),qa.array(qa.string())]);lo.ClassificationRequestInputs$outboundSchema=qa.union([qa.string(),qa.array(qa.string())]);var $Et;(function(t){t.inboundSchema=lo.ClassificationRequestInputs$inboundSchema,t.outboundSchema=lo.ClassificationRequestInputs$outboundSchema})($Et||(lo.ClassificationRequestInputs$=$Et={}));function J5r(t){return JSON.stringify(lo.ClassificationRequestInputs$outboundSchema.parse(t))}function G5r(t){return(0,zEt.safeParse)(t,e=>lo.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}lo.ClassificationRequest$inboundSchema=qa.object({input:qa.union([qa.string(),qa.array(qa.string())]),model:qa.nullable(qa.string()).optional()}).transform(t=>(0,UEt.remap)(t,{input:"inputs"}));lo.ClassificationRequest$outboundSchema=qa.object({inputs:qa.union([qa.string(),qa.array(qa.string())]),model:qa.nullable(qa.string()).optional()}).transform(t=>(0,UEt.remap)(t,{inputs:"input"}));var qEt;(function(t){t.inboundSchema=lo.ClassificationRequest$inboundSchema,t.outboundSchema=lo.ClassificationRequest$outboundSchema})(qEt||(lo.ClassificationRequest$=qEt={}));function Y5r(t){return JSON.stringify(lo.ClassificationRequest$outboundSchema.parse(t))}function Z5r(t){return(0,zEt.safeParse)(t,e=>lo.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var KEt=b(Ks=>{"use strict";var X5r=Ks&&Ks.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q5r=Ks&&Ks.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e9r=Ks&&Ks.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&X5r(e,t,r);return Q5r(e,t),e};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.ClassificationResponse$=Ks.ClassificationResponse$outboundSchema=Ks.ClassificationResponse$inboundSchema=void 0;Ks.classificationResponseToJSON=r9r;Ks.classificationResponseFromJSON=n9r;var kT=e9r(ye()),t9r=pe(),WEt=kPe();Ks.ClassificationResponse$inboundSchema=kT.object({id:kT.string().optional(),model:kT.string().optional(),results:kT.array(WEt.ClassificationObject$inboundSchema).optional()});Ks.ClassificationResponse$outboundSchema=kT.object({id:kT.string().optional(),model:kT.string().optional(),results:kT.array(WEt.ClassificationObject$outboundSchema).optional()});var VEt;(function(t){t.inboundSchema=Ks.ClassificationResponse$inboundSchema,t.outboundSchema=Ks.ClassificationResponse$outboundSchema})(VEt||(Ks.ClassificationResponse$=VEt={}));function r9r(t){return JSON.stringify(Ks.ClassificationResponse$outboundSchema.parse(t))}function n9r(t){return(0,t9r.safeParse)(t,e=>Ks.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var BPe=b(co=>{"use strict";var o9r=co&&co.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i9r=co&&co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a9r=co&&co.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o9r(e,t,r);return i9r(e,t),e};Object.defineProperty(co,"__esModule",{value:!0});co.DeltaMessage$=co.DeltaMessage$outboundSchema=co.DeltaMessage$inboundSchema=co.Content$=co.Content$outboundSchema=co.Content$inboundSchema=void 0;co.contentToJSON=s9r;co.contentFromJSON=u9r;co.deltaMessageToJSON=l9r;co.deltaMessageFromJSON=c9r;var Qi=a9r(ye()),YEt=Re(),ZEt=pe(),Bre=PB(),XEt=tre();co.Content$inboundSchema=Qi.union([Qi.string(),Qi.array(Bre.ContentChunk$inboundSchema)]);co.Content$outboundSchema=Qi.union([Qi.string(),Qi.array(Bre.ContentChunk$outboundSchema)]);var JEt;(function(t){t.inboundSchema=co.Content$inboundSchema,t.outboundSchema=co.Content$outboundSchema})(JEt||(co.Content$=JEt={}));function s9r(t){return JSON.stringify(co.Content$outboundSchema.parse(t))}function u9r(t){return(0,ZEt.safeParse)(t,e=>co.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}co.DeltaMessage$inboundSchema=Qi.object({role:Qi.nullable(Qi.string()).optional(),content:Qi.nullable(Qi.union([Qi.string(),Qi.array(Bre.ContentChunk$inboundSchema)])).optional(),tool_calls:Qi.nullable(Qi.array(XEt.ToolCall$inboundSchema)).optional()}).transform(t=>(0,YEt.remap)(t,{tool_calls:"toolCalls"}));co.DeltaMessage$outboundSchema=Qi.object({role:Qi.nullable(Qi.string()).optional(),content:Qi.nullable(Qi.union([Qi.string(),Qi.array(Bre.ContentChunk$outboundSchema)])).optional(),toolCalls:Qi.nullable(Qi.array(XEt.ToolCall$outboundSchema)).optional()}).transform(t=>(0,YEt.remap)(t,{toolCalls:"tool_calls"}));var GEt;(function(t){t.inboundSchema=co.DeltaMessage$inboundSchema,t.outboundSchema=co.DeltaMessage$outboundSchema})(GEt||(co.DeltaMessage$=GEt={}));function l9r(t){return JSON.stringify(co.DeltaMessage$outboundSchema.parse(t))}function c9r(t){return(0,ZEt.safeParse)(t,e=>co.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var $Pe=b(Bn=>{"use strict";var d9r=Bn&&Bn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f9r=Bn&&Bn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p9r=Bn&&Bn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&d9r(e,t,r);return f9r(e,t),e};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.CompletionResponseStreamChoice$=Bn.CompletionResponseStreamChoice$outboundSchema=Bn.CompletionResponseStreamChoice$inboundSchema=Bn.CompletionResponseStreamChoiceFinishReason$=Bn.CompletionResponseStreamChoiceFinishReason$outboundSchema=Bn.CompletionResponseStreamChoiceFinishReason$inboundSchema=Bn.CompletionResponseStreamChoiceFinishReason=void 0;Bn.completionResponseStreamChoiceToJSON=g9r;Bn.completionResponseStreamChoiceFromJSON=y9r;var rm=p9r(ye()),tPt=Re(),m9r=pe(),h9r=NT(),rPt=BPe();Bn.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};Bn.CompletionResponseStreamChoiceFinishReason$inboundSchema=rm.union([rm.nativeEnum(Bn.CompletionResponseStreamChoiceFinishReason),rm.string().transform(h9r.catchUnrecognizedEnum)]);Bn.CompletionResponseStreamChoiceFinishReason$outboundSchema=rm.union([rm.nativeEnum(Bn.CompletionResponseStreamChoiceFinishReason),rm.string().and(rm.custom())]);var QEt;(function(t){t.inboundSchema=Bn.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=Bn.CompletionResponseStreamChoiceFinishReason$outboundSchema})(QEt||(Bn.CompletionResponseStreamChoiceFinishReason$=QEt={}));Bn.CompletionResponseStreamChoice$inboundSchema=rm.object({index:rm.number().int(),delta:rPt.DeltaMessage$inboundSchema,finish_reason:rm.nullable(Bn.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,tPt.remap)(t,{finish_reason:"finishReason"}));Bn.CompletionResponseStreamChoice$outboundSchema=rm.object({index:rm.number().int(),delta:rPt.DeltaMessage$outboundSchema,finishReason:rm.nullable(Bn.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,tPt.remap)(t,{finishReason:"finish_reason"}));var ePt;(function(t){t.inboundSchema=Bn.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=Bn.CompletionResponseStreamChoice$outboundSchema})(ePt||(Bn.CompletionResponseStreamChoice$=ePt={}));function g9r(t){return JSON.stringify(Bn.CompletionResponseStreamChoice$outboundSchema.parse(t))}function y9r(t){return(0,m9r.safeParse)(t,e=>Bn.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var qPe=b(Js=>{"use strict";var b9r=Js&&Js.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_9r=Js&&Js.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v9r=Js&&Js.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b9r(e,t,r);return _9r(e,t),e};Object.defineProperty(Js,"__esModule",{value:!0});Js.CompletionChunk$=Js.CompletionChunk$outboundSchema=Js.CompletionChunk$inboundSchema=void 0;Js.completionChunkToJSON=S9r;Js.completionChunkFromJSON=x9r;var Ch=v9r(ye()),w9r=pe(),oPt=$Pe(),iPt=NB();Js.CompletionChunk$inboundSchema=Ch.object({id:Ch.string(),object:Ch.string().optional(),created:Ch.number().int().optional(),model:Ch.string(),usage:iPt.UsageInfo$inboundSchema.optional(),choices:Ch.array(oPt.CompletionResponseStreamChoice$inboundSchema)});Js.CompletionChunk$outboundSchema=Ch.object({id:Ch.string(),object:Ch.string().optional(),created:Ch.number().int().optional(),model:Ch.string(),usage:iPt.UsageInfo$outboundSchema.optional(),choices:Ch.array(oPt.CompletionResponseStreamChoice$outboundSchema)});var nPt;(function(t){t.inboundSchema=Js.CompletionChunk$inboundSchema,t.outboundSchema=Js.CompletionChunk$outboundSchema})(nPt||(Js.CompletionChunk$=nPt={}));function S9r(t){return JSON.stringify(Js.CompletionChunk$outboundSchema.parse(t))}function x9r(t){return(0,w9r.safeParse)(t,e=>Js.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var uPt=b(Gs=>{"use strict";var C9r=Gs&&Gs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O9r=Gs&&Gs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E9r=Gs&&Gs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&C9r(e,t,r);return O9r(e,t),e};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.CompletionEvent$=Gs.CompletionEvent$outboundSchema=Gs.CompletionEvent$inboundSchema=void 0;Gs.completionEventToJSON=T9r;Gs.completionEventFromJSON=A9r;var hH=E9r(ye()),P9r=pe(),sPt=qPe();Gs.CompletionEvent$inboundSchema=hH.object({data:hH.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:hH.ZodIssueCode.custom,message:`malformed json: ${r}`}),hH.NEVER}}).pipe(sPt.CompletionChunk$inboundSchema)});Gs.CompletionEvent$outboundSchema=hH.object({data:sPt.CompletionChunk$outboundSchema});var aPt;(function(t){t.inboundSchema=Gs.CompletionEvent$inboundSchema,t.outboundSchema=Gs.CompletionEvent$outboundSchema})(aPt||(Gs.CompletionEvent$=aPt={}));function T9r(t){return JSON.stringify(Gs.CompletionEvent$outboundSchema.parse(t))}function A9r(t){return(0,P9r.safeParse)(t,e=>Gs.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var cPt=b(Ys=>{"use strict";var I9r=Ys&&Ys.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M9r=Ys&&Ys.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R9r=Ys&&Ys.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&I9r(e,t,r);return M9r(e,t),e};Object.defineProperty(Ys,"__esModule",{value:!0});Ys.DeleteFileOut$=Ys.DeleteFileOut$outboundSchema=Ys.DeleteFileOut$inboundSchema=void 0;Ys.deleteFileOutToJSON=D9r;Ys.deleteFileOutFromJSON=N9r;var BT=R9r(ye()),j9r=pe();Ys.DeleteFileOut$inboundSchema=BT.object({id:BT.string(),object:BT.string(),deleted:BT.boolean()});Ys.DeleteFileOut$outboundSchema=BT.object({id:BT.string(),object:BT.string(),deleted:BT.boolean()});var lPt;(function(t){t.inboundSchema=Ys.DeleteFileOut$inboundSchema,t.outboundSchema=Ys.DeleteFileOut$outboundSchema})(lPt||(Ys.DeleteFileOut$=lPt={}));function D9r(t){return JSON.stringify(Ys.DeleteFileOut$outboundSchema.parse(t))}function N9r(t){return(0,j9r.safeParse)(t,e=>Ys.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var fPt=b(Zs=>{"use strict";var L9r=Zs&&Zs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F9r=Zs&&Zs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k9r=Zs&&Zs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L9r(e,t,r);return F9r(e,t),e};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.DeleteModelOut$=Zs.DeleteModelOut$outboundSchema=Zs.DeleteModelOut$inboundSchema=void 0;Zs.deleteModelOutToJSON=$9r;Zs.deleteModelOutFromJSON=q9r;var $T=k9r(ye()),B9r=pe();Zs.DeleteModelOut$inboundSchema=$T.object({id:$T.string(),object:$T.string().default("model"),deleted:$T.boolean().default(!0)});Zs.DeleteModelOut$outboundSchema=$T.object({id:$T.string(),object:$T.string().default("model"),deleted:$T.boolean().default(!0)});var dPt;(function(t){t.inboundSchema=Zs.DeleteModelOut$inboundSchema,t.outboundSchema=Zs.DeleteModelOut$outboundSchema})(dPt||(Zs.DeleteModelOut$=dPt={}));function $9r(t){return JSON.stringify(Zs.DeleteModelOut$outboundSchema.parse(t))}function q9r(t){return(0,B9r.safeParse)(t,e=>Zs.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var UPe=b(Xs=>{"use strict";var U9r=Xs&&Xs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z9r=Xs&&Xs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H9r=Xs&&Xs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&U9r(e,t,r);return z9r(e,t),e};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.EventOut$=Xs.EventOut$outboundSchema=Xs.EventOut$inboundSchema=void 0;Xs.eventOutToJSON=W9r;Xs.eventOutFromJSON=K9r;var Oh=H9r(ye()),mPt=Re(),V9r=pe();Xs.EventOut$inboundSchema=Oh.object({name:Oh.string(),data:Oh.nullable(Oh.record(Oh.any())).optional(),created_at:Oh.number().int()}).transform(t=>(0,mPt.remap)(t,{created_at:"createdAt"}));Xs.EventOut$outboundSchema=Oh.object({name:Oh.string(),data:Oh.nullable(Oh.record(Oh.any())).optional(),createdAt:Oh.number().int()}).transform(t=>(0,mPt.remap)(t,{createdAt:"created_at"}));var pPt;(function(t){t.inboundSchema=Xs.EventOut$inboundSchema,t.outboundSchema=Xs.EventOut$outboundSchema})(pPt||(Xs.EventOut$=pPt={}));function W9r(t){return JSON.stringify(Xs.EventOut$outboundSchema.parse(t))}function K9r(t){return(0,V9r.safeParse)(t,e=>Xs.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var $re=b(fo=>{"use strict";var J9r=fo&&fo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G9r=fo&&fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y9r=fo&&fo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&J9r(e,t,r);return G9r(e,t),e};Object.defineProperty(fo,"__esModule",{value:!0});fo.GithubRepositoryOut$=fo.GithubRepositoryOut$outboundSchema=fo.GithubRepositoryOut$inboundSchema=fo.GithubRepositoryOutType$=fo.GithubRepositoryOutType$outboundSchema=fo.GithubRepositoryOutType$inboundSchema=fo.GithubRepositoryOutType=void 0;fo.githubRepositoryOutToJSON=X9r;fo.githubRepositoryOutFromJSON=Q9r;var Sc=Y9r(ye()),yPt=Re(),Z9r=pe();fo.GithubRepositoryOutType={Github:"github"};fo.GithubRepositoryOutType$inboundSchema=Sc.nativeEnum(fo.GithubRepositoryOutType);fo.GithubRepositoryOutType$outboundSchema=fo.GithubRepositoryOutType$inboundSchema;var hPt;(function(t){t.inboundSchema=fo.GithubRepositoryOutType$inboundSchema,t.outboundSchema=fo.GithubRepositoryOutType$outboundSchema})(hPt||(fo.GithubRepositoryOutType$=hPt={}));fo.GithubRepositoryOut$inboundSchema=Sc.object({type:Sc.literal("github").default("github"),name:Sc.string(),owner:Sc.string(),ref:Sc.nullable(Sc.string()).optional(),weight:Sc.number().default(1),commit_id:Sc.string()}).transform(t=>(0,yPt.remap)(t,{commit_id:"commitId"}));fo.GithubRepositoryOut$outboundSchema=Sc.object({type:Sc.literal("github").default("github"),name:Sc.string(),owner:Sc.string(),ref:Sc.nullable(Sc.string()).optional(),weight:Sc.number().default(1),commitId:Sc.string()}).transform(t=>(0,yPt.remap)(t,{commitId:"commit_id"}));var gPt;(function(t){t.inboundSchema=fo.GithubRepositoryOut$inboundSchema,t.outboundSchema=fo.GithubRepositoryOut$outboundSchema})(gPt||(fo.GithubRepositoryOut$=gPt={}));function X9r(t){return JSON.stringify(fo.GithubRepositoryOut$outboundSchema.parse(t))}function Q9r(t){return(0,Z9r.safeParse)(t,e=>fo.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var qre=b(Qs=>{"use strict";var eWr=Qs&&Qs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tWr=Qs&&Qs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rWr=Qs&&Qs.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eWr(e,t,r);return tWr(e,t),e};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.JobMetadataOut$=Qs.JobMetadataOut$outboundSchema=Qs.JobMetadataOut$inboundSchema=void 0;Qs.jobMetadataOutToJSON=oWr;Qs.jobMetadataOutFromJSON=iWr;var Uo=rWr(ye()),_Pt=Re(),nWr=pe();Qs.JobMetadataOut$inboundSchema=Uo.object({expected_duration_seconds:Uo.nullable(Uo.number().int()).optional(),cost:Uo.nullable(Uo.number()).optional(),cost_currency:Uo.nullable(Uo.string()).optional(),train_tokens_per_step:Uo.nullable(Uo.number().int()).optional(),train_tokens:Uo.nullable(Uo.number().int()).optional(),data_tokens:Uo.nullable(Uo.number().int()).optional(),estimated_start_time:Uo.nullable(Uo.number().int()).optional()}).transform(t=>(0,_Pt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));Qs.JobMetadataOut$outboundSchema=Uo.object({expectedDurationSeconds:Uo.nullable(Uo.number().int()).optional(),cost:Uo.nullable(Uo.number()).optional(),costCurrency:Uo.nullable(Uo.string()).optional(),trainTokensPerStep:Uo.nullable(Uo.number().int()).optional(),trainTokens:Uo.nullable(Uo.number().int()).optional(),dataTokens:Uo.nullable(Uo.number().int()).optional(),estimatedStartTime:Uo.nullable(Uo.number().int()).optional()}).transform(t=>(0,_Pt.remap)(t,{expectedDurationSeconds:"expected_duration_seconds",costCurrency:"cost_currency",trainTokensPerStep:"train_tokens_per_step",trainTokens:"train_tokens",dataTokens:"data_tokens",estimatedStartTime:"estimated_start_time"}));var bPt;(function(t){t.inboundSchema=Qs.JobMetadataOut$inboundSchema,t.outboundSchema=Qs.JobMetadataOut$outboundSchema})(bPt||(Qs.JobMetadataOut$=bPt={}));function oWr(t){return JSON.stringify(Qs.JobMetadataOut$outboundSchema.parse(t))}function iWr(t){return(0,nWr.safeParse)(t,e=>Qs.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var Ure=b(eu=>{"use strict";var aWr=eu&&eu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sWr=eu&&eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uWr=eu&&eu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aWr(e,t,r);return sWr(e,t),e};Object.defineProperty(eu,"__esModule",{value:!0});eu.TrainingParameters$=eu.TrainingParameters$outboundSchema=eu.TrainingParameters$inboundSchema=void 0;eu.trainingParametersToJSON=cWr;eu.trainingParametersFromJSON=dWr;var ii=uWr(ye()),wPt=Re(),lWr=pe();eu.TrainingParameters$inboundSchema=ii.object({training_steps:ii.nullable(ii.number().int()).optional(),learning_rate:ii.number().default(1e-4),weight_decay:ii.nullable(ii.number()).optional(),warmup_fraction:ii.nullable(ii.number()).optional(),epochs:ii.nullable(ii.number()).optional(),fim_ratio:ii.nullable(ii.number()).optional(),seq_len:ii.nullable(ii.number().int()).optional()}).transform(t=>(0,wPt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));eu.TrainingParameters$outboundSchema=ii.object({trainingSteps:ii.nullable(ii.number().int()).optional(),learningRate:ii.number().default(1e-4),weightDecay:ii.nullable(ii.number()).optional(),warmupFraction:ii.nullable(ii.number()).optional(),epochs:ii.nullable(ii.number()).optional(),fimRatio:ii.nullable(ii.number()).optional(),seqLen:ii.nullable(ii.number().int()).optional()}).transform(t=>(0,wPt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var vPt;(function(t){t.inboundSchema=eu.TrainingParameters$inboundSchema,t.outboundSchema=eu.TrainingParameters$outboundSchema})(vPt||(eu.TrainingParameters$=vPt={}));function cWr(t){return JSON.stringify(eu.TrainingParameters$outboundSchema.parse(t))}function dWr(t){return(0,lWr.safeParse)(t,e=>eu.TrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParameters' from JSON")}});var zre=b(po=>{"use strict";var fWr=po&&po.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pWr=po&&po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mWr=po&&po.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fWr(e,t,r);return pWr(e,t),e};Object.defineProperty(po,"__esModule",{value:!0});po.WandbIntegrationOut$=po.WandbIntegrationOut$outboundSchema=po.WandbIntegrationOut$inboundSchema=po.WandbIntegrationOutType$=po.WandbIntegrationOutType$outboundSchema=po.WandbIntegrationOutType$inboundSchema=po.WandbIntegrationOutType=void 0;po.wandbIntegrationOutToJSON=gWr;po.wandbIntegrationOutFromJSON=yWr;var rf=mWr(ye()),CPt=Re(),hWr=pe();po.WandbIntegrationOutType={Wandb:"wandb"};po.WandbIntegrationOutType$inboundSchema=rf.nativeEnum(po.WandbIntegrationOutType);po.WandbIntegrationOutType$outboundSchema=po.WandbIntegrationOutType$inboundSchema;var SPt;(function(t){t.inboundSchema=po.WandbIntegrationOutType$inboundSchema,t.outboundSchema=po.WandbIntegrationOutType$outboundSchema})(SPt||(po.WandbIntegrationOutType$=SPt={}));po.WandbIntegrationOut$inboundSchema=rf.object({type:rf.literal("wandb").default("wandb"),project:rf.string(),name:rf.nullable(rf.string()).optional(),run_name:rf.nullable(rf.string()).optional()}).transform(t=>(0,CPt.remap)(t,{run_name:"runName"}));po.WandbIntegrationOut$outboundSchema=rf.object({type:rf.literal("wandb").default("wandb"),project:rf.string(),name:rf.nullable(rf.string()).optional(),runName:rf.nullable(rf.string()).optional()}).transform(t=>(0,CPt.remap)(t,{runName:"run_name"}));var xPt;(function(t){t.inboundSchema=po.WandbIntegrationOut$inboundSchema,t.outboundSchema=po.WandbIntegrationOut$outboundSchema})(xPt||(po.WandbIntegrationOut$=xPt={}));function gWr(t){return JSON.stringify(po.WandbIntegrationOut$outboundSchema.parse(t))}function yWr(t){return(0,hWr.safeParse)(t,e=>po.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var NPt=b(ot=>{"use strict";var bWr=ot&&ot.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Wr=ot&&ot.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vWr=ot&&ot.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bWr(e,t,r);return _Wr(e,t),e};Object.defineProperty(ot,"__esModule",{value:!0});ot.DetailedJobOut$=ot.DetailedJobOut$outboundSchema=ot.DetailedJobOut$inboundSchema=ot.DetailedJobOutRepositories$=ot.DetailedJobOutRepositories$outboundSchema=ot.DetailedJobOutRepositories$inboundSchema=ot.DetailedJobOutIntegrations$=ot.DetailedJobOutIntegrations$outboundSchema=ot.DetailedJobOutIntegrations$inboundSchema=ot.DetailedJobOutObject$=ot.DetailedJobOutObject$outboundSchema=ot.DetailedJobOutObject$inboundSchema=ot.DetailedJobOutStatus$=ot.DetailedJobOutStatus$outboundSchema=ot.DetailedJobOutStatus$inboundSchema=ot.DetailedJobOutObject=ot.DetailedJobOutStatus=void 0;ot.detailedJobOutIntegrationsToJSON=wWr;ot.detailedJobOutIntegrationsFromJSON=SWr;ot.detailedJobOutRepositoriesToJSON=xWr;ot.detailedJobOutRepositoriesFromJSON=CWr;ot.detailedJobOutToJSON=OWr;ot.detailedJobOutFromJSON=EWr;var Vt=vWr(ye()),IPt=Re(),zPe=pe(),MPt=FPe(),RPt=UPe(),Hre=$re(),jPt=qre(),DPt=Ure(),Vre=zre();ot.DetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};ot.DetailedJobOutObject={Job:"job"};ot.DetailedJobOutStatus$inboundSchema=Vt.nativeEnum(ot.DetailedJobOutStatus);ot.DetailedJobOutStatus$outboundSchema=ot.DetailedJobOutStatus$inboundSchema;var OPt;(function(t){t.inboundSchema=ot.DetailedJobOutStatus$inboundSchema,t.outboundSchema=ot.DetailedJobOutStatus$outboundSchema})(OPt||(ot.DetailedJobOutStatus$=OPt={}));ot.DetailedJobOutObject$inboundSchema=Vt.nativeEnum(ot.DetailedJobOutObject);ot.DetailedJobOutObject$outboundSchema=ot.DetailedJobOutObject$inboundSchema;var EPt;(function(t){t.inboundSchema=ot.DetailedJobOutObject$inboundSchema,t.outboundSchema=ot.DetailedJobOutObject$outboundSchema})(EPt||(ot.DetailedJobOutObject$=EPt={}));ot.DetailedJobOutIntegrations$inboundSchema=Vre.WandbIntegrationOut$inboundSchema;ot.DetailedJobOutIntegrations$outboundSchema=Vre.WandbIntegrationOut$outboundSchema;var PPt;(function(t){t.inboundSchema=ot.DetailedJobOutIntegrations$inboundSchema,t.outboundSchema=ot.DetailedJobOutIntegrations$outboundSchema})(PPt||(ot.DetailedJobOutIntegrations$=PPt={}));function wWr(t){return JSON.stringify(ot.DetailedJobOutIntegrations$outboundSchema.parse(t))}function SWr(t){return(0,zPe.safeParse)(t,e=>ot.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}ot.DetailedJobOutRepositories$inboundSchema=Hre.GithubRepositoryOut$inboundSchema;ot.DetailedJobOutRepositories$outboundSchema=Hre.GithubRepositoryOut$outboundSchema;var TPt;(function(t){t.inboundSchema=ot.DetailedJobOutRepositories$inboundSchema,t.outboundSchema=ot.DetailedJobOutRepositories$outboundSchema})(TPt||(ot.DetailedJobOutRepositories$=TPt={}));function xWr(t){return JSON.stringify(ot.DetailedJobOutRepositories$outboundSchema.parse(t))}function CWr(t){return(0,zPe.safeParse)(t,e=>ot.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}ot.DetailedJobOut$inboundSchema=Vt.object({id:Vt.string(),auto_start:Vt.boolean(),hyperparameters:DPt.TrainingParameters$inboundSchema,model:Vt.string(),status:ot.DetailedJobOutStatus$inboundSchema,job_type:Vt.string(),created_at:Vt.number().int(),modified_at:Vt.number().int(),training_files:Vt.array(Vt.string()),validation_files:Vt.nullable(Vt.array(Vt.string())).optional(),object:Vt.literal("job").default("job"),fine_tuned_model:Vt.nullable(Vt.string()).optional(),suffix:Vt.nullable(Vt.string()).optional(),integrations:Vt.nullable(Vt.array(Vre.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Vt.nullable(Vt.number().int()).optional(),repositories:Vt.array(Hre.GithubRepositoryOut$inboundSchema).optional(),metadata:Vt.nullable(jPt.JobMetadataOut$inboundSchema).optional(),events:Vt.array(RPt.EventOut$inboundSchema).optional(),checkpoints:Vt.array(MPt.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,IPt.remap)(t,{auto_start:"autoStart",job_type:"jobType",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens"}));ot.DetailedJobOut$outboundSchema=Vt.object({id:Vt.string(),autoStart:Vt.boolean(),hyperparameters:DPt.TrainingParameters$outboundSchema,model:Vt.string(),status:ot.DetailedJobOutStatus$outboundSchema,jobType:Vt.string(),createdAt:Vt.number().int(),modifiedAt:Vt.number().int(),trainingFiles:Vt.array(Vt.string()),validationFiles:Vt.nullable(Vt.array(Vt.string())).optional(),object:Vt.literal("job").default("job"),fineTunedModel:Vt.nullable(Vt.string()).optional(),suffix:Vt.nullable(Vt.string()).optional(),integrations:Vt.nullable(Vt.array(Vre.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Vt.nullable(Vt.number().int()).optional(),repositories:Vt.array(Hre.GithubRepositoryOut$outboundSchema).optional(),metadata:Vt.nullable(jPt.JobMetadataOut$outboundSchema).optional(),events:Vt.array(RPt.EventOut$outboundSchema).optional(),checkpoints:Vt.array(MPt.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,IPt.remap)(t,{autoStart:"auto_start",jobType:"job_type",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens"}));var APt;(function(t){t.inboundSchema=ot.DetailedJobOut$inboundSchema,t.outboundSchema=ot.DetailedJobOut$outboundSchema})(APt||(ot.DetailedJobOut$=APt={}));function OWr(t){return JSON.stringify(ot.DetailedJobOut$outboundSchema.parse(t))}function EWr(t){return(0,zPe.safeParse)(t,e=>ot.DetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOut' from JSON")}});var $Pt=b(mo=>{"use strict";var PWr=mo&&mo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TWr=mo&&mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AWr=mo&&mo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PWr(e,t,r);return TWr(e,t),e};Object.defineProperty(mo,"__esModule",{value:!0});mo.EmbeddingRequest$=mo.EmbeddingRequest$outboundSchema=mo.EmbeddingRequest$inboundSchema=mo.Inputs$=mo.Inputs$outboundSchema=mo.Inputs$inboundSchema=void 0;mo.inputsToJSON=IWr;mo.inputsFromJSON=MWr;mo.embeddingRequestToJSON=RWr;mo.embeddingRequestFromJSON=jWr;var ea=AWr(ye()),kPt=Re(),BPt=pe();mo.Inputs$inboundSchema=ea.union([ea.string(),ea.array(ea.string())]);mo.Inputs$outboundSchema=ea.union([ea.string(),ea.array(ea.string())]);var LPt;(function(t){t.inboundSchema=mo.Inputs$inboundSchema,t.outboundSchema=mo.Inputs$outboundSchema})(LPt||(mo.Inputs$=LPt={}));function IWr(t){return JSON.stringify(mo.Inputs$outboundSchema.parse(t))}function MWr(t){return(0,BPt.safeParse)(t,e=>mo.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}mo.EmbeddingRequest$inboundSchema=ea.object({input:ea.union([ea.string(),ea.array(ea.string())]),model:ea.string().default("mistral-embed"),encoding_format:ea.nullable(ea.string()).optional()}).transform(t=>(0,kPt.remap)(t,{input:"inputs",encoding_format:"encodingFormat"}));mo.EmbeddingRequest$outboundSchema=ea.object({inputs:ea.union([ea.string(),ea.array(ea.string())]),model:ea.string().default("mistral-embed"),encodingFormat:ea.nullable(ea.string()).optional()}).transform(t=>(0,kPt.remap)(t,{inputs:"input",encodingFormat:"encoding_format"}));var FPt;(function(t){t.inboundSchema=mo.EmbeddingRequest$inboundSchema,t.outboundSchema=mo.EmbeddingRequest$outboundSchema})(FPt||(mo.EmbeddingRequest$=FPt={}));function RWr(t){return JSON.stringify(mo.EmbeddingRequest$outboundSchema.parse(t))}function jWr(t){return(0,BPt.safeParse)(t,e=>mo.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var HPe=b(tu=>{"use strict";var DWr=tu&&tu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NWr=tu&&tu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LWr=tu&&tu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&DWr(e,t,r);return NWr(e,t),e};Object.defineProperty(tu,"__esModule",{value:!0});tu.EmbeddingResponseData$=tu.EmbeddingResponseData$outboundSchema=tu.EmbeddingResponseData$inboundSchema=void 0;tu.embeddingResponseDataToJSON=kWr;tu.embeddingResponseDataFromJSON=BWr;var fS=LWr(ye()),FWr=pe();tu.EmbeddingResponseData$inboundSchema=fS.object({object:fS.string().optional(),embedding:fS.array(fS.number()).optional(),index:fS.number().int().optional()});tu.EmbeddingResponseData$outboundSchema=fS.object({object:fS.string().optional(),embedding:fS.array(fS.number()).optional(),index:fS.number().int().optional()});var qPt;(function(t){t.inboundSchema=tu.EmbeddingResponseData$inboundSchema,t.outboundSchema=tu.EmbeddingResponseData$outboundSchema})(qPt||(tu.EmbeddingResponseData$=qPt={}));function kWr(t){return JSON.stringify(tu.EmbeddingResponseData$outboundSchema.parse(t))}function BWr(t){return(0,FWr.safeParse)(t,e=>tu.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var VPt=b(ru=>{"use strict";var $Wr=ru&&ru.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qWr=ru&&ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UWr=ru&&ru.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Wr(e,t,r);return qWr(e,t),e};Object.defineProperty(ru,"__esModule",{value:!0});ru.EmbeddingResponse$=ru.EmbeddingResponse$outboundSchema=ru.EmbeddingResponse$inboundSchema=void 0;ru.embeddingResponseToJSON=HWr;ru.embeddingResponseFromJSON=VWr;var pS=UWr(ye()),zWr=pe(),zPt=HPe(),HPt=NB();ru.EmbeddingResponse$inboundSchema=pS.object({id:pS.string(),object:pS.string(),model:pS.string(),usage:HPt.UsageInfo$inboundSchema,data:pS.array(zPt.EmbeddingResponseData$inboundSchema)});ru.EmbeddingResponse$outboundSchema=pS.object({id:pS.string(),object:pS.string(),model:pS.string(),usage:HPt.UsageInfo$outboundSchema,data:pS.array(zPt.EmbeddingResponseData$outboundSchema)});var UPt;(function(t){t.inboundSchema=ru.EmbeddingResponse$inboundSchema,t.outboundSchema=ru.EmbeddingResponse$outboundSchema})(UPt||(ru.EmbeddingResponse$=UPt={}));function HWr(t){return JSON.stringify(ru.EmbeddingResponse$outboundSchema.parse(t))}function VWr(t){return(0,zWr.safeParse)(t,e=>ru.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var gH=b(nu=>{"use strict";var WWr=nu&&nu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KWr=nu&&nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JWr=nu&&nu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WWr(e,t,r);return KWr(e,t),e};Object.defineProperty(nu,"__esModule",{value:!0});nu.FilePurpose$=nu.FilePurpose$outboundSchema=nu.FilePurpose$inboundSchema=nu.FilePurpose=void 0;var Q1=JWr(ye()),GWr=NT();nu.FilePurpose={FineTune:"fine-tune",Batch:"batch"};nu.FilePurpose$inboundSchema=Q1.union([Q1.nativeEnum(nu.FilePurpose),Q1.string().transform(GWr.catchUnrecognizedEnum)]);nu.FilePurpose$outboundSchema=Q1.union([Q1.nativeEnum(nu.FilePurpose),Q1.string().and(Q1.custom())]);var WPt;(function(t){t.inboundSchema=nu.FilePurpose$inboundSchema,t.outboundSchema=nu.FilePurpose$outboundSchema})(WPt||(nu.FilePurpose$=WPt={}))});var yH=b(ou=>{"use strict";var YWr=ou&&ou.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZWr=ou&&ou.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XWr=ou&&ou.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YWr(e,t,r);return ZWr(e,t),e};Object.defineProperty(ou,"__esModule",{value:!0});ou.SampleType$=ou.SampleType$outboundSchema=ou.SampleType$inboundSchema=ou.SampleType=void 0;var ej=XWr(ye()),QWr=NT();ou.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};ou.SampleType$inboundSchema=ej.union([ej.nativeEnum(ou.SampleType),ej.string().transform(QWr.catchUnrecognizedEnum)]);ou.SampleType$outboundSchema=ej.union([ej.nativeEnum(ou.SampleType),ej.string().and(ej.custom())]);var KPt;(function(t){t.inboundSchema=ou.SampleType$inboundSchema,t.outboundSchema=ou.SampleType$outboundSchema})(KPt||(ou.SampleType$=KPt={}))});var bH=b(iu=>{"use strict";var eKr=iu&&iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tKr=iu&&iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rKr=iu&&iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eKr(e,t,r);return tKr(e,t),e};Object.defineProperty(iu,"__esModule",{value:!0});iu.Source$=iu.Source$outboundSchema=iu.Source$inboundSchema=iu.Source=void 0;var tj=rKr(ye()),nKr=NT();iu.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};iu.Source$inboundSchema=tj.union([tj.nativeEnum(iu.Source),tj.string().transform(nKr.catchUnrecognizedEnum)]);iu.Source$outboundSchema=tj.union([tj.nativeEnum(iu.Source),tj.string().and(tj.custom())]);var JPt;(function(t){t.inboundSchema=iu.Source$inboundSchema,t.outboundSchema=iu.Source$outboundSchema})(JPt||(iu.Source$=JPt={}))});var VPe=b(au=>{"use strict";var oKr=au&&au.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iKr=au&&au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aKr=au&&au.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oKr(e,t,r);return iKr(e,t),e};Object.defineProperty(au,"__esModule",{value:!0});au.FileSchema$=au.FileSchema$outboundSchema=au.FileSchema$inboundSchema=void 0;au.fileSchemaToJSON=uKr;au.fileSchemaFromJSON=lKr;var yd=aKr(ye()),YPt=Re(),sKr=pe(),ZPt=gH(),XPt=yH(),QPt=bH();au.FileSchema$inboundSchema=yd.object({id:yd.string(),object:yd.string(),bytes:yd.number().int(),created_at:yd.number().int(),filename:yd.string(),purpose:ZPt.FilePurpose$inboundSchema,sample_type:XPt.SampleType$inboundSchema,num_lines:yd.nullable(yd.number().int()).optional(),source:QPt.Source$inboundSchema}).transform(t=>(0,YPt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));au.FileSchema$outboundSchema=yd.object({id:yd.string(),object:yd.string(),sizeBytes:yd.number().int(),createdAt:yd.number().int(),filename:yd.string(),purpose:ZPt.FilePurpose$outboundSchema,sampleType:XPt.SampleType$outboundSchema,numLines:yd.nullable(yd.number().int()).optional(),source:QPt.Source$outboundSchema}).transform(t=>(0,YPt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var GPt;(function(t){t.inboundSchema=au.FileSchema$inboundSchema,t.outboundSchema=au.FileSchema$outboundSchema})(GPt||(au.FileSchema$=GPt={}));function uKr(t){return JSON.stringify(au.FileSchema$outboundSchema.parse(t))}function lKr(t){return(0,sKr.safeParse)(t,e=>au.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var tTt=b(su=>{"use strict";var cKr=su&&su.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dKr=su&&su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fKr=su&&su.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cKr(e,t,r);return dKr(e,t),e};Object.defineProperty(su,"__esModule",{value:!0});su.FileSignedURL$=su.FileSignedURL$outboundSchema=su.FileSignedURL$inboundSchema=void 0;su.fileSignedURLToJSON=mKr;su.fileSignedURLFromJSON=hKr;var Wre=fKr(ye()),pKr=pe();su.FileSignedURL$inboundSchema=Wre.object({url:Wre.string()});su.FileSignedURL$outboundSchema=Wre.object({url:Wre.string()});var eTt;(function(t){t.inboundSchema=su.FileSignedURL$inboundSchema,t.outboundSchema=su.FileSignedURL$outboundSchema})(eTt||(su.FileSignedURL$=eTt={}));function mKr(t){return JSON.stringify(su.FileSignedURL$outboundSchema.parse(t))}function hKr(t){return(0,pKr.safeParse)(t,e=>su.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var aTt=b(ho=>{"use strict";var gKr=ho&&ho.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yKr=ho&&ho.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bKr=ho&&ho.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gKr(e,t,r);return yKr(e,t),e};Object.defineProperty(ho,"__esModule",{value:!0});ho.FIMCompletionRequest$=ho.FIMCompletionRequest$outboundSchema=ho.FIMCompletionRequest$inboundSchema=ho.FIMCompletionRequestStop$=ho.FIMCompletionRequestStop$outboundSchema=ho.FIMCompletionRequestStop$inboundSchema=void 0;ho.fimCompletionRequestStopToJSON=_Kr;ho.fimCompletionRequestStopFromJSON=vKr;ho.fimCompletionRequestToJSON=wKr;ho.fimCompletionRequestFromJSON=SKr;var Qt=bKr(ye()),oTt=Re(),iTt=pe();ho.FIMCompletionRequestStop$inboundSchema=Qt.union([Qt.string(),Qt.array(Qt.string())]);ho.FIMCompletionRequestStop$outboundSchema=Qt.union([Qt.string(),Qt.array(Qt.string())]);var rTt;(function(t){t.inboundSchema=ho.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=ho.FIMCompletionRequestStop$outboundSchema})(rTt||(ho.FIMCompletionRequestStop$=rTt={}));function _Kr(t){return JSON.stringify(ho.FIMCompletionRequestStop$outboundSchema.parse(t))}function vKr(t){return(0,iTt.safeParse)(t,e=>ho.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}ho.FIMCompletionRequest$inboundSchema=Qt.object({model:Qt.nullable(Qt.string()),temperature:Qt.nullable(Qt.number()).optional(),top_p:Qt.number().default(1),max_tokens:Qt.nullable(Qt.number().int()).optional(),stream:Qt.boolean().default(!1),stop:Qt.union([Qt.string(),Qt.array(Qt.string())]).optional(),random_seed:Qt.nullable(Qt.number().int()).optional(),prompt:Qt.string(),suffix:Qt.nullable(Qt.string()).optional(),min_tokens:Qt.nullable(Qt.number().int()).optional()}).transform(t=>(0,oTt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));ho.FIMCompletionRequest$outboundSchema=Qt.object({model:Qt.nullable(Qt.string()),temperature:Qt.nullable(Qt.number()).optional(),topP:Qt.number().default(1),maxTokens:Qt.nullable(Qt.number().int()).optional(),stream:Qt.boolean().default(!1),stop:Qt.union([Qt.string(),Qt.array(Qt.string())]).optional(),randomSeed:Qt.nullable(Qt.number().int()).optional(),prompt:Qt.string(),suffix:Qt.nullable(Qt.string()).optional(),minTokens:Qt.nullable(Qt.number().int()).optional()}).transform(t=>(0,oTt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var nTt;(function(t){t.inboundSchema=ho.FIMCompletionRequest$inboundSchema,t.outboundSchema=ho.FIMCompletionRequest$outboundSchema})(nTt||(ho.FIMCompletionRequest$=nTt={}));function wKr(t){return JSON.stringify(ho.FIMCompletionRequest$outboundSchema.parse(t))}function SKr(t){return(0,iTt.safeParse)(t,e=>ho.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var cTt=b(uu=>{"use strict";var xKr=uu&&uu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CKr=uu&&uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OKr=uu&&uu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xKr(e,t,r);return CKr(e,t),e};Object.defineProperty(uu,"__esModule",{value:!0});uu.FIMCompletionResponse$=uu.FIMCompletionResponse$outboundSchema=uu.FIMCompletionResponse$inboundSchema=void 0;uu.fimCompletionResponseToJSON=PKr;uu.fimCompletionResponseFromJSON=TKr;var Eh=OKr(ye()),EKr=pe(),uTt=Cre(),lTt=NB();uu.FIMCompletionResponse$inboundSchema=Eh.object({id:Eh.string(),object:Eh.string(),model:Eh.string(),usage:lTt.UsageInfo$inboundSchema,created:Eh.number().int().optional(),choices:Eh.array(uTt.ChatCompletionChoice$inboundSchema).optional()});uu.FIMCompletionResponse$outboundSchema=Eh.object({id:Eh.string(),object:Eh.string(),model:Eh.string(),usage:lTt.UsageInfo$outboundSchema,created:Eh.number().int().optional(),choices:Eh.array(uTt.ChatCompletionChoice$outboundSchema).optional()});var sTt;(function(t){t.inboundSchema=uu.FIMCompletionResponse$inboundSchema,t.outboundSchema=uu.FIMCompletionResponse$outboundSchema})(sTt||(uu.FIMCompletionResponse$=sTt={}));function PKr(t){return JSON.stringify(uu.FIMCompletionResponse$outboundSchema.parse(t))}function TKr(t){return(0,EKr.safeParse)(t,e=>uu.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var hTt=b(go=>{"use strict";var AKr=go&&go.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IKr=go&&go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MKr=go&&go.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AKr(e,t,r);return IKr(e,t),e};Object.defineProperty(go,"__esModule",{value:!0});go.FIMCompletionStreamRequest$=go.FIMCompletionStreamRequest$outboundSchema=go.FIMCompletionStreamRequest$inboundSchema=go.FIMCompletionStreamRequestStop$=go.FIMCompletionStreamRequestStop$outboundSchema=go.FIMCompletionStreamRequestStop$inboundSchema=void 0;go.fimCompletionStreamRequestStopToJSON=RKr;go.fimCompletionStreamRequestStopFromJSON=jKr;go.fimCompletionStreamRequestToJSON=DKr;go.fimCompletionStreamRequestFromJSON=NKr;var er=MKr(ye()),pTt=Re(),mTt=pe();go.FIMCompletionStreamRequestStop$inboundSchema=er.union([er.string(),er.array(er.string())]);go.FIMCompletionStreamRequestStop$outboundSchema=er.union([er.string(),er.array(er.string())]);var dTt;(function(t){t.inboundSchema=go.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=go.FIMCompletionStreamRequestStop$outboundSchema})(dTt||(go.FIMCompletionStreamRequestStop$=dTt={}));function RKr(t){return JSON.stringify(go.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function jKr(t){return(0,mTt.safeParse)(t,e=>go.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}go.FIMCompletionStreamRequest$inboundSchema=er.object({model:er.nullable(er.string()),temperature:er.nullable(er.number()).optional(),top_p:er.number().default(1),max_tokens:er.nullable(er.number().int()).optional(),stream:er.boolean().default(!0),stop:er.union([er.string(),er.array(er.string())]).optional(),random_seed:er.nullable(er.number().int()).optional(),prompt:er.string(),suffix:er.nullable(er.string()).optional(),min_tokens:er.nullable(er.number().int()).optional()}).transform(t=>(0,pTt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));go.FIMCompletionStreamRequest$outboundSchema=er.object({model:er.nullable(er.string()),temperature:er.nullable(er.number()).optional(),topP:er.number().default(1),maxTokens:er.nullable(er.number().int()).optional(),stream:er.boolean().default(!0),stop:er.union([er.string(),er.array(er.string())]).optional(),randomSeed:er.nullable(er.number().int()).optional(),prompt:er.string(),suffix:er.nullable(er.string()).optional(),minTokens:er.nullable(er.number().int()).optional()}).transform(t=>(0,pTt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var fTt;(function(t){t.inboundSchema=go.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=go.FIMCompletionStreamRequest$outboundSchema})(fTt||(go.FIMCompletionStreamRequest$=fTt={}));function DKr(t){return JSON.stringify(go.FIMCompletionStreamRequest$outboundSchema.parse(t))}function NKr(t){return(0,mTt.safeParse)(t,e=>go.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var WPe=b(lu=>{"use strict";var LKr=lu&&lu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FKr=lu&&lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kKr=lu&&lu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LKr(e,t,r);return FKr(e,t),e};Object.defineProperty(lu,"__esModule",{value:!0});lu.FTModelCapabilitiesOut$=lu.FTModelCapabilitiesOut$outboundSchema=lu.FTModelCapabilitiesOut$inboundSchema=void 0;lu.ftModelCapabilitiesOutToJSON=$Kr;lu.ftModelCapabilitiesOutFromJSON=qKr;var mS=kKr(ye()),yTt=Re(),BKr=pe();lu.FTModelCapabilitiesOut$inboundSchema=mS.object({completion_chat:mS.boolean().default(!0),completion_fim:mS.boolean().default(!1),function_calling:mS.boolean().default(!1),fine_tuning:mS.boolean().default(!1)}).transform(t=>(0,yTt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));lu.FTModelCapabilitiesOut$outboundSchema=mS.object({completionChat:mS.boolean().default(!0),completionFim:mS.boolean().default(!1),functionCalling:mS.boolean().default(!1),fineTuning:mS.boolean().default(!1)}).transform(t=>(0,yTt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var gTt;(function(t){t.inboundSchema=lu.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=lu.FTModelCapabilitiesOut$outboundSchema})(gTt||(lu.FTModelCapabilitiesOut$=gTt={}));function $Kr(t){return JSON.stringify(lu.FTModelCapabilitiesOut$outboundSchema.parse(t))}function qKr(t){return(0,BKr.safeParse)(t,e=>lu.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var KPe=b(yo=>{"use strict";var UKr=yo&&yo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zKr=yo&&yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HKr=yo&&yo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UKr(e,t,r);return zKr(e,t),e};Object.defineProperty(yo,"__esModule",{value:!0});yo.FTModelCard$=yo.FTModelCard$outboundSchema=yo.FTModelCard$inboundSchema=yo.FTModelCardType$=yo.FTModelCardType$outboundSchema=yo.FTModelCardType$inboundSchema=yo.FTModelCardType=void 0;yo.ftModelCardToJSON=WKr;yo.ftModelCardFromJSON=KKr;var $r=HKr(ye()),vTt=Re(),VKr=pe(),wTt=Sre();yo.FTModelCardType={FineTuned:"fine-tuned"};yo.FTModelCardType$inboundSchema=$r.nativeEnum(yo.FTModelCardType);yo.FTModelCardType$outboundSchema=yo.FTModelCardType$inboundSchema;var bTt;(function(t){t.inboundSchema=yo.FTModelCardType$inboundSchema,t.outboundSchema=yo.FTModelCardType$outboundSchema})(bTt||(yo.FTModelCardType$=bTt={}));yo.FTModelCard$inboundSchema=$r.object({id:$r.string(),object:$r.string().default("model"),created:$r.number().int().optional(),owned_by:$r.string().default("mistralai"),capabilities:wTt.ModelCapabilities$inboundSchema,name:$r.nullable($r.string()).optional(),description:$r.nullable($r.string()).optional(),max_context_length:$r.number().int().default(32768),aliases:$r.array($r.string()).optional(),deprecation:$r.nullable($r.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:$r.nullable($r.number()).optional(),type:$r.literal("fine-tuned").default("fine-tuned"),job:$r.string(),root:$r.string(),archived:$r.boolean().default(!1)}).transform(t=>(0,vTt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));yo.FTModelCard$outboundSchema=$r.object({id:$r.string(),object:$r.string().default("model"),created:$r.number().int().optional(),ownedBy:$r.string().default("mistralai"),capabilities:wTt.ModelCapabilities$outboundSchema,name:$r.nullable($r.string()).optional(),description:$r.nullable($r.string()).optional(),maxContextLength:$r.number().int().default(32768),aliases:$r.array($r.string()).optional(),deprecation:$r.nullable($r.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:$r.nullable($r.number()).optional(),type:$r.literal("fine-tuned").default("fine-tuned"),job:$r.string(),root:$r.string(),archived:$r.boolean().default(!1)}).transform(t=>(0,vTt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var _Tt;(function(t){t.inboundSchema=yo.FTModelCard$inboundSchema,t.outboundSchema=yo.FTModelCard$outboundSchema})(_Tt||(yo.FTModelCard$=_Tt={}));function WKr(t){return JSON.stringify(yo.FTModelCard$outboundSchema.parse(t))}function KKr(t){return(0,VKr.safeParse)(t,e=>yo.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var ETt=b(bo=>{"use strict";var JKr=bo&&bo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GKr=bo&&bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YKr=bo&&bo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JKr(e,t,r);return GKr(e,t),e};Object.defineProperty(bo,"__esModule",{value:!0});bo.FTModelOut$=bo.FTModelOut$outboundSchema=bo.FTModelOut$inboundSchema=bo.FTModelOutObject$=bo.FTModelOutObject$outboundSchema=bo.FTModelOutObject$inboundSchema=bo.FTModelOutObject=void 0;bo.ftModelOutToJSON=XKr;bo.ftModelOutFromJSON=QKr;var Lo=YKr(ye()),CTt=Re(),ZKr=pe(),OTt=WPe();bo.FTModelOutObject={Model:"model"};bo.FTModelOutObject$inboundSchema=Lo.nativeEnum(bo.FTModelOutObject);bo.FTModelOutObject$outboundSchema=bo.FTModelOutObject$inboundSchema;var STt;(function(t){t.inboundSchema=bo.FTModelOutObject$inboundSchema,t.outboundSchema=bo.FTModelOutObject$outboundSchema})(STt||(bo.FTModelOutObject$=STt={}));bo.FTModelOut$inboundSchema=Lo.object({id:Lo.string(),object:Lo.literal("model").default("model"),created:Lo.number().int(),owned_by:Lo.string(),root:Lo.string(),archived:Lo.boolean(),name:Lo.nullable(Lo.string()).optional(),description:Lo.nullable(Lo.string()).optional(),capabilities:OTt.FTModelCapabilitiesOut$inboundSchema,max_context_length:Lo.number().int().default(32768),aliases:Lo.array(Lo.string()).optional(),job:Lo.string()}).transform(t=>(0,CTt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));bo.FTModelOut$outboundSchema=Lo.object({id:Lo.string(),object:Lo.literal("model").default("model"),created:Lo.number().int(),ownedBy:Lo.string(),root:Lo.string(),archived:Lo.boolean(),name:Lo.nullable(Lo.string()).optional(),description:Lo.nullable(Lo.string()).optional(),capabilities:OTt.FTModelCapabilitiesOut$outboundSchema,maxContextLength:Lo.number().int().default(32768),aliases:Lo.array(Lo.string()).optional(),job:Lo.string()}).transform(t=>(0,CTt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var xTt;(function(t){t.inboundSchema=bo.FTModelOut$inboundSchema,t.outboundSchema=bo.FTModelOut$outboundSchema})(xTt||(bo.FTModelOut$=xTt={}));function XKr(t){return JSON.stringify(bo.FTModelOut$outboundSchema.parse(t))}function QKr(t){return(0,ZKr.safeParse)(t,e=>bo.FTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelOut' from JSON")}});var JPe=b(_o=>{"use strict";var eJr=_o&&_o.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tJr=_o&&_o.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rJr=_o&&_o.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eJr(e,t,r);return tJr(e,t),e};Object.defineProperty(_o,"__esModule",{value:!0});_o.GithubRepositoryIn$=_o.GithubRepositoryIn$outboundSchema=_o.GithubRepositoryIn$inboundSchema=_o.GithubRepositoryInType$=_o.GithubRepositoryInType$outboundSchema=_o.GithubRepositoryInType$inboundSchema=_o.GithubRepositoryInType=void 0;_o.githubRepositoryInToJSON=oJr;_o.githubRepositoryInFromJSON=iJr;var xc=rJr(ye()),nJr=pe();_o.GithubRepositoryInType={Github:"github"};_o.GithubRepositoryInType$inboundSchema=xc.nativeEnum(_o.GithubRepositoryInType);_o.GithubRepositoryInType$outboundSchema=_o.GithubRepositoryInType$inboundSchema;var PTt;(function(t){t.inboundSchema=_o.GithubRepositoryInType$inboundSchema,t.outboundSchema=_o.GithubRepositoryInType$outboundSchema})(PTt||(_o.GithubRepositoryInType$=PTt={}));_o.GithubRepositoryIn$inboundSchema=xc.object({type:xc.literal("github").default("github"),name:xc.string(),owner:xc.string(),ref:xc.nullable(xc.string()).optional(),weight:xc.number().default(1),token:xc.string()});_o.GithubRepositoryIn$outboundSchema=xc.object({type:xc.literal("github").default("github"),name:xc.string(),owner:xc.string(),ref:xc.nullable(xc.string()).optional(),weight:xc.number().default(1),token:xc.string()});var TTt;(function(t){t.inboundSchema=_o.GithubRepositoryIn$inboundSchema,t.outboundSchema=_o.GithubRepositoryIn$outboundSchema})(TTt||(_o.GithubRepositoryIn$=TTt={}));function oJr(t){return JSON.stringify(_o.GithubRepositoryIn$outboundSchema.parse(t))}function iJr(t){return(0,nJr.safeParse)(t,e=>_o.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var GPe=b(cu=>{"use strict";var aJr=cu&&cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sJr=cu&&cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uJr=cu&&cu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aJr(e,t,r);return sJr(e,t),e};Object.defineProperty(cu,"__esModule",{value:!0});cu.TrainingFile$=cu.TrainingFile$outboundSchema=cu.TrainingFile$inboundSchema=void 0;cu.trainingFileToJSON=cJr;cu.trainingFileFromJSON=dJr;var FB=uJr(ye()),ITt=Re(),lJr=pe();cu.TrainingFile$inboundSchema=FB.object({file_id:FB.string(),weight:FB.number().default(1)}).transform(t=>(0,ITt.remap)(t,{file_id:"fileId"}));cu.TrainingFile$outboundSchema=FB.object({fileId:FB.string(),weight:FB.number().default(1)}).transform(t=>(0,ITt.remap)(t,{fileId:"file_id"}));var ATt;(function(t){t.inboundSchema=cu.TrainingFile$inboundSchema,t.outboundSchema=cu.TrainingFile$outboundSchema})(ATt||(cu.TrainingFile$=ATt={}));function cJr(t){return JSON.stringify(cu.TrainingFile$outboundSchema.parse(t))}function dJr(t){return(0,lJr.safeParse)(t,e=>cu.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var YPe=b(du=>{"use strict";var fJr=du&&du.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pJr=du&&du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mJr=du&&du.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fJr(e,t,r);return pJr(e,t),e};Object.defineProperty(du,"__esModule",{value:!0});du.TrainingParametersIn$=du.TrainingParametersIn$outboundSchema=du.TrainingParametersIn$inboundSchema=void 0;du.trainingParametersInToJSON=gJr;du.trainingParametersInFromJSON=yJr;var ai=mJr(ye()),RTt=Re(),hJr=pe();du.TrainingParametersIn$inboundSchema=ai.object({training_steps:ai.nullable(ai.number().int()).optional(),learning_rate:ai.number().default(1e-4),weight_decay:ai.nullable(ai.number()).optional(),warmup_fraction:ai.nullable(ai.number()).optional(),epochs:ai.nullable(ai.number()).optional(),fim_ratio:ai.nullable(ai.number()).optional(),seq_len:ai.nullable(ai.number().int()).optional()}).transform(t=>(0,RTt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));du.TrainingParametersIn$outboundSchema=ai.object({trainingSteps:ai.nullable(ai.number().int()).optional(),learningRate:ai.number().default(1e-4),weightDecay:ai.nullable(ai.number()).optional(),warmupFraction:ai.nullable(ai.number()).optional(),epochs:ai.nullable(ai.number()).optional(),fimRatio:ai.nullable(ai.number()).optional(),seqLen:ai.nullable(ai.number().int()).optional()}).transform(t=>(0,RTt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var MTt;(function(t){t.inboundSchema=du.TrainingParametersIn$inboundSchema,t.outboundSchema=du.TrainingParametersIn$outboundSchema})(MTt||(du.TrainingParametersIn$=MTt={}));function gJr(t){return JSON.stringify(du.TrainingParametersIn$outboundSchema.parse(t))}function yJr(t){return(0,hJr.safeParse)(t,e=>du.TrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParametersIn' from JSON")}});var ZPe=b(vo=>{"use strict";var bJr=vo&&vo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Jr=vo&&vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vJr=vo&&vo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bJr(e,t,r);return _Jr(e,t),e};Object.defineProperty(vo,"__esModule",{value:!0});vo.WandbIntegration$=vo.WandbIntegration$outboundSchema=vo.WandbIntegration$inboundSchema=vo.WandbIntegrationType$=vo.WandbIntegrationType$outboundSchema=vo.WandbIntegrationType$inboundSchema=vo.WandbIntegrationType=void 0;vo.wandbIntegrationToJSON=SJr;vo.wandbIntegrationFromJSON=xJr;var Cc=vJr(ye()),NTt=Re(),wJr=pe();vo.WandbIntegrationType={Wandb:"wandb"};vo.WandbIntegrationType$inboundSchema=Cc.nativeEnum(vo.WandbIntegrationType);vo.WandbIntegrationType$outboundSchema=vo.WandbIntegrationType$inboundSchema;var jTt;(function(t){t.inboundSchema=vo.WandbIntegrationType$inboundSchema,t.outboundSchema=vo.WandbIntegrationType$outboundSchema})(jTt||(vo.WandbIntegrationType$=jTt={}));vo.WandbIntegration$inboundSchema=Cc.object({type:Cc.literal("wandb").default("wandb"),project:Cc.string(),name:Cc.nullable(Cc.string()).optional(),api_key:Cc.string(),run_name:Cc.nullable(Cc.string()).optional()}).transform(t=>(0,NTt.remap)(t,{api_key:"apiKey",run_name:"runName"}));vo.WandbIntegration$outboundSchema=Cc.object({type:Cc.literal("wandb").default("wandb"),project:Cc.string(),name:Cc.nullable(Cc.string()).optional(),apiKey:Cc.string(),runName:Cc.nullable(Cc.string()).optional()}).transform(t=>(0,NTt.remap)(t,{apiKey:"api_key",runName:"run_name"}));var DTt;(function(t){t.inboundSchema=vo.WandbIntegration$inboundSchema,t.outboundSchema=vo.WandbIntegration$outboundSchema})(DTt||(vo.WandbIntegration$=DTt={}));function SJr(t){return JSON.stringify(vo.WandbIntegration$outboundSchema.parse(t))}function xJr(t){return(0,wJr.safeParse)(t,e=>vo.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var UTt=b(vr=>{"use strict";var CJr=vr&&vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OJr=vr&&vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EJr=vr&&vr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CJr(e,t,r);return OJr(e,t),e};Object.defineProperty(vr,"__esModule",{value:!0});vr.JobIn$=vr.JobIn$outboundSchema=vr.JobIn$inboundSchema=vr.JobInRepositories$=vr.JobInRepositories$outboundSchema=vr.JobInRepositories$inboundSchema=vr.JobInIntegrations$=vr.JobInIntegrations$outboundSchema=vr.JobInIntegrations$inboundSchema=void 0;vr.jobInIntegrationsToJSON=PJr;vr.jobInIntegrationsFromJSON=TJr;vr.jobInRepositoriesToJSON=AJr;vr.jobInRepositoriesFromJSON=IJr;vr.jobInToJSON=MJr;vr.jobInFromJSON=RJr;var ta=EJr(ye()),BTt=Re(),XPe=pe(),Kre=JPe(),$Tt=GPe(),qTt=YPe(),Jre=ZPe();vr.JobInIntegrations$inboundSchema=Jre.WandbIntegration$inboundSchema;vr.JobInIntegrations$outboundSchema=Jre.WandbIntegration$outboundSchema;var LTt;(function(t){t.inboundSchema=vr.JobInIntegrations$inboundSchema,t.outboundSchema=vr.JobInIntegrations$outboundSchema})(LTt||(vr.JobInIntegrations$=LTt={}));function PJr(t){return JSON.stringify(vr.JobInIntegrations$outboundSchema.parse(t))}function TJr(t){return(0,XPe.safeParse)(t,e=>vr.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}vr.JobInRepositories$inboundSchema=Kre.GithubRepositoryIn$inboundSchema;vr.JobInRepositories$outboundSchema=Kre.GithubRepositoryIn$outboundSchema;var FTt;(function(t){t.inboundSchema=vr.JobInRepositories$inboundSchema,t.outboundSchema=vr.JobInRepositories$outboundSchema})(FTt||(vr.JobInRepositories$=FTt={}));function AJr(t){return JSON.stringify(vr.JobInRepositories$outboundSchema.parse(t))}function IJr(t){return(0,XPe.safeParse)(t,e=>vr.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}vr.JobIn$inboundSchema=ta.object({model:ta.string(),training_files:ta.array($Tt.TrainingFile$inboundSchema).optional(),validation_files:ta.nullable(ta.array(ta.string())).optional(),hyperparameters:qTt.TrainingParametersIn$inboundSchema,suffix:ta.nullable(ta.string()).optional(),integrations:ta.nullable(ta.array(Jre.WandbIntegration$inboundSchema)).optional(),repositories:ta.array(Kre.GithubRepositoryIn$inboundSchema).optional(),auto_start:ta.boolean().optional()}).transform(t=>(0,BTt.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));vr.JobIn$outboundSchema=ta.object({model:ta.string(),trainingFiles:ta.array($Tt.TrainingFile$outboundSchema).optional(),validationFiles:ta.nullable(ta.array(ta.string())).optional(),hyperparameters:qTt.TrainingParametersIn$outboundSchema,suffix:ta.nullable(ta.string()).optional(),integrations:ta.nullable(ta.array(Jre.WandbIntegration$outboundSchema)).optional(),repositories:ta.array(Kre.GithubRepositoryIn$outboundSchema).optional(),autoStart:ta.boolean().optional()}).transform(t=>(0,BTt.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var kTt;(function(t){t.inboundSchema=vr.JobIn$inboundSchema,t.outboundSchema=vr.JobIn$outboundSchema})(kTt||(vr.JobIn$=kTt={}));function MJr(t){return JSON.stringify(vr.JobIn$outboundSchema.parse(t))}function RJr(t){return(0,XPe.safeParse)(t,e=>vr.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var eTe=b(it=>{"use strict";var jJr=it&&it.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DJr=it&&it.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NJr=it&&it.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jJr(e,t,r);return DJr(e,t),e};Object.defineProperty(it,"__esModule",{value:!0});it.JobOut$=it.JobOut$outboundSchema=it.JobOut$inboundSchema=it.Repositories$=it.Repositories$outboundSchema=it.Repositories$inboundSchema=it.Integrations$=it.Integrations$outboundSchema=it.Integrations$inboundSchema=it.ObjectT$=it.ObjectT$outboundSchema=it.ObjectT$inboundSchema=it.Status$=it.Status$outboundSchema=it.Status$inboundSchema=it.ObjectT=it.Status=void 0;it.integrationsToJSON=LJr;it.integrationsFromJSON=FJr;it.repositoriesToJSON=kJr;it.repositoriesFromJSON=BJr;it.jobOutToJSON=$Jr;it.jobOutFromJSON=qJr;var tr=NJr(ye()),JTt=Re(),QPe=pe(),Gre=$re(),GTt=qre(),YTt=Ure(),Yre=zre();it.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};it.ObjectT={Job:"job"};it.Status$inboundSchema=tr.nativeEnum(it.Status);it.Status$outboundSchema=it.Status$inboundSchema;var zTt;(function(t){t.inboundSchema=it.Status$inboundSchema,t.outboundSchema=it.Status$outboundSchema})(zTt||(it.Status$=zTt={}));it.ObjectT$inboundSchema=tr.nativeEnum(it.ObjectT);it.ObjectT$outboundSchema=it.ObjectT$inboundSchema;var HTt;(function(t){t.inboundSchema=it.ObjectT$inboundSchema,t.outboundSchema=it.ObjectT$outboundSchema})(HTt||(it.ObjectT$=HTt={}));it.Integrations$inboundSchema=Yre.WandbIntegrationOut$inboundSchema;it.Integrations$outboundSchema=Yre.WandbIntegrationOut$outboundSchema;var VTt;(function(t){t.inboundSchema=it.Integrations$inboundSchema,t.outboundSchema=it.Integrations$outboundSchema})(VTt||(it.Integrations$=VTt={}));function LJr(t){return JSON.stringify(it.Integrations$outboundSchema.parse(t))}function FJr(t){return(0,QPe.safeParse)(t,e=>it.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}it.Repositories$inboundSchema=Gre.GithubRepositoryOut$inboundSchema;it.Repositories$outboundSchema=Gre.GithubRepositoryOut$outboundSchema;var WTt;(function(t){t.inboundSchema=it.Repositories$inboundSchema,t.outboundSchema=it.Repositories$outboundSchema})(WTt||(it.Repositories$=WTt={}));function kJr(t){return JSON.stringify(it.Repositories$outboundSchema.parse(t))}function BJr(t){return(0,QPe.safeParse)(t,e=>it.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}it.JobOut$inboundSchema=tr.object({id:tr.string(),auto_start:tr.boolean(),hyperparameters:YTt.TrainingParameters$inboundSchema,model:tr.string(),status:it.Status$inboundSchema,job_type:tr.string(),created_at:tr.number().int(),modified_at:tr.number().int(),training_files:tr.array(tr.string()),validation_files:tr.nullable(tr.array(tr.string())).optional(),object:tr.literal("job").default("job"),fine_tuned_model:tr.nullable(tr.string()).optional(),suffix:tr.nullable(tr.string()).optional(),integrations:tr.nullable(tr.array(Yre.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:tr.nullable(tr.number().int()).optional(),repositories:tr.array(Gre.GithubRepositoryOut$inboundSchema).optional(),metadata:tr.nullable(GTt.JobMetadataOut$inboundSchema).optional()}).transform(t=>(0,JTt.remap)(t,{auto_start:"autoStart",job_type:"jobType",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens"}));it.JobOut$outboundSchema=tr.object({id:tr.string(),autoStart:tr.boolean(),hyperparameters:YTt.TrainingParameters$outboundSchema,model:tr.string(),status:it.Status$outboundSchema,jobType:tr.string(),createdAt:tr.number().int(),modifiedAt:tr.number().int(),trainingFiles:tr.array(tr.string()),validationFiles:tr.nullable(tr.array(tr.string())).optional(),object:tr.literal("job").default("job"),fineTunedModel:tr.nullable(tr.string()).optional(),suffix:tr.nullable(tr.string()).optional(),integrations:tr.nullable(tr.array(Yre.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:tr.nullable(tr.number().int()).optional(),repositories:tr.array(Gre.GithubRepositoryOut$outboundSchema).optional(),metadata:tr.nullable(GTt.JobMetadataOut$outboundSchema).optional()}).transform(t=>(0,JTt.remap)(t,{autoStart:"auto_start",jobType:"job_type",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens"}));var KTt;(function(t){t.inboundSchema=it.JobOut$inboundSchema,t.outboundSchema=it.JobOut$outboundSchema})(KTt||(it.JobOut$=KTt={}));function $Jr(t){return JSON.stringify(it.JobOut$outboundSchema.parse(t))}function qJr(t){return(0,QPe.safeParse)(t,e=>it.JobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobOut' from JSON")}});var eAt=b(wo=>{"use strict";var UJr=wo&&wo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zJr=wo&&wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HJr=wo&&wo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UJr(e,t,r);return zJr(e,t),e};Object.defineProperty(wo,"__esModule",{value:!0});wo.JobsOut$=wo.JobsOut$outboundSchema=wo.JobsOut$inboundSchema=wo.JobsOutObject$=wo.JobsOutObject$outboundSchema=wo.JobsOutObject$inboundSchema=wo.JobsOutObject=void 0;wo.jobsOutToJSON=WJr;wo.jobsOutFromJSON=KJr;var jC=HJr(ye()),VJr=pe(),QTt=eTe();wo.JobsOutObject={List:"list"};wo.JobsOutObject$inboundSchema=jC.nativeEnum(wo.JobsOutObject);wo.JobsOutObject$outboundSchema=wo.JobsOutObject$inboundSchema;var ZTt;(function(t){t.inboundSchema=wo.JobsOutObject$inboundSchema,t.outboundSchema=wo.JobsOutObject$outboundSchema})(ZTt||(wo.JobsOutObject$=ZTt={}));wo.JobsOut$inboundSchema=jC.object({data:jC.array(QTt.JobOut$inboundSchema).optional(),object:jC.literal("list").default("list"),total:jC.number().int()});wo.JobsOut$outboundSchema=jC.object({data:jC.array(QTt.JobOut$outboundSchema).optional(),object:jC.literal("list").default("list"),total:jC.number().int()});var XTt;(function(t){t.inboundSchema=wo.JobsOut$inboundSchema,t.outboundSchema=wo.JobsOut$outboundSchema})(XTt||(wo.JobsOut$=XTt={}));function WJr(t){return JSON.stringify(wo.JobsOut$outboundSchema.parse(t))}function KJr(t){return(0,VJr.safeParse)(t,e=>wo.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var oAt=b(So=>{"use strict";var JJr=So&&So.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GJr=So&&So.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YJr=So&&So.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JJr(e,t,r);return GJr(e,t),e};Object.defineProperty(So,"__esModule",{value:!0});So.LegacyJobMetadataOut$=So.LegacyJobMetadataOut$outboundSchema=So.LegacyJobMetadataOut$inboundSchema=So.LegacyJobMetadataOutObject$=So.LegacyJobMetadataOutObject$outboundSchema=So.LegacyJobMetadataOutObject$inboundSchema=So.LegacyJobMetadataOutObject=void 0;So.legacyJobMetadataOutToJSON=XJr;So.legacyJobMetadataOutFromJSON=QJr;var yr=YJr(ye()),nAt=Re(),ZJr=pe();So.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};So.LegacyJobMetadataOutObject$inboundSchema=yr.nativeEnum(So.LegacyJobMetadataOutObject);So.LegacyJobMetadataOutObject$outboundSchema=So.LegacyJobMetadataOutObject$inboundSchema;var tAt;(function(t){t.inboundSchema=So.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=So.LegacyJobMetadataOutObject$outboundSchema})(tAt||(So.LegacyJobMetadataOutObject$=tAt={}));So.LegacyJobMetadataOut$inboundSchema=yr.object({expected_duration_seconds:yr.nullable(yr.number().int()).optional(),cost:yr.nullable(yr.number()).optional(),cost_currency:yr.nullable(yr.string()).optional(),train_tokens_per_step:yr.nullable(yr.number().int()).optional(),train_tokens:yr.nullable(yr.number().int()).optional(),data_tokens:yr.nullable(yr.number().int()).optional(),estimated_start_time:yr.nullable(yr.number().int()).optional(),deprecated:yr.boolean().default(!0),details:yr.string(),epochs:yr.nullable(yr.number()).optional(),training_steps:yr.nullable(yr.number().int()).optional(),object:yr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,nAt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime",training_steps:"trainingSteps"}));So.LegacyJobMetadataOut$outboundSchema=yr.object({expectedDurationSeconds:yr.nullable(yr.number().int()).optional(),cost:yr.nullable(yr.number()).optional(),costCurrency:yr.nullable(yr.string()).optional(),trainTokensPerStep:yr.nullable(yr.number().int()).optional(),trainTokens:yr.nullable(yr.number().int()).optional(),dataTokens:yr.nullable(yr.number().int()).optional(),estimatedStartTime:yr.nullable(yr.number().int()).optional(),deprecated:yr.boolean().default(!0),details:yr.string(),epochs:yr.nullable(yr.number()).optional(),trainingSteps:yr.nullable(yr.number().int()).optional(),object:yr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,nAt.remap)(t,{expectedDurationSeconds:"expected_duration_seconds",costCurrency:"cost_currency",trainTokensPerStep:"train_tokens_per_step",trainTokens:"train_tokens",dataTokens:"data_tokens",estimatedStartTime:"estimated_start_time",trainingSteps:"training_steps"}));var rAt;(function(t){t.inboundSchema=So.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=So.LegacyJobMetadataOut$outboundSchema})(rAt||(So.LegacyJobMetadataOut$=rAt={}));function XJr(t){return JSON.stringify(So.LegacyJobMetadataOut$outboundSchema.parse(t))}function QJr(t){return(0,ZJr.safeParse)(t,e=>So.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var sAt=b(fu=>{"use strict";var eGr=fu&&fu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tGr=fu&&fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rGr=fu&&fu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eGr(e,t,r);return tGr(e,t),e};Object.defineProperty(fu,"__esModule",{value:!0});fu.ListFilesOut$=fu.ListFilesOut$outboundSchema=fu.ListFilesOut$inboundSchema=void 0;fu.listFilesOutToJSON=oGr;fu.listFilesOutFromJSON=iGr;var qT=rGr(ye()),nGr=pe(),aAt=VPe();fu.ListFilesOut$inboundSchema=qT.object({data:qT.array(aAt.FileSchema$inboundSchema),object:qT.string(),total:qT.number().int()});fu.ListFilesOut$outboundSchema=qT.object({data:qT.array(aAt.FileSchema$outboundSchema),object:qT.string(),total:qT.number().int()});var iAt;(function(t){t.inboundSchema=fu.ListFilesOut$inboundSchema,t.outboundSchema=fu.ListFilesOut$outboundSchema})(iAt||(fu.ListFilesOut$=iAt={}));function oGr(t){return JSON.stringify(fu.ListFilesOut$outboundSchema.parse(t))}function iGr(t){return(0,nGr.safeParse)(t,e=>fu.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var dAt=b(xo=>{"use strict";var aGr=xo&&xo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sGr=xo&&xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uGr=xo&&xo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aGr(e,t,r);return sGr(e,t),e};Object.defineProperty(xo,"__esModule",{value:!0});xo.ModelList$=xo.ModelList$outboundSchema=xo.ModelList$inboundSchema=xo.Data$=xo.Data$outboundSchema=xo.Data$inboundSchema=void 0;xo.dataToJSON=lGr;xo.dataFromJSON=cGr;xo.modelListToJSON=dGr;xo.modelListFromJSON=fGr;var vi=uGr(ye()),cAt=pe(),Zre=RPe(),Xre=KPe();xo.Data$inboundSchema=vi.union([Zre.BaseModelCard$inboundSchema.and(vi.object({type:vi.literal("base")}).transform(t=>({type:t.type}))),Xre.FTModelCard$inboundSchema.and(vi.object({type:vi.literal("fine-tuned")}).transform(t=>({type:t.type})))]);xo.Data$outboundSchema=vi.union([Zre.BaseModelCard$outboundSchema.and(vi.object({type:vi.literal("base")}).transform(t=>({type:t.type}))),Xre.FTModelCard$outboundSchema.and(vi.object({type:vi.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var uAt;(function(t){t.inboundSchema=xo.Data$inboundSchema,t.outboundSchema=xo.Data$outboundSchema})(uAt||(xo.Data$=uAt={}));function lGr(t){return JSON.stringify(xo.Data$outboundSchema.parse(t))}function cGr(t){return(0,cAt.safeParse)(t,e=>xo.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}xo.ModelList$inboundSchema=vi.object({object:vi.string().default("list"),data:vi.array(vi.union([Zre.BaseModelCard$inboundSchema.and(vi.object({type:vi.literal("base")}).transform(t=>({type:t.type}))),Xre.FTModelCard$inboundSchema.and(vi.object({type:vi.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});xo.ModelList$outboundSchema=vi.object({object:vi.string().default("list"),data:vi.array(vi.union([Zre.BaseModelCard$outboundSchema.and(vi.object({type:vi.literal("base")}).transform(t=>({type:t.type}))),Xre.FTModelCard$outboundSchema.and(vi.object({type:vi.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});var lAt;(function(t){t.inboundSchema=xo.ModelList$inboundSchema,t.outboundSchema=xo.ModelList$outboundSchema})(lAt||(xo.ModelList$=lAt={}));function dGr(t){return JSON.stringify(xo.ModelList$outboundSchema.parse(t))}function fGr(t){return(0,cAt.safeParse)(t,e=>xo.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var yAt=b(pu=>{"use strict";var pGr=pu&&pu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mGr=pu&&pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hGr=pu&&pu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pGr(e,t,r);return mGr(e,t),e};Object.defineProperty(pu,"__esModule",{value:!0});pu.RetrieveFileOut$=pu.RetrieveFileOut$outboundSchema=pu.RetrieveFileOut$inboundSchema=void 0;pu.retrieveFileOutToJSON=yGr;pu.retrieveFileOutFromJSON=bGr;var Ll=hGr(ye()),pAt=Re(),gGr=pe(),mAt=gH(),hAt=yH(),gAt=bH();pu.RetrieveFileOut$inboundSchema=Ll.object({id:Ll.string(),object:Ll.string(),bytes:Ll.number().int(),created_at:Ll.number().int(),filename:Ll.string(),purpose:mAt.FilePurpose$inboundSchema,sample_type:hAt.SampleType$inboundSchema,num_lines:Ll.nullable(Ll.number().int()).optional(),source:gAt.Source$inboundSchema,deleted:Ll.boolean()}).transform(t=>(0,pAt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));pu.RetrieveFileOut$outboundSchema=Ll.object({id:Ll.string(),object:Ll.string(),sizeBytes:Ll.number().int(),createdAt:Ll.number().int(),filename:Ll.string(),purpose:mAt.FilePurpose$outboundSchema,sampleType:hAt.SampleType$outboundSchema,numLines:Ll.nullable(Ll.number().int()).optional(),source:gAt.Source$outboundSchema,deleted:Ll.boolean()}).transform(t=>(0,pAt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var fAt;(function(t){t.inboundSchema=pu.RetrieveFileOut$inboundSchema,t.outboundSchema=pu.RetrieveFileOut$outboundSchema})(fAt||(pu.RetrieveFileOut$=fAt={}));function yGr(t){return JSON.stringify(pu.RetrieveFileOut$outboundSchema.parse(t))}function bGr(t){return(0,gGr.safeParse)(t,e=>pu.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var vAt=b(mu=>{"use strict";var _Gr=mu&&mu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vGr=mu&&mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wGr=mu&&mu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Gr(e,t,r);return vGr(e,t),e};Object.defineProperty(mu,"__esModule",{value:!0});mu.Security$=mu.Security$outboundSchema=mu.Security$inboundSchema=void 0;mu.securityToJSON=xGr;mu.securityFromJSON=CGr;var Qre=wGr(ye()),_At=Re(),SGr=pe();mu.Security$inboundSchema=Qre.object({ApiKey:Qre.string().optional()}).transform(t=>(0,_At.remap)(t,{ApiKey:"apiKey"}));mu.Security$outboundSchema=Qre.object({apiKey:Qre.string().optional()}).transform(t=>(0,_At.remap)(t,{apiKey:"ApiKey"}));var bAt;(function(t){t.inboundSchema=mu.Security$inboundSchema,t.outboundSchema=mu.Security$outboundSchema})(bAt||(mu.Security$=bAt={}));function xGr(t){return JSON.stringify(mu.Security$outboundSchema.parse(t))}function CGr(t){return(0,SGr.safeParse)(t,e=>mu.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var xAt=b(Co=>{"use strict";var OGr=Co&&Co.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EGr=Co&&Co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PGr=Co&&Co.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OGr(e,t,r);return EGr(e,t),e};Object.defineProperty(Co,"__esModule",{value:!0});Co.UnarchiveFTModelOut$=Co.UnarchiveFTModelOut$outboundSchema=Co.UnarchiveFTModelOut$inboundSchema=Co.UnarchiveFTModelOutObject$=Co.UnarchiveFTModelOutObject$outboundSchema=Co.UnarchiveFTModelOutObject$inboundSchema=Co.UnarchiveFTModelOutObject=void 0;Co.unarchiveFTModelOutToJSON=AGr;Co.unarchiveFTModelOutFromJSON=IGr;var DC=PGr(ye()),TGr=pe();Co.UnarchiveFTModelOutObject={Model:"model"};Co.UnarchiveFTModelOutObject$inboundSchema=DC.nativeEnum(Co.UnarchiveFTModelOutObject);Co.UnarchiveFTModelOutObject$outboundSchema=Co.UnarchiveFTModelOutObject$inboundSchema;var wAt;(function(t){t.inboundSchema=Co.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=Co.UnarchiveFTModelOutObject$outboundSchema})(wAt||(Co.UnarchiveFTModelOutObject$=wAt={}));Co.UnarchiveFTModelOut$inboundSchema=DC.object({id:DC.string(),object:DC.literal("model").default("model"),archived:DC.boolean().default(!1)});Co.UnarchiveFTModelOut$outboundSchema=DC.object({id:DC.string(),object:DC.literal("model").default("model"),archived:DC.boolean().default(!1)});var SAt;(function(t){t.inboundSchema=Co.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=Co.UnarchiveFTModelOut$outboundSchema})(SAt||(Co.UnarchiveFTModelOut$=SAt={}));function AGr(t){return JSON.stringify(Co.UnarchiveFTModelOut$outboundSchema.parse(t))}function IGr(t){return(0,TGr.safeParse)(t,e=>Co.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var OAt=b(hu=>{"use strict";var MGr=hu&&hu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RGr=hu&&hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jGr=hu&&hu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&MGr(e,t,r);return RGr(e,t),e};Object.defineProperty(hu,"__esModule",{value:!0});hu.UpdateFTModelIn$=hu.UpdateFTModelIn$outboundSchema=hu.UpdateFTModelIn$inboundSchema=void 0;hu.updateFTModelInToJSON=NGr;hu.updateFTModelInFromJSON=LGr;var hS=jGr(ye()),DGr=pe();hu.UpdateFTModelIn$inboundSchema=hS.object({name:hS.nullable(hS.string()).optional(),description:hS.nullable(hS.string()).optional()});hu.UpdateFTModelIn$outboundSchema=hS.object({name:hS.nullable(hS.string()).optional(),description:hS.nullable(hS.string()).optional()});var CAt;(function(t){t.inboundSchema=hu.UpdateFTModelIn$inboundSchema,t.outboundSchema=hu.UpdateFTModelIn$outboundSchema})(CAt||(hu.UpdateFTModelIn$=CAt={}));function NGr(t){return JSON.stringify(hu.UpdateFTModelIn$outboundSchema.parse(t))}function LGr(t){return(0,DGr.safeParse)(t,e=>hu.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var MAt=b(gu=>{"use strict";var FGr=gu&&gu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kGr=gu&&gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BGr=gu&&gu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FGr(e,t,r);return kGr(e,t),e};Object.defineProperty(gu,"__esModule",{value:!0});gu.UploadFileOut$=gu.UploadFileOut$outboundSchema=gu.UploadFileOut$inboundSchema=void 0;gu.uploadFileOutToJSON=qGr;gu.uploadFileOutFromJSON=UGr;var bd=BGr(ye()),PAt=Re(),$Gr=pe(),TAt=gH(),AAt=yH(),IAt=bH();gu.UploadFileOut$inboundSchema=bd.object({id:bd.string(),object:bd.string(),bytes:bd.number().int(),created_at:bd.number().int(),filename:bd.string(),purpose:TAt.FilePurpose$inboundSchema,sample_type:AAt.SampleType$inboundSchema,num_lines:bd.nullable(bd.number().int()).optional(),source:IAt.Source$inboundSchema}).transform(t=>(0,PAt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));gu.UploadFileOut$outboundSchema=bd.object({id:bd.string(),object:bd.string(),sizeBytes:bd.number().int(),createdAt:bd.number().int(),filename:bd.string(),purpose:TAt.FilePurpose$outboundSchema,sampleType:AAt.SampleType$outboundSchema,numLines:bd.nullable(bd.number().int()).optional(),source:IAt.Source$outboundSchema}).transform(t=>(0,PAt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var EAt;(function(t){t.inboundSchema=gu.UploadFileOut$inboundSchema,t.outboundSchema=gu.UploadFileOut$outboundSchema})(EAt||(gu.UploadFileOut$=EAt={}));function qGr(t){return JSON.stringify(gu.UploadFileOut$outboundSchema.parse(t))}function UGr(t){return(0,$Gr.safeParse)(t,e=>gu.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var NAt=b(Oo=>{"use strict";var zGr=Oo&&Oo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HGr=Oo&&Oo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VGr=Oo&&Oo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zGr(e,t,r);return HGr(e,t),e};Object.defineProperty(Oo,"__esModule",{value:!0});Oo.ValidationError$=Oo.ValidationError$outboundSchema=Oo.ValidationError$inboundSchema=Oo.Loc$=Oo.Loc$outboundSchema=Oo.Loc$inboundSchema=void 0;Oo.locToJSON=WGr;Oo.locFromJSON=KGr;Oo.validationErrorToJSON=JGr;Oo.validationErrorFromJSON=GGr;var yu=VGr(ye()),DAt=pe();Oo.Loc$inboundSchema=yu.union([yu.string(),yu.number().int()]);Oo.Loc$outboundSchema=yu.union([yu.string(),yu.number().int()]);var RAt;(function(t){t.inboundSchema=Oo.Loc$inboundSchema,t.outboundSchema=Oo.Loc$outboundSchema})(RAt||(Oo.Loc$=RAt={}));function WGr(t){return JSON.stringify(Oo.Loc$outboundSchema.parse(t))}function KGr(t){return(0,DAt.safeParse)(t,e=>Oo.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}Oo.ValidationError$inboundSchema=yu.object({loc:yu.array(yu.union([yu.string(),yu.number().int()])),msg:yu.string(),type:yu.string()});Oo.ValidationError$outboundSchema=yu.object({loc:yu.array(yu.union([yu.string(),yu.number().int()])),msg:yu.string(),type:yu.string()});var jAt;(function(t){t.inboundSchema=Oo.ValidationError$inboundSchema,t.outboundSchema=Oo.ValidationError$outboundSchema})(jAt||(Oo.ValidationError$=jAt={}));function JGr(t){return JSON.stringify(Oo.ValidationError$outboundSchema.parse(t))}function GGr(t){return(0,DAt.safeParse)(t,e=>Oo.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var gn=b(Ne=>{"use strict";var YGr=Ne&&Ne.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),He=Ne&&Ne.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&YGr(e,t,r)};Object.defineProperty(Ne,"__esModule",{value:!0});He(bOt(),Ne);He(POt(),Ne);He(MPe(),Ne);He(MOt(),Ne);He(LT(),Ne);He(RPe(),Ne);He(jPe(),Ne);He(UOt(),Ne);He(NPe(),Ne);He(XOt(),Ne);He(DPe(),Ne);He(oEt(),Ne);He(Cre(),Ne);He(yEt(),Ne);He(xEt(),Ne);He(REt(),Ne);He(FPe(),Ne);He(kPe(),Ne);He(HEt(),Ne);He(KEt(),Ne);He(qPe(),Ne);He(uPt(),Ne);He($Pe(),Ne);He(PB(),Ne);He(cPt(),Ne);He(fPt(),Ne);He(BPe(),Ne);He(NPt(),Ne);He($Pt(),Ne);He(VPt(),Ne);He(HPe(),Ne);He(UPe(),Ne);He(gH(),Ne);He(VPe(),Ne);He(tTt(),Ne);He(aTt(),Ne);He(cTt(),Ne);He(hTt(),Ne);He(WPe(),Ne);He(KPe(),Ne);He(ETt(),Ne);He(APe(),Ne);He(OPe(),Ne);He(IPe(),Ne);He(JPe(),Ne);He($re(),Ne);He(SPe(),Ne);He(xPe(),Ne);He(UTt(),Ne);He(qre(),Ne);He(eTe(),Ne);He(eAt(),Ne);He(PPe(),Ne);He(oAt(),Ne);He(sAt(),Ne);He(LPe(),Ne);He(Sre(),Ne);He(dAt(),Ne);He(AB(),Ne);He(CPe(),Ne);He(IB(),Ne);He(TPe(),Ne);He(yAt(),Ne);He(yH(),Ne);He(vAt(),Ne);He(bH(),Ne);He(G1(),Ne);He(ere(),Ne);He(MB(),Ne);He(tre(),Ne);He(RB(),Ne);He(jB(),Ne);He(Y1(),Ne);He(mH(),Ne);He(GPe(),Ne);He(Ure(),Ne);He(YPe(),Ne);He(xAt(),Ne);He(OAt(),Ne);He(MAt(),Ne);He(NB(),Ne);He(Z1(),Ne);He(NAt(),Ne);He(ZPe(),Ne);He(zre(),Ne)});var BAt=b(Fl=>{"use strict";var ZGr=Fl&&Fl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XGr=Fl&&Fl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FAt=Fl&&Fl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZGr(e,t,r);return XGr(e,t),e};Object.defineProperty(Fl,"__esModule",{value:!0});Fl.HTTPValidationError$=Fl.HTTPValidationError$outboundSchema=Fl.HTTPValidationError$inboundSchema=Fl.HTTPValidationError=void 0;var _H=FAt(ye()),kAt=FAt(gn()),vH=class extends Error{constructor(e){let r="message"in e&&typeof e.message=="string"?e.message:`API error occurred: ${JSON.stringify(e)}`;super(r),this.data$=e,e.detail!=null&&(this.detail=e.detail),this.name="HTTPValidationError"}};Fl.HTTPValidationError=vH;Fl.HTTPValidationError$inboundSchema=_H.object({detail:_H.array(kAt.ValidationError$inboundSchema).optional()}).transform(t=>new vH(t));Fl.HTTPValidationError$outboundSchema=_H.instanceof(vH).transform(t=>t.data$).pipe(_H.object({detail:_H.array(kAt.ValidationError$outboundSchema).optional()}));var LAt;(function(t){t.inboundSchema=Fl.HTTPValidationError$inboundSchema,t.outboundSchema=Fl.HTTPValidationError$outboundSchema})(LAt||(Fl.HTTPValidationError$=LAt={}))});var nm=b(gS=>{"use strict";var QGr=gS&&gS.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ene=gS&&gS.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&QGr(e,t,r)};Object.defineProperty(gS,"__esModule",{value:!0});ene(KEe(),gS);ene(BAt(),gS);ene(hPe(),gS);ene(vPe(),gS)});var UAt=b(NC=>{"use strict";var e7r=NC&&NC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t7r=NC&&NC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tTe=NC&&NC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&e7r(e,t,r);return t7r(e,t),e};Object.defineProperty(NC,"__esModule",{value:!0});NC.agentsComplete=s7r;var r7r=jo(),wH=tTe(Do()),n7r=Re(),o7r=pe(),$At=No(),i7r=ro(),qAt=tTe(gn()),a7r=tTe(nm());async function s7r(t,e,r){let n=(0,o7r.safeParse)(e,_=>qAt.AgentsCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,r7r.encodeJSON)("body",o,{explode:!0}),a=(0,i7r.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,n7r.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,$At.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,$At.resolveGlobalSecurity)(l),d={operationID:"agents_completion_v1_agents_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,v={HttpMeta:{Response:h,Request:p}},[g]=await wH.match(wH.json(200,qAt.ChatCompletionResponse$inboundSchema),wH.jsonErr(422,a7r.HTTPValidationError$inboundSchema),wH.fail("4XX"),wH.fail("5XX"))(h,{extraFields:v});return g.ok,g}});var VAt=b(LC=>{"use strict";var u7r=LC&&LC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l7r=LC&&LC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tne=LC&&LC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&u7r(e,t,r);return l7r(e,t),e};Object.defineProperty(LC,"__esModule",{value:!0});LC.agentsStream=y7r;var c7r=tne(ye()),d7r=jo(),f7r=dH(),SH=tne(Do()),p7r=Re(),m7r=pe(),zAt=No(),h7r=ro(),HAt=tne(gn()),g7r=tne(nm());async function y7r(t,e,r){let n=(0,m7r.safeParse)(e,_=>HAt.AgentsCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,d7r.encodeJSON)("body",o,{explode:!0}),a=(0,h7r.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,p7r.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,zAt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,zAt.resolveGlobalSecurity)(l),d={operationID:"stream_agents",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,v={HttpMeta:{Response:h,Request:p}},[g]=await SH.match(SH.sse(200,c7r.instanceof(ReadableStream).transform(_=>new f7r.EventStream({stream:_,decoder(w){return HAt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),SH.jsonErr(422,g7r.HTTPValidationError$inboundSchema),SH.fail("4XX"),SH.fail("5XX"))(h,{extraFields:v});return g.ok,g}});var KAt=b(rne=>{"use strict";Object.defineProperty(rne,"__esModule",{value:!0});rne.Agents=void 0;var b7r=UAt(),_7r=VAt(),v7r=tm(),WAt=fh(),rTe=class extends v7r.ClientSDK{async complete(e,r){return(0,WAt.unwrapAsync)((0,b7r.agentsComplete)(this,e,r))}async stream(e,r){return(0,WAt.unwrapAsync)((0,_7r.agentsStream)(this,e,r))}};rne.Agents=rTe});var YAt=b(bu=>{"use strict";var w7r=bu&&bu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),S7r=bu&&bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x7r=bu&&bu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&w7r(e,t,r);return S7r(e,t),e};Object.defineProperty(bu,"__esModule",{value:!0});bu.DeleteModelV1ModelsModelIdDeleteRequest$=bu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=bu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;bu.deleteModelV1ModelsModelIdDeleteRequestToJSON=O7r;bu.deleteModelV1ModelsModelIdDeleteRequestFromJSON=E7r;var nne=x7r(ye()),GAt=Re(),C7r=pe();bu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=nne.object({model_id:nne.string()}).transform(t=>(0,GAt.remap)(t,{model_id:"modelId"}));bu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=nne.object({modelId:nne.string()}).transform(t=>(0,GAt.remap)(t,{modelId:"model_id"}));var JAt;(function(t){t.inboundSchema=bu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=bu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(JAt||(bu.DeleteModelV1ModelsModelIdDeleteRequest$=JAt={}));function O7r(t){return JSON.stringify(bu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function E7r(t){return(0,C7r.safeParse)(t,e=>bu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var QAt=b(_u=>{"use strict";var P7r=_u&&_u.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T7r=_u&&_u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A7r=_u&&_u.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P7r(e,t,r);return T7r(e,t),e};Object.defineProperty(_u,"__esModule",{value:!0});_u.FilesApiRoutesDeleteFileRequest$=_u.FilesApiRoutesDeleteFileRequest$outboundSchema=_u.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;_u.filesApiRoutesDeleteFileRequestToJSON=M7r;_u.filesApiRoutesDeleteFileRequestFromJSON=R7r;var one=A7r(ye()),XAt=Re(),I7r=pe();_u.FilesApiRoutesDeleteFileRequest$inboundSchema=one.object({file_id:one.string()}).transform(t=>(0,XAt.remap)(t,{file_id:"fileId"}));_u.FilesApiRoutesDeleteFileRequest$outboundSchema=one.object({fileId:one.string()}).transform(t=>(0,XAt.remap)(t,{fileId:"file_id"}));var ZAt;(function(t){t.inboundSchema=_u.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=_u.FilesApiRoutesDeleteFileRequest$outboundSchema})(ZAt||(_u.FilesApiRoutesDeleteFileRequest$=ZAt={}));function M7r(t){return JSON.stringify(_u.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function R7r(t){return(0,I7r.safeParse)(t,e=>_u.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var rIt=b(vu=>{"use strict";var j7r=vu&&vu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D7r=vu&&vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N7r=vu&&vu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&j7r(e,t,r);return D7r(e,t),e};Object.defineProperty(vu,"__esModule",{value:!0});vu.FilesApiRoutesDownloadFileRequest$=vu.FilesApiRoutesDownloadFileRequest$outboundSchema=vu.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;vu.filesApiRoutesDownloadFileRequestToJSON=F7r;vu.filesApiRoutesDownloadFileRequestFromJSON=k7r;var ine=N7r(ye()),tIt=Re(),L7r=pe();vu.FilesApiRoutesDownloadFileRequest$inboundSchema=ine.object({file_id:ine.string()}).transform(t=>(0,tIt.remap)(t,{file_id:"fileId"}));vu.FilesApiRoutesDownloadFileRequest$outboundSchema=ine.object({fileId:ine.string()}).transform(t=>(0,tIt.remap)(t,{fileId:"file_id"}));var eIt;(function(t){t.inboundSchema=vu.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=vu.FilesApiRoutesDownloadFileRequest$outboundSchema})(eIt||(vu.FilesApiRoutesDownloadFileRequest$=eIt={}));function F7r(t){return JSON.stringify(vu.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function k7r(t){return(0,L7r.safeParse)(t,e=>vu.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var iIt=b(wu=>{"use strict";var B7r=wu&&wu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$7r=wu&&wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q7r=wu&&wu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&B7r(e,t,r);return $7r(e,t),e};Object.defineProperty(wu,"__esModule",{value:!0});wu.FilesApiRoutesGetSignedUrlRequest$=wu.FilesApiRoutesGetSignedUrlRequest$outboundSchema=wu.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;wu.filesApiRoutesGetSignedUrlRequestToJSON=z7r;wu.filesApiRoutesGetSignedUrlRequestFromJSON=H7r;var kB=q7r(ye()),oIt=Re(),U7r=pe();wu.FilesApiRoutesGetSignedUrlRequest$inboundSchema=kB.object({file_id:kB.string(),expiry:kB.number().int().default(24)}).transform(t=>(0,oIt.remap)(t,{file_id:"fileId"}));wu.FilesApiRoutesGetSignedUrlRequest$outboundSchema=kB.object({fileId:kB.string(),expiry:kB.number().int().default(24)}).transform(t=>(0,oIt.remap)(t,{fileId:"file_id"}));var nIt;(function(t){t.inboundSchema=wu.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=wu.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(nIt||(wu.FilesApiRoutesGetSignedUrlRequest$=nIt={}));function z7r(t){return JSON.stringify(wu.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function H7r(t){return(0,U7r.safeParse)(t,e=>wu.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var lIt=b(xu=>{"use strict";var V7r=xu&&xu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W7r=xu&&xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sIt=xu&&xu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&V7r(e,t,r);return W7r(e,t),e};Object.defineProperty(xu,"__esModule",{value:!0});xu.FilesApiRoutesListFilesRequest$=xu.FilesApiRoutesListFilesRequest$outboundSchema=xu.FilesApiRoutesListFilesRequest$inboundSchema=void 0;xu.filesApiRoutesListFilesRequestToJSON=J7r;xu.filesApiRoutesListFilesRequestFromJSON=G7r;var Su=sIt(ye()),uIt=Re(),K7r=pe(),BB=sIt(gn());xu.FilesApiRoutesListFilesRequest$inboundSchema=Su.object({page:Su.number().int().default(0),page_size:Su.number().int().default(100),sample_type:Su.nullable(Su.array(BB.SampleType$inboundSchema)).optional(),source:Su.nullable(Su.array(BB.Source$inboundSchema)).optional(),search:Su.nullable(Su.string()).optional(),purpose:Su.nullable(BB.FilePurpose$inboundSchema).optional()}).transform(t=>(0,uIt.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));xu.FilesApiRoutesListFilesRequest$outboundSchema=Su.object({page:Su.number().int().default(0),pageSize:Su.number().int().default(100),sampleType:Su.nullable(Su.array(BB.SampleType$outboundSchema)).optional(),source:Su.nullable(Su.array(BB.Source$outboundSchema)).optional(),search:Su.nullable(Su.string()).optional(),purpose:Su.nullable(BB.FilePurpose$outboundSchema).optional()}).transform(t=>(0,uIt.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var aIt;(function(t){t.inboundSchema=xu.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=xu.FilesApiRoutesListFilesRequest$outboundSchema})(aIt||(xu.FilesApiRoutesListFilesRequest$=aIt={}));function J7r(t){return JSON.stringify(xu.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function G7r(t){return(0,K7r.safeParse)(t,e=>xu.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var fIt=b(Cu=>{"use strict";var Y7r=Cu&&Cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z7r=Cu&&Cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X7r=Cu&&Cu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Y7r(e,t,r);return Z7r(e,t),e};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.FilesApiRoutesRetrieveFileRequest$=Cu.FilesApiRoutesRetrieveFileRequest$outboundSchema=Cu.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;Cu.filesApiRoutesRetrieveFileRequestToJSON=eYr;Cu.filesApiRoutesRetrieveFileRequestFromJSON=tYr;var ane=X7r(ye()),dIt=Re(),Q7r=pe();Cu.FilesApiRoutesRetrieveFileRequest$inboundSchema=ane.object({file_id:ane.string()}).transform(t=>(0,dIt.remap)(t,{file_id:"fileId"}));Cu.FilesApiRoutesRetrieveFileRequest$outboundSchema=ane.object({fileId:ane.string()}).transform(t=>(0,dIt.remap)(t,{fileId:"file_id"}));var cIt;(function(t){t.inboundSchema=Cu.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=Cu.FilesApiRoutesRetrieveFileRequest$outboundSchema})(cIt||(Cu.FilesApiRoutesRetrieveFileRequest$=cIt={}));function eYr(t){return JSON.stringify(Cu.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function tYr(t){return(0,Q7r.safeParse)(t,e=>Cu.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var nTe=b(Gg=>{"use strict";var rYr=Gg&&Gg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nYr=Gg&&Gg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oYr=Gg&&Gg.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rYr(e,t,r);return nYr(e,t),e};Object.defineProperty(Gg,"__esModule",{value:!0});Gg.blobLikeSchema=void 0;Gg.isBlobLike=pIt;var iYr=oYr(ye());Gg.blobLikeSchema=iYr.custom(pIt,{message:"expected a Blob, File or Blob-like object",fatal:!0});function pIt(t){if(t instanceof Blob)return!0;if(typeof t!="object"||t==null||!(Symbol.toStringTag in t))return!1;let e=t[Symbol.toStringTag];return typeof e!="string"||e!=="Blob"&&e!=="File"?!1:"stream"in t&&typeof t.stream=="function"}});var _It=b($n=>{"use strict";var aYr=$n&&$n.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sYr=$n&&$n.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gIt=$n&&$n.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aYr(e,t,r);return sYr(e,t),e};Object.defineProperty($n,"__esModule",{value:!0});$n.FilesApiRoutesUploadFileMultiPartBodyParams$=$n.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=$n.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=$n.FileT$=$n.FileT$outboundSchema=$n.FileT$inboundSchema=void 0;$n.fileToJSON=lYr;$n.fileFromJSON=cYr;$n.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=dYr;$n.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=fYr;var kl=gIt(ye()),yIt=pe(),uYr=nTe(),bIt=gIt(gn());$n.FileT$inboundSchema=kl.object({fileName:kl.string(),content:kl.union([kl.instanceof(ReadableStream),kl.instanceof(Blob),kl.instanceof(ArrayBuffer),kl.instanceof(Uint8Array)])});$n.FileT$outboundSchema=kl.object({fileName:kl.string(),content:kl.union([kl.instanceof(ReadableStream),kl.instanceof(Blob),kl.instanceof(ArrayBuffer),kl.instanceof(Uint8Array)])});var mIt;(function(t){t.inboundSchema=$n.FileT$inboundSchema,t.outboundSchema=$n.FileT$outboundSchema})(mIt||($n.FileT$=mIt={}));function lYr(t){return JSON.stringify($n.FileT$outboundSchema.parse(t))}function cYr(t){return(0,yIt.safeParse)(t,e=>$n.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}$n.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=kl.object({file:kl.lazy(()=>$n.FileT$inboundSchema),purpose:bIt.FilePurpose$inboundSchema.optional()});$n.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=kl.object({file:kl.lazy(()=>$n.FileT$outboundSchema).or(uYr.blobLikeSchema),purpose:bIt.FilePurpose$outboundSchema.optional()});var hIt;(function(t){t.inboundSchema=$n.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=$n.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(hIt||($n.FilesApiRoutesUploadFileMultiPartBodyParams$=hIt={}));function dYr(t){return JSON.stringify($n.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function fYr(t){return(0,yIt.safeParse)(t,e=>$n.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var SIt=b(Ou=>{"use strict";var pYr=Ou&&Ou.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mYr=Ou&&Ou.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hYr=Ou&&Ou.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pYr(e,t,r);return mYr(e,t),e};Object.defineProperty(Ou,"__esModule",{value:!0});Ou.JobsApiRoutesBatchCancelBatchJobRequest$=Ou.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=Ou.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;Ou.jobsApiRoutesBatchCancelBatchJobRequestToJSON=yYr;Ou.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=bYr;var sne=hYr(ye()),wIt=Re(),gYr=pe();Ou.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=sne.object({job_id:sne.string()}).transform(t=>(0,wIt.remap)(t,{job_id:"jobId"}));Ou.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=sne.object({jobId:sne.string()}).transform(t=>(0,wIt.remap)(t,{jobId:"job_id"}));var vIt;(function(t){t.inboundSchema=Ou.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=Ou.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(vIt||(Ou.JobsApiRoutesBatchCancelBatchJobRequest$=vIt={}));function yYr(t){return JSON.stringify(Ou.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function bYr(t){return(0,gYr.safeParse)(t,e=>Ou.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var OIt=b(Eu=>{"use strict";var _Yr=Eu&&Eu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vYr=Eu&&Eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wYr=Eu&&Eu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_Yr(e,t,r);return vYr(e,t),e};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.JobsApiRoutesBatchGetBatchJobRequest$=Eu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=Eu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;Eu.jobsApiRoutesBatchGetBatchJobRequestToJSON=xYr;Eu.jobsApiRoutesBatchGetBatchJobRequestFromJSON=CYr;var une=wYr(ye()),CIt=Re(),SYr=pe();Eu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=une.object({job_id:une.string()}).transform(t=>(0,CIt.remap)(t,{job_id:"jobId"}));Eu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=une.object({jobId:une.string()}).transform(t=>(0,CIt.remap)(t,{jobId:"job_id"}));var xIt;(function(t){t.inboundSchema=Eu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=Eu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(xIt||(Eu.JobsApiRoutesBatchGetBatchJobRequest$=xIt={}));function xYr(t){return JSON.stringify(Eu.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function CYr(t){return(0,SYr.safeParse)(t,e=>Eu.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var IIt=b(Pu=>{"use strict";var OYr=Pu&&Pu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EYr=Pu&&Pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PIt=Pu&&Pu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&OYr(e,t,r);return EYr(e,t),e};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.JobsApiRoutesBatchGetBatchJobsRequest$=Pu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Pu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;Pu.jobsApiRoutesBatchGetBatchJobsRequestToJSON=TYr;Pu.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=AYr;var ra=PIt(ye()),TIt=Re(),PYr=pe(),AIt=PIt(gn());Pu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=ra.object({page:ra.number().int().default(0),page_size:ra.number().int().default(100),model:ra.nullable(ra.string()).optional(),metadata:ra.nullable(ra.record(ra.any())).optional(),created_after:ra.nullable(ra.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:ra.boolean().default(!1),status:ra.nullable(AIt.BatchJobStatus$inboundSchema).optional()}).transform(t=>(0,TIt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));Pu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=ra.object({page:ra.number().int().default(0),pageSize:ra.number().int().default(100),model:ra.nullable(ra.string()).optional(),metadata:ra.nullable(ra.record(ra.any())).optional(),createdAfter:ra.nullable(ra.date().transform(t=>t.toISOString())).optional(),createdByMe:ra.boolean().default(!1),status:ra.nullable(AIt.BatchJobStatus$outboundSchema).optional()}).transform(t=>(0,TIt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var EIt;(function(t){t.inboundSchema=Pu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=Pu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(EIt||(Pu.JobsApiRoutesBatchGetBatchJobsRequest$=EIt={}));function TYr(t){return JSON.stringify(Pu.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function AYr(t){return(0,PYr.safeParse)(t,e=>Pu.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var jIt=b(Tu=>{"use strict";var IYr=Tu&&Tu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MYr=Tu&&Tu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RYr=Tu&&Tu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IYr(e,t,r);return MYr(e,t),e};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=Tu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=Tu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;Tu.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=DYr;Tu.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=NYr;var lne=RYr(ye()),RIt=Re(),jYr=pe();Tu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=lne.object({model_id:lne.string()}).transform(t=>(0,RIt.remap)(t,{model_id:"modelId"}));Tu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=lne.object({modelId:lne.string()}).transform(t=>(0,RIt.remap)(t,{modelId:"model_id"}));var MIt;(function(t){t.inboundSchema=Tu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Tu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(MIt||(Tu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=MIt={}));function DYr(t){return JSON.stringify(Tu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function NYr(t){return(0,jYr.safeParse)(t,e=>Tu.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var LIt=b(Au=>{"use strict";var LYr=Au&&Au.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FYr=Au&&Au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kYr=Au&&Au.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&LYr(e,t,r);return FYr(e,t),e};Object.defineProperty(Au,"__esModule",{value:!0});Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;Au.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=$Yr;Au.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=qYr;var cne=kYr(ye()),NIt=Re(),BYr=pe();Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=cne.object({job_id:cne.string()}).transform(t=>(0,NIt.remap)(t,{job_id:"jobId"}));Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=cne.object({jobId:cne.string()}).transform(t=>(0,NIt.remap)(t,{jobId:"job_id"}));var DIt;(function(t){t.inboundSchema=Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(DIt||(Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=DIt={}));function $Yr(t){return JSON.stringify(Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function qYr(t){return(0,BYr.safeParse)(t,e=>Au.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var $It=b(Iu=>{"use strict";var UYr=Iu&&Iu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zYr=Iu&&Iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kIt=Iu&&Iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UYr(e,t,r);return zYr(e,t),e};Object.defineProperty(Iu,"__esModule",{value:!0});Iu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Iu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Iu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;Iu.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=VYr;Iu.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=WYr;var BIt=kIt(ye()),HYr=pe(),dne=kIt(gn());Iu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=BIt.union([dne.LegacyJobMetadataOut$inboundSchema,dne.JobOut$inboundSchema]);Iu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=BIt.union([dne.LegacyJobMetadataOut$outboundSchema,dne.JobOut$outboundSchema]);var FIt;(function(t){t.inboundSchema=Iu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=Iu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(FIt||(Iu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=FIt={}));function VYr(t){return JSON.stringify(Iu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function WYr(t){return(0,HYr.safeParse)(t,e=>Iu.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var zIt=b(Mu=>{"use strict";var KYr=Mu&&Mu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JYr=Mu&&Mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GYr=Mu&&Mu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&KYr(e,t,r);return JYr(e,t),e};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Mu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Mu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;Mu.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=ZYr;Mu.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=XYr;var fne=GYr(ye()),UIt=Re(),YYr=pe();Mu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=fne.object({job_id:fne.string()}).transform(t=>(0,UIt.remap)(t,{job_id:"jobId"}));Mu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=fne.object({jobId:fne.string()}).transform(t=>(0,UIt.remap)(t,{jobId:"job_id"}));var qIt;(function(t){t.inboundSchema=Mu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=Mu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(qIt||(Mu.JobsApiRoutesFineTuningGetFineTuningJobRequest$=qIt={}));function ZYr(t){return JSON.stringify(Mu.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function XYr(t){return(0,YYr.safeParse)(t,e=>Mu.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var KIt=b(qn=>{"use strict";var QYr=qn&&qn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eZr=qn&&qn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tZr=qn&&qn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QYr(e,t,r);return eZr(e,t),e};Object.defineProperty(qn,"__esModule",{value:!0});qn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=qn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=qn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=qn.Status$=qn.Status$outboundSchema=qn.Status$inboundSchema=qn.Status=void 0;qn.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=nZr;qn.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=oZr;var Fo=tZr(ye()),WIt=Re(),rZr=pe();qn.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};qn.Status$inboundSchema=Fo.nativeEnum(qn.Status);qn.Status$outboundSchema=qn.Status$inboundSchema;var HIt;(function(t){t.inboundSchema=qn.Status$inboundSchema,t.outboundSchema=qn.Status$outboundSchema})(HIt||(qn.Status$=HIt={}));qn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Fo.object({page:Fo.number().int().default(0),page_size:Fo.number().int().default(100),model:Fo.nullable(Fo.string()).optional(),created_after:Fo.nullable(Fo.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Fo.boolean().default(!1),status:Fo.nullable(qn.Status$inboundSchema).optional(),wandb_project:Fo.nullable(Fo.string()).optional(),wandb_name:Fo.nullable(Fo.string()).optional(),suffix:Fo.nullable(Fo.string()).optional()}).transform(t=>(0,WIt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));qn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Fo.object({page:Fo.number().int().default(0),pageSize:Fo.number().int().default(100),model:Fo.nullable(Fo.string()).optional(),createdAfter:Fo.nullable(Fo.date().transform(t=>t.toISOString())).optional(),createdByMe:Fo.boolean().default(!1),status:Fo.nullable(qn.Status$outboundSchema).optional(),wandbProject:Fo.nullable(Fo.string()).optional(),wandbName:Fo.nullable(Fo.string()).optional(),suffix:Fo.nullable(Fo.string()).optional()}).transform(t=>(0,WIt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var VIt;(function(t){t.inboundSchema=qn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=qn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(VIt||(qn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=VIt={}));function nZr(t){return JSON.stringify(qn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function oZr(t){return(0,rZr.safeParse)(t,e=>qn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var YIt=b(Ru=>{"use strict";var iZr=Ru&&Ru.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aZr=Ru&&Ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sZr=Ru&&Ru.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iZr(e,t,r);return aZr(e,t),e};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Ru.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Ru.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;Ru.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=lZr;Ru.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=cZr;var pne=sZr(ye()),GIt=Re(),uZr=pe();Ru.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=pne.object({job_id:pne.string()}).transform(t=>(0,GIt.remap)(t,{job_id:"jobId"}));Ru.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=pne.object({jobId:pne.string()}).transform(t=>(0,GIt.remap)(t,{jobId:"job_id"}));var JIt;(function(t){t.inboundSchema=Ru.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=Ru.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(JIt||(Ru.JobsApiRoutesFineTuningStartFineTuningJobRequest$=JIt={}));function lZr(t){return JSON.stringify(Ru.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function cZr(t){return(0,uZr.safeParse)(t,e=>Ru.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var QIt=b(ju=>{"use strict";var dZr=ju&&ju.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fZr=ju&&ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pZr=ju&&ju.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dZr(e,t,r);return fZr(e,t),e};Object.defineProperty(ju,"__esModule",{value:!0});ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;ju.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=hZr;ju.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=gZr;var mne=pZr(ye()),XIt=Re(),mZr=pe();ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=mne.object({model_id:mne.string()}).transform(t=>(0,XIt.remap)(t,{model_id:"modelId"}));ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=mne.object({modelId:mne.string()}).transform(t=>(0,XIt.remap)(t,{modelId:"model_id"}));var ZIt;(function(t){t.inboundSchema=ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(ZIt||(ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=ZIt={}));function hZr(t){return JSON.stringify(ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function gZr(t){return(0,mZr.safeParse)(t,e=>ju.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var oMt=b(Du=>{"use strict";var yZr=Du&&Du.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bZr=Du&&Du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tMt=Du&&Du.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yZr(e,t,r);return bZr(e,t),e};Object.defineProperty(Du,"__esModule",{value:!0});Du.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Du.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Du.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;Du.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=vZr;Du.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=wZr;var hne=tMt(ye()),rMt=Re(),_Zr=pe(),nMt=tMt(gn());Du.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=hne.object({model_id:hne.string(),UpdateFTModelIn:nMt.UpdateFTModelIn$inboundSchema}).transform(t=>(0,rMt.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));Du.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=hne.object({modelId:hne.string(),updateFTModelIn:nMt.UpdateFTModelIn$outboundSchema}).transform(t=>(0,rMt.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var eMt;(function(t){t.inboundSchema=Du.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=Du.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(eMt||(Du.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=eMt={}));function vZr(t){return JSON.stringify(Du.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function wZr(t){return(0,_Zr.safeParse)(t,e=>Du.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var cMt=b(Eo=>{"use strict";var SZr=Eo&&Eo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xZr=Eo&&Eo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sMt=Eo&&Eo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&SZr(e,t,r);return xZr(e,t),e};Object.defineProperty(Eo,"__esModule",{value:!0});Eo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=Eo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Eo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Eo.RetrieveModelV1ModelsModelIdGetRequest$=Eo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Eo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;Eo.retrieveModelV1ModelsModelIdGetRequestToJSON=CZr;Eo.retrieveModelV1ModelsModelIdGetRequestFromJSON=OZr;Eo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=EZr;Eo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=PZr;var ap=sMt(ye()),uMt=Re(),lMt=pe(),gne=sMt(gn());Eo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=ap.object({model_id:ap.string()}).transform(t=>(0,uMt.remap)(t,{model_id:"modelId"}));Eo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=ap.object({modelId:ap.string()}).transform(t=>(0,uMt.remap)(t,{modelId:"model_id"}));var iMt;(function(t){t.inboundSchema=Eo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=Eo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(iMt||(Eo.RetrieveModelV1ModelsModelIdGetRequest$=iMt={}));function CZr(t){return JSON.stringify(Eo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function OZr(t){return(0,lMt.safeParse)(t,e=>Eo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}Eo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=ap.union([gne.BaseModelCard$inboundSchema.and(ap.object({type:ap.literal("base")}).transform(t=>({type:t.type}))),gne.FTModelCard$inboundSchema.and(ap.object({type:ap.literal("fine-tuned")}).transform(t=>({type:t.type})))]);Eo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=ap.union([gne.BaseModelCard$outboundSchema.and(ap.object({type:ap.literal("base")}).transform(t=>({type:t.type}))),gne.FTModelCard$outboundSchema.and(ap.object({type:ap.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var aMt;(function(t){t.inboundSchema=Eo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=Eo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(aMt||(Eo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=aMt={}));function EZr(t){return JSON.stringify(Eo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function PZr(t){return(0,lMt.safeParse)(t,e=>Eo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var Nu=b(ki=>{"use strict";var TZr=ki&&ki.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ll=ki&&ki.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TZr(e,t,r)};Object.defineProperty(ki,"__esModule",{value:!0});ll(YAt(),ki);ll(QAt(),ki);ll(rIt(),ki);ll(iIt(),ki);ll(lIt(),ki);ll(fIt(),ki);ll(_It(),ki);ll(SIt(),ki);ll(OIt(),ki);ll(IIt(),ki);ll(jIt(),ki);ll(LIt(),ki);ll($It(),ki);ll(zIt(),ki);ll(KIt(),ki);ll(YIt(),ki);ll(QIt(),ki);ll(oMt(),ki);ll(cMt(),ki)});var fMt=b(FC=>{"use strict";var AZr=FC&&FC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IZr=FC&&FC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oTe=FC&&FC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AZr(e,t,r);return IZr(e,t),e};Object.defineProperty(FC,"__esModule",{value:!0});FC.batchJobsCancel=FZr;var MZr=jo(),yne=oTe(Do()),RZr=Re(),jZr=pe(),dMt=No(),DZr=ro(),NZr=oTe(gn()),LZr=oTe(Nu());async function FZr(t,e,r){let n=(0,jZr.safeParse)(e,_=>LZr.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,MZr.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,DZr.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,RZr.compactMap)({Accept:"application/json"})),l=await(0,dMt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,dMt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_cancel_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await yne.match(yne.json(200,NZr.BatchJobOut$inboundSchema),yne.fail("4XX"),yne.fail("5XX"))(v);return g.ok,g}});var gMt=b(kC=>{"use strict";var kZr=kC&&kC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BZr=kC&&kC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hMt=kC&&kC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kZr(e,t,r);return BZr(e,t),e};Object.defineProperty(kC,"__esModule",{value:!0});kC.batchJobsCreate=HZr;var $Zr=jo(),bne=hMt(Do()),qZr=Re(),UZr=pe(),pMt=No(),zZr=ro(),mMt=hMt(gn());async function HZr(t,e,r){let n=(0,UZr.safeParse)(e,g=>mMt.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,$Zr.encodeJSON)("body",o,{explode:!0}),a=(0,zZr.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,qZr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,pMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,pMt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_batch_create_batch_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[v]=await bne.match(bne.json(200,mMt.BatchJobOut$inboundSchema),bne.fail("4XX"),bne.fail("5XX"))(h);return v.ok,v}});var bMt=b(BC=>{"use strict";var VZr=BC&&BC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WZr=BC&&BC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iTe=BC&&BC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&VZr(e,t,r);return WZr(e,t),e};Object.defineProperty(BC,"__esModule",{value:!0});BC.batchJobsGet=QZr;var KZr=jo(),_ne=iTe(Do()),JZr=Re(),GZr=pe(),yMt=No(),YZr=ro(),ZZr=iTe(gn()),XZr=iTe(Nu());async function QZr(t,e,r){let n=(0,GZr.safeParse)(e,_=>XZr.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,KZr.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,YZr.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,JZr.compactMap)({Accept:"application/json"})),l=await(0,yMt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,yMt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await _ne.match(_ne.json(200,ZZr.BatchJobOut$inboundSchema),_ne.fail("4XX"),_ne.fail("5XX"))(v);return g.ok,g}});var vMt=b($C=>{"use strict";var eXr=$C&&$C.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tXr=$C&&$C.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aTe=$C&&$C.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eXr(e,t,r);return tXr(e,t),e};Object.defineProperty($C,"__esModule",{value:!0});$C.batchJobsList=uXr;var rXr=jo(),vne=aTe(Do()),nXr=Re(),oXr=pe(),_Mt=No(),iXr=ro(),aXr=aTe(gn()),sXr=aTe(Nu());async function uXr(t,e,r){let n=(0,oXr.safeParse)(e,_=>sXr.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,iXr.pathToFunc)("/v1/batch/jobs")(),s=(0,rXr.encodeFormQuery)({created_after:o?.created_after,created_by_me:o?.created_by_me,metadata:o?.metadata,model:o?.model,page:o?.page,page_size:o?.page_size,status:o?.status}),u=new Headers((0,nXr.compactMap)({Accept:"application/json"})),l=await(0,_Mt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,_Mt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_batch_get_batch_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await vne.match(vne.json(200,aXr.BatchJobsOut$inboundSchema),vne.fail("4XX"),vne.fail("5XX"))(v);return g.ok,g}});var wMt=b(Sne=>{"use strict";Object.defineProperty(Sne,"__esModule",{value:!0});Sne.MistralJobs=void 0;var lXr=fMt(),cXr=gMt(),dXr=bMt(),fXr=vMt(),pXr=tm(),wne=fh(),sTe=class extends pXr.ClientSDK{async list(e,r){return(0,wne.unwrapAsync)((0,fXr.batchJobsList)(this,e,r))}async create(e,r){return(0,wne.unwrapAsync)((0,cXr.batchJobsCreate)(this,e,r))}async get(e,r){return(0,wne.unwrapAsync)((0,dXr.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,wne.unwrapAsync)((0,lXr.batchJobsCancel)(this,e,r))}};Sne.MistralJobs=sTe});var SMt=b(xne=>{"use strict";Object.defineProperty(xne,"__esModule",{value:!0});xne.Batch=void 0;var mXr=tm(),hXr=wMt(),uTe=class extends mXr.ClientSDK{get jobs(){return this._jobs??(this._jobs=new hXr.MistralJobs(this._options))}};xne.Batch=uTe});var OMt=b(qC=>{"use strict";var gXr=qC&&qC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yXr=qC&&qC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lTe=qC&&qC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gXr(e,t,r);return yXr(e,t),e};Object.defineProperty(qC,"__esModule",{value:!0});qC.chatComplete=xXr;var bXr=jo(),xH=lTe(Do()),_Xr=Re(),vXr=pe(),xMt=No(),wXr=ro(),CMt=lTe(gn()),SXr=lTe(nm());async function xXr(t,e,r){let n=(0,vXr.safeParse)(e,_=>CMt.ChatCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,bXr.encodeJSON)("body",o,{explode:!0}),a=(0,wXr.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,_Xr.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,xMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,xMt.resolveGlobalSecurity)(l),d={operationID:"chat_completion_v1_chat_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,v={HttpMeta:{Response:h,Request:p}},[g]=await xH.match(xH.json(200,CMt.ChatCompletionResponse$inboundSchema),xH.jsonErr(422,SXr.HTTPValidationError$inboundSchema),xH.fail("4XX"),xH.fail("5XX"))(h,{extraFields:v});return g.ok,g}});var TMt=b(UC=>{"use strict";var CXr=UC&&UC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OXr=UC&&UC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cne=UC&&UC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&CXr(e,t,r);return OXr(e,t),e};Object.defineProperty(UC,"__esModule",{value:!0});UC.chatStream=jXr;var EXr=Cne(ye()),PXr=jo(),TXr=dH(),CH=Cne(Do()),AXr=Re(),IXr=pe(),EMt=No(),MXr=ro(),PMt=Cne(gn()),RXr=Cne(nm());async function jXr(t,e,r){let n=(0,IXr.safeParse)(e,_=>PMt.ChatCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,PXr.encodeJSON)("body",o,{explode:!0}),a=(0,MXr.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,AXr.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,EMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,EMt.resolveGlobalSecurity)(l),d={operationID:"stream_chat",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,v={HttpMeta:{Response:h,Request:p}},[g]=await CH.match(CH.sse(200,EXr.instanceof(ReadableStream).transform(_=>new TXr.EventStream({stream:_,decoder(w){return PMt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),CH.jsonErr(422,RXr.HTTPValidationError$inboundSchema),CH.fail("4XX"),CH.fail("5XX"))(h,{extraFields:v});return g.ok,g}});var One=b(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});yS.getDefaultOptions=yS.defaultOptions=yS.ignoreOverride=void 0;yS.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");yS.defaultOptions={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"};var DXr=t=>typeof t=="string"?{...yS.defaultOptions,name:t}:{...yS.defaultOptions,...t};yS.getDefaultOptions=DXr});var cTe=b(Ene=>{"use strict";Object.defineProperty(Ene,"__esModule",{value:!0});Ene.getRefs=void 0;var NXr=One(),LXr=t=>{let e=(0,NXr.getDefaultOptions)(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};Ene.getRefs=LXr});var UT=b($B=>{"use strict";Object.defineProperty($B,"__esModule",{value:!0});$B.setResponseValueAndErrors=$B.addErrorMessage=void 0;function AMt(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}$B.addErrorMessage=AMt;function FXr(t,e,r,n,o){t[e]=r,AMt(t,e,n,o)}$B.setResponseValueAndErrors=FXr});var dTe=b(Pne=>{"use strict";Object.defineProperty(Pne,"__esModule",{value:!0});Pne.parseAnyDef=void 0;function kXr(){return{}}Pne.parseAnyDef=kXr});var fTe=b(Ane=>{"use strict";Object.defineProperty(Ane,"__esModule",{value:!0});Ane.parseArrayDef=void 0;var BXr=ye(),Tne=UT(),$Xr=Lu();function qXr(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==BXr.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,$Xr.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,Tne.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,Tne.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,Tne.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,Tne.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}Ane.parseArrayDef=qXr});var pTe=b(Ine=>{"use strict";Object.defineProperty(Ine,"__esModule",{value:!0});Ine.parseBigintDef=void 0;var rj=UT();function UXr(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?(0,rj.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,rj.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,rj.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,rj.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,rj.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,rj.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,rj.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Ine.parseBigintDef=UXr});var mTe=b(Mne=>{"use strict";Object.defineProperty(Mne,"__esModule",{value:!0});Mne.parseBooleanDef=void 0;function zXr(){return{type:"boolean"}}Mne.parseBooleanDef=zXr});var jne=b(Rne=>{"use strict";Object.defineProperty(Rne,"__esModule",{value:!0});Rne.parseBrandedDef=void 0;var HXr=Lu();function VXr(t,e){return(0,HXr.parseDef)(t.type._def,e)}Rne.parseBrandedDef=VXr});var hTe=b(Dne=>{"use strict";Object.defineProperty(Dne,"__esModule",{value:!0});Dne.parseCatchDef=void 0;var WXr=Lu(),KXr=(t,e)=>(0,WXr.parseDef)(t.innerType._def,e);Dne.parseCatchDef=KXr});var gTe=b(Nne=>{"use strict";Object.defineProperty(Nne,"__esModule",{value:!0});Nne.parseDateDef=void 0;var IMt=UT();function MMt(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>MMt(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return JXr(t,e)}}Nne.parseDateDef=MMt;var JXr=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":(0,IMt.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,IMt.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var yTe=b(Lne=>{"use strict";Object.defineProperty(Lne,"__esModule",{value:!0});Lne.parseDefaultDef=void 0;var GXr=Lu();function YXr(t,e){return{...(0,GXr.parseDef)(t.innerType._def,e),default:t.defaultValue()}}Lne.parseDefaultDef=YXr});var bTe=b(Fne=>{"use strict";Object.defineProperty(Fne,"__esModule",{value:!0});Fne.parseEffectsDef=void 0;var ZXr=Lu();function XXr(t,e){return e.effectStrategy==="input"?(0,ZXr.parseDef)(t.schema._def,e):{}}Fne.parseEffectsDef=XXr});var _Te=b(kne=>{"use strict";Object.defineProperty(kne,"__esModule",{value:!0});kne.parseEnumDef=void 0;function QXr(t){return{type:"string",enum:Array.from(t.values)}}kne.parseEnumDef=QXr});var vTe=b(Bne=>{"use strict";Object.defineProperty(Bne,"__esModule",{value:!0});Bne.parseIntersectionDef=void 0;var RMt=Lu(),eQr=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function tQr(t,e){let r=[(0,RMt.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,RMt.parseDef)(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(eQr(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...u}=i;a=u}else n=void 0;o.push(a)}}),o.length?{allOf:o,...n}:void 0}Bne.parseIntersectionDef=tQr});var wTe=b($ne=>{"use strict";Object.defineProperty($ne,"__esModule",{value:!0});$ne.parseLiteralDef=void 0;function rQr(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}$ne.parseLiteralDef=rQr});var qne=b(Oc=>{"use strict";Object.defineProperty(Oc,"__esModule",{value:!0});Oc.parseStringDef=Oc.zodPatterns=void 0;var nj=UT(),STe;Oc.zodPatterns={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(STe===void 0&&(STe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),STe),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function nQr(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,nj.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,nj.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Yg(r,"email",n.message,e);break;case"format:idn-email":Yg(r,"idn-email",n.message,e);break;case"pattern:zod":nf(r,Oc.zodPatterns.email,n.message,e);break}break;case"url":Yg(r,"uri",n.message,e);break;case"uuid":Yg(r,"uuid",n.message,e);break;case"regex":nf(r,n.regex,n.message,e);break;case"cuid":nf(r,Oc.zodPatterns.cuid,n.message,e);break;case"cuid2":nf(r,Oc.zodPatterns.cuid2,n.message,e);break;case"startsWith":nf(r,RegExp(`^${xTe(n.value,e)}`),n.message,e);break;case"endsWith":nf(r,RegExp(`${xTe(n.value,e)}$`),n.message,e);break;case"datetime":Yg(r,"date-time",n.message,e);break;case"date":Yg(r,"date",n.message,e);break;case"time":Yg(r,"time",n.message,e);break;case"duration":Yg(r,"duration",n.message,e);break;case"length":(0,nj.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,nj.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{nf(r,RegExp(xTe(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Yg(r,"ipv4",n.message,e),n.version!=="v4"&&Yg(r,"ipv6",n.message,e);break}case"base64url":nf(r,Oc.zodPatterns.base64url,n.message,e);break;case"jwt":nf(r,Oc.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&nf(r,Oc.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&nf(r,Oc.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":nf(r,Oc.zodPatterns.emoji(),n.message,e);break;case"ulid":{nf(r,Oc.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Yg(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,nj.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{nf(r,Oc.zodPatterns.base64,n.message,e);break}}break}case"nanoid":nf(r,Oc.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}Oc.parseStringDef=nQr;function xTe(t,e){return e.patternStrategy==="escape"?iQr(t):t}var oQr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function iQr(t){let e="";for(let r=0;r<t.length;r++)oQr.has(t[r])||(e+="\\"),e+=t[r];return e}function Yg(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):(0,nj.setResponseValueAndErrors)(t,"format",e,r,n)}function nf(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:jMt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,nj.setResponseValueAndErrors)(t,"pattern",jMt(e,n),r,n)}function jMt(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",i=!1,a=!1,s=!1;for(let u=0;u<n.length;u++){if(i){o+=n[u],i=!1;continue}if(r.i){if(a){if(n[u].match(/[a-z]/)){s?(o+=n[u],o+=`${n[u-2]}-${n[u]}`.toUpperCase(),s=!1):n[u+1]==="-"&&n[u+2]?.match(/[a-z]/)?(o+=n[u],s=!0):o+=`${n[u]}${n[u].toUpperCase()}`;continue}}else if(n[u].match(/[a-z]/)){o+=`[${n[u]}${n[u].toUpperCase()}]`;continue}}if(r.m){if(n[u]==="^"){o+=`(^|(?<=[\r
]))`;continue}else if(n[u]==="$"){o+=`($|(?=[\r
]))`;continue}}if(r.s&&n[u]==="."){o+=a?`${n[u]}\r
`:`[${n[u]}\r
]`;continue}o+=n[u],n[u]==="\\"?i=!0:a&&n[u]==="]"?a=!1:!a&&n[u]==="["&&(a=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}});var zne=b(Une=>{"use strict";Object.defineProperty(Une,"__esModule",{value:!0});Une.parseRecordDef=void 0;var OH=ye(),DMt=Lu(),aQr=qne(),sQr=jne();function uQr(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===OH.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,DMt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,DMt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===OH.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,aQr.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===OH.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===OH.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===OH.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,sQr.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}Une.parseRecordDef=uQr});var CTe=b(Hne=>{"use strict";Object.defineProperty(Hne,"__esModule",{value:!0});Hne.parseMapDef=void 0;var NMt=Lu(),lQr=zne();function cQr(t,e){if(e.mapStrategy==="record")return(0,lQr.parseRecordDef)(t,e);let r=(0,NMt.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,NMt.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}Hne.parseMapDef=cQr});var OTe=b(Vne=>{"use strict";Object.defineProperty(Vne,"__esModule",{value:!0});Vne.parseNativeEnumDef=void 0;function dQr(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}Vne.parseNativeEnumDef=dQr});var ETe=b(Wne=>{"use strict";Object.defineProperty(Wne,"__esModule",{value:!0});Wne.parseNeverDef=void 0;function fQr(){return{not:{}}}Wne.parseNeverDef=fQr});var PTe=b(Kne=>{"use strict";Object.defineProperty(Kne,"__esModule",{value:!0});Kne.parseNullDef=void 0;function pQr(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}Kne.parseNullDef=pQr});var Jne=b(zT=>{"use strict";Object.defineProperty(zT,"__esModule",{value:!0});zT.parseUnionDef=zT.primitiveMappings=void 0;var mQr=Lu();zT.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function hQr(t,e){if(e.target==="openApi3")return LMt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in zT.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=zT.primitiveMappings[i._def.typeName];return a&&!o.includes(a)?[...o,a]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...o,a];case"bigint":return[...o,"integer"];case"object":if(i._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,a,s)=>s.indexOf(i)===a);return{type:o.length>1?o:o[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return LMt(t,e)}zT.parseUnionDef=hQr;var LMt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,mQr.parseDef)(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});var TTe=b(Gne=>{"use strict";Object.defineProperty(Gne,"__esModule",{value:!0});Gne.parseNullableDef=void 0;var FMt=Lu(),kMt=Jne();function gQr(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:kMt.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[kMt.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,FMt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,FMt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}Gne.parseNullableDef=gQr});var ATe=b(Yne=>{"use strict";Object.defineProperty(Yne,"__esModule",{value:!0});Yne.parseNumberDef=void 0;var HT=UT();function yQr(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",(0,HT.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,HT.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,HT.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,HT.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,HT.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,HT.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,HT.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,HT.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Yne.parseNumberDef=yQr});var MTe=b(Zne=>{"use strict";Object.defineProperty(Zne,"__esModule",{value:!0});Zne.parseObjectDef=void 0;var bQr=ye(),ITe=Lu();function _Qr(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,ITe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,ITe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function vQr(t,e){let r=e.target==="openAi",n={type:"object",...Object.entries(t.shape()).reduce((o,[i,a])=>{if(a===void 0||a._def===void 0)return o;let s=a.isOptional();s&&r&&(a instanceof bQr.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,ITe.parseDef)(a._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});return u===void 0?o:{properties:{...o.properties,[i]:u},required:s?o.required:[...o.required,i]}},{properties:{},required:[]}),additionalProperties:_Qr(t,e)};return n.required.length||delete n.required,n}Zne.parseObjectDef=vQr});var RTe=b(Xne=>{"use strict";Object.defineProperty(Xne,"__esModule",{value:!0});Xne.parseOptionalDef=void 0;var BMt=Lu(),wQr=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,BMt.parseDef)(t.innerType._def,e);let r=(0,BMt.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};Xne.parseOptionalDef=wQr});var jTe=b(eoe=>{"use strict";Object.defineProperty(eoe,"__esModule",{value:!0});eoe.parsePipelineDef=void 0;var Qne=Lu(),SQr=(t,e)=>{if(e.pipeStrategy==="input")return(0,Qne.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,Qne.parseDef)(t.out._def,e);let r=(0,Qne.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,Qne.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};eoe.parsePipelineDef=SQr});var DTe=b(toe=>{"use strict";Object.defineProperty(toe,"__esModule",{value:!0});toe.parsePromiseDef=void 0;var xQr=Lu();function CQr(t,e){return(0,xQr.parseDef)(t.type._def,e)}toe.parsePromiseDef=CQr});var NTe=b(roe=>{"use strict";Object.defineProperty(roe,"__esModule",{value:!0});roe.parseSetDef=void 0;var $Mt=UT(),OQr=Lu();function EQr(t,e){let n={type:"array",uniqueItems:!0,items:(0,OQr.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,$Mt.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,$Mt.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}roe.parseSetDef=EQr});var FTe=b(noe=>{"use strict";Object.defineProperty(noe,"__esModule",{value:!0});noe.parseTupleDef=void 0;var LTe=Lu();function PQr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,LTe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,LTe.parseDef)(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>(0,LTe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}noe.parseTupleDef=PQr});var kTe=b(ooe=>{"use strict";Object.defineProperty(ooe,"__esModule",{value:!0});ooe.parseUndefinedDef=void 0;function TQr(){return{not:{}}}ooe.parseUndefinedDef=TQr});var BTe=b(ioe=>{"use strict";Object.defineProperty(ioe,"__esModule",{value:!0});ioe.parseUnknownDef=void 0;function AQr(){return{}}ioe.parseUnknownDef=AQr});var $Te=b(aoe=>{"use strict";Object.defineProperty(aoe,"__esModule",{value:!0});aoe.parseReadonlyDef=void 0;var IQr=Lu(),MQr=(t,e)=>(0,IQr.parseDef)(t.innerType._def,e);aoe.parseReadonlyDef=MQr});var Lu=b(soe=>{"use strict";Object.defineProperty(soe,"__esModule",{value:!0});soe.parseDef=void 0;var yn=ye(),RQr=dTe(),jQr=fTe(),DQr=pTe(),NQr=mTe(),LQr=jne(),FQr=hTe(),kQr=gTe(),BQr=yTe(),$Qr=bTe(),qQr=_Te(),UQr=vTe(),zQr=wTe(),HQr=CTe(),VQr=OTe(),WQr=ETe(),KQr=PTe(),JQr=TTe(),GQr=ATe(),YQr=MTe(),ZQr=RTe(),XQr=jTe(),QQr=DTe(),een=zne(),ten=NTe(),ren=qne(),nen=FTe(),oen=kTe(),ien=Jne(),aen=BTe(),sen=$Te(),uen=One();function qMt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==uen.ignoreOverride)return a}if(n&&!r){let a=len(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=den(t,t.typeName,e);return i&&fen(t,e,i),o.jsonSchema=i,i}soe.parseDef=qMt;var len=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:cen(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},cen=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},den=(t,e,r)=>{switch(e){case yn.ZodFirstPartyTypeKind.ZodString:return(0,ren.parseStringDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodNumber:return(0,GQr.parseNumberDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodObject:return(0,YQr.parseObjectDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodBigInt:return(0,DQr.parseBigintDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodBoolean:return(0,NQr.parseBooleanDef)();case yn.ZodFirstPartyTypeKind.ZodDate:return(0,kQr.parseDateDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodUndefined:return(0,oen.parseUndefinedDef)();case yn.ZodFirstPartyTypeKind.ZodNull:return(0,KQr.parseNullDef)(r);case yn.ZodFirstPartyTypeKind.ZodArray:return(0,jQr.parseArrayDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodUnion:case yn.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,ien.parseUnionDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodIntersection:return(0,UQr.parseIntersectionDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodTuple:return(0,nen.parseTupleDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodRecord:return(0,een.parseRecordDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodLiteral:return(0,zQr.parseLiteralDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodEnum:return(0,qQr.parseEnumDef)(t);case yn.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,VQr.parseNativeEnumDef)(t);case yn.ZodFirstPartyTypeKind.ZodNullable:return(0,JQr.parseNullableDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodOptional:return(0,ZQr.parseOptionalDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodMap:return(0,HQr.parseMapDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodSet:return(0,ten.parseSetDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodLazy:return qMt(t.getter()._def,r);case yn.ZodFirstPartyTypeKind.ZodPromise:return(0,QQr.parsePromiseDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodNaN:case yn.ZodFirstPartyTypeKind.ZodNever:return(0,WQr.parseNeverDef)();case yn.ZodFirstPartyTypeKind.ZodEffects:return(0,$Qr.parseEffectsDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodAny:return(0,RQr.parseAnyDef)();case yn.ZodFirstPartyTypeKind.ZodUnknown:return(0,aen.parseUnknownDef)();case yn.ZodFirstPartyTypeKind.ZodDefault:return(0,BQr.parseDefaultDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodBranded:return(0,LQr.parseBrandedDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodReadonly:return(0,sen.parseReadonlyDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodCatch:return(0,FQr.parseCatchDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodPipeline:return(0,XQr.parsePipelineDef)(t,r);case yn.ZodFirstPartyTypeKind.ZodFunction:case yn.ZodFirstPartyTypeKind.ZodVoid:case yn.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},fen=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var qTe=b(uoe=>{"use strict";Object.defineProperty(uoe,"__esModule",{value:!0});uoe.zodToJsonSchema=void 0;var UMt=Lu(),pen=cTe(),men=(t,e)=>{let r=(0,pen.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,UMt.parseDef)(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??{}}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(0,UMt.parseDef)(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??{},a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(i.title=a);let s=o===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s};uoe.zodToJsonSchema=men});var zMt=b(jr=>{"use strict";var hen=jr&&jr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tn=jr&&jr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hen(e,t,r)};Object.defineProperty(jr,"__esModule",{value:!0});Tn(One(),jr);Tn(cTe(),jr);Tn(UT(),jr);Tn(Lu(),jr);Tn(dTe(),jr);Tn(fTe(),jr);Tn(pTe(),jr);Tn(mTe(),jr);Tn(jne(),jr);Tn(hTe(),jr);Tn(gTe(),jr);Tn(yTe(),jr);Tn(bTe(),jr);Tn(_Te(),jr);Tn(vTe(),jr);Tn(wTe(),jr);Tn(CTe(),jr);Tn(OTe(),jr);Tn(ETe(),jr);Tn(PTe(),jr);Tn(TTe(),jr);Tn(ATe(),jr);Tn(MTe(),jr);Tn(RTe(),jr);Tn(jTe(),jr);Tn(DTe(),jr);Tn($Te(),jr);Tn(zne(),jr);Tn(NTe(),jr);Tn(qne(),jr);Tn(FTe(),jr);Tn(kTe(),jr);Tn(Jne(),jr);Tn(BTe(),jr);Tn(qTe(),jr);var gen=qTe();jr.default=gen.zodToJsonSchema});var VMt=b(EH=>{"use strict";Object.defineProperty(EH,"__esModule",{value:!0});EH.transformToChatCompletionRequest=ben;EH.convertToParsedChatCompletionResponse=_en;EH.responseFormatFromZodObject=HMt;var yen=zMt();function ben(t){let{responseFormat:e,...r}=t,n=HMt(e);return{...r,responseFormat:n}}function _en(t,e){if(t.choices===void 0||t.choices.length===0)return{...t,choices:t.choices===void 0?void 0:[]};let r=[];for(let n of t.choices)n.message===null||typeof n.message>"u"?r.push({...n,message:void 0}):n.message.content!==null&&typeof n.message.content<"u"&&!Array.isArray(n.message.content)&&r.push({...n,message:{...n.message,parsed:e.safeParse(JSON.parse(n.message.content)).data}});return{...t,choices:r}}function HMt(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,yen.zodToJsonSchema)(t),strict:!0}}}});var JMt=b(coe=>{"use strict";Object.defineProperty(coe,"__esModule",{value:!0});coe.Chat=void 0;var WMt=OMt(),KMt=TMt(),ven=tm(),loe=fh(),UTe=VMt(),zTe=class extends ven.ClientSDK{async parse(e,r){let n=(0,UTe.transformToChatCompletionRequest)(e),o=await(0,loe.unwrapAsync)((0,WMt.chatComplete)(this,n,r));return(0,UTe.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,UTe.transformToChatCompletionRequest)(e);return(0,loe.unwrapAsync)((0,KMt.chatStream)(this,n,r))}async complete(e,r){return(0,loe.unwrapAsync)((0,WMt.chatComplete)(this,e,r))}async stream(e,r){return(0,loe.unwrapAsync)((0,KMt.chatStream)(this,e,r))}};coe.Chat=zTe});var ZMt=b(zC=>{"use strict";var wen=zC&&zC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Sen=zC&&zC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HTe=zC&&zC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wen(e,t,r);return Sen(e,t),e};Object.defineProperty(zC,"__esModule",{value:!0});zC.classifiersModerate=Ten;var xen=jo(),PH=HTe(Do()),Cen=Re(),Oen=pe(),GMt=No(),Een=ro(),YMt=HTe(gn()),Pen=HTe(nm());async function Ten(t,e,r){let n=(0,Oen.safeParse)(e,_=>YMt.ClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,xen.encodeJSON)("body",o,{explode:!0}),a=(0,Een.pathToFunc)("/v1/moderations")(),s=new Headers((0,Cen.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,GMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,GMt.resolveGlobalSecurity)(l),d={operationID:"moderations_v1_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,v={HttpMeta:{Response:h,Request:p}},[g]=await PH.match(PH.json(200,YMt.ClassificationResponse$inboundSchema),PH.jsonErr(422,Pen.HTTPValidationError$inboundSchema),PH.fail("4XX"),PH.fail("5XX"))(h,{extraFields:v});return g.ok,g}});var eRt=b(HC=>{"use strict";var Aen=HC&&HC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ien=HC&&HC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VTe=HC&&HC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Aen(e,t,r);return Ien(e,t),e};Object.defineProperty(HC,"__esModule",{value:!0});HC.classifiersModerateChat=Len;var Men=jo(),TH=VTe(Do()),Ren=Re(),jen=pe(),XMt=No(),Den=ro(),QMt=VTe(gn()),Nen=VTe(nm());async function Len(t,e,r){let n=(0,jen.safeParse)(e,_=>QMt.ChatClassificationRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Men.encodeJSON)("body",o,{explode:!0}),a=(0,Den.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,Ren.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,XMt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,XMt.resolveGlobalSecurity)(l),d={operationID:"moderations_chat_v1_chat_moderations_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,v={HttpMeta:{Response:h,Request:p}},[g]=await TH.match(TH.json(200,QMt.ClassificationResponse$inboundSchema),TH.jsonErr(422,Nen.HTTPValidationError$inboundSchema),TH.fail("4XX"),TH.fail("5XX"))(h,{extraFields:v});return g.ok,g}});var rRt=b(doe=>{"use strict";Object.defineProperty(doe,"__esModule",{value:!0});doe.Classifiers=void 0;var Fen=ZMt(),ken=eRt(),Ben=tm(),tRt=fh(),WTe=class extends Ben.ClientSDK{async moderate(e,r){return(0,tRt.unwrapAsync)((0,Fen.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,tRt.unwrapAsync)((0,ken.classifiersModerateChat)(this,e,r))}};doe.Classifiers=WTe});var iRt=b(VC=>{"use strict";var $en=VC&&VC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qen=VC&&VC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KTe=VC&&VC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$en(e,t,r);return qen(e,t),e};Object.defineProperty(VC,"__esModule",{value:!0});VC.embeddingsCreate=Ken;var Uen=jo(),AH=KTe(Do()),zen=Re(),Hen=pe(),nRt=No(),Ven=ro(),oRt=KTe(gn()),Wen=KTe(nm());async function Ken(t,e,r){let n=(0,Hen.safeParse)(e,_=>oRt.EmbeddingRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Uen.encodeJSON)("body",o,{explode:!0}),a=(0,Ven.pathToFunc)("/v1/embeddings")(),s=new Headers((0,zen.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,nRt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,nRt.resolveGlobalSecurity)(l),d={operationID:"embeddings_v1_embeddings_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,v={HttpMeta:{Response:h,Request:p}},[g]=await AH.match(AH.json(200,oRt.EmbeddingResponse$inboundSchema),AH.jsonErr(422,Wen.HTTPValidationError$inboundSchema),AH.fail("4XX"),AH.fail("5XX"))(h,{extraFields:v});return g.ok,g}});var aRt=b(foe=>{"use strict";Object.defineProperty(foe,"__esModule",{value:!0});foe.Embeddings=void 0;var Jen=iRt(),Gen=tm(),Yen=fh(),JTe=class extends Gen.ClientSDK{async create(e,r){return(0,Yen.unwrapAsync)((0,Jen.embeddingsCreate)(this,e,r))}};foe.Embeddings=JTe});var uRt=b(WC=>{"use strict";var Zen=WC&&WC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xen=WC&&WC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GTe=WC&&WC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Zen(e,t,r);return Xen(e,t),e};Object.defineProperty(WC,"__esModule",{value:!0});WC.filesDelete=itn;var Qen=jo(),poe=GTe(Do()),etn=Re(),ttn=pe(),sRt=No(),rtn=ro(),ntn=GTe(gn()),otn=GTe(Nu());async function itn(t,e,r){let n=(0,ttn.safeParse)(e,_=>otn.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,Qen.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,rtn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,etn.compactMap)({Accept:"application/json"})),l=await(0,sRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,sRt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_delete_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await poe.match(poe.json(200,ntn.DeleteFileOut$inboundSchema),poe.fail("4XX"),poe.fail("5XX"))(v);return g.ok,g}});var cRt=b(KC=>{"use strict";var atn=KC&&KC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),stn=KC&&KC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YTe=KC&&KC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&atn(e,t,r);return stn(e,t),e};Object.defineProperty(KC,"__esModule",{value:!0});KC.filesDownload=mtn;var utn=YTe(ye()),ltn=jo(),moe=YTe(Do()),ctn=Re(),dtn=pe(),lRt=No(),ftn=ro(),ptn=YTe(Nu());async function mtn(t,e,r){let n=(0,dtn.safeParse)(e,_=>ptn.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,ltn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,ftn.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,ctn.compactMap)({Accept:"application/octet-stream"})),l=await(0,lRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,lRt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_download_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await moe.match(moe.stream(200,utn.instanceof(ReadableStream)),moe.fail("4XX"),moe.fail("5XX"))(v);return g.ok,g}});var pRt=b(JC=>{"use strict";var htn=JC&&JC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gtn=JC&&JC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZTe=JC&&JC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&htn(e,t,r);return gtn(e,t),e};Object.defineProperty(JC,"__esModule",{value:!0});JC.filesGetSignedUrl=Stn;var dRt=jo(),hoe=ZTe(Do()),ytn=Re(),btn=pe(),fRt=No(),_tn=ro(),vtn=ZTe(gn()),wtn=ZTe(Nu());async function Stn(t,e,r){let n=(0,btn.safeParse)(e,w=>wtn.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,dRt.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,_tn.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,dRt.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,ytn.compactMap)({Accept:"application/json"})),c=await(0,fRt.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,fRt.resolveGlobalSecurity)(d),p={operationID:"files_api_routes_get_signed_url",oAuth2Scopes:[],resolvedSecurity:f,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},m=t._createRequest(p,{security:f,method:"GET",baseURL:r?.serverURL,path:s,headers:l,query:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return m;let h=m.value,v=await t._do(h,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!v.ok)return v;let g=v.value,[_]=await hoe.match(hoe.json(200,vtn.FileSignedURL$inboundSchema),hoe.fail("4XX"),hoe.fail("5XX"))(g);return _.ok,_}});var hRt=b(GC=>{"use strict";var xtn=GC&&GC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ctn=GC&&GC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XTe=GC&&GC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xtn(e,t,r);return Ctn(e,t),e};Object.defineProperty(GC,"__esModule",{value:!0});GC.filesList=Mtn;var Otn=jo(),goe=XTe(Do()),Etn=Re(),Ptn=pe(),mRt=No(),Ttn=ro(),Atn=XTe(gn()),Itn=XTe(Nu());async function Mtn(t,e,r){let n=(0,Ptn.safeParse)(e,_=>Itn.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,Ttn.pathToFunc)("/v1/files")(),s=(0,Otn.encodeFormQuery)({page:o?.page,page_size:o?.page_size,purpose:o?.purpose,sample_type:o?.sample_type,search:o?.search,source:o?.source}),u=new Headers((0,Etn.compactMap)({Accept:"application/json"})),l=await(0,mRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,mRt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_list_files",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await goe.match(goe.json(200,Atn.ListFilesOut$inboundSchema),goe.fail("4XX"),goe.fail("5XX"))(v);return g.ok,g}});var yRt=b(YC=>{"use strict";var Rtn=YC&&YC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jtn=YC&&YC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QTe=YC&&YC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rtn(e,t,r);return jtn(e,t),e};Object.defineProperty(YC,"__esModule",{value:!0});YC.filesRetrieve=$tn;var Dtn=jo(),yoe=QTe(Do()),Ntn=Re(),Ltn=pe(),gRt=No(),Ftn=ro(),ktn=QTe(gn()),Btn=QTe(Nu());async function $tn(t,e,r){let n=(0,Ltn.safeParse)(e,_=>Btn.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,Dtn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,Ftn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,Ntn.compactMap)({Accept:"application/json"})),l=await(0,gRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,gRt.resolveGlobalSecurity)(c),f={operationID:"files_api_routes_retrieve_file",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await yoe.match(yoe.json(200,ktn.RetrieveFileOut$inboundSchema),yoe.fail("4XX"),yoe.fail("5XX"))(v);return g.ok,g}});var bRt=b(eAe=>{"use strict";Object.defineProperty(eAe,"__esModule",{value:!0});eAe.isReadableStream=qtn;function qtn(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.getReader=="function"&&typeof e.cancel=="function"&&typeof e.tee=="function"}});var vRt=b(ZC=>{"use strict";var Utn=ZC&&ZC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ztn=ZC&&ZC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tAe=ZC&&ZC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Utn(e,t,r);return ztn(e,t),e};Object.defineProperty(ZC,"__esModule",{value:!0});ZC.filesUpload=Xtn;var boe=jo(),Htn=FEe(),_oe=tAe(Do()),Vtn=Re(),Wtn=pe(),_Rt=No(),Ktn=ro(),Jtn=tAe(gn()),Gtn=tAe(Nu()),Ytn=nTe(),Ztn=bRt();async function Xtn(t,e,r){let n=(0,Wtn.safeParse)(e,g=>Gtn.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,Ytn.isBlobLike)(o.file))(0,boe.appendForm)(i,"file",o.file);else if((0,Ztn.isReadableStream)(o.file.content)){let g=await(0,Htn.readableStreamToArrayBuffer)(o.file.content),_=new Blob([g],{type:"application/octet-stream"});(0,boe.appendForm)(i,"file",_)}else(0,boe.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,boe.appendForm)(i,"purpose",o.purpose);let a=(0,Ktn.pathToFunc)("/v1/files")(),s=new Headers((0,Vtn.compactMap)({Accept:"application/json"})),u=await(0,_Rt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,_Rt.resolveGlobalSecurity)(l),d={operationID:"files_api_routes_upload_file",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[v]=await _oe.match(_oe.json(200,Jtn.UploadFileOut$inboundSchema),_oe.fail("4XX"),_oe.fail("5XX"))(h);return v.ok,v}});var wRt=b(voe=>{"use strict";Object.defineProperty(voe,"__esModule",{value:!0});voe.Files=void 0;var Qtn=uRt(),ern=cRt(),trn=pRt(),rrn=hRt(),nrn=yRt(),orn=vRt(),irn=tm(),qB=fh(),rAe=class extends irn.ClientSDK{async upload(e,r){return(0,qB.unwrapAsync)((0,orn.filesUpload)(this,e,r))}async list(e,r){return(0,qB.unwrapAsync)((0,rrn.filesList)(this,e,r))}async retrieve(e,r){return(0,qB.unwrapAsync)((0,nrn.filesRetrieve)(this,e,r))}async delete(e,r){return(0,qB.unwrapAsync)((0,Qtn.filesDelete)(this,e,r))}async download(e,r){return(0,qB.unwrapAsync)((0,ern.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,qB.unwrapAsync)((0,trn.filesGetSignedUrl)(this,e,r))}};voe.Files=rAe});var CRt=b(XC=>{"use strict";var arn=XC&&XC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),srn=XC&&XC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nAe=XC&&XC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&arn(e,t,r);return srn(e,t),e};Object.defineProperty(XC,"__esModule",{value:!0});XC.fimComplete=prn;var urn=jo(),IH=nAe(Do()),lrn=Re(),crn=pe(),SRt=No(),drn=ro(),xRt=nAe(gn()),frn=nAe(nm());async function prn(t,e,r){let n=(0,crn.safeParse)(e,_=>xRt.FIMCompletionRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,urn.encodeJSON)("body",o,{explode:!0}),a=(0,drn.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,lrn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,SRt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,SRt.resolveGlobalSecurity)(l),d={operationID:"fim_completion_v1_fim_completions_post",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,v={HttpMeta:{Response:h,Request:p}},[g]=await IH.match(IH.json(200,xRt.FIMCompletionResponse$inboundSchema),IH.jsonErr(422,frn.HTTPValidationError$inboundSchema),IH.fail("4XX"),IH.fail("5XX"))(h,{extraFields:v});return g.ok,g}});var PRt=b(QC=>{"use strict";var mrn=QC&&QC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hrn=QC&&QC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),woe=QC&&QC.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mrn(e,t,r);return hrn(e,t),e};Object.defineProperty(QC,"__esModule",{value:!0});QC.fimStream=xrn;var grn=woe(ye()),yrn=jo(),brn=dH(),MH=woe(Do()),_rn=Re(),vrn=pe(),ORt=No(),wrn=ro(),ERt=woe(gn()),Srn=woe(nm());async function xrn(t,e,r){let n=(0,vrn.safeParse)(e,_=>ERt.FIMCompletionStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,yrn.encodeJSON)("body",o,{explode:!0}),a=(0,wrn.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,_rn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,ORt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,ORt.resolveGlobalSecurity)(l),d={operationID:"stream_fim",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["422","4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,v={HttpMeta:{Response:h,Request:p}},[g]=await MH.match(MH.sse(200,grn.instanceof(ReadableStream).transform(_=>new brn.EventStream({stream:_,decoder(w){return ERt.CompletionEvent$inboundSchema.parse(w)}})),{sseSentinel:"[DONE]"}),MH.jsonErr(422,Srn.HTTPValidationError$inboundSchema),MH.fail("4XX"),MH.fail("5XX"))(h,{extraFields:v});return g.ok,g}});var ARt=b(Soe=>{"use strict";Object.defineProperty(Soe,"__esModule",{value:!0});Soe.Fim=void 0;var Crn=CRt(),Orn=PRt(),Ern=tm(),TRt=fh(),oAe=class extends Ern.ClientSDK{async complete(e,r){return(0,TRt.unwrapAsync)((0,Crn.fimComplete)(this,e,r))}async stream(e,r){return(0,TRt.unwrapAsync)((0,Orn.fimStream)(this,e,r))}};Soe.Fim=oAe});var MRt=b(eO=>{"use strict";var Prn=eO&&eO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Trn=eO&&eO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iAe=eO&&eO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Prn(e,t,r);return Trn(e,t),e};Object.defineProperty(eO,"__esModule",{value:!0});eO.fineTuningJobsCancel=Nrn;var Arn=jo(),xoe=iAe(Do()),Irn=Re(),Mrn=pe(),IRt=No(),Rrn=ro(),jrn=iAe(gn()),Drn=iAe(Nu());async function Nrn(t,e,r){let n=(0,Mrn.safeParse)(e,_=>Drn.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Arn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Rrn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,Irn.compactMap)({Accept:"application/json"})),l=await(0,IRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,IRt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_cancel_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await xoe.match(xoe.json(200,jrn.DetailedJobOut$inboundSchema),xoe.fail("4XX"),xoe.fail("5XX"))(v);return g.ok,g}});var jRt=b(tO=>{"use strict";var Lrn=tO&&tO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Frn=tO&&tO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aAe=tO&&tO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lrn(e,t,r);return Frn(e,t),e};Object.defineProperty(tO,"__esModule",{value:!0});tO.fineTuningJobsCreate=Hrn;var krn=jo(),Coe=aAe(Do()),Brn=Re(),$rn=pe(),RRt=No(),qrn=ro(),Urn=aAe(gn()),zrn=aAe(Nu());async function Hrn(t,e,r){let n=(0,$rn.safeParse)(e,g=>Urn.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,krn.encodeJSON)("body",o,{explode:!0}),a=(0,qrn.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,Brn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,RRt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,RRt.resolveGlobalSecurity)(l),d={operationID:"jobs_api_routes_fine_tuning_create_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:c,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},f=t._createRequest(d,{security:c,method:"POST",baseURL:r?.serverURL,path:a,headers:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return f;let p=f.value,m=await t._do(p,{context:d,errorCodes:["4XX","5XX"],retryConfig:d.retryConfig,retryCodes:d.retryCodes});if(!m.ok)return m;let h=m.value,[v]=await Coe.match(Coe.json(200,zrn.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),Coe.fail("4XX"),Coe.fail("5XX"))(h);return v.ok,v}});var NRt=b(rO=>{"use strict";var Vrn=rO&&rO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wrn=rO&&rO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sAe=rO&&rO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vrn(e,t,r);return Wrn(e,t),e};Object.defineProperty(rO,"__esModule",{value:!0});rO.fineTuningJobsGet=Qrn;var Krn=jo(),Ooe=sAe(Do()),Jrn=Re(),Grn=pe(),DRt=No(),Yrn=ro(),Zrn=sAe(gn()),Xrn=sAe(Nu());async function Qrn(t,e,r){let n=(0,Grn.safeParse)(e,_=>Xrn.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Krn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Yrn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,Jrn.compactMap)({Accept:"application/json"})),l=await(0,DRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,DRt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await Ooe.match(Ooe.json(200,Zrn.DetailedJobOut$inboundSchema),Ooe.fail("4XX"),Ooe.fail("5XX"))(v);return g.ok,g}});var FRt=b(nO=>{"use strict";var enn=nO&&nO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tnn=nO&&nO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uAe=nO&&nO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&enn(e,t,r);return tnn(e,t),e};Object.defineProperty(nO,"__esModule",{value:!0});nO.fineTuningJobsList=unn;var rnn=jo(),Eoe=uAe(Do()),nnn=Re(),onn=pe(),LRt=No(),inn=ro(),ann=uAe(gn()),snn=uAe(Nu());async function unn(t,e,r){let n=(0,onn.safeParse)(e,_=>snn.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,inn.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,rnn.encodeFormQuery)({created_after:o?.created_after,created_by_me:o?.created_by_me,model:o?.model,page:o?.page,page_size:o?.page_size,status:o?.status,suffix:o?.suffix,wandb_name:o?.wandb_name,wandb_project:o?.wandb_project}),u=new Headers((0,nnn.compactMap)({Accept:"application/json"})),l=await(0,LRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,LRt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_get_fine_tuning_jobs",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:a,headers:u,query:s,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await Eoe.match(Eoe.json(200,ann.JobsOut$inboundSchema),Eoe.fail("4XX"),Eoe.fail("5XX"))(v);return g.ok,g}});var BRt=b(oO=>{"use strict";var lnn=oO&&oO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cnn=oO&&oO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lAe=oO&&oO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lnn(e,t,r);return cnn(e,t),e};Object.defineProperty(oO,"__esModule",{value:!0});oO.fineTuningJobsStart=ynn;var dnn=jo(),Poe=lAe(Do()),fnn=Re(),pnn=pe(),kRt=No(),mnn=ro(),hnn=lAe(gn()),gnn=lAe(Nu());async function ynn(t,e,r){let n=(0,pnn.safeParse)(e,_=>gnn.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,dnn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,mnn.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,fnn.compactMap)({Accept:"application/json"})),l=await(0,kRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,kRt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_start_fine_tuning_job",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await Poe.match(Poe.json(200,hnn.DetailedJobOut$inboundSchema),Poe.fail("4XX"),Poe.fail("5XX"))(v);return g.ok,g}});var $Rt=b(Toe=>{"use strict";Object.defineProperty(Toe,"__esModule",{value:!0});Toe.Jobs=void 0;var bnn=MRt(),_nn=jRt(),vnn=NRt(),wnn=FRt(),Snn=BRt(),xnn=tm(),RH=fh(),cAe=class extends xnn.ClientSDK{async list(e,r){return(0,RH.unwrapAsync)((0,wnn.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,RH.unwrapAsync)((0,_nn.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,RH.unwrapAsync)((0,vnn.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,RH.unwrapAsync)((0,bnn.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,RH.unwrapAsync)((0,Snn.fineTuningJobsStart)(this,e,r))}};Toe.Jobs=cAe});var qRt=b(Aoe=>{"use strict";Object.defineProperty(Aoe,"__esModule",{value:!0});Aoe.FineTuning=void 0;var Cnn=tm(),Onn=$Rt(),dAe=class extends Cnn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new Onn.Jobs(this._options))}};Aoe.FineTuning=dAe});var zRt=b(iO=>{"use strict";var Enn=iO&&iO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pnn=iO&&iO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fAe=iO&&iO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Enn(e,t,r);return Pnn(e,t),e};Object.defineProperty(iO,"__esModule",{value:!0});iO.modelsArchive=Dnn;var Tnn=jo(),Ioe=fAe(Do()),Ann=Re(),Inn=pe(),URt=No(),Mnn=ro(),Rnn=fAe(gn()),jnn=fAe(Nu());async function Dnn(t,e,r){let n=(0,Inn.safeParse)(e,_=>jnn.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Tnn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Mnn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Ann.compactMap)({Accept:"application/json"})),l=await(0,URt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,URt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_archive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"POST",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await Ioe.match(Ioe.json(200,Rnn.ArchiveFTModelOut$inboundSchema),Ioe.fail("4XX"),Ioe.fail("5XX"))(v);return g.ok,g}});var VRt=b(aO=>{"use strict";var Nnn=aO&&aO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lnn=aO&&aO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Moe=aO&&aO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Nnn(e,t,r);return Lnn(e,t),e};Object.defineProperty(aO,"__esModule",{value:!0});aO.modelsDelete=Hnn;var Fnn=jo(),jH=Moe(Do()),knn=Re(),Bnn=pe(),HRt=No(),$nn=ro(),qnn=Moe(gn()),Unn=Moe(nm()),znn=Moe(Nu());async function Hnn(t,e,r){let n=(0,Bnn.safeParse)(e,w=>znn.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Fnn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,$nn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,knn.compactMap)({Accept:"application/json"})),l=await(0,HRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,HRt.resolveGlobalSecurity)(c),f={operationID:"delete_model_v1_models__model_id__delete",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,g={HttpMeta:{Response:v,Request:m}},[_]=await jH.match(jH.json(200,qnn.DeleteModelOut$inboundSchema),jH.jsonErr(422,Unn.HTTPValidationError$inboundSchema),jH.fail("4XX"),jH.fail("5XX"))(v,{extraFields:g});return _.ok,_}});var KRt=b(sO=>{"use strict";var Vnn=sO&&sO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wnn=sO&&sO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pAe=sO&&sO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vnn(e,t,r);return Wnn(e,t),e};Object.defineProperty(sO,"__esModule",{value:!0});sO.modelsList=Znn;var DH=pAe(Do()),Knn=Re(),WRt=No(),Jnn=ro(),Gnn=pAe(gn()),Ynn=pAe(nm());async function Znn(t,e){let r=(0,Jnn.pathToFunc)("/v1/models")(),n=new Headers((0,Knn.compactMap)({Accept:"application/json"})),o=await(0,WRt.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,WRt.resolveGlobalSecurity)(i),s={operationID:"list_models_v1_models_get",oAuth2Scopes:[],resolvedSecurity:a,securitySource:t._options.apiKey,retryConfig:e?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:e?.retryCodes||["429","500","502","503","504"]},u=t._createRequest(s,{security:a,method:"GET",baseURL:e?.serverURL,path:r,headers:n,timeoutMs:e?.timeoutMs||t._options.timeoutMs||-1},e);if(!u.ok)return u;let l=u.value,c=await t._do(l,{context:s,errorCodes:["422","4XX","5XX"],retryConfig:s.retryConfig,retryCodes:s.retryCodes});if(!c.ok)return c;let d=c.value,f={HttpMeta:{Response:d,Request:l}},[p]=await DH.match(DH.json(200,Gnn.ModelList$inboundSchema),DH.jsonErr(422,Ynn.HTTPValidationError$inboundSchema),DH.fail("4XX"),DH.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var YRt=b(uO=>{"use strict";var Xnn=uO&&uO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qnn=uO&&uO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mAe=uO&&uO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xnn(e,t,r);return Qnn(e,t),e};Object.defineProperty(uO,"__esModule",{value:!0});uO.modelsRetrieve=ion;var eon=jo(),NH=mAe(Do()),ton=Re(),ron=pe(),JRt=No(),non=ro(),oon=mAe(nm()),GRt=mAe(Nu());async function ion(t,e,r){let n=(0,ron.safeParse)(e,w=>GRt.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,eon.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,non.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,ton.compactMap)({Accept:"application/json"})),l=await(0,JRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,JRt.resolveGlobalSecurity)(c),f={operationID:"retrieve_model_v1_models__model_id__get",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"GET",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["422","4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,g={HttpMeta:{Response:v,Request:m}},[_]=await NH.match(NH.json(200,GRt.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),NH.jsonErr(422,oon.HTTPValidationError$inboundSchema),NH.fail("4XX"),NH.fail("5XX"))(v,{extraFields:g});return _.ok,_}});var XRt=b(lO=>{"use strict";var aon=lO&&lO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),son=lO&&lO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hAe=lO&&lO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aon(e,t,r);return son(e,t),e};Object.defineProperty(lO,"__esModule",{value:!0});lO.modelsUnarchive=mon;var uon=jo(),Roe=hAe(Do()),lon=Re(),con=pe(),ZRt=No(),don=ro(),fon=hAe(gn()),pon=hAe(Nu());async function mon(t,e,r){let n=(0,con.safeParse)(e,_=>pon.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,uon.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,don.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,lon.compactMap)({Accept:"application/json"})),l=await(0,ZRt.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ZRt.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_unarchive_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"DELETE",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await Roe.match(Roe.json(200,fon.UnarchiveFTModelOut$inboundSchema),Roe.fail("4XX"),Roe.fail("5XX"))(v);return g.ok,g}});var t1t=b(cO=>{"use strict";var hon=cO&&cO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gon=cO&&cO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gAe=cO&&cO.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hon(e,t,r);return gon(e,t),e};Object.defineProperty(cO,"__esModule",{value:!0});cO.modelsUpdate=Son;var QRt=jo(),joe=gAe(Do()),yon=Re(),bon=pe(),e1t=No(),_on=ro(),von=gAe(gn()),won=gAe(Nu());async function Son(t,e,r){let n=(0,bon.safeParse)(e,_=>won.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,QRt.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,QRt.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,_on.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,yon.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,e1t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,e1t.resolveGlobalSecurity)(c),f={operationID:"jobs_api_routes_fine_tuning_update_fine_tuned_model",oAuth2Scopes:[],resolvedSecurity:d,securitySource:t._options.apiKey,retryConfig:r?.retries||t._options.retryConfig||{strategy:"none"},retryCodes:r?.retryCodes||["429","500","502","503","504"]},p=t._createRequest(f,{security:d,method:"PATCH",baseURL:r?.serverURL,path:s,headers:u,body:i,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return p;let m=p.value,h=await t._do(m,{context:f,errorCodes:["4XX","5XX"],retryConfig:f.retryConfig,retryCodes:f.retryCodes});if(!h.ok)return h;let v=h.value,[g]=await joe.match(joe.json(200,von.FTModelOut$inboundSchema),joe.fail("4XX"),joe.fail("5XX"))(v);return g.ok,g}});var r1t=b(Doe=>{"use strict";Object.defineProperty(Doe,"__esModule",{value:!0});Doe.Models=void 0;var xon=zRt(),Con=VRt(),Oon=KRt(),Eon=YRt(),Pon=XRt(),Ton=t1t(),Aon=tm(),UB=fh(),yAe=class extends Aon.ClientSDK{async list(e){return(0,UB.unwrapAsync)((0,Oon.modelsList)(this,e))}async retrieve(e,r){return(0,UB.unwrapAsync)((0,Eon.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,UB.unwrapAsync)((0,Con.modelsDelete)(this,e,r))}async update(e,r){return(0,UB.unwrapAsync)((0,Ton.modelsUpdate)(this,e,r))}async archive(e,r){return(0,UB.unwrapAsync)((0,xon.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,UB.unwrapAsync)((0,Pon.modelsUnarchive)(this,e,r))}};Doe.Models=yAe});var n1t=b(Noe=>{"use strict";Object.defineProperty(Noe,"__esModule",{value:!0});Noe.Mistral=void 0;var Ion=tm(),Mon=KAt(),Ron=SMt(),jon=JMt(),Don=rRt(),Non=aRt(),Lon=wRt(),Fon=ARt(),kon=qRt(),Bon=r1t(),bAe=class extends Ion.ClientSDK{get models(){return this._models??(this._models=new Bon.Models(this._options))}get files(){return this._files??(this._files=new Lon.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new kon.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new Ron.Batch(this._options))}get chat(){return this._chat??(this._chat=new jon.Chat(this._options))}get fim(){return this._fim??(this._fim=new Fon.Fim(this._options))}get agents(){return this._agents??(this._agents=new Mon.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new Non.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new Don.Classifiers(this._options))}};Noe.Mistral=bAe});var a1t=b(sp=>{"use strict";var o1t=sp&&sp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$on=sp&&sp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i1t=sp&&sp.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&o1t(e,t,r)},qon=sp&&sp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&o1t(e,t,r);return $on(e,t),e};Object.defineProperty(sp,"__esModule",{value:!0});sp.files=void 0;i1t(Mte(),sp);sp.files=qon(FEe());i1t(n1t(),sp)});var v1t=b((IAe,MAe)=>{(function(t,e){typeof IAe=="object"&&typeof MAe<"u"?MAe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(IAe,function(){"use strict";var t="month",e="quarter";return function(r,n){var o=n.prototype;o.quarter=function(s){return this.$utils().u(s)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(s-1))};var i=o.add;o.add=function(s,u){return s=Number(s),this.$utils().p(u)===e?this.add(3*s,t):i.bind(this)(s,u)};var a=o.startOf;o.startOf=function(s,u){var l=this.$utils(),c=!!l.u(u)||u;if(l.p(s)===e){var d=this.quarter()-1;return c?this.month(3*d).startOf(t).startOf("day"):this.month(3*d+2).endOf(t).endOf("day")}return a.bind(this)(s,u)}}})});var WT=b((RAe,jAe)=>{(function(t,e){typeof RAe=="object"&&typeof jAe<"u"?jAe.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(RAe,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",l="month",c="quarter",d="year",f="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var k=["th","st","nd","rd"],F=L%100;return"["+L+(k[(F-20)%10]||k[F]||k[0])+"]"}},g=function(L,k,F){var $=String(L);return!$||$.length>=k?L:""+Array(k+1-$.length).join(F)+L},_={s:g,z:function(L){var k=-L.utcOffset(),F=Math.abs(k),$=Math.floor(F/60),U=F%60;return(k<=0?"+":"-")+g($,2,"0")+":"+g(U,2,"0")},m:function L(k,F){if(k.date()<F.date())return-L(F,k);var $=12*(F.year()-k.year())+(F.month()-k.month()),U=k.clone().add($,l),J=F-U<0,V=k.clone().add($+(J?-1:1),l);return+(-($+(F-U)/(J?U-V:V-U))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},w="en",x={};x[w]=v;var C="$isDayjsObject",P=function(L){return L instanceof R||!(!L||!L[C])},E=function L(k,F,$){var U;if(!k)return w;if(typeof k=="string"){var J=k.toLowerCase();x[J]&&(U=J),F&&(x[J]=F,U=J);var V=k.split("-");if(!U&&V.length>1)return L(V[0])}else{var j=k.name;x[j]=k,U=j}return!$&&U&&(w=U),U||!$&&w},A=function(L,k){if(P(L))return L.clone();var F=typeof k=="object"?k:{};return F.date=L,F.args=arguments,new R(F)},M=_;M.l=E,M.i=P,M.w=function(L,k){return A(L,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var R=function(){function L(F){this.$L=E(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[C]=!0}var k=L.prototype;return k.parse=function(F){this.$d=function($){var U=$.date,J=$.utc;if(U===null)return new Date(NaN);if(M.u(U))return new Date;if(U instanceof Date)return new Date(U);if(typeof U=="string"&&!/Z$/i.test(U)){var V=U.match(m);if(V){var j=V[2]-1||0,z=(V[7]||"0").substring(0,3);return J?new Date(Date.UTC(V[1],j,V[3]||1,V[4]||0,V[5]||0,V[6]||0,z)):new Date(V[1],j,V[3]||1,V[4]||0,V[5]||0,V[6]||0,z)}}return new Date(U)}(F),this.init()},k.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},k.$utils=function(){return M},k.isValid=function(){return this.$d.toString()!==p},k.isSame=function(F,$){var U=A(F);return this.startOf($)<=U&&U<=this.endOf($)},k.isAfter=function(F,$){return A(F)<this.startOf($)},k.isBefore=function(F,$){return this.endOf($)<A(F)},k.$g=function(F,$,U){return M.u(F)?this[$]:this.set(U,F)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(F,$){var U=this,J=!!M.u($)||$,V=M.p(F),j=function(oe,Te){var bt=M.w(U.$u?Date.UTC(U.$y,Te,oe):new Date(U.$y,Te,oe),U);return J?bt:bt.endOf(s)},z=function(oe,Te){return M.w(U.toDate()[oe].apply(U.toDate("s"),(J?[0,0,0,0]:[23,59,59,999]).slice(Te)),U)},W=this.$W,K=this.$M,re=this.$D,De="set"+(this.$u?"UTC":"");switch(V){case d:return J?j(1,0):j(31,11);case l:return J?j(1,K):j(0,K+1);case u:var Y=this.$locale().weekStart||0,Q=(W<Y?W+7:W)-Y;return j(J?re-Q:re+(6-Q),K);case s:case f:return z(De+"Hours",0);case a:return z(De+"Minutes",1);case i:return z(De+"Seconds",2);case o:return z(De+"Milliseconds",3);default:return this.clone()}},k.endOf=function(F){return this.startOf(F,!1)},k.$set=function(F,$){var U,J=M.p(F),V="set"+(this.$u?"UTC":""),j=(U={},U[s]=V+"Date",U[f]=V+"Date",U[l]=V+"Month",U[d]=V+"FullYear",U[a]=V+"Hours",U[i]=V+"Minutes",U[o]=V+"Seconds",U[n]=V+"Milliseconds",U)[J],z=J===s?this.$D+($-this.$W):$;if(J===l||J===d){var W=this.clone().set(f,1);W.$d[j](z),W.init(),this.$d=W.set(f,Math.min(this.$D,W.daysInMonth())).$d}else j&&this.$d[j](z);return this.init(),this},k.set=function(F,$){return this.clone().$set(F,$)},k.get=function(F){return this[M.p(F)]()},k.add=function(F,$){var U,J=this;F=Number(F);var V=M.p($),j=function(K){var re=A(J);return M.w(re.date(re.date()+Math.round(K*F)),J)};if(V===l)return this.set(l,this.$M+F);if(V===d)return this.set(d,this.$y+F);if(V===s)return j(1);if(V===u)return j(7);var z=(U={},U[i]=e,U[a]=r,U[o]=t,U)[V]||1,W=this.$d.getTime()+F*z;return M.w(W,this)},k.subtract=function(F,$){return this.add(-1*F,$)},k.format=function(F){var $=this,U=this.$locale();if(!this.isValid())return U.invalidDate||p;var J=F||"YYYY-MM-DDTHH:mm:ssZ",V=M.z(this),j=this.$H,z=this.$m,W=this.$M,K=U.weekdays,re=U.months,De=U.meridiem,Y=function(Te,bt,xe,Z){return Te&&(Te[bt]||Te($,J))||xe[bt].slice(0,Z)},Q=function(Te){return M.s(j%12||12,Te,"0")},oe=De||function(Te,bt,xe){var Z=Te<12?"AM":"PM";return xe?Z.toLowerCase():Z};return J.replace(h,function(Te,bt){return bt||function(xe){switch(xe){case"YY":return String($.$y).slice(-2);case"YYYY":return M.s($.$y,4,"0");case"M":return W+1;case"MM":return M.s(W+1,2,"0");case"MMM":return Y(U.monthsShort,W,re,3);case"MMMM":return Y(re,W);case"D":return $.$D;case"DD":return M.s($.$D,2,"0");case"d":return String($.$W);case"dd":return Y(U.weekdaysMin,$.$W,K,2);case"ddd":return Y(U.weekdaysShort,$.$W,K,3);case"dddd":return K[$.$W];case"H":return String(j);case"HH":return M.s(j,2,"0");case"h":return Q(1);case"hh":return Q(2);case"a":return oe(j,z,!0);case"A":return oe(j,z,!1);case"m":return String(z);case"mm":return M.s(z,2,"0");case"s":return String($.$s);case"ss":return M.s($.$s,2,"0");case"SSS":return M.s($.$ms,3,"0");case"Z":return V}return null}(Te)||V.replace(":","")})},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(F,$,U){var J,V=this,j=M.p($),z=A(F),W=(z.utcOffset()-this.utcOffset())*e,K=this-z,re=function(){return M.m(V,z)};switch(j){case d:J=re()/12;break;case l:J=re();break;case c:J=re()/3;break;case u:J=(K-W)/6048e5;break;case s:J=(K-W)/864e5;break;case a:J=K/r;break;case i:J=K/e;break;case o:J=K/t;break;default:J=K}return U?J:M.a(J)},k.daysInMonth=function(){return this.endOf(l).$D},k.$locale=function(){return x[this.$L]},k.locale=function(F,$){if(!F)return this.$L;var U=this.clone(),J=E(F,$,!0);return J&&(U.$L=J),U},k.clone=function(){return M.w(this.$d,this)},k.toDate=function(){return new Date(this.valueOf())},k.toJSON=function(){return this.isValid()?this.toISOString():null},k.toISOString=function(){return this.$d.toISOString()},k.toString=function(){return this.$d.toUTCString()},L}(),N=R.prototype;return A.prototype=N,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(L){N[L[1]]=function(k){return this.$g(k,L[0],L[1])}}),A.extend=function(L,k){return L.$i||(L(k,R,A),L.$i=!0),A},A.locale=E,A.isDayjs=P,A.unix=function(L){return A(1e3*L)},A.en=x[w],A.Ls=x,A.p={},A})});var IDt=O(()=>{GO()});var MDt=O(()=>{fd();IDt();Cp();Wp()});var RDt=O(()=>{og()});var LIe=O(()=>{Wp();eE();Cp();MDt();RDt()});var Qkt=b((Y9o,Xkt)=>{"use strict";var efn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Xkt.exports=efn});var nBt=b((Z9o,rBt)=>{"use strict";var tfn=Qkt();function eBt(){}function tBt(){}tBt.resetWarningCache=eBt;rBt.exports=function(){function t(n,o,i,a,s,u){if(u!==tfn){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:tBt,resetWarningCache:eBt};return r.PropTypes=r,r}});var iBt=b((eWo,oBt)=>{oBt.exports=nBt()();var X9o,Q9o});var dBt=b(bRe=>{"use strict";bRe.__esModule=!0;bRe.default=function(t,e){if(t&&e){var r=Array.isArray(e)?e:e.split(",");if(r.length===0)return!0;var n=t.name||"",o=(t.type||"").toLowerCase(),i=o.replace(/\/.*$/,"");return r.some(function(a){var s=a.trim().toLowerCase();return s.charAt(0)==="."?n.toLowerCase().endsWith(s):s.endsWith("/*")?i===s.replace(/\/.*$/,""):o===s})}return!0}});var bbn={};ff(bbn,{default:()=>Ose});module.exports=gl(bbn);var zse="{copilot-selection}",Hse=50,aD=[{name:"Fix grammar and spelling",prompt:"Fix the grammar and spelling of {}. Preserve all formatting, line breaks, and special characters. Do not add or remove any content. Return only the corrected text.",showInContextMenu:!0},{name:"Translate to Chinese",prompt:`Translate {} into Chinese:
1. Preserve the meaning and tone
2. Maintain appropriate cultural context
3. Keep formatting and structure
Return only the translated text.`,showInContextMenu:!0},{name:"Summarize",prompt:"Create a bullet-point summary of {}. Each bullet point should capture a key point. Return only the bullet-point summary.",showInContextMenu:!0},{name:"Simplify",prompt:"Simplify {} to a 6th-grade reading level (ages 11-12). Use simple sentences, common words, and clear explanations. Maintain the original key concepts. Return only the simplified text.",showInContextMenu:!0},{name:"Emojify",prompt:`Add relevant emojis to enhance {}. Follow these rules:
1. Insert emojis at natural breaks in the text
2. Never place two emojis next to each other
3. Keep all original text unchanged
4. Choose emojis that match the context and tone
Return only the emojified text.`,showInContextMenu:!0},{name:"Make shorter",prompt:`Reduce {} to half its length while preserving these elements:
1. Main ideas and key points
2. Essential details
3. Original tone and style
Return only the shortened text.`,showInContextMenu:!0},{name:"Make longer",prompt:`Expand {} to twice its length by:
1. Adding relevant details and examples
2. Elaborating on key points
3. Maintaining the original tone and style
Return only the expanded text.`,showInContextMenu:!0},{name:"Generate table of contents",prompt:"Generate a hierarchical table of contents for {}. Use appropriate heading levels (H1, H2, H3, etc.). Include page numbers if present. Return only the table of contents.",showInContextMenu:!1},{name:"Generate glossary",prompt:'Create a glossary of important terms, concepts, and phrases from {}. Format each entry as "Term: Definition". Sort entries alphabetically. Return only the glossary.',showInContextMenu:!1},{name:"Remove URLs",prompt:"Remove all URLs from {}. Preserve all other content and formatting. URLs may be in various formats (http, https, www). Return only the text with URLs removed.",showInContextMenu:!1},{name:"Rewrite as tweet",prompt:`Rewrite {} as a single tweet with these requirements:
1. Maximum 280 characters
2. Use concise, impactful language
3. Maintain the core message
Return only the tweet text.`,showInContextMenu:!1},{name:"Rewrite as tweet thread",prompt:`Convert {} into a Twitter thread following these rules:
1. Each tweet must be under 240 characters
2. Start with "THREAD START" on its own line
3. Separate tweets with "
---
"
4. End with "THREAD END" on its own line
5. Make content engaging and clear
Return only the formatted thread.`,showInContextMenu:!1},{name:"Explain like I am 5",prompt:`Explain {} in simple terms that a 5-year-old would understand:
1. Use basic vocabulary
2. Include simple analogies
3. Break down complex concepts
Return only the simplified explanation.`,showInContextMenu:!1},{name:"Rewrite as press release",prompt:`Transform {} into a professional press release:
1. Use formal, journalistic style
2. Include headline and dateline
3. Follow inverted pyramid structure
Return only the press release format.`,showInContextMenu:!1}];w6();og();eE();Cp();var gce=t=>t.map(e=>e.pageContent).join(`
`);var Vi={},cGt=0;function FI(t,e){let r=`atom${++cGt}`,n={toString(){return(Vi.env?Vi.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=dGt,n.write=fGt),e&&(n.write=e),n}function dGt(t){return t(this)}function fGt(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var $Be=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,yce=t=>"init"in t,bce=t=>!!t.write,X5=new WeakMap,vce=t=>{var e;return wce(t)&&!((e=X5.get(t))!=null&&e[1])},pGt=(t,e)=>{let r=X5.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((Vi.env?Vi.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},mGt=t=>{if(X5.has(t))return;let e=[new Set,!1];X5.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},wce=t=>typeof t?.then=="function",qBe=t=>"v"in t||"e"in t,Z5=t=>{if("e"in t)throw t.e;if((Vi.env?Vi.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},HBe=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},UBe=(t,e,r,n,o)=>{var i;if((Vi.env?Vi.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),vce(r.v)&&HBe(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&hGt(t,n,e)},kD=()=>[new Map,new Map,new Set],_ce=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},hGt=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},gGt=(t,e)=>t[0].get(e),zBe=(t,e)=>{t[2].add(e)},tE=t=>{let e,r=!1,n=o=>{try{o()}catch(i){r||(e=i,r=!0)}};for(;t[1].size||t[2].size;){t[0].clear();let o=new Set(t[1].values());t[1].clear();let i=new Set(t[2]);t[2].clear(),o.forEach(a=>{var s;return(s=a.m)==null?void 0:s.l.forEach(n)}),i.forEach(n)}if(r)throw e},VBe=(...[t,e,r,n])=>{let o;(Vi.env?Vi.env.MODE:void 0)!=="production"&&(o=new Set);let i=(w,x,C)=>{let P="v"in x,E=x.v,A=vce(x.v)?x.v:null;if(wce(C)){mGt(C);for(let M of x.d.keys())HBe(w,C,t(M));x.v=C,delete x.e}else x.v=C,delete x.e;(!P||!Object.is(E,x.v))&&(++x.n,A&&pGt(A,C))},a=(w,x,C)=>{var P;let E=t(x);if(qBe(E)&&(E.m&&!C?.has(x)||Array.from(E.d).every(([k,F])=>a(w,k,C).n===F)))return E;E.d.clear();let A=!0,M=k=>{if($Be(x,k)){let $=t(k);if(!qBe($))if(yce(k))i(k,$,k.init);else throw new Error("no atom init");return Z5($)}let F=a(w,k,C);try{return Z5(F)}finally{if(A)UBe(w,x,E,k,F);else{let $=kD();UBe($,x,E,k,F),p($,x,E),tE($)}}},R,N,L={get signal(){return R||(R=new AbortController),R.signal},get setSelf(){return(Vi.env?Vi.env.MODE:void 0)!=="production"&&!bce(x)&&console.warn("setSelf function cannot be used with read-only atom"),!N&&bce(x)&&(N=(...k)=>{if((Vi.env?Vi.env.MODE:void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)return f(x,...k)}),N}};try{let k=e(x,M,L);if(i(x,E,k),wce(k)){(P=k.onCancel)==null||P.call(k,()=>R?.abort());let F=()=>{if(E.m){let $=kD();p($,x,E),tE($)}};k.then(F,F)}return E}catch(k){return delete E.v,E.e=k,++E.n,E}finally{A=!1}},s=w=>Z5(a(void 0,w)),u=(w,x,C)=>{var P,E;let A=new Map;for(let M of((P=C.m)==null?void 0:P.t)||[])A.set(M,t(M));for(let M of C.p)A.set(M,t(M));return(E=gGt(w,x))==null||E.forEach(M=>{A.set(M,t(M))}),A};function l(w,x,C){let P=[],E=new Set,A=new Set,M=[[x,C]];for(;M.length>0;){let[R,N]=M[M.length-1];if(A.has(R)){M.pop();continue}if(E.has(R)){P.push([R,N,N.n]),A.add(R),M.pop();continue}E.add(R);for(let[L,k]of u(w,R,N))R!==L&&!E.has(L)&&M.push([L,k])}return[P,A]}let c=(w,x,C)=>{let[P,E]=l(w,x,C),A=new Set([x]);for(let M=P.length-1;M>=0;--M){let[R,N,L]=P[M],k=!1;for(let F of N.d.keys())if(F!==R&&A.has(F)){k=!0;break}k&&(a(w,R,E),p(w,R,N),L!==N.n&&(_ce(w,R,N),A.add(R))),E.delete(R)}},d=(w,x,...C)=>{let P=!0,E=M=>Z5(a(w,M)),A=(M,...R)=>{let N=t(M);try{if($Be(x,M)){if(!yce(M))throw new Error("atom not writable");let L=N.n,k=R[0];i(M,N,k),p(w,M,N),L!==N.n&&(_ce(w,M,N),c(w,M,N));return}else return d(w,M,...R)}finally{P||tE(w)}};try{return r(x,E,A,...C)}finally{P=!1}},f=(w,...x)=>{let C=kD();try{return d(C,w,...x)}finally{tE(C)}},p=(w,x,C)=>{if(C.m&&!vce(C.v)){for(let P of C.d.keys())C.m.d.has(P)||(m(w,P,t(P)).t.add(x),C.m.d.add(P));for(let P of C.m.d||[])if(!C.d.has(P)){C.m.d.delete(P);let E=h(w,P,t(P));E?.t.delete(x)}}},m=(w,x,C)=>{if(!C.m){a(w,x);for(let P of C.d.keys())m(w,P,t(P)).t.add(x);if(C.m={l:new Set,d:new Set(C.d.keys()),t:new Set},(Vi.env?Vi.env.MODE:void 0)!=="production"&&o.add(x),bce(x)){let P=C.m,E,A=(M,R)=>{let N=!0;E=(...L)=>{try{return d(M,x,...L)}finally{N||tE(M)}};try{return R()}finally{N=!1}};zBe(w,()=>{let M=A(w,()=>n(x,(...R)=>E(...R)));M&&(P.u=R=>A(R,M))})}}return C.m},h=(w,x,C)=>{if(C.m&&!C.m.l.size&&!Array.from(C.m.t).some(P=>{var E;return(E=t(P).m)==null?void 0:E.d.has(x)})){let P=C.m.u;P&&zBe(w,()=>P(w)),delete C.m,(Vi.env?Vi.env.MODE:void 0)!=="production"&&o.delete(x);for(let E of C.d.keys()){let A=h(w,E,t(E));A?.t.delete(x)}return}return C.m},_={get:s,set:f,sub:(w,x)=>{let C=kD(),P=t(w),A=m(C,w,P).l;return A.add(x),tE(C),()=>{A.delete(x);let M=kD();h(M,w,P),tE(M)}},unstable_derive:w=>VBe(...w(t,e,r,n))};return(Vi.env?Vi.env.MODE:void 0)!=="production"&&Object.assign(_,{dev4_get_internal_weak_map:()=>({get:x=>{let C=t(x);if(C.n!==0)return C}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:x=>{let C=kD();for(let[P,E]of x)if(yce(P)){let A=t(P),M=A.n;i(P,A,E),p(C,P,A),M!==A.n&&(_ce(C,P,A),c(C,P,A))}tE(C)}}),_},Q5=()=>{let t=new WeakMap;return VBe(r=>{if((Vi.env?Vi.env.MODE:void 0)!=="production"&&!r)throw new Error("Atom is undefined or null");let n=t.get(r);return n||(n={d:new Map,p:new Set,n:0},t.set(r,n)),n},(r,...n)=>r.read(...n),(r,...n)=>r.write(...n),(r,...n)=>{var o;return(o=r.onMount)==null?void 0:o.call(r,...n)})},uU,WBe=()=>(uU||(uU=Q5(),(Vi.env?Vi.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=uU),globalThis.__JOTAI_DEFAULT_STORE__!==uU&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),uU);var Gc=B(X(),1);var n9={},RGt=(0,Gc.createContext)(void 0),a$e=t=>{let e=(0,Gc.useContext)(RGt);return t?.store||e||WBe()};var Tce=t=>typeof t?.then=="function",s$e=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},jGt=Gc.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(s$e(t),t)}),Pce=new WeakMap,i$e=t=>{let e=Pce.get(t);return e||(e=new Promise((r,n)=>{let o=t,i=u=>l=>{o===u&&r(l)},a=u=>l=>{o===u&&n(l)},s=u=>{"onCancel"in u&&typeof u.onCancel=="function"&&u.onCancel(l=>{if((n9.env?n9.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");Tce(l)?(Pce.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),Pce.set(t,e)),e};function Ace(t,e){let r=a$e(e),[[n,o,i],a]=(0,Gc.useReducer)(l=>{let c=r.get(t);return Object.is(l[0],c)&&l[1]===r&&l[2]===t?l:[c,r,t]},void 0,()=>[r.get(t),r,t]),s=n;(o!==r||i!==t)&&(a(),s=r.get(t));let u=e?.delay;if((0,Gc.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);Tce(c)&&s$e(i$e(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,Gc.useDebugValue)(s),Tce(s)){let l=i$e(s);return jGt(l)}return s}function DGt(t,e){let r=a$e(e);return(0,Gc.useCallback)((...o)=>{if((n9.env?n9.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function Ice(t,e){return[Ace(t,e),DGt(t,e)]}w6();var Op=Q5(),kI=FI(ag);function rE(t){let e=NGt({...de(),...t});Op.set(kI,e)}function xt(t,e){let r=de();rE({...r,[t]:e})}function de(){return Op.get(kI)}function l$e(){let t={...ag,activeModels:nE.map(e=>({...e,enabled:!0})),activeEmbeddingModels:cU.map(e=>({...e,enabled:!0}))};rE(t)}function bl(t){let e=de();return Op.sub(kI,()=>{let r=de();t(e,r),e=r})}function Bo(){return Ace(kI,{store:Op})}function c$e(t){let e=t||ag;e.userId||(e.userId=tI()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(u=>({...u,provider:u.provider==="azure_openai"?"azure openai":u.provider})):e.activeEmbeddingModels=cU.map(u=>({...u,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?ag.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?ag.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?ag.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?ag.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);return r.embeddingBatchSize=isNaN(s)?ag.embeddingBatchSize:s,typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=ag.passMarkdownImages),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=ag.enableCustomPromptTemplating),r}function BI(){let t=de().userSystemPrompt;return t?`${Mce}
${t}`:Mce}function NGt(t){return t.activeModels=u$e(t.activeModels,nE),t.activeEmbeddingModels=u$e(t.activeEmbeddingModels,cU),t}function Kr(t){return`${t.name}|${t.provider}`}function u$e(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(Kr(n),{...n})}),t.forEach(n=>{let o=Kr(n),i=r.get(o);if(i){let a=e.find(s=>s.name===n.name&&s.provider===n.provider);a?r.set(o,{...a,...n,isBuiltIn:!0,believerExclusive:a.believerExclusive}):r.set(o,{...n,isBuiltIn:i.isBuiltIn})}else r.set(o,n)}),Array.from(r.values())}function ar(...t){de().debug&&console.log(...t)}function nt(...t){de().debug&&console.error(...t)}var Nce=B(d$e()),Am=require("obsidian"),jce={INVALID_LICENSE_KEY_USER:"Invalid Copilot Plus license key. Please check your license key in settings.",UNKNOWN_ERROR:"An unknown error occurred",REQUEST_FAILED:t=>`Request failed, status ${t}`};function f$e(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function LGt(t){let e=f$e(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function p$e(t){let e=f$e(t);return LGt(t)?jce.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:jce.UNKNOWN_ERROR)}var Lce=(t,e)=>{let r=t.getMarkdownFiles();if(e==="/")return r;let n=e.toLowerCase().replace(/^\/|\/$/g,"");return r.filter(o=>{let a=o.path.toLowerCase().split("/"),s=n.split("/"),u=0;for(let l of s){for(;u<a.length&&a[u]!==l;)u++;if(u>=a.length)return!1}return!0})};function qD(t){return t.replace(/^#/,"").trim().toLowerCase()}function dU(t,e=!0){let r=app.metadataCache.getFileCache(t),n=r?.frontmatter?.tags,o=new Set;if(!e){let i=r?.tags?.map(a=>a.tag);i&&i.forEach(a=>o.add(qD(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(qD(i))}):typeof n=="string"&&o.add(qD(n))),Array.from(o)}function m$e(t,e,r){if(e.length===0)return[];e=e.map(i=>qD(i));let n=r&&r.length>0?r:Lce(t,"/"),o=[];for(let i of n){let a=dU(i);e.some(s=>a.includes(s))&&o.push(i)}return o}var FGt=t=>t.last.bound.modelName||t.last.bound.model,kGt=t=>t.last.bound.retriever!==void 0,h$e=t=>FGt(t)||kGt(t);var _l=(t,e="local")=>{let r=(0,Nce.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};function Fce(t){let e=(0,Nce.default)(t,"YYYY/MM/DD HH:mm:ss");return e.isValid()?{fileName:e.format("YYYYMMDD_HHmmss"),display:e.format("YYYY/MM/DD HH:mm:ss"),epoch:e.valueOf()}:_l(new Date)}async function UD(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function o9(t){return t.basename}function g$e(t,e){return!t||!e?!1:t.includes(Dce)&&e.includes(Dce)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function zD(t){let e=[],{history:r}=t;for(let n=0;n<r.length;n+=2){let o=r[n]?.content||"",i=r[n+1]?.content||"";e.push([o,i])}return e}function rx(t,e){let r=/\[\[(.*?)\]\]/g,n=t.match(r),o=new Map;return n&&n.forEach(i=>{let a=i.slice(2,-2),s=e.getAbstractFileByPath(a);if(s instanceof Am.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(kce(a,e)?o.set(l[0].path,l[0]):console.warn(`Found multiple files with title "${a}". Expected a full path for duplicate titles.`))}}),Array.from(o.values())}function kce(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function y$e(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function b$e(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}var _$e=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/;function v$e(t){return _$e.test(t)}function fU(t){let e=t.match(_$e);return e?e[0]:null}async function vl(t,e={}){let r=e.headers?{...e.headers}:{};if(delete r["content-length"],typeof e.body=="string"){let a=JSON.parse(e.body??{});delete a.frequency_penalty,e.body=JSON.stringify(a)}ar("==== safeFetch method request ====");let n=e.method?.toUpperCase()||"POST",i=await(0,Am.requestUrl)({url:t,contentType:"application/json",headers:r,method:n,...["POST","PUT","PATCH"].includes(n)&&{body:e.body?.toString()},throw:!1});if(i.status>=400){let a;try{a=typeof i.json=="string"?JSON.parse(i.json):i.json}catch{try{a=typeof i.text=="string"?JSON.parse(i.text):i.text}catch{a=null}}let s=new Error(jce.REQUEST_FAILED(i.status));if(s.json=a,a?.detail?.reason==="Invalid license key"||a?.reason==="Invalid license key")s.message="Invalid license key";else if(a?.detail?.message||a?.message){let u=a?.detail?.message||a?.message,l=a?.detail?.reason||a?.reason;s.message=l?`${u}: ${l}`:u}else a?.detail&&(s.message=JSON.stringify(a.detail));throw s}return{ok:i.status>=200&&i.status<300,status:i.status,statusText:i.status.toString(),headers:new Headers(i.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:BGt(i.text),bodyUsed:!0,json:()=>i.json,text:async()=>i.text,arrayBuffer:async()=>{if(i.arrayBuffer)return i.arrayBuffer;let a=i.text.replace(/^data:.*;base64,/,""),s=atob(a),u=new Uint8Array(s.length);for(let l=0;l<s.length;l++)u[l]=s.charCodeAt(l);return u.buffer},blob:()=>{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function BGt(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function Pi(t,e=!1){return t instanceof Error?t.message+`
${t?.cause?"more message: "+t.cause.message:""}
${e?t.stack:""}`:JSON.stringify(t)}function Bce(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function i9(t,e){let[r,n]=t.split("|"),o=e.find(i=>i.name===r&&i.provider===n);if(!o)throw new Error(`No model configuration found for: ${t}`);return o}function nx(t){let e=VD[t];return{...e,label:e.label||t}}function Ef(t,e){let r=VD[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}async function pU(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new Am.Notice("No active leaf found.");return}if(r.view instanceof Am.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof Am.MarkdownView)){new Am.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to");e?n.replaceRange(t,o,i):n.replaceRange(t,i),new Am.Notice("Message inserted into the active note.")}function a9(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function s9(t,e){let r=t.split(".").map(Number),n=e.split(".").map(Number);for(let o=0;o<3;o++){if(r[o]>n[o])return!0;if(r[o]<n[o])return!1}return!1}async function w$e(){try{return{version:(await(0,Am.requestUrl)({url:"https://api.github.com/repos/logancyang/obsidian-copilot/releases/latest",method:"GET"})).json.tag_name.replace("v",""),error:null}}catch(t){return{version:null,error:t instanceof Error?t.message:"Failed to check for updates"}}}function $I(t){if(typeof t=="string")return t.startsWith("o1")||t.startsWith("o3")||t.startsWith("o4");let e=t.modelName||t.model||"";return e.startsWith("o1")||e.startsWith("o3")||e.startsWith("o4")}function S$e(t,e="system"){return $I(t)?"human":e}function $ce(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","copilot-plus","copilot-plus-jina"];return Object.entries(VD).filter(([e])=>!t.includes(e)).map(([e])=>e)}function u9(t,e){let r=!!$ce().find(i=>i===t.provider),n=My[t.provider],o=!t.apiKey&&!e[n];return r&&o?{hasApiKey:!1,errorNotice:`Please configure API Key for ${t.name} in settings first.
Path: Settings > copilot plugin > Basic Tab > Set Keys`}:{hasApiKey:!0}}function HD(t){return t.replace(/<think>[\s\S]*?<\/think>/g,"").trim()}var WD=class WD{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.bind({signal:i?.signal}),s=Wo.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return WD.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=WD.instances.get("llm_chain");return r||(r=WD.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=$d.fromTemplate(`Given the following conversation and a follow up question,
summarize the conversation as context and keep the follow up question unchanged, in its original language.
If the follow up question is unrelated to its preceding messages, return this follow up question directly.
If it is related, then combine the summary and the follow up question to construct a standalone question.
Make sure to keep any [[]] wrapped note titles in the question unchanged.
Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:`),c=$d.fromTemplate(`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`),d=v=>v.map(_=>`Human: ${_[0]}
Assistant: ${_[1]}`).join(`
`),f=Wo.from([{question:v=>(n&&console.log("Input Question: ",v.question),v.question),chat_history:v=>{let g=d(v.chat_history);return n&&console.log("Formatted Chat History: ",g),g}},u,o,new K5,v=>{let g=HD(v);return n&&console.log("Standalone Question: ",g),g}]),p=async v=>(r(v),gce(v)),m=Wo.from([{context:i.pipe(p),question:new Kn,system_message:()=>a},c,o]);return f.pipe(m)}};WD.instances=new Map;var qce=WD,l9=qce;var UI="https://api.brevilabs.com/v1",wl="copilot-chat-view",ti="user",Ry="ai",Mce=`You are Obsidian Copilot, a helpful assistant that integrates AI to Obsidian note-taking.
1. Never mention that you do not have access to something. Always rely on the user provided context.
2. Always answer to the best of your knowledge. If you are unsure about something, say so and ask the user to provide more context.
3. If the user mentions "note", it most likely means an Obsidian note in the vault, not the generic meaning of a note.
4. If the user mentions "@vault", it means the user wants you to search the Obsidian vault for information relevant to the query. The search results will be provided to you in the context along with the user query, read it carefully and answer the question based on the information provided. If there's no relevant information in the vault, just say so.
5. If the user mentions any other tool with the @ symbol, check the context for their results. If nothing is found, just ignore the @ symbol in the query.
6. Always use $'s instead of \\[ etc. for LaTeX equations.
7. When showing note titles, use [[title]] format and do not wrap them in \` \`.
8. When showing **Obsidian internal** image links, use ![[link]] format and do not wrap them in \` \`.
9. When showing **web** image links, use ![link](url) format and do not wrap them in \` \`.
10. When generating a table, use compact formatting without excessive whitespace.
11. Always respond in the language of the user's query.
12. Do NOT mention the additional context provided such as getCurrentTime and getTimeRangeMs if it's irrelevant to the user message.`,c9=`Copilot index does not exist. Please index your vault first!
1. Set a working embedding model in QA settings. If it's not a local model, don't forget to set the API key.
2. Click 'Refresh Index for Vault' and wait for indexing to complete. If you encounter the rate limiting error, please turn your request per second down in QA setting.`,x$e=6e3,Uce=.4,C$e=.4,zce=15,Hce=448e3,ox={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},iE={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"};var qI=(m=>(m.OPENAI="openai",m.OPENAI_FORMAT="3rd party (openai-format)",m.AZURE_OPENAI="azure openai",m.ANTHROPIC="anthropic",m.COHEREAI="cohereai",m.GOOGLE="google",m.XAI="xai",m.OPENROUTERAI="openrouterai",m.GROQ="groq",m.OLLAMA="ollama",m.LM_STUDIO="lm-studio",m.COPILOT_PLUS="copilot-plus",m.MISTRAL="mistralai",m.DEEPSEEK="deepseek",m))(qI||{});var aE={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},nE=[{name:"copilot-plus-flash",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,core:!0,plusExclusive:!0,capabilities:["vision"]},{name:"gpt-4.1",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-4.1-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-4.1-nano",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"o4-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["reasoning"]},{name:"claude-3-5-sonnet-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"claude-3-5-haiku-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0},{name:"grok-3-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"grok-3-mini-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"command-r",provider:"cohereai",enabled:!0,isBuiltIn:!0},{name:"command-r-plus",provider:"cohereai",enabled:!0,isBuiltIn:!0},{name:"gemini-2.0-pro-exp",provider:"google",enabled:!0,isBuiltIn:!0,capabilities:["vision"]},{name:"gemini-2.0-flash",provider:"google",enabled:!0,isBuiltIn:!0,capabilities:["vision"]},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0},{name:"deepseek-chat",provider:"deepseek",enabled:!0,isBuiltIn:!0},{name:"deepseek-reasoner",provider:"deepseek",enabled:!0,isBuiltIn:!0,capabilities:["reasoning"]}],oE=(l=>(l.OPENAI="openai",l.COHEREAI="cohereai",l.GOOGLE="google",l.AZURE_OPENAI="azure openai",l.OLLAMA="ollama",l.LM_STUDIO="lm-studio",l.OPENAI_FORMAT="3rd party (openai-format)",l.COPILOT_PLUS="copilot-plus",l.COPILOT_PLUS_JINA="copilot-plus-jina",l))(oE||{});var cU=[{name:"copilot-plus-small",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0},{name:"copilot-plus-large",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,believerExclusive:!0,dimensions:1024},{name:"copilot-plus-multilingual",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,dimensions:512},{name:"text-embedding-3-small",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"text-embedding-3-large",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"embed-multilingual-light-v3.0",provider:"cohereai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"text-embedding-004",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0}],Dce="nomic-embed-text",VD={openai:{label:"OpenAI",host:"https://api.openai.com",keyManagementURL:"https://platform.openai.com/api-keys",testModel:"gpt-4.1"},"azure openai":{label:"Azure OpenAI",host:"",keyManagementURL:"",testModel:"azure-openai"},anthropic:{label:"Anthropic",host:"https://api.anthropic.com/",keyManagementURL:"https://console.anthropic.com/settings/keys",testModel:"claude-3-5-sonnet-latest"},cohereai:{label:"Cohere",host:"https://api.cohere.com",keyManagementURL:"https://dashboard.cohere.ai/api-keys",testModel:"command-r"},google:{label:"Gemini",host:"https://generativelanguage.googleapis.com",keyManagementURL:"https://makersuite.google.com/app/apikey",testModel:"gemini-2.0-flash"},xai:{label:"XAI",host:"https://api.x.ai/v1",keyManagementURL:"https://console.x.ai",testModel:"grok-3-beta"},openrouterai:{label:"OpenRouter",host:"https://openrouter.ai/api/v1/",keyManagementURL:"https://openrouter.ai/keys",testModel:"openai/chatgpt-4o-latest"},groq:{label:"Groq",host:"https://api.groq.com/openai",keyManagementURL:"https://console.groq.com/keys",testModel:"llama3-8b-8192"},ollama:{label:"Ollama",host:"http://localhost:11434/v1/",keyManagementURL:""},"lm-studio":{label:"LM Studio",host:"http://localhost:1234/v1",keyManagementURL:""},"3rd party (openai-format)":{label:"OpenAI Format",host:"https://api.example.com/v1",keyManagementURL:""},mistralai:{label:"Mistral",host:"https://api.mistral.ai/v1",keyManagementURL:"https://console.mistral.ai/api-keys",testModel:"mistral-tiny-latest"},deepseek:{label:"DeepSeek",host:"https://api.deepseek.com/",keyManagementURL:"https://platform.deepseek.com/api-keys",testModel:"deepseek-chat"},"copilot-plus":{label:"Copilot Plus",host:"https://api.brevilabs.com/v1",keyManagementURL:""},"copilot-plus-jina":{label:"Copilot Plus",host:"https://api.brevilabs.com/v1",keyManagementURL:""}},My={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey"};var O$e=["NEVER","ON STARTUP","ON MODE SWITCH"];var mr={ADD_CUSTOM_PROMPT:"add-custom-prompt",APPLY_ADHOC_PROMPT:"apply-adhoc-prompt",APPLY_CUSTOM_PROMPT:"apply-custom-prompt",CLEAR_LOCAL_COPILOT_INDEX:"clear-local-copilot-index",CLEAR_COPILOT_CACHE:"clear-copilot-cache",COUNT_WORD_AND_TOKENS_SELECTION:"count-word-and-tokens-selection",COUNT_TOTAL_VAULT_TOKENS:"count-total-vault-tokens",DELETE_CUSTOM_PROMPT:"delete-custom-prompt",EDIT_CUSTOM_PROMPT:"edit-custom-prompt",FIND_RELEVANT_NOTES:"find-relevant-notes",FORCE_REINDEX_VAULT_TO_COPILOT_INDEX:"force-reindex-vault-to-copilot-index",GARBAGE_COLLECT_COPILOT_INDEX:"garbage-collect-copilot-index",INDEX_VAULT_TO_COPILOT_INDEX:"index-vault-to-copilot-index",INSPECT_COPILOT_INDEX_BY_NOTE_PATHS:"copilot-inspect-index-by-note-paths",LIST_INDEXED_FILES:"copilot-list-indexed-files",LOAD_COPILOT_CHAT_CONVERSATION:"load-copilot-chat-conversation",OPEN_COPILOT_CHAT_WINDOW:"chat-open-window",REMOVE_FILES_FROM_COPILOT_INDEX:"remove-files-from-copilot-index",SEARCH_ORAMA_DB:"copilot-search-orama-db",TOGGLE_COPILOT_CHAT_WINDOW:"chat-toggle-window"},d9={[mr.ADD_CUSTOM_PROMPT]:"Add custom prompt",[mr.APPLY_ADHOC_PROMPT]:"Apply ad-hoc custom prompt",[mr.APPLY_CUSTOM_PROMPT]:"Apply custom prompt",[mr.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[mr.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[mr.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[mr.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[mr.DELETE_CUSTOM_PROMPT]:"Delete custom prompt",[mr.EDIT_CUSTOM_PROMPT]:"Edit custom prompt",[mr.FIND_RELEVANT_NOTES]:"Find relevant notes",[mr.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[mr.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[mr.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[mr.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[mr.LIST_INDEXED_FILES]:"List all indexed files (debug)",[mr.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[mr.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[mr.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[mr.SEARCH_ORAMA_DB]:"Search OramaDB (debug)",[mr.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window"},ag={userId:tI(),isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",xaiApiKey:"",mistralApiKey:"",deepseekApiKey:"",defaultChainType:"llm_chain",defaultModelKey:"gpt-4.1|openai",embeddingModelKey:"text-embedding-3-small|openai",temperature:.1,maxTokens:1e3,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:"copilot-conversations",defaultConversationTag:"copilot-conversation",autosaveChat:!1,defaultOpenArea:"view",customPromptsFolder:"copilot-custom-prompts",indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:"",qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:3,groqApiKey:"",activeModels:nE,activeEmbeddingModels:cU,embeddingRequestsPerMin:90,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,promptUsageTimestamps:{},defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:aD,lastDismissedVersion:null,passMarkdownImages:!0,enableCustomPromptTemplating:!0},ix={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change"};var nde=B(Tf()),W$e=require("obsidian"),h9=null;function hU(){return W$e.Platform.isDesktop&&h9||(h9=require("electron")?.remote?.safeStorage),h9}var ode="enc_desk_",ide="enc_web_",sde="enc_",y9="dec_",b7t=new TextEncoder().encode("obsidian-copilot-v1"),g9={name:"AES-GCM",iv:new Uint8Array(12)};async function ade(){return await crypto.subtle.importKey("raw",b7t,g9.name,!1,["encrypt","decrypt"])}async function K$e(t){if(!t.enableEncryption)return t;let e={...t},r=Object.keys(t).filter(n=>n.toLowerCase().includes("apikey")||n==="plusLicenseKey");for(let n of r){let o=t[n];e[n]=await rde(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await rde(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await rde(n.apiKey||"")})))),e}async function rde(t){if(!t||t.startsWith(sde))return t;J$e(t)&&(t=t.replace(y9,""));try{if(hU()?.isEncryptionAvailable()){let o=hU().encryptString(t);return ode+o.toString("base64")}let e=await ade(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(g9,e,r);return ide+v7t(n)}catch(e){return console.error("Encryption failed:",e),t}}async function Io(t){if(!t||_7t(t))return t;if(J$e(t))return t.replace(y9,"");if(t.startsWith(ode)){let r=t.replace(ode,""),n=nde.Buffer.from(r,"base64");return hU().decryptString(n)}if(t.startsWith(ide)){let r=t.replace(ide,""),n=await ade(),o=V$e(r),i=await crypto.subtle.decrypt(g9,n,o);return new TextDecoder().decode(i)}let e=t.replace(sde,"");try{if(hU()?.isEncryptionAvailable())try{let i=nde.Buffer.from(e,"base64");return hU().decryptString(i)}catch{}let r=await ade(),n=V$e(e),o=await crypto.subtle.decrypt(g9,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function _7t(t){return!t.startsWith(sde)&&!t.startsWith(y9)}function J$e(t){return t.startsWith(y9)}function v7t(t){let e=new Uint8Array(t),r="";for(let n=0;n<e.byteLength;n++)r+=String.fromCharCode(e[n]);return window.btoa(r)}function V$e(t){let e=window.atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r.buffer}var G$e=FI(null),b9=FI(t=>{let e=t(G$e);return e!==null?e:t(kI).defaultModelKey},(t,e,r)=>{e(G$e,r)}),Y$e=FI(null),_9=FI(t=>{let e=t(Y$e);return e!==null?e:t(kI).defaultChainType},(t,e,r)=>{e(Y$e,r)});function v9(t){Op.set(b9,t)}function w9(){return Op.get(b9)}function Z$e(t){return Op.sub(b9,t)}function ZD(){return Ice(b9,{store:Op})}function ug(){return Op.get(_9)}function XD(t){Op.set(_9,t)}function X$e(t){return Op.sub(_9,t)}function Ny(){return Ice(_9,{store:Op})}var Vy=B(X()),$2e=require("obsidian"),q2e=B(km());var zW=B(X());var tc=B(X(),1);var v2e=B(X(),1);function SZt(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function Spe(...t){return e=>t.forEach(r=>SZt(r,e))}function ri(...t){return v2e.useCallback(Spe(...t),t)}var TN=B(_t(),1),Uy=tc.forwardRef((t,e)=>{let{children:r,...n}=t,o=tc.Children.toArray(r),i=o.find(IZt);if(i){let a=i.props.children,s=o.map(u=>u===i?tc.Children.count(a)>1?tc.Children.only(null):tc.isValidElement(a)?a.props.children:null:u);return(0,TN.jsx)(xpe,{...n,ref:e,children:tc.isValidElement(a)?tc.cloneElement(a,void 0,s):null})}return(0,TN.jsx)(xpe,{...n,ref:e,children:r})});Uy.displayName="Slot";var xpe=tc.forwardRef((t,e)=>{let{children:r,...n}=t;if(tc.isValidElement(r)){let o=RZt(r);return tc.cloneElement(r,{...MZt(n,r.props),ref:e?Spe(e,o):o})}return tc.Children.count(r)>1?tc.Children.only(null):null});xpe.displayName="SlotClone";var AZt=({children:t})=>(0,TN.jsx)(TN.Fragment,{children:t});function IZt(t){return tc.isValidElement(t)&&t.type===AZt}function MZt(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function RZt(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function C2e(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(r=C2e(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function UW(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=C2e(t))&&(n&&(n+=" "),n+=e);return n}var O2e=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,E2e=UW,AN=(t,e)=>r=>{var n;if(e?.variants==null)return E2e(t,r?.class,r?.className);let{variants:o,defaultVariants:i}=e,a=Object.keys(o).map(l=>{let c=r?.[l],d=i?.[l];if(c===null)return null;let f=O2e(c)||O2e(d);return o[l][f]}),s=r&&Object.entries(r).reduce((l,c)=>{let[d,f]=c;return f===void 0||(l[d]=f),l},{}),u=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:d,className:f,...p}=c;return Object.entries(p).every(m=>{let[h,v]=m;return Array.isArray(v)?v.includes({...i,...s}[h]):{...i,...s}[h]===v})?[...l,d,f]:l},[]);return E2e(t,a,u,r?.class,r?.className)};var Epe="-",jZt=t=>{let e=NZt(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(Epe);return s[0]===""&&s.length!==1&&s.shift(),M2e(s,e)||DZt(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},M2e=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?M2e(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(Epe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},P2e=/^\[(.+)\]$/,DZt=t=>{if(P2e.test(t)){let e=P2e.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},NZt=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return FZt(Object.entries(t.classGroups),r).forEach(([i,a])=>{Ope(a,n,i,e)}),n},Ope=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:T2e(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(LZt(o)){Ope(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{Ope(a,T2e(e,i),r,n)})})},T2e=(t,e)=>{let r=t;return e.split(Epe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},LZt=t=>t.isThemeGetter,FZt=(t,e)=>e?t.map(([r,n])=>{let o=n.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,s])=>[e+a,s])):i);return[r,o]}):t,kZt=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,n=new Map,o=(i,a)=>{r.set(i,a),e++,e>t&&(e=0,n=r,r=new Map)};return{get(i){let a=r.get(i);if(a!==void 0)return a;if((a=n.get(i))!==void 0)return o(i,a),a},set(i,a){r.has(i)?r.set(i,a):o(i,a)}}},R2e="!",BZt=t=>{let{separator:e,experimentalParseClassName:r}=t,n=e.length===1,o=e[0],i=e.length,a=s=>{let u=[],l=0,c=0,d;for(let v=0;v<s.length;v++){let g=s[v];if(l===0){if(g===o&&(n||s.slice(v,v+i)===e)){u.push(s.slice(c,v)),c=v+i;continue}if(g==="/"){d=v;continue}}g==="["?l++:g==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(R2e),m=p?f.substring(1):f,h=d&&d>c?d-c:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:h}};return r?s=>r({className:s,parseClassName:a}):a},$Zt=t=>{if(t.length<=1)return t;let e=[],r=[];return t.forEach(n=>{n[0]==="["?(e.push(...r.sort(),n),r=[]):r.push(n)}),e.push(...r.sort()),e},qZt=t=>({cache:kZt(t.cacheSize),parseClassName:BZt(t),...jZt(t)}),UZt=/\s+/,zZt=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(UZt),s="";for(let u=a.length-1;u>=0;u-=1){let l=a[u],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=r(l),m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){s=l+(s.length>0?" "+s:s);continue}if(h=n(f),!h){s=l+(s.length>0?" "+s:s);continue}m=!1}let v=$Zt(c).join(":"),g=d?v+R2e:v,_=g+h;if(i.includes(_))continue;i.push(_);let w=o(h,m);for(let x=0;x<w.length;++x){let C=w[x];i.push(g+C)}s=l+(s.length>0?" "+s:s)}return s};function HZt(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=j2e(e))&&(n&&(n+=" "),n+=r);return n}var j2e=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=j2e(t[n]))&&(r&&(r+=" "),r+=e);return r};function A2e(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=qZt(l),n=r.cache.get,o=r.cache.set,i=s,s(u)}function s(u){let l=n(u);if(l)return l;let c=zZt(u,r);return o(u,c),c}return function(){return i(HZt.apply(null,arguments))}}var Ii=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},D2e=/^\[(?:([a-z-]+):)?(.+)\]$/i,VZt=/^\d+\/\d+$/,WZt=new Set(["px","full","screen"]),KZt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JZt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,GZt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,YZt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZZt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,yx=t=>IN(t)||WZt.has(t)||VZt.test(t),AE=t=>MN(t,"length",iXt),IN=t=>!!t&&!Number.isNaN(Number(t)),Cpe=t=>MN(t,"number",IN),sz=t=>!!t&&Number.isInteger(Number(t)),XZt=t=>t.endsWith("%")&&IN(t.slice(0,-1)),kr=t=>D2e.test(t),IE=t=>KZt.test(t),QZt=new Set(["length","size","percentage"]),eXt=t=>MN(t,QZt,N2e),tXt=t=>MN(t,"position",N2e),rXt=new Set(["image","url"]),nXt=t=>MN(t,rXt,sXt),oXt=t=>MN(t,"",aXt),uz=()=>!0,MN=(t,e,r)=>{let n=D2e.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},iXt=t=>JZt.test(t)&&!GZt.test(t),N2e=()=>!1,aXt=t=>YZt.test(t),sXt=t=>ZZt.test(t);var I2e=()=>{let t=Ii("colors"),e=Ii("spacing"),r=Ii("blur"),n=Ii("brightness"),o=Ii("borderColor"),i=Ii("borderRadius"),a=Ii("borderSpacing"),s=Ii("borderWidth"),u=Ii("contrast"),l=Ii("grayscale"),c=Ii("hueRotate"),d=Ii("invert"),f=Ii("gap"),p=Ii("gradientColorStops"),m=Ii("gradientColorStopPositions"),h=Ii("inset"),v=Ii("margin"),g=Ii("opacity"),_=Ii("padding"),w=Ii("saturate"),x=Ii("scale"),C=Ii("sepia"),P=Ii("skew"),E=Ii("space"),A=Ii("translate"),M=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",kr,e],L=()=>[kr,e],k=()=>["",yx,AE],F=()=>["auto",IN,kr],$=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>["start","end","center","between","around","evenly","stretch"],j=()=>["","0",kr],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[IN,kr];return{cacheSize:500,separator:":",theme:{colors:[uz],spacing:[yx,AE],blur:["none","",IE,kr],brightness:W(),borderColor:[t],borderRadius:["none","","full",IE,kr],borderSpacing:L(),borderWidth:k(),contrast:W(),grayscale:j(),hueRotate:W(),invert:j(),gap:L(),gradientColorStops:[t],gradientColorStopPositions:[XZt,AE],inset:N(),margin:N(),opacity:W(),padding:L(),saturate:W(),scale:W(),sepia:j(),skew:W(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",kr]}],container:["container"],columns:[{columns:[IE]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...$(),kr]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",sz,kr]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",kr]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",sz,kr]}],"grid-cols":[{"grid-cols":[uz]}],"col-start-end":[{col:["auto",{span:["full",sz,kr]},kr]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[uz]}],"row-start-end":[{row:["auto",{span:[sz,kr]},kr]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",kr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",kr]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...V()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...V(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...V(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[_]}],px:[{px:[_]}],py:[{py:[_]}],ps:[{ps:[_]}],pe:[{pe:[_]}],pt:[{pt:[_]}],pr:[{pr:[_]}],pb:[{pb:[_]}],pl:[{pl:[_]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",kr,e]}],"min-w":[{"min-w":[kr,e,"min","max","fit"]}],"max-w":[{"max-w":[kr,e,"none","full","min","max","fit","prose",{screen:[IE]},IE]}],h:[{h:[kr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[kr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[kr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[kr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",IE,AE]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Cpe]}],"font-family":[{font:[uz]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",kr]}],"line-clamp":[{"line-clamp":["none",IN,Cpe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",yx,kr]}],"list-image":[{"list-image":["none",kr]}],"list-style-type":[{list:["none","disc","decimal",kr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",yx,AE]}],"underline-offset":[{"underline-offset":["auto",yx,kr]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",kr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",kr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...$(),tXt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",eXt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},nXt]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:U()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[yx,kr]}],"outline-w":[{outline:[yx,AE]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:k()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[yx,AE]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",IE,oXt]}],"shadow-color":[{shadow:[uz]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...J(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":J()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",IE,kr]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",kr]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",kr]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",kr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[sz,kr]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",kr]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",kr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",kr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[yx,AE,Cpe]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},uXt=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{lz(t,"cacheSize",e),lz(t,"prefix",r),lz(t,"separator",n),lz(t,"experimentalParseClassName",o);for(let s in a)lXt(t[s],a[s]);for(let s in i)cXt(t[s],i[s]);return t},lz=(t,e,r)=>{r!==void 0&&(t[e]=r)},lXt=(t,e)=>{if(e)for(let r in e)lz(t,r,e[r])},cXt=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},L2e=(t,...e)=>typeof t=="function"?A2e(I2e,t,...e):A2e(()=>uXt(I2e(),t),...e);var dXt=L2e({extend:{classGroups:{"text-color":["text-muted","text-success","text-warning","text-error","text-accent"],"font-size":["text-smallest","text-smaller","text-small","text-ui-smaller","text-ui-small","text-ui-medium","text-ui-larger"]}}});function Ce(...t){return dXt(UW(t))}var fXt=AN("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",{variants:{variant:{default:"mod-cta bg-interactive-accent text-on-accent shadow hover:bg-interactive-accent-hover",destructive:"bg-modifier-error text-normal shadow-sm hover:bg-modifier-error/90",secondary:"bg-secondary text-normal shadow-sm hover:bg-interactive-hover",ghost:"clickable-icon bg-transparent hover:bg-interactive-accent hover:text-on-accent",link:"text-accent underline-offset-4 hover:underline",ghost2:"text-faint clickable-icon bg-transparent hover:bg-opacity-100 hover:text-normal hover:bg-transparent outline-none focus-visible:outline-none focus-visible:text-normal focus-visible:ring-0"},size:{default:"h-9 px-4 py-2",sm:"h-6 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"size-7",fit:"px-1 text-xs gap-1"}},defaultVariants:{variant:"default",size:"default"}}),ke=zW.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>zW.createElement(n?Uy:"button",{className:Ce(fXt({variant:e,size:r,className:t})),ref:i,...o}));ke.displayName="Button";var VW=B(X());var F2e=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),HW=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();var cz=B(X());var k2e={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"};var B2e=(0,cz.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,cz.createElement)("svg",{ref:u,...k2e,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:HW("lucide",o),...s},[...a.map(([l,c])=>(0,cz.createElement)(l,c)),...Array.isArray(i)?i:[i]]));var Se=(t,e)=>{let r=(0,VW.forwardRef)(({className:n,...o},i)=>(0,VW.createElement)(B2e,{ref:i,iconNode:e,className:HW(`lucide-${F2e(t)}`,n),...o}));return r.displayName=`${t}`,r};var bx=Se("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]]);var dz=Se("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var aM=Se("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var yg=Se("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var ps=Se("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var _x=Se("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var sM=Se("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var ms=Se("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var bg=Se("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var ME=Se("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);var fz=Se("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var pz=Se("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);var zy=Se("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);var vx=Se("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var Rp=Se("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);var mz=Se("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);var hz=Se("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);var gz=Se("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);var RE=Se("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);var jE=Se("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);var uM=Se("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var yz=Se("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var wx=Se("Eye",[["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"}]]);var bz=Se("FileInput",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);var _z=Se("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);var lM=Se("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);var vz=Se("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);var wz=Se("Folder",[["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"}]]);var cM=Se("Globe",[["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"}]]);var DE=Se("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);var Sz=Se("Image",[["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"}]]);var xz=Se("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var Cz=Se("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);var Oz=Se("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);var Sx=Se("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);var td=Se("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var Ez=Se("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);var NE=Se("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);var RN=Se("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);var jN=Se("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);var xx=Se("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var Pz=Se("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);var Tz=Se("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var Az=Se("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);var Hy=Se("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);var LE=Se("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);var Df=Se("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);var Iz=Se("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);var Mz=Se("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]);var _g=Se("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);var Bm=Se("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var Rz=Se("User",[["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"}]]);var dM=Se("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);var Nf=Se("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function pXt({onCancel:t}){let e=de(),r=Ppe(e.defaultModelKey)&&Ppe(e.embeddingModelKey);return Vy.default.createElement("div",{className:"flex flex-col gap-4"},Vy.default.createElement("div",{className:"flex flex-col gap-2"},Vy.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&Vy.default.createElement("div",{className:"text-sm text-warning"},"The Copilot Plus exclusive models will stop working. You can switch to the default models in the Settings.")),Vy.default.createElement("div",{className:"flex gap-2 justify-end w-full"},Vy.default.createElement(ke,{variant:"ghost",onClick:t},"Close"),Vy.default.createElement(ke,{variant:"default",onClick:()=>{DN(iE.EXPIRED_MODAL)}},"Renew Now ",Vy.default.createElement(uM,{className:"size-4"}))))}var WW=class extends $2e.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,q2e.createRoot)(e);let r=()=>{this.close()};this.root.render(Vy.default.createElement(pXt,{onCancel:r}))}onClose(){this.root.unmount()}};var hr=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}};var sbt=B(t3(),1);Gl();MI();Wp();xf();Uc();function rl(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return e._def||Object.values(Pr.ZodFirstPartyTypeKind).includes(e.constructor?.name??"NOT_INCLUDED")?!0:typeof e.parse=="function"&&typeof e.parseAsync=="function"&&typeof e.safeParse=="function"&&typeof e.safeParseAsync=="function"}function Qyt(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function ebt(t){return t!==void 0&&ln.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function tbt(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&rl(t.schema)}function pc(t){return tbt(t)||ebt(t)||Qyt(t)}Gl();Zq();Zq();function rbt(t){return rl(t)?Xn(t):t}function n3(t){if(!t||typeof t!="object"||Object.keys(t).length===0||Array.isArray(t))return!1;if("type"in t)return typeof t.type=="string"?t.type==="string":Array.isArray(t.type)?t.type.every(e=>e==="string"):!1;if("enum"in t)return Array.isArray(t.enum)&&t.enum.length>0&&t.enum.every(e=>typeof e=="string");if("const"in t)return typeof t.const=="string";if("allOf"in t&&Array.isArray(t.allOf))return t.allOf.some(e=>n3(e));if("anyOf"in t&&Array.isArray(t.anyOf)||"oneOf"in t&&Array.isArray(t.oneOf)){let e="anyOf"in t?t.anyOf:t.oneOf;return e.length>0&&e.every(r=>n3(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=ex(t);return r[e]?n3(r[e]):!1}return!1}function zP(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:rbt(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function qw(t,e){let r=typeof e=="number"?void 0:e,n;return pc(t)?n={type:"function",function:zP(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}Gl();MI();ED();r3();GO();xf();Py();H5();Nq();var _s=class t extends qF{constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models",this._llmType()]}),Object.defineProperty(this,"disableStreaming",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_separateRunnableConfigFromCallOptionsCompat(e){let[r,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=r.signal,[r,n]}async invoke(e,r){let n=t._convertInputToPromptValue(e);return(await this.generatePrompt([n],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,r,n){throw new Error("Not implemented.")}async*_streamIterator(e,r){if(this._streamResponseChunks===t.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(e,r);else{let o=t._convertInputToPromptValue(e).toChatMessages(),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(r),s={...i.metadata,...this.getLsParams(a)},u=await ls.configure(i.callbacks,this.callbacks,i.tags,this.tags,s,this.metadata,{verbose:this.verbose}),l={options:a,invocation_params:this?.invocationParams(a),batch_size:1},c=await u?.handleChatModelStart(this.toJSON(),[o],i.runId,void 0,l,void 0,void 0,i.runName),d,f;try{for await(let p of this._streamResponseChunks(o,a,c?.[0])){if(p.message.id==null){let m=c?.at(0)?.runId;m!=null&&p.message._updateId(`run-${m}`)}p.message.response_metadata={...p.generationInfo,...p.message.response_metadata},yield p.message,d?d=d.concat(p):d=p,Xue(p.message)&&p.message.usage_metadata!==void 0&&(f={tokenUsage:{promptTokens:p.message.usage_metadata.input_tokens,completionTokens:p.message.usage_metadata.output_tokens,totalTokens:p.message.usage_metadata.total_tokens}})}}catch(p){throw await Promise.all((c??[]).map(m=>m?.handleLLMError(p))),p}await Promise.all((c??[]).map(p=>p?.handleLLMEnd({generations:[[d]],llmOutput:f})))}}getLsParams(e){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:r}}async _generateUncached(e,r,n,o){let i=e.map(d=>d.map(eg)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await ls.configure(n.callbacks,this.callbacks,n.tags,this.tags,d,this.metadata,{verbose:this.verbose}),p={options:r,invocation_params:this?.invocationParams(r),batch_size:1};a=await f?.handleChatModelStart(this.toJSON(),i,n.runId,void 0,p,void 0,void 0,n.runName)}let s=[],u=[];if(!!a?.[0].handlers.find(Wue)&&!this.disableStreaming&&i.length===1&&this._streamResponseChunks!==t.prototype._streamResponseChunks)try{let d=await this._streamResponseChunks(i[0],r,a?.[0]),f,p;for await(let m of d){if(m.message.id==null){let h=a?.at(0)?.runId;h!=null&&m.message._updateId(`run-${h}`)}f===void 0?f=m:f=yl(f,m),Xue(m.message)&&m.message.usage_metadata!==void 0&&(p={tokenUsage:{promptTokens:m.message.usage_metadata.input_tokens,completionTokens:m.message.usage_metadata.output_tokens,totalTokens:m.message.usage_metadata.total_tokens}})}if(f===void 0)throw new Error("Received empty response from chat model call.");s.push([f]),await a?.[0].handleLLMEnd({generations:s,llmOutput:p})}catch(d){throw await a?.[0].handleLLMError(d),d}else{let d=await Promise.allSettled(i.map((f,p)=>this._generate(f,{...r,promptIndex:p},a?.[p])));await Promise.all(d.map(async(f,p)=>{if(f.status==="fulfilled"){let m=f.value;for(let h of m.generations){if(h.message.id==null){let v=a?.at(0)?.runId;v!=null&&h.message._updateId(`run-${v}`)}h.message.response_metadata={...h.generationInfo,...h.message.response_metadata}}return m.generations.length===1&&(m.generations[0].message.response_metadata={...m.llmOutput,...m.generations[0].message.response_metadata}),s[p]=m.generations,u[p]=m.llmOutput,a?.[p]?.handleLLMEnd({generations:[m.generations],llmOutput:m.llmOutput})}else return await a?.[p]?.handleLLMError(f.reason),Promise.reject(f.reason)}))}let c={generations:s,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(c,Vq,{value:a?{runIds:a?.map(d=>d.runId)}:void 0,configurable:!0}),c}async _generateCached({messages:e,cache:r,llmStringKey:n,parsedOptions:o,handledOptions:i}){let a=e.map(v=>v.map(eg)),s={...i.metadata,...this.getLsParams(o)},u=await ls.configure(i.callbacks,this.callbacks,i.tags,this.tags,s,this.metadata,{verbose:this.verbose}),l={options:o,invocation_params:this?.invocationParams(o),batch_size:1},c=await u?.handleChatModelStart(this.toJSON(),a,i.runId,void 0,l,void 0,void 0,i.runName),d=[],p=(await Promise.allSettled(a.map(async(v,g)=>{let _=t._convertInputToPromptValue(v).toString(),w=await r.lookup(_,n);return w==null&&d.push(g),w}))).map((v,g)=>({result:v,runManager:c?.[g]})).filter(({result:v})=>v.status==="fulfilled"&&v.value!=null||v.status==="rejected"),m=[];await Promise.all(p.map(async({result:v,runManager:g},_)=>{if(v.status==="fulfilled"){let w=v.value;return m[_]=w.map(x=>("message"in x&&Om(x.message)&&ei(x.message)&&(x.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0}),x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),w.length&&await g?.handleLLMNewToken(w[0].text),g?.handleLLMEnd({generations:[w]},void 0,void 0,void 0,{cached:!0})}else return await g?.handleLLMError(v.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(v.reason)}));let h={generations:m,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(h,Vq,{value:c?{runIds:c?.map(v=>v.runId)}:void 0,configurable:!0}),h}async generate(e,r,n){let o;Array.isArray(r)?o={stop:r}:o=r;let i=e.map(m=>m.map(eg)),[a,s]=this._separateRunnableConfigFromCallOptionsCompat(o);if(a.callbacks=a.callbacks??n,!this.cache)return this._generateUncached(i,s,a);let{cache:u}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:c,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({messages:i,cache:u,llmStringKey:l,parsedOptions:s,handledOptions:a}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>i[h]),s,a,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,v)=>{let g=d[v];c[g]=h;let _=t._convertInputToPromptValue(i[g]).toString();return u.update(_,l,h)})),p=m.llmOutput??{}}return{generations:c,llmOutput:p}}invocationParams(e){return{}}_modelType(){return"base_chat_model"}serialize(){return{...this.invocationParams(),_type:this._llmType(),_model:this._modelType()}}async generatePrompt(e,r,n){let o=e.map(i=>i.toChatMessages());return this.generate(o,r,n)}async call(e,r,n){return(await this.generate([e.map(eg)],r,n)).generations[0][0].message}async callPrompt(e,r,n){let o=e.toChatMessages();return this.call(o,r,n)}async predictMessages(e,r,n){return this.call(e,r,n)}async predict(e,r,n){let o=new Ga(e),i=await this.call([o],r,n);if(typeof i.content!="string")throw new Error("Cannot use predict when output is not a string.");return i.content}withStructuredOutput(e,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let n=e,o=r?.name,i=n.description??"A function available to call.",a=r?.method,s=r?.includeRaw;if(a==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let u=o??"extract",l;rl(n)?l=[{type:"function",function:{name:u,description:i,parameters:Xn(n)}}]:("name"in n&&(u=n.name),l=[{type:"function",function:{name:u,description:i,parameters:n}}]);let c=this.bindTools(l),d=kd.from(h=>{if(!h.tool_calls||h.tool_calls.length===0)throw new Error("No tool calls found in the response.");let v=h.tool_calls.find(g=>g.name===u);if(!v)throw new Error(`No tool call found with name ${u}.`);return v.args});if(!s)return c.pipe(d).withConfig({runName:"StructuredOutput"});let f=Kn.assign({parsed:(h,v)=>d.invoke(h.raw,v)}),p=Kn.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return Wo.from([{raw:c},m]).withConfig({runName:"StructuredOutputRunnable"})}};fd();CI();var mc=[];for(BX=0;BX<256;++BX)mc.push((BX+256).toString(16).slice(1));var BX;function nbt(t,e=0){return(mc[t[e+0]]+mc[t[e+1]]+mc[t[e+2]]+mc[t[e+3]]+"-"+mc[t[e+4]]+mc[t[e+5]]+"-"+mc[t[e+6]]+mc[t[e+7]]+"-"+mc[t[e+8]]+mc[t[e+9]]+"-"+mc[t[e+10]]+mc[t[e+11]]+mc[t[e+12]]+mc[t[e+13]]+mc[t[e+14]]+mc[t[e+15]]).toLowerCase()}var $X,PFr=new Uint8Array(16);function qxe(){if(!$X&&($X=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!$X))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $X(PFr)}var TFr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Uxe={randomUUID:TFr};function AFr(t,e,r){if(Uxe.randomUUID&&!e&&!t)return Uxe.randomUUID();t=t||{};var n=t.random||(t.rng||qxe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return nbt(n)}var zxe=AFr;function obt(t){let e=[],r=[];typeof t=="string"?r=[{output:t}]:t instanceof Map||typeof t=="object"&&t!==null&&!Array.isArray(t)?r=[t]:Array.isArray(t)||(r=[{output:t}]);for(let n of r)!(n instanceof Map)&&(typeof n!="object"||n===null)&&(n={output:n}),e.push(n);return e}function qX(t,e){let r=i=>{switch(i){case"system":return"SYSTEM";case"human":return"USER";case"ai":return"CHATBOT";case"tool":return"TOOL";default:throw new Error(`Unknown message type: '${i}'. Accepted types: 'human', 'ai', 'system', 'tool'`)}},n=i=>{if(typeof i=="string")return i;throw new Error(`ChatCohere does not support non text message content. Received: ${JSON.stringify(i,null,2)}`)},o=i=>ei(i)&&i.tool_calls?i.tool_calls.map(a=>({name:a.name,parameters:a.args})):[];if(t._getType().toLowerCase()==="ai")return{role:r(t._getType()),message:n(t.content),toolCalls:o(t)};if(t._getType().toLowerCase()==="tool")return{role:r(t._getType()),message:n(t.content),toolResults:e};if(t._getType().toLowerCase()==="human"||t._getType().toLowerCase()==="system")return{role:r(t._getType()),message:n(t.content)};throw new Error("Got unknown message type. Supported types are AIMessage, ToolMessage, HumanMessage, and SystemMessage")}function MFr(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function ibt(t){return t._getType()==="tool"}function abt(t){let e="properties"in t?t.properties:{},r="required"in t?t.required:[],n={};return Object.keys(e).forEach(o=>{n[o]=e[o],r===void 0&&(r=[]),n[o].required=r.includes(o)}),n}function RFr(t){if(t){if(t.every(MFr))return t;if(t.every(fc))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:abt(e.function.parameters)}));if(t.every(pc))return t.map(e=>{let r=Xn(e.schema);return{name:e.name,description:e.description??"",parameterDefinitions:abt(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var UX=class extends _s{static lc_name(){return"ChatCohere"}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"command-r-plus"}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:.3}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0});let r=e?.apiKey??Ye("COHERE_API_KEY");if(!r)throw new Error("No API key provided for ChatCohere.");this.client=new sbt.CohereClient({token:r}),this.model=e?.model??this.model,this.temperature=e?.temperature??this.temperature,this.streaming=e?.streaming??this.streaming,this.streamUsage=e?.streamUsage??this.streamUsage}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"cohere",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:this.temperature??void 0,ls_max_tokens:typeof r.maxTokens=="number"?r.maxTokens:void 0,ls_stop:Array.isArray(r.stopSequences)?r.stopSequences:void 0}}_llmType(){return"cohere"}invocationParams(e){if(e.tool_choice)throw new Error("'tool_choice' call option is not supported by ChatCohere.");let r={model:this.model,preamble:e.preamble,conversationId:e.conversationId,promptTruncation:e.promptTruncation,connectors:e.connectors,searchQueriesOnly:e.searchQueriesOnly,documents:e.documents,temperature:e.temperature??this.temperature,forceSingleStep:e.forceSingleStep,tools:e.tools};return Object.fromEntries(Object.entries(r).filter(([,n])=>n!==void 0))}bindTools(e,r){return this.bind({tools:RFr(e),...r})}_getChatRequest(e,r){let n=this.invocationParams(r),o=this._messagesToCohereToolResultsCurrChatTurn(e),i=[],a="",s=[];if(n.forceSingleStep){a="";for(let l=0;l<e.length-1;l+=1){let c=e[l];if(!(ei(c)&&c.tool_calls))if(c._getType().toLowerCase()==="tool"){if(s=s.concat(this._messageToCohereToolResults(e,l)),l===e.length-1||e[l+1]._getType().toLowerCase()!=="tool"){let d=qX(c,s);i.push(d),s=[]}}else i.push(qX(c,[]))}for(let l=e.length-1;l>=0;l-=1){let c=e[l];if(c._getType().toLowerCase()==="human"&&c.content){a=c.content.toString();break}}}else{for(let l=0;l<e.length-1;l+=1){let c=e[l];if(c._getType().toLowerCase()==="tool"){if(s=s.concat(this._messageToCohereToolResults(e,l)),l===e.length-1||e[l+1]._getType().toLowerCase()!=="tool"){let d=qX(c,s);i.push(d),s=[]}}else i.push(qX(c,[]))}a=o.length>0?"":e[e.length-1].content.toString()}return{message:a,chatHistory:i,toolResults:o.length>0?o:void 0,...n}}_getCurrChatTurnMessages(e){let r=[];for(let n=e.length-1;n>=0;n-=1){let o=e[n];if(r.push(o),o._getType().toLowerCase()==="human")break}return r.reverse()}_messagesToCohereToolResultsCurrChatTurn(e){let r=[],n=this._getCurrChatTurnMessages(e);for(let o of n)if(ibt(o)){let i=o,a=n.filter(s=>ei(s)&&s.tool_calls!==void 0);if(a.length>0){let s=a[a.length-1];s.tool_calls&&r.push(...s.tool_calls.filter(u=>u.id===i.tool_call_id).map(u=>({call:{name:u.name,parameters:u.args},outputs:obt(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!ibt(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>ei(s)&&s.tool_calls).slice(-1)[0];return a.tool_calls&&n.push(...a.tool_calls.filter(s=>s.id===o.tool_call_id).map(s=>({call:{name:s.name,parameters:s.args},outputs:obt(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:zxe().substring(0,32),function:{name:n.name,arguments:n.parameters},type:"function"});return r}_convertCohereToolCallToLangchain(e){return e.map(r=>({name:r.function.name,args:r.function.arguments,id:r.id,type:"tool_call"}))}async _generate(e,r,n){let o={},i=this._getChatRequest(e,r);if(this.streaming){let c=this._streamResponseChunks(e,r,n),d={};for await(let p of c){let m=p.generationInfo?.completion??0;d[m]===void 0?d[m]=p:d[m]=d[m].concat(p)}return{generations:Object.entries(d).sort(([p],[m])=>parseInt(p,10)-parseInt(m,10)).map(([p,m])=>m),llmOutput:{estimatedTokenUsage:o}}}let a=await this.caller.callWithOptions({signal:r.signal},async()=>{let c;try{c=await this.client.chat(i)}catch(d){throw d.status=d.status??d.statusCode,d}return c});if(a.meta?.tokens){let{inputTokens:c,outputTokens:d}=a.meta.tokens;d&&(o.completionTokens=(o.completionTokens??0)+d),c&&(o.promptTokens=(o.promptTokens??0)+c),o.totalTokens=(o.totalTokens??0)+(o.promptTokens??0)+(o.completionTokens??0)}let s={...a};delete s.text,a.toolCalls&&a.toolCalls.length>0&&(s.toolCalls=this._formatCohereToolCalls(a.toolCalls));let u=[];return"toolCalls"in s&&(u=this._convertCohereToolCallToLangchain(s.toolCalls)),{generations:[{text:a.text,message:new en({content:a.text,additional_kwargs:s,tool_calls:u,usage_metadata:{input_tokens:o.promptTokens??0,output_tokens:o.completionTokens??0,total_tokens:o.totalTokens??0}}),generationInfo:s}],llmOutput:{estimatedTokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=this._getChatRequest(e,r),i=await this.caller.call(async()=>{let a;try{a=await this.client.chatStream(o)}catch(s){throw s.status=s.status??s.statusCode,s}return a});for await(let a of i)if(a.eventType==="text-generation")yield new Sn({text:a.text,message:new or({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new Sn({text:"",message:new or({content:"",additional_kwargs:{...a}}),generationInfo:{...a}});else if(a.eventType==="stream-end"&&(this.streamUsage||r.streamUsage)){let s=a.response.meta?.tokens?.inputTokens??0,u=a.response.meta?.tokens?.outputTokens??0,l={...a.response};a.response.toolCalls&&a.response.toolCalls.length>0&&(l.toolCalls=this._formatCohereToolCalls(a.response.toolCalls));let c=[],d=l.toolCalls??[];d.length>0&&(c=d.map(f=>({name:f.function.name,args:f.function.arguments,id:f.id,index:f.index,type:"tool_call_chunk"}))),yield new Sn({text:"",message:new or({content:"",additional_kwargs:{eventType:"stream-end"},tool_call_chunks:c,usage_metadata:{input_tokens:s,output_tokens:u,total_tokens:s+u}}),generationInfo:{eventType:"stream-end",...l}})}}_combineLLMOutput(...e){return e.reduce((r,n)=>{if(n&&n.estimatedTokenUsage){let o=r.estimatedTokenUsage?.completionTokens??0,i=r.estimatedTokenUsage?.promptTokens??0,a=r.estimatedTokenUsage?.totalTokens??0;o+=n.estimatedTokenUsage.completionTokens??0,i+=n.estimatedTokenUsage.promptTokens??0,a+=n.estimatedTokenUsage.totalTokens??0,r.estimatedTokenUsage={completionTokens:o,promptTokens:i,totalTokens:a}}return r},{estimatedTokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}get lc_secrets(){return{apiKey:"COHERE_API_KEY",api_key:"COHERE_API_KEY"}}get lc_aliases(){return{apiKey:"cohere_api_key",api_key:"cohere_api_key"}}};var jFr=B(t3(),1);MI();ED();GO();r3();Py();Nq();var lbt=B(t3(),1);PD();var Zd=class{constructor(e){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new wp(e??{})}};var Xd=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[]);var zX=class extends Zd{constructor(e){let r={maxConcurrency:2,...e};super(r),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"embeddingTypes",{enumerable:!0,configurable:!0,writable:!0,value:["float"]}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let n=r?.apiKey||Ye("COHERE_API_KEY");if(!n)throw new Error("Cohere API key not found");if(this.client=new lbt.CohereClient({token:n}),this.model=r?.model??this.model,!this.model)throw new Error("Model not specified for CohereEmbeddings instance. Please provide a model name from the options here: https://docs.cohere.com/reference/embed");this.batchSize=r?.batchSize??this.batchSize,this.embeddingTypes=r?.embeddingTypes??this.embeddingTypes}async embedDocuments(e){let r=Xd(e,this.batchSize),n=r.map(a=>this.embeddingWithRetry({model:this.model,texts:a,inputType:"search_document",embeddingTypes:this.embeddingTypes})),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],{embeddings:u}=o[a];for(let l=0;l<s.length;l+=1)"float"in u&&u.float?i.push(u.float[l]):Array.isArray(u)&&i.push(u[l])}return i}async embedQuery(e){let{embeddings:r}=await this.embeddingWithRetry({model:this.model,texts:[e],inputType:"search_query",embeddingTypes:this.embeddingTypes});if("float"in r&&r.float)return r.float[0];if(Array.isArray(r))return r[0];throw new Error(`Invalid response from Cohere API. Received: ${JSON.stringify(r,null,2)}`)}async embed(e){let{embeddings:r}=await this.embeddingWithRetry(e);if("float"in r&&r.float)return r.float[0];if(Array.isArray(r))return r[0];throw new Error(`Invalid response from Cohere API. Received: ${JSON.stringify(r,null,2)}`)}async embeddingWithRetry(e){return this.caller.call(async()=>{let r;try{r=await this.client.embed(e)}catch(n){throw n.status=n.status??n.statusCode,n}return r})}get lc_secrets(){return{apiKey:"COHERE_API_KEY",api_key:"COHERE_API_KEY"}}get lc_aliases(){return{apiKey:"cohere_api_key",api_key:"cohere_api_key"}}};var DFr=B(t3(),1);var cbt;(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(cbt||(cbt={}));var dbt;(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(dbt||(dbt={}));var fbt;(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(fbt||(fbt={}));var pbt=["user","model","function","system"],MR;(function(t){t.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",t.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",t.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",t.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT"})(MR||(MR={}));var RR;(function(t){t.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",t.BLOCK_NONE="BLOCK_NONE"})(RR||(RR={}));var mbt;(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(mbt||(mbt={}));var hbt;(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(hbt||(hbt={}));var o3;(function(t){t.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",t.STOP="STOP",t.MAX_TOKENS="MAX_TOKENS",t.SAFETY="SAFETY",t.RECITATION="RECITATION",t.LANGUAGE="LANGUAGE",t.OTHER="OTHER"})(o3||(o3={}));var gbt;(function(t){t.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",t.RETRIEVAL_QUERY="RETRIEVAL_QUERY",t.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",t.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",t.CLASSIFICATION="CLASSIFICATION",t.CLUSTERING="CLUSTERING"})(gbt||(gbt={}));var jR;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(jR||(jR={}));var ybt;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(ybt||(ybt={}));var pd=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},HP=class extends pd{constructor(e,r){super(e),this.response=r}},VX=class extends pd{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},Uw=class extends pd{};var NFr="https://generativelanguage.googleapis.com",LFr="v1beta",FFr="0.21.0",kFr="genai-js",DR;(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(DR||(DR={}));var Hxe=class{constructor(e,r,n,o,i){this.model=e,this.task=r,this.apiKey=n,this.stream=o,this.requestOptions=i}toString(){var e,r;let n=((e=this.requestOptions)===null||e===void 0?void 0:e.apiVersion)||LFr,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||NFr}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};function BFr(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${kFr}/${FFr}`),e.join(" ")}async function $Fr(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",BFr(t.requestOptions)),r.append("x-goog-api-key",t.apiKey);let n=(e=t.requestOptions)===null||e===void 0?void 0:e.customHeaders;if(n){if(!(n instanceof Headers))try{n=new Headers(n)}catch(o){throw new Uw(`unable to convert customHeaders value ${JSON.stringify(n)} to Headers: ${o.message}`)}for(let[o,i]of n.entries()){if(o==="x-goog-api-key")throw new Uw(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new Uw(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function qFr(t,e,r,n,o,i){let a=new Hxe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},VFr(i)),{method:"POST",headers:await $Fr(a),body:o})}}async function s3(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await qFr(t,e,r,n,o,i);return UFr(s,u,a)}async function UFr(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){zFr(o,t)}return n.ok||await HFr(n,t),n}function zFr(t,e){let r=t;throw t instanceof VX||t instanceof Uw||(r=new pd(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function HFr(t,e){let r="",n;try{let o=await t.json();r=o.error.message,o.error.details&&(r+=` ${JSON.stringify(o.error.details)}`,n=o.error.details)}catch{}throw new VX(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function VFr(t){let e={};if(t?.signal!==void 0||t?.timeout>=0){let r=new AbortController;t?.timeout>=0&&setTimeout(()=>r.abort(),t.timeout),t?.signal&&t.signal.addEventListener("abort",()=>{r.abort()}),e.signal=r.signal}return e}function Wxe(t){return t.text=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),HX(t.candidates[0]))throw new HP(`${VP(t)}`,t);return WFr(t)}else if(t.promptFeedback)throw new HP(`Text not available. ${VP(t)}`,t);return""},t.functionCall=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),HX(t.candidates[0]))throw new HP(`${VP(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),bbt(t)[0]}else if(t.promptFeedback)throw new HP(`Function call not available. ${VP(t)}`,t)},t.functionCalls=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),HX(t.candidates[0]))throw new HP(`${VP(t)}`,t);return bbt(t)}else if(t.promptFeedback)throw new HP(`Function call not available. ${VP(t)}`,t)},t}function WFr(t){var e,r,n,o;let i=[];if(!((r=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||r===void 0)&&r.parts)for(let a of(o=(n=t.candidates)===null||n===void 0?void 0:n[0].content)===null||o===void 0?void 0:o.parts)a.text&&i.push(a.text),a.executableCode&&i.push("\n```"+a.executableCode.language+`
`+a.executableCode.code+"\n```\n"),a.codeExecutionResult&&i.push("\n```\n"+a.codeExecutionResult.output+"\n```\n");return i.length>0?i.join(""):""}function bbt(t){var e,r,n,o;let i=[];if(!((r=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||r===void 0)&&r.parts)for(let a of(o=(n=t.candidates)===null||n===void 0?void 0:n[0].content)===null||o===void 0?void 0:o.parts)a.functionCall&&i.push(a.functionCall);if(i.length>0)return i}var KFr=[o3.RECITATION,o3.SAFETY,o3.LANGUAGE];function HX(t){return!!t.finishReason&&KFr.includes(t.finishReason)}function VP(t){var e,r,n;let o="";if((!t.candidates||t.candidates.length===0)&&t.promptFeedback)o+="Response was blocked",!((e=t.promptFeedback)===null||e===void 0)&&e.blockReason&&(o+=` due to ${t.promptFeedback.blockReason}`),!((r=t.promptFeedback)===null||r===void 0)&&r.blockReasonMessage&&(o+=`: ${t.promptFeedback.blockReasonMessage}`);else if(!((n=t.candidates)===null||n===void 0)&&n[0]){let i=t.candidates[0];HX(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function i3(t){return this instanceof i3?(this.v=t,this):new i3(t)}function JFr(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(f){n[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||s(f,p)})})}function s(f,p){try{u(n[f](p))}catch(m){d(i[0][3],m)}}function u(f){f.value instanceof i3?Promise.resolve(f.value.v).then(l,c):d(i[0][2],f)}function l(f){s("next",f)}function c(f){s("throw",f)}function d(f,p){f(p),i.shift(),i.length&&s(i[0][0],i[0][1])}}var _bt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function GFr(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=XFr(e),[n,o]=r.tee();return{stream:ZFr(n),response:YFr(o)}}async function YFr(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return Wxe(QFr(e));e.push(o)}}function ZFr(t){return JFr(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield i3(r.read());if(o)break;yield yield i3(Wxe(n))}})}function XFr(t){let e=t.getReader();return new ReadableStream({start(n){let o="";return i();function i(){return e.read().then(({value:a,done:s})=>{if(s){if(o.trim()){n.error(new pd("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(_bt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new pd(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(_bt)}return i()})}}})}function QFr(t){let e=t[t.length-1],r={promptFeedback:e?.promptFeedback};for(let n of t){if(n.candidates)for(let o of n.candidates){let i=o.index;if(r.candidates||(r.candidates=[]),r.candidates[i]||(r.candidates[i]={index:o.index}),r.candidates[i].citationMetadata=o.citationMetadata,r.candidates[i].groundingMetadata=o.groundingMetadata,r.candidates[i].finishReason=o.finishReason,r.candidates[i].finishMessage=o.finishMessage,r.candidates[i].safetyRatings=o.safetyRatings,o.content&&o.content.parts){r.candidates[i].content||(r.candidates[i].content={role:o.content.role||"user",parts:[]});let a={};for(let s of o.content.parts)s.text&&(a.text=s.text),s.functionCall&&(a.functionCall=s.functionCall),s.executableCode&&(a.executableCode=s.executableCode),s.codeExecutionResult&&(a.codeExecutionResult=s.codeExecutionResult),Object.keys(a).length===0&&(a.text=""),r.candidates[i].content.parts.push(a)}}n.usageMetadata&&(r.usageMetadata=n.usageMetadata)}return r}async function xbt(t,e,r,n){let o=await s3(e,DR.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return GFr(o)}async function Cbt(t,e,r,n){let i=await(await s3(e,DR.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:Wxe(i)}}function Obt(t){if(t!=null){if(typeof t=="string")return{role:"system",parts:[{text:t}]};if(t.text)return{role:"system",parts:[t]};if(t.parts)return t.role?t:{role:"system",parts:t.parts}}}function a3(t){let e=[];if(typeof t=="string")e=[{text:t}];else for(let r of t)typeof r=="string"?e.push({text:r}):e.push(r);return ekr(e)}function ekr(t){let e={role:"user",parts:[]},r={role:"function",parts:[]},n=!1,o=!1;for(let i of t)"functionResponse"in i?(r.parts.push(i),o=!0):(e.parts.push(i),n=!0);if(n&&o)throw new pd("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");if(!n&&!o)throw new pd("No content is provided for sending chat message.");return n?e:r}function tkr(t,e){var r;let n={model:e?.model,generationConfig:e?.generationConfig,safetySettings:e?.safetySettings,tools:e?.tools,toolConfig:e?.toolConfig,systemInstruction:e?.systemInstruction,cachedContent:(r=e?.cachedContent)===null||r===void 0?void 0:r.name,contents:[]},o=t.generateContentRequest!=null;if(t.contents){if(o)throw new Uw("CountTokensRequest must have one of contents or generateContentRequest, not both.");n.contents=t.contents}else if(o)n=Object.assign(Object.assign({},n),t.generateContentRequest);else{let i=a3(t);n.contents=[i]}return{generateContentRequest:n}}function vbt(t){let e;return t.contents?e=t:e={contents:[a3(t)]},t.systemInstruction&&(e.systemInstruction=Obt(t.systemInstruction)),e}function rkr(t){return typeof t=="string"||Array.isArray(t)?{content:a3(t)}:t}var wbt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],nkr={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};function okr(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new pd(`First content should be with role 'user', got ${n}`);if(!pbt.includes(n))throw new pd(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(pbt)}`);if(!Array.isArray(o))throw new pd("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new pd("Each Content should have at least one part");let i={text:0,inlineData:0,functionCall:0,functionResponse:0,fileData:0,executableCode:0,codeExecutionResult:0};for(let s of o)for(let u of wbt)u in s&&(i[u]+=1);let a=nkr[n];for(let s of wbt)if(!a.includes(s)&&i[s]>0)throw new pd(`Content with role '${n}' can't contain '${s}' part`);e=!0}}var Sbt="SILENT_ERROR",Vxe=class{constructor(e,r,n,o={}){this.model=r,this.params=n,this._requestOptions=o,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=e,n?.history&&(okr(n.history),this._history=n.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=a3(e),c={safetySettings:(n=this.params)===null||n===void 0?void 0:n.safetySettings,generationConfig:(o=this.params)===null||o===void 0?void 0:o.generationConfig,tools:(i=this.params)===null||i===void 0?void 0:i.tools,toolConfig:(a=this.params)===null||a===void 0?void 0:a.toolConfig,systemInstruction:(s=this.params)===null||s===void 0?void 0:s.systemInstruction,cachedContent:(u=this.params)===null||u===void 0?void 0:u.cachedContent,contents:[...this._history,l]},d=Object.assign(Object.assign({},this._requestOptions),r),f;return this._sendPromise=this._sendPromise.then(()=>Cbt(this._apiKey,this.model,c,d)).then(p=>{var m;if(p.response.candidates&&p.response.candidates.length>0){this._history.push(l);let h=Object.assign({parts:[],role:"model"},(m=p.response.candidates)===null||m===void 0?void 0:m[0].content);this._history.push(h)}else{let h=VP(p.response);h&&console.warn(`sendMessage() was unsuccessful. ${h}. Inspect response object for details.`)}f=p}),await this._sendPromise,f}async sendMessageStream(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=a3(e),c={safetySettings:(n=this.params)===null||n===void 0?void 0:n.safetySettings,generationConfig:(o=this.params)===null||o===void 0?void 0:o.generationConfig,tools:(i=this.params)===null||i===void 0?void 0:i.tools,toolConfig:(a=this.params)===null||a===void 0?void 0:a.toolConfig,systemInstruction:(s=this.params)===null||s===void 0?void 0:s.systemInstruction,cachedContent:(u=this.params)===null||u===void 0?void 0:u.cachedContent,contents:[...this._history,l]},d=Object.assign(Object.assign({},this._requestOptions),r),f=xbt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(Sbt)}).then(p=>p.response).then(p=>{if(p.candidates&&p.candidates.length>0){this._history.push(l);let m=Object.assign({},p.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{let m=VP(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==Sbt&&console.error(p)}),f}};async function ikr(t,e,r,n){return(await s3(e,DR.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function akr(t,e,r,n){return(await s3(e,DR.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function skr(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await s3(e,DR.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var WX=class{constructor(e,r,n={}){this.apiKey=e,this._requestOptions=n,r.model.includes("/")?this.model=r.model:this.model=`models/${r.model}`,this.generationConfig=r.generationConfig||{},this.safetySettings=r.safetySettings||[],this.tools=r.tools,this.toolConfig=r.toolConfig,this.systemInstruction=Obt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=vbt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return Cbt(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(n=this.cachedContent)===null||n===void 0?void 0:n.name},o),i)}async generateContentStream(e,r={}){var n;let o=vbt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return xbt(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(n=this.cachedContent)===null||n===void 0?void 0:n.name},o),i)}startChat(e){var r;return new Vxe(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(r=this.cachedContent)===null||r===void 0?void 0:r.name},e),this._requestOptions)}async countTokens(e,r={}){let n=tkr(e,{model:this.model,generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent}),o=Object.assign(Object.assign({},this._requestOptions),r);return ikr(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=rkr(e),o=Object.assign(Object.assign({},this._requestOptions),r);return akr(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return skr(this.apiKey,this.model,e,n)}};var NR=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new pd("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new WX(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new Uw("Cached content must contain a `name` field.");if(!e.model)throw new Uw("Cached content must contain a `model` field.");let o=["model","systemInstruction"];for(let a of o)if(r?.[a]&&e[a]&&r?.[a]!==e[a]){if(a==="model"){let s=r.model.startsWith("models/")?r.model.replace("models/",""):r.model,u=e.model.startsWith("models/")?e.model.replace("models/",""):e.model;if(s===u)continue}throw new Uw(`Different value for "${a}" specified in modelParams (${r[a]}) and cachedContent (${e[a]})`)}let i=Object.assign(Object.assign({},r),{model:e.model,tools:e.tools,toolConfig:e.toolConfig,systemInstruction:e.systemInstruction,cachedContent:e});return new WX(this.apiKey,i,n)}};Cp();Gl();function UF(t){if(typeof t=="object"&&t!==null){let e={...t};"additionalProperties"in e&&delete e.additionalProperties,"$schema"in e&&delete e.$schema;for(let r in e)r in e&&(Array.isArray(e[r])?e[r]=e[r].map(UF):typeof e[r]=="object"&&e[r]!==null&&(e[r]=UF(e[r])));return e}return t}function KX(t){let e=UF(Xn(t)),{$schema:r,...n}=e;return n}function Ebt(t){let e=UF(t),{$schema:r,...n}=e;return n}fd();Wp();function ukr(t){let e=t._getType();return Ja.isInstance(t)?t.role:e==="tool"?e:t.name??e}function lkr(t){switch(t){case"ai":case"model":return"model";case"system":return"system";case"human":return"user";case"tool":case"function":return"function";default:throw new Error(`Unknown / unsupported author: ${t}`)}}function ckr(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};throw new Error("Invalid media content")}function dkr(t,e){if(typeof t.content=="string"&&t.content!=="")return[{text:t.content}];let r=[],n=[],o=[];return"tool_calls"in t&&Array.isArray(t.tool_calls)&&t.tool_calls.length>0?r=t.tool_calls.map(i=>({functionCall:{name:i.name,args:i.args}})):t.getType()==="tool"&&t.name&&t.content?n=[{functionResponse:{name:t.name,response:t.content}}]:Array.isArray(t.content)&&(o=t.content.map(i=>{if(i.type==="text")return{text:i.text};if(i.type==="executableCode")return{executableCode:i.executableCode};if(i.type==="codeExecutionResult")return{codeExecutionResult:i.codeExecutionResult};if(i.type==="image_url"){if(!e)throw new Error("This model does not support images");let a;if(typeof i.image_url=="string")a=i.image_url;else if(typeof i.image_url=="object"&&"url"in i.image_url)a=i.image_url.url;else throw new Error("Please provide image as base64 encoded data URL");let[s,u]=a.split(",");if(!s.startsWith("data:"))throw new Error("Please provide image as base64 encoded data URL");let[l,c]=s.replace(/^data:/,"").split(";");if(c!=="base64")throw new Error("Please provide image as base64 encoded data URL");return{inlineData:{data:u,mimeType:l}}}else{if(i.type==="media")return ckr(i);if(i.type==="tool_use")return{functionCall:{name:i.name,args:i.input}}}throw new Error(`Unknown content type ${i.type}`)})),[...o,...r,...n]}function Kxe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!Om(o))throw new Error("Unsupported message input");let a=ukr(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=lkr(a),u=n.content[n.content.length];if(!n.mergeWithPreviousContent&&u&&u.role===s)throw new Error("Google Generative AI requires alternate messages between authors");let l=dkr(o,e);if(n.mergeWithPreviousContent){let f=n.content[n.content.length-1];if(!f)throw new Error("There was a problem parsing your system message. Please try a prompt without one.");return f.parts.push(...l),{mergeWithPreviousContent:!1,content:n.content}}let c=s;(c==="function"||c==="system"&&!r)&&(c="user");let d={role:c,parts:l};return{mergeWithPreviousContent:a==="system"&&!r,content:[...n.content,d]}},{content:[],mergeWithPreviousContent:!1}).content}function Pbt(t,e){if(!t.candidates||t.candidates.length===0||!t.candidates[0])return{generations:[],llmOutput:{filters:t.promptFeedback}};let r=t.functionCalls(),[n]=t.candidates,{content:o,...i}=n,a;o?.parts.length===1&&o.parts[0].text?a=o.parts[0].text:a=o.parts.map(l=>"text"in l?{type:"text",text:l.text}:"executableCode"in l?{type:"executableCode",executableCode:l.executableCode}:"codeExecutionResult"in l?{type:"codeExecutionResult",codeExecutionResult:l.codeExecutionResult}:l);let s="";return typeof a=="string"?s=a:"text"in a[0]&&(s=a[0].text),{generations:[{text:s,message:new en({content:a,tool_calls:r?.map(l=>({...l,type:"tool_call"})),additional_kwargs:{...i},usage_metadata:e?.usageMetadata}),generationInfo:i}]}}function Tbt(t,e){if(!t.candidates||t.candidates.length===0)return null;let r=t.functionCalls(),[n]=t.candidates,{content:o,...i}=n,a;o?.parts&&o.parts.every(l=>"text"in l)?a=o.parts.map(l=>l.text).join(""):o.parts&&(a=o.parts.map(l=>"text"in l?{type:"text",text:l.text}:"executableCode"in l?{type:"executableCode",executableCode:l.executableCode}:"codeExecutionResult"in l?{type:"codeExecutionResult",codeExecutionResult:l.codeExecutionResult}:l));let s="";a&&typeof a=="string"?s=a:a&&typeof a=="object"&&"text"in a[0]&&(s=a[0].text);let u=[];return r&&u.push(...r.map(l=>({...l,args:JSON.stringify(l.args),index:e.index,type:"tool_call_chunk"}))),new Sn({text:s,message:new or({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:e.usageMetadata}),generationInfo:i})}function Abt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(pc(e)){let r=KX(e.schema);return{name:e.name,description:e.description,parameters:r}}return fc(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:Ebt(e.function.parameters)}:e})}]}og();var u3=class extends RI{static lc_name(){return"GoogleGenerativeAIToolsOutputParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","google_genai","output_parsers"]}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await this.zodSchema.safeParseAsync(e);if(r.success)return r.data;throw new Sp(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error.errors)}`,JSON.stringify(e,null,2))}async parseResult(e){let r=e.flatMap(i=>{let{message:a}=i;return!("tool_calls"in a)||!Array.isArray(a.tool_calls)?[]:a.tool_calls});if(r[0]===void 0)throw new Error("No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser.");let[n]=r;return await this._validateResult(n.args)}};Wp();function Jxe(t,e){let r=fkr(t),n=mkr(r,e);return{tools:r,toolConfig:n}}function fkr(t){let e=[],r=[];return t.forEach(o=>{if(pc(o)){let[i]=Abt([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(fc(o)){let{functionDeclarations:i}=pkr(o);if(i)e.push(...i);else throw new Error("Failed to convert OpenAI structured tool to GenerativeAI tool")}else r.push(o)}),r.find(o=>"functionDeclarations"in o)?r.map(o=>{if(e?.length>0&&"functionDeclarations"in o){let i={functionDeclarations:[...o.functionDeclarations||[],...e]};return e=[],i}return o}):[...r,...e.length>0?[{functionDeclarations:e}]:[]]}function pkr(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:UF(t.function.parameters)}]}}function mkr(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:jR.ANY,auto:jR.AUTO,none:jR.NONE};if(r&&["any","auto","none"].includes(r))return{functionCallingConfig:{mode:o[r]??"MODE_UNSPECIFIED",allowedFunctionNames:n}};if(typeof r=="string"||n)return{functionCallingConfig:{mode:jR.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var JX=class extends _s{static lc_name(){return"ChatGoogleGenerativeAI"}get lc_secrets(){return{apiKey:"GOOGLE_API_KEY"}}get lc_aliases(){return{apiKey:"google_api_key"}}get _isMultimodalModel(){return this.model.includes("vision")||this.model.startsWith("gemini-1.5")||this.model.startsWith("gemini-2")}constructor(e){if(super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","google_genai"]}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"gemini-pro"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gemini-pro"}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxOutputTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"safetySettings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"convertSystemMessageToHumanContent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.modelName=e?.model?.replace(/^models\//,"")??e?.modelName?.replace(/^models\//,"")??this.model,this.model=this.modelName,this.maxOutputTokens=e?.maxOutputTokens??this.maxOutputTokens,this.maxOutputTokens&&this.maxOutputTokens<0)throw new Error("`maxOutputTokens` must be a positive integer");if(this.temperature=e?.temperature??this.temperature,this.temperature&&(this.temperature<0||this.temperature>1))throw new Error("`temperature` must be in the range of [0.0,1.0]");if(this.topP=e?.topP??this.topP,this.topP&&this.topP<0)throw new Error("`topP` must be a positive integer");if(this.topP&&this.topP>1)throw new Error("`topP` must be below 1.");if(this.topK=e?.topK??this.topK,this.topK&&this.topK<0)throw new Error("`topK` must be a positive integer");if(this.stopSequences=e?.stopSequences??this.stopSequences,this.apiKey=e?.apiKey??Ye("GOOGLE_API_KEY"),!this.apiKey)throw new Error("Please set an API key for Google GenerativeAI in the environment variable GOOGLE_API_KEY or in the `apiKey` field of the ChatGoogleGenerativeAI constructor");if(this.safetySettings=e?.safetySettings??this.safetySettings,this.safetySettings&&this.safetySettings.length>0&&new Set(this.safetySettings.map(n=>n.category)).size!==this.safetySettings.length)throw new Error("The categories in `safetySettings` array must be unique");this.streaming=e?.streaming??this.streaming,this.client=new NR(this.apiKey).getGenerativeModel({model:this.model,safetySettings:this.safetySettings,generationConfig:{candidateCount:1,stopSequences:this.stopSequences,maxOutputTokens:this.maxOutputTokens,temperature:this.temperature,topP:this.topP,topK:this.topK,...e?.json?{responseMimeType:"application/json"}:{}}},{apiVersion:e?.apiVersion,baseUrl:e?.baseUrl}),this.streamUsage=e?.streamUsage??this.streamUsage}useCachedContent(e,r,n){this.apiKey&&(this.client=new NR(this.apiKey).getGenerativeModelFromCachedContent(e,r,n))}get useSystemInstruction(){return typeof this.convertSystemMessageToHumanContent=="boolean"?!this.convertSystemMessageToHumanContent:this.computeUseSystemInstruction}get computeUseSystemInstruction(){return this.modelName==="gemini-1.0-pro-001"||this.modelName.startsWith("gemini-pro-vision")||this.modelName.startsWith("gemini-1.0-pro-vision")?!1:this.modelName!=="gemini-pro"}getLsParams(e){return{ls_provider:"google_genai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:this.client.generationConfig.temperature,ls_max_tokens:this.client.generationConfig.maxOutputTokens,ls_stop:e.stop}}_combineLLMOutput(){return[]}_llmType(){return"googlegenerativeai"}bindTools(e,r){return this.bind({tools:Jxe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?Jxe(e.tools,{toolChoice:e.tool_choice,allowedFunctionNames:e.allowedFunctionNames}):void 0;return{...r?.tools?{tools:r.tools}:{},...r?.toolConfig?{toolConfig:r.toolConfig}:{}}}async _generate(e,r,n){let o=Kxe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[c]=o;this.client.systemInstruction=c,i=o.slice(1)}let a=this.invocationParams(r);if(this.streaming){let c={},d=this._streamResponseChunks(e,r,n),f={};for await(let m of d){let h=m.generationInfo?.completion??0;f[h]===void 0?f[h]=m:f[h]=f[h].concat(m)}return{generations:Object.entries(f).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),llmOutput:{estimatedTokenUsage:c}}}let s=await this.completionWithRetry({...a,contents:i}),u;if("usageMetadata"in s.response){let c=s.response.usageMetadata;u={input_tokens:c.promptTokenCount??0,output_tokens:c.candidatesTokenCount??0,total_tokens:c.totalTokenCount??0}}let l=Pbt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(e,r,n){let o=Kxe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[d]=o;this.client.systemInstruction=d,i=o.slice(1)}let s={...this.invocationParams(r),contents:i},u=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:d}=await this.client.generateContentStream(s);return d}),l,c=0;for await(let d of u){if("usageMetadata"in d&&this.streamUsage!==!1&&r.streamUsage!==!1){let p=d.usageMetadata;if(!l)l={input_tokens:p.promptTokenCount,output_tokens:p.candidatesTokenCount,total_tokens:p.totalTokenCount};else{let m=p.candidatesTokenCount-l.output_tokens;l={input_tokens:0,output_tokens:m,total_tokens:m}}}let f=Tbt(d,{usageMetadata:l,index:c});c+=1,f&&(yield f,await n?.handleLLMNewToken(f.text??""))}}async completionWithRetry(e,r){return this.caller.callWithOptions({signal:r?.signal},async()=>{try{return await this.client.generateContent(e)}catch(n){throw n.message?.includes("400 Bad Request")&&(n.status=400),n}})}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw;if(i==="jsonMode")throw new Error('ChatGoogleGenerativeAI only supports "functionCalling" as a method.');let s=o??"extract",u,l;if(rl(n)){let m=KX(n);l=[{functionDeclarations:[{name:s,description:m.description??"A function available to call.",parameters:m}]}],u=new u3({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(m=n,s=n.name):m={name:s,description:n.description??"",parameters:n},l=[{functionDeclarations:[m]}],u=new u3({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=Kn.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=Kn.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Wo.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}};var GX=class extends Zd{constructor(e){if(super(e??{}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"embedding-001"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"embedding-001"}),Object.defineProperty(this,"taskType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stripNewLines",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxBatchSize",{enumerable:!0,configurable:!0,writable:!0,value:100}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.modelName=e?.model?.replace(/^models\//,"")??e?.modelName?.replace(/^models\//,"")??this.modelName,this.model=this.modelName,this.taskType=e?.taskType??this.taskType,this.title=e?.title??this.title,this.title&&this.taskType!=="RETRIEVAL_DOCUMENT")throw new Error("title can only be sepcified with TaskType.RETRIEVAL_DOCUMENT");if(this.apiKey=e?.apiKey??Ye("GOOGLE_API_KEY"),!this.apiKey)throw new Error("Please set an API key for Google GenerativeAI in the environmentb variable GOOGLE_API_KEY or in the `apiKey` field of the GoogleGenerativeAIEmbeddings constructor");this.client=new NR(this.apiKey).getGenerativeModel({model:this.model})}_convertToContent(e){return{content:{role:"user",parts:[{text:this.stripNewLines?e.replace(/\n/g," "):e}]},taskType:this.taskType,title:this.title}}async _embedQueryContent(e){let r=this._convertToContent(e);return(await this.client.embedContent(r)).embedding.values??[]}async _embedDocumentsContent(e){let r=Xd(e,this.maxBatchSize),n=r.map(a=>({requests:a.map(s=>this._convertToContent(s))}));return(await Promise.allSettled(n.map(a=>this.client.batchEmbedContents(a)))).flatMap((a,s)=>a.status==="fulfilled"?a.value.embeddings.map(u=>u.values||[]):Array(r[s].length).fill([]))}embedQuery(e){return this.caller.call(this._embedQueryContent.bind(this),e)}embedDocuments(e){return this.caller.call(this._embedDocumentsContent.bind(this),e)}};var hc=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},Qd={searchParams:"URLSearchParams"in hc,iterable:"Symbol"in hc&&"iterator"in Symbol,blob:"FileReader"in hc&&"Blob"in hc&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in hc,arrayBuffer:"ArrayBuffer"in hc};function hkr(t){return t&&DataView.prototype.isPrototypeOf(t)}Qd.arrayBuffer&&(Ibt=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Rbt=ArrayBuffer.isView||function(t){return t&&Ibt.indexOf(Object.prototype.toString.call(t))>-1});var Ibt,Rbt;function zF(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||t==="")throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function Yxe(t){return typeof t!="string"&&(t=String(t)),t}function Zxe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return Qd.iterable&&(e[Symbol.iterator]=function(){return e}),e}function nl(t){this.map={},t instanceof nl?t.forEach(function(e,r){this.append(r,e)},this):Array.isArray(t)?t.forEach(function(e){if(e.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}nl.prototype.append=function(t,e){t=zF(t),e=Yxe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};nl.prototype.delete=function(t){delete this.map[zF(t)]};nl.prototype.get=function(t){return t=zF(t),this.has(t)?this.map[t]:null};nl.prototype.has=function(t){return this.map.hasOwnProperty(zF(t))};nl.prototype.set=function(t,e){this.map[zF(t)]=Yxe(e)};nl.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};nl.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),Zxe(t)};nl.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),Zxe(t)};nl.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),Zxe(t)};Qd.iterable&&(nl.prototype[Symbol.iterator]=nl.prototype.entries);function Gxe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function jbt(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function gkr(t){var e=new FileReader,r=jbt(e);return e.readAsArrayBuffer(t),r}function ykr(t){var e=new FileReader,r=jbt(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function bkr(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}function Mbt(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function Dbt(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:Qd.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:Qd.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Qd.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():Qd.arrayBuffer&&Qd.blob&&hkr(t)?(this._bodyArrayBuffer=Mbt(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Qd.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||Rbt(t))?this._bodyArrayBuffer=Mbt(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):Qd.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Qd.blob&&(this.blob=function(){var t=Gxe(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=Gxe(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(Qd.blob)return this.blob().then(gkr);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=Gxe(this);if(t)return t;if(this._bodyBlob)return ykr(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(bkr(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Qd.formData&&(this.formData=function(){return this.text().then(wkr)}),this.json=function(){return this.text().then(JSON.parse)},this}var _kr=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function vkr(t){var e=t.toUpperCase();return _kr.indexOf(e)>-1?e:t}function FR(t,e){if(!(this instanceof FR))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var r=e.body;if(t instanceof FR){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new nl(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!r&&t._bodyInit!=null&&(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",(e.headers||!this.headers)&&(this.headers=new nl(e.headers)),this.method=vkr(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in hc){var i=new AbortController;return i.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+new Date().getTime());else{var o=/\?/;this.url+=(o.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}FR.prototype.clone=function(){return new FR(this,{body:this._bodyInit})};function wkr(t){var e=new FormData;return t.trim().split("&").forEach(function(r){if(r){var n=r.split("="),o=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(o),decodeURIComponent(i))}}),e}function Skr(t){var e=new nl,r=t.replace(/\r?\n[\t ]+/g," ");return r.split("\r").map(function(n){return n.indexOf(`
`)===0?n.substr(1,n.length):n}).forEach(function(n){var o=n.split(":"),i=o.shift().trim();if(i){var a=o.join(":").trim();try{e.append(i,a)}catch(s){console.warn("Response "+s.message)}}}),e}Dbt.call(FR.prototype);function zw(t,e){if(!(this instanceof zw))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=e.status===void 0?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText===void 0?"":""+e.statusText,this.headers=new nl(e.headers),this.url=e.url||"",this._initBody(t)}Dbt.call(zw.prototype);zw.prototype.clone=function(){return new zw(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new nl(this.headers),url:this.url})};zw.error=function(){var t=new zw(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var xkr=[301,302,303,307,308];zw.redirect=function(t,e){if(xkr.indexOf(e)===-1)throw new RangeError("Invalid status code");return new zw(null,{status:e,headers:{location:t}})};var LR=hc.DOMException;try{new LR}catch{LR=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},LR.prototype=Object.create(Error.prototype),LR.prototype.constructor=LR}function Nbt(t,e){return new Promise(function(r,n){var o=new FR(t,e);if(o.signal&&o.signal.aborted)return n(new LR("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:Skr(i.getAllResponseHeaders()||"")};o.url.indexOf("file://")===0&&(i.status<200||i.status>599)?l.status=200:l.status=i.status,l.url="responseURL"in i?i.responseURL:l.headers.get("X-Request-URL");var c="response"in i?i.response:i.responseText;setTimeout(function(){r(new zw(c,l))},0)},i.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},i.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request timed out"))},0)},i.onabort=function(){setTimeout(function(){n(new LR("Aborted","AbortError"))},0)};function s(l){try{return l===""&&hc.location.href?hc.location.href:l}catch{return l}}if(i.open(o.method,s(o.url),!0),o.credentials==="include"?i.withCredentials=!0:o.credentials==="omit"&&(i.withCredentials=!1),"responseType"in i&&(Qd.blob?i.responseType="blob":Qd.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof nl||hc.Headers&&e.headers instanceof hc.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(zF(l)),i.setRequestHeader(l,Yxe(e.headers[l]))}),o.headers.forEach(function(l,c){u.indexOf(c)===-1&&i.setRequestHeader(c,l)})}else o.headers.forEach(function(l,c){i.setRequestHeader(c,l)});o.signal&&(o.signal.addEventListener("abort",a),i.onreadystatechange=function(){i.readyState===4&&o.signal.removeEventListener("abort",a)}),i.send(typeof o._bodyInit>"u"?null:o._bodyInit)})}Nbt.polyfill=!0;hc.fetch||(hc.fetch=Nbt,hc.Headers=nl,hc.Request=FR,hc.Response=zw);var Ckr="0.5.14",Fbt="11434",kbt=`http://127.0.0.1:${Fbt}`,Okr=Object.defineProperty,Ekr=(t,e,r)=>e in t?Okr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xxe=(t,e,r)=>(Ekr(t,typeof e!="symbol"?e+"":e,r),r),eCe=class t extends Error{constructor(e,r){super(e),this.error=e,this.status_code=r,this.name="ResponseError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}},tCe=class{constructor(e,r,n){Xxe(this,"abortController"),Xxe(this,"itr"),Xxe(this,"doneCallback"),this.abortController=e,this.itr=r,this.doneCallback=n}abort(){this.abortController.abort()}async*[Symbol.asyncIterator](){for await(let e of this.itr){if("error"in e)throw new Error(e.error);if(yield e,e.done||e.status==="success"){this.doneCallback();return}}throw new Error("Did not receive done or success response in stream.")}},rCe=async t=>{if(t.ok)return;let e=`Error ${t.status}: ${t.statusText}`,r=null;if(t.headers.get("content-type")?.includes("application/json"))try{r=await t.json(),e=r.error||e}catch{console.log("Failed to parse error response as JSON")}else try{console.log("Getting text from response"),e=await t.text()||e}catch{console.log("Failed to get text from error response")}throw new eCe(e,t.status)};function Pkr(){if(typeof window<"u"&&window.navigator){let t=navigator;return"userAgentData"in t&&t.userAgentData?.platform?`${t.userAgentData.platform.toLowerCase()} Browser/${navigator.userAgent};`:navigator.platform?`${navigator.platform.toLowerCase()} Browser/${navigator.userAgent};`:`unknown Browser/${navigator.userAgent};`}else if(typeof process<"u")return`${process.arch} ${process.platform} Node.js/${process.version}`;return""}function Tkr(t){if(t instanceof Headers){let e={};return t.forEach((r,n)=>{e[n]=r}),e}else return Array.isArray(t)?Object.fromEntries(t):t||{}}var nCe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${Ckr} (${Pkr()})`};r.headers=Tkr(r.headers);let o=Object.fromEntries(Object.entries(r.headers).filter(([i])=>!Object.keys(n).some(a=>a.toLowerCase()===i.toLowerCase())));return r.headers={...n,...o},t(e,r)},Lbt=async(t,e,r)=>{let n=await nCe(t,e,{headers:r?.headers});return await rCe(n),n},HF=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await nCe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await rCe(a),a},Akr=async(t,e,r,n)=>{let o=await nCe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await rCe(o),o},Ikr=async function*(t){let e=new TextDecoder("utf-8"),r="",n=t.getReader();for(;;){let{done:o,value:i}=await n.read();if(o)break;r+=e.decode(i);let a=r.split(`
`);r=a.pop()??"";for(let s of a)try{yield JSON.parse(s)}catch{console.warn("invalid json: ",s)}}for(let o of r.split(`
`).filter(i=>i!==""))try{yield JSON.parse(o)}catch{console.warn("invalid json: ",o)}},Mkr=t=>{if(!t)return kbt;let e=t.includes("://");t.startsWith(":")&&(t=`http://127.0.0.1${t}`,e=!0),e||(t=`http://${t}`);let r=new URL(t),n=r.port;n||(e?n=r.protocol==="https:"?"443":"80":n=Fbt);let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},Rkr=Object.defineProperty,jkr=(t,e,r)=>e in t?Rkr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qxe=(t,e,r)=>(jkr(t,typeof e!="symbol"?e+"":e,r),r),VF=class{constructor(e){Qxe(this,"config"),Qxe(this,"fetch"),Qxe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=Mkr(e?.host??kbt)),this.fetch=e?.fetch??fetch}abort(){for(let e of this.ongoingStreamedRequests)e.abort();this.ongoingStreamedRequests.length=0}async processStreamableRequest(e,r){r.stream=r.stream??!1;let n=`${this.config.host}/api/${e}`;if(r.stream){let i=new AbortController,a=await HF(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=Ikr(a.body),u=new tCe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await HF(this.fetch,n,r,{headers:this.config.headers})).json()}async encodeImage(e){if(typeof e!="string"){let r=new Uint8Array(e),n="",o=r.byteLength;for(let i=0;i<o;i++)n+=String.fromCharCode(r[i]);return btoa(n)}return e}async generate(e){return e.images&&(e.images=await Promise.all(e.images.map(this.encodeImage.bind(this)))),this.processStreamableRequest("generate",e)}async chat(e){if(e.messages)for(let r of e.messages)r.images&&(r.images=await Promise.all(r.images.map(this.encodeImage.bind(this))));return this.processStreamableRequest("chat",e)}async create(e){return this.processStreamableRequest("create",{...e})}async pull(e){return this.processStreamableRequest("pull",{name:e.model,stream:e.stream,insecure:e.insecure})}async push(e){return this.processStreamableRequest("push",{name:e.model,stream:e.stream,insecure:e.insecure})}async delete(e){return await Akr(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await HF(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await Lbt(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await HF(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await HF(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await HF(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await Lbt(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}},umo=new VF;fd();Cp();Py();og();Gl();var gc=[];for(YX=0;YX<256;++YX)gc.push((YX+256).toString(16).slice(1));var YX;function Bbt(t,e=0){return(gc[t[e+0]]+gc[t[e+1]]+gc[t[e+2]]+gc[t[e+3]]+"-"+gc[t[e+4]]+gc[t[e+5]]+"-"+gc[t[e+6]]+gc[t[e+7]]+"-"+gc[t[e+8]]+gc[t[e+9]]+"-"+gc[t[e+10]]+gc[t[e+11]]+gc[t[e+12]]+gc[t[e+13]]+gc[t[e+14]]+gc[t[e+15]]).toLowerCase()}var ZX,Dkr=new Uint8Array(16);function oCe(){if(!ZX&&(ZX=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ZX))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ZX(Dkr)}var Nkr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),iCe={randomUUID:Nkr};function Lkr(t,e,r){if(iCe.randomUUID&&!e&&!t)return iCe.randomUUID();t=t||{};var n=t.random||(t.rng||oCe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return Bbt(n)}var aCe=Lkr;function sCe(t,e){return new or({content:t.content??"",tool_call_chunks:t.tool_calls?.map(r=>({name:r.function.name,args:JSON.stringify(r.function.arguments),type:"tool_call_chunk",index:0,id:aCe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function $bt(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function Fkr(t){if(typeof t.content=="string")return[{role:"assistant",content:t.content}];let r=t.content.filter(o=>o.type==="text"&&typeof o.text=="string").map(o=>({role:"assistant",content:o.text})),n;if(t.content.find(o=>o.type==="tool_use")&&t.tool_calls?.length){let o=t.tool_calls?.map(i=>({id:i.id,type:"function",function:{name:i.name,arguments:i.args}}));o&&(n={role:"assistant",tool_calls:o,content:""})}else if(t.content.find(o=>o.type==="tool_use")&&!t.tool_calls?.length)throw new Error("'tool_use' content type is not supported without tool calls.");return[...r,...n?[n]:[]]}function kkr(t){return typeof t.content=="string"?[{role:"user",content:t.content}]:t.content.map(e=>{if(e.type==="text")return{role:"user",content:e.text};if(e.type==="image_url"){if(typeof e.image_url=="string")return{role:"user",content:"",images:[$bt(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[$bt(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function Bkr(t){if(typeof t.content=="string")return[{role:"system",content:t.content}];if(t.content.every(e=>e.type==="text"&&typeof e.text=="string"))return t.content.map(e=>({role:"system",content:e.text}));throw new Error(`Unsupported content type(s): ${t.content.map(e=>e.type).join(", ")}`)}function $kr(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function qbt(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return kkr(e);if(e._getType()==="ai")return Fkr(e);if(e._getType()==="system")return Bkr(e);if(e._getType()==="tool")return $kr(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var XX=class extends _s{static lc_name(){return"ChatOllama"}constructor(e){super(e??{}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"llama3"}),Object.defineProperty(this,"numa",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numBatch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numGpu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mainGpu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lowVram",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"f16Kv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logitsAll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"vocabOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useMmap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useMlock",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"embeddingOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numThread",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numKeep",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"seed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numPredict",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tfsZ",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"typicalP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"repeatLastN",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"repeatPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostatTau",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mirostatEta",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"penalizeNewline",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"format",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"checkOrPullModel",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:"http://127.0.0.1:11434"}),this.client=new VF({host:e?.baseUrl,headers:e?.headers}),this.baseUrl=e?.baseUrl??this.baseUrl,this.model=e?.model??this.model,this.numa=e?.numa,this.numCtx=e?.numCtx,this.numBatch=e?.numBatch,this.numGpu=e?.numGpu,this.mainGpu=e?.mainGpu,this.lowVram=e?.lowVram,this.f16Kv=e?.f16Kv,this.logitsAll=e?.logitsAll,this.vocabOnly=e?.vocabOnly,this.useMmap=e?.useMmap,this.useMlock=e?.useMlock,this.embeddingOnly=e?.embeddingOnly,this.numThread=e?.numThread,this.numKeep=e?.numKeep,this.seed=e?.seed,this.numPredict=e?.numPredict,this.topK=e?.topK,this.topP=e?.topP,this.tfsZ=e?.tfsZ,this.typicalP=e?.typicalP,this.repeatLastN=e?.repeatLastN,this.temperature=e?.temperature,this.repeatPenalty=e?.repeatPenalty,this.presencePenalty=e?.presencePenalty,this.frequencyPenalty=e?.frequencyPenalty,this.mirostat=e?.mirostat,this.mirostatTau=e?.mirostatTau,this.mirostatEta=e?.mirostatEta,this.penalizeNewline=e?.penalizeNewline,this.streaming=e?.streaming,this.format=e?.format,this.keepAlive=e?.keepAlive,this.checkOrPullModel=e?.checkOrPullModel??this.checkOrPullModel}_llmType(){return"ollama"}async pull(e,r){let{stream:n,insecure:o,logProgress:i}={stream:!0,...r};if(n)for await(let a of await this.client.pull({model:e,insecure:o,stream:n}))i&&console.log(a);else{let a=await this.client.pull({model:e,insecure:o});i&&console.log(a)}}bindTools(e,r){return this.bind({tools:e.map(n=>qw(n)),...r})}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"ollama",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.options?.temperature??void 0,ls_max_tokens:r.options?.num_predict??void 0,ls_stop:e.stop}}invocationParams(e){if(e?.tool_choice)throw new Error("Tool choice is not supported for ChatOllama.");return{model:this.model,format:e?.format??this.format,keep_alive:this.keepAlive,options:{numa:this.numa,num_ctx:this.numCtx,num_batch:this.numBatch,num_gpu:this.numGpu,main_gpu:this.mainGpu,low_vram:this.lowVram,f16_kv:this.f16Kv,logits_all:this.logitsAll,vocab_only:this.vocabOnly,use_mmap:this.useMmap,use_mlock:this.useMlock,embedding_only:this.embeddingOnly,num_thread:this.numThread,num_keep:this.numKeep,seed:this.seed,num_predict:this.numPredict,top_k:this.topK,top_p:this.topP,tfs_z:this.tfsZ,typical_p:this.typicalP,repeat_last_n:this.repeatLastN,temperature:this.temperature,repeat_penalty:this.repeatPenalty,presence_penalty:this.presencePenalty,frequency_penalty:this.frequencyPenalty,mirostat:this.mirostat,mirostat_tau:this.mirostatTau,mirostat_eta:this.mirostatEta,penalize_newline:this.penalizeNewline,stop:e?.stop},tools:e?.tools?.length?e.tools.map(r=>qw(r)):void 0}}async checkModelExistsOnMachine(e){let{models:r}=await this.client.list();return!!r.find(n=>n.name===e||n.name===`${e}:latest`)}async _generate(e,r,n){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o;for await(let a of this._streamResponseChunks(e,r,n))o?o=yl(o,a.message):o=a.message;let i=new en({id:o?.id,content:o?.content??"",tool_calls:o?.tool_calls,response_metadata:o?.response_metadata,usage_metadata:o?.usage_metadata});return{generations:[{text:typeof i.content=="string"?i.content:"",message:i}]}}async*_streamResponseChunks(e,r,n){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o=this.invocationParams(r),i=qbt(e),a={input_tokens:0,output_tokens:0,total_tokens:0};if(o.tools&&o.tools.length>0){let l=await this.client.chat({...o,messages:i,stream:!1}),{message:c,...d}=l;return a.input_tokens+=d.prompt_eval_count??0,a.output_tokens+=d.eval_count??0,a.total_tokens=a.input_tokens+a.output_tokens,yield new Sn({text:c.content,message:sCe(c,{responseMetadata:d,usageMetadata:a})}),n?.handleLLMNewToken(c.content)}let s=await this.client.chat({...o,messages:i,stream:!0}),u;for await(let l of s){r.signal?.aborted&&this.client.abort();let{message:c,...d}=l;a.input_tokens+=d.prompt_eval_count??0,a.output_tokens+=d.eval_count??0,a.total_tokens=a.input_tokens+a.output_tokens,u=d,yield new Sn({text:c.content??"",message:sCe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new Sn({text:"",message:new or({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=rl(e),o=n?Xn(e):e,i=this.bind({format:o}),a=n?Yl.fromZodSchema(e):new Zl;if(!r?.includeRaw)return i.pipe(a);let s=Kn.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=Kn.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return Wo.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}};var QX=class extends Zd{constructor(e){super({maxConcurrency:1,...e}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"mxbai-embed-large"}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:"http://localhost:11434"}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"truncate",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.client=new VF({host:e?.baseUrl,headers:e?.headers?new Headers(e.headers):void 0}),this.baseUrl=e?.baseUrl??this.baseUrl,this.model=e?.model??this.model,this.keepAlive=e?.keepAlive,this.truncate=e?.truncate??this.truncate,this.requestOptions=e?.requestOptions?this._convertOptions(e?.requestOptions):void 0}_convertOptions(e){let r={},n={embeddingOnly:"embedding_only",frequencyPenalty:"frequency_penalty",keepAlive:"keep_alive",logitsAll:"logits_all",lowVram:"low_vram",mainGpu:"main_gpu",mirostat:"mirostat",mirostatEta:"mirostat_eta",mirostatTau:"mirostat_tau",numBatch:"num_batch",numCtx:"num_ctx",numGpu:"num_gpu",numKeep:"num_keep",numPredict:"num_predict",numThread:"num_thread",penalizeNewline:"penalize_newline",presencePenalty:"presence_penalty",repeatLastN:"repeat_last_n",repeatPenalty:"repeat_penalty",temperature:"temperature",stop:"stop",tfsZ:"tfs_z",topK:"top_k",topP:"top_p",typicalP:"typical_p",useMlock:"use_mlock",useMmap:"use_mmap",vocabOnly:"vocab_only",f16Kv:"f16_kv",numa:"numa",seed:"seed"};for(let[o,i]of Object.entries(e)){let a=n[o];a?r[a]=i:r[o]=i}return r}async embedDocuments(e){return this.embeddingWithRetry(e)}async embedQuery(e){return(await this.embeddingWithRetry([e]))[0]}async embeddingWithRetry(e){return(await this.caller.call(()=>this.client.embed({model:this.model,input:e,keep_alive:this.keepAlive,options:this.requestOptions,truncate:this.truncate}))).embeddings}};fd();var eQ="RFC3986",tQ={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},Ubt="RFC1738";var qkr=Array.isArray,Hw=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var uCe=1024,zbt=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(s){return"%26%23"+parseInt(s.slice(2),16)+"%3B"});let a="";for(let s=0;s<i.length;s+=uCe){let u=i.length>=uCe?i.slice(s,s+uCe):i,l=[];for(let c=0;c<u.length;++c){let d=u.charCodeAt(c);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===Ubt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=Hw[d];continue}if(d<2048){l[l.length]=Hw[192|d>>6]+Hw[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=Hw[224|d>>12]+Hw[128|d>>6&63]+Hw[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=Hw[240|d>>18]+Hw[128|d>>12&63]+Hw[128|d>>6&63]+Hw[128|d&63]}a+=l.join("")}return a};function Hbt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function lCe(t,e){if(qkr(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var Ukr=Object.prototype.hasOwnProperty,Vbt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Vw=Array.isArray,zkr=Array.prototype.push,Wbt=function(t,e){zkr.apply(t,Vw(e)?e:[e])},Hkr=Date.prototype.toISOString,ol={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:zbt,encodeValuesOnly:!1,format:eQ,formatter:tQ[eQ],indices:!1,serializeDate(t){return Hkr.call(t)},skipNulls:!1,strictNullHandling:!1};function Vkr(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var cCe={};function Kbt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,v,g){let _=t,w=g,x=0,C=!1;for(;(w=w.get(cCe))!==void 0&&!C;){let R=w.get(t);if(x+=1,typeof R<"u"){if(R===x)throw new RangeError("Cyclic object value");C=!0}typeof w.get(cCe)>"u"&&(x=0)}if(typeof l=="function"?_=l(e,_):_ instanceof Date?_=f?.(_):r==="comma"&&Vw(_)&&(_=lCe(_,function(R){return R instanceof Date?f?.(R):R})),_===null){if(i)return u&&!h?u(e,ol.encoder,v,"key",p):e;_=""}if(Vkr(_)||Hbt(_)){if(u){let R=h?e:u(e,ol.encoder,v,"key",p);return[m?.(R)+"="+m?.(u(_,ol.encoder,v,"value",p))]}return[m?.(e)+"="+m?.(String(_))]}let P=[];if(typeof _>"u")return P;let E;if(r==="comma"&&Vw(_))h&&u&&(_=lCe(_,u)),E=[{value:_.length>0?_.join(",")||null:void 0}];else if(Vw(l))E=l;else{let R=Object.keys(_);E=c?R.sort(c):R}let A=s?String(e).replace(/\./g,"%2E"):String(e),M=n&&Vw(_)&&_.length===1?A+"[]":A;if(o&&Vw(_)&&_.length===0)return M+"[]";for(let R=0;R<E.length;++R){let N=E[R],L=typeof N=="object"&&typeof N.value<"u"?N.value:_[N];if(a&&L===null)continue;let k=d&&s?N.replace(/\./g,"%2E"):N,F=Vw(_)?typeof r=="function"?r(M,k):M:M+(d?"."+k:"["+k+"]");g.set(t,x);let $=new WeakMap;$.set(cCe,g),Wbt(P,Kbt(L,F,r,n,o,i,a,s,r==="comma"&&h&&Vw(_)?null:u,l,c,d,f,p,m,h,v,$))}return P}function Wkr(t=ol){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||ol.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=eQ;if(typeof t.format<"u"){if(!Ukr.call(tQ,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=tQ[r],o=ol.filter;(typeof t.filter=="function"||Vw(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Vbt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=ol.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:ol.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ol.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ol.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ol.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ol.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ol.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ol.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ol.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ol.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ol.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ol.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ol.strictNullHandling}}function dCe(t,e={}){let r=t,n=Wkr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Vw(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Vbt[n.arrayFormat],u=s==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let l=new WeakMap;for(let f=0;f<o.length;++f){let p=o[f];n.skipNulls&&r[p]===null||Wbt(a,Kbt(r[p],p,s,u,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let c=a.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),c.length>0?d+c:""}var kR="4.95.1";var Jbt=!1,BR,fCe,Jkr,Gkr,Ykr,pCe,Zkr,rQ,mCe,hCe,gCe,nQ,yCe;function Gbt(t,e={auto:!1}){if(Jbt)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(BR)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${BR}'\``);Jbt=e.auto,BR=t.kind,fCe=t.fetch,Jkr=t.Request,Gkr=t.Response,Ykr=t.Headers,pCe=t.FormData,Zkr=t.Blob,rQ=t.File,mCe=t.ReadableStream,hCe=t.getMultipartRequestOptions,gCe=t.getDefaultAgent,nQ=t.fileFromPath,yCe=t.isFsReadStream}var oQ=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function Ybt({manuallyImported:t}={}){let e=t?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from 'openai'`:\n- `import 'openai/shims/node'` (if you're running on Node)\n- `import 'openai/shims/web'` (otherwise)\n",r,n,o,i;try{r=fetch,n=Request,o=Response,i=Headers}catch(a){throw new Error(`this environment is missing the following Web Fetch API type: ${a.message}. ${e}`)}return{kind:"web",fetch:r,Request:n,Response:o,Headers:i,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new oQ(a)}),getDefaultAgent:a=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:a=>!1}}var bCe=()=>{BR||Gbt(Ybt(),{auto:!0})};bCe();var ut=class extends Error{},vs=class t extends ut{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.request_id=o?.["x-request-id"],this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new iC({message:n,cause:iQ(r)});let i=r?.error;return e===400?new WF(e,i,n,o):e===401?new KF(e,i,n,o):e===403?new JF(e,i,n,o):e===404?new GF(e,i,n,o):e===409?new YF(e,i,n,o):e===422?new ZF(e,i,n,o):e===429?new XF(e,i,n,o):e>=500?new QF(e,i,n,o):new t(e,i,n,o)}},di=class extends vs{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},iC=class extends vs{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},ef=class extends iC{constructor({message:e}={}){super({message:e??"Request timed out."})}},WF=class extends vs{},KF=class extends vs{},JF=class extends vs{},GF=class extends vs{},YF=class extends vs{},ZF=class extends vs{},XF=class extends vs{},QF=class extends vs{},ek=class extends ut{constructor(){super("Could not parse response content as the length limit was reached")}},tk=class extends ut{constructor(){super("Could not parse response content as the request was rejected by the content filter")}};var aQ=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},$R=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Kp,qR=class{constructor(){Kp.set(this,void 0),this.buffer=new Uint8Array,aQ(this,Kp,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?new TextEncoder().encode(e):e,n=new Uint8Array(this.buffer.length+r.length);n.set(this.buffer),n.set(r,this.buffer.length),this.buffer=n;let o=[],i;for(;(i=eBr(this.buffer,$R(this,Kp,"f")))!=null;){if(i.carriage&&$R(this,Kp,"f")==null){aQ(this,Kp,i.index,"f");continue}if($R(this,Kp,"f")!=null&&(i.index!==$R(this,Kp,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,$R(this,Kp,"f")-1))),this.buffer=this.buffer.slice($R(this,Kp,"f")),aQ(this,Kp,null,"f");continue}let a=$R(this,Kp,"f")!==null?i.preceding-1:i.preceding,s=this.decodeText(this.buffer.slice(0,a));o.push(s),this.buffer=this.buffer.slice(i.index),aQ(this,Kp,null,"f")}return o}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new ut(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new ut(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new ut("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};Kp=new WeakMap;qR.NEWLINE_CHARS=new Set([`
`,"\r"]);qR.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function eBr(t,e){for(let o=e??0;o<t.length;o++){if(t[o]===10)return{preceding:o,index:o+1,carriage:!1};if(t[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function Zbt(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}function _Ce(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var Ww=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;async function*o(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let i=!1;try{for await(let a of tBr(e,r))if(!i){if(a.data.startsWith("[DONE]")){i=!0;continue}if(a.event===null||a.event.startsWith("response.")||a.event.startsWith("transcript.")){let s;try{s=JSON.parse(a.data)}catch(u){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),u}if(s&&s.error)throw new vs(void 0,s.error,void 0,wCe(e.headers));yield s}else{let s;try{s=JSON.parse(a.data)}catch(u){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),u}if(a.event=="error")throw new vs(void 0,s.error,s.message,void 0);yield{event:a.event,data:s}}}i=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{i||r.abort()}}return new t(o,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new qR,s=_Ce(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new mCe({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}};async function*tBr(t,e){if(!t.body)throw e.abort(),new ut("Attempted to iterate over a response with no body");let r=new vCe,n=new qR,o=_Ce(t.body);for await(let i of rBr(o))for(let a of n.decode(i)){let s=r.decode(a);s&&(yield s)}for(let i of n.flush()){let a=r.decode(i);a&&(yield a)}}async function*rBr(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?new TextEncoder().encode(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=Zbt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var vCe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=nBr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function nBr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var Xbt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",Qbt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&l3(t),l3=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",oBr=t=>Qbt(t)||Xbt(t)||yCe(t);async function CCe(t,e,r){if(t=await t,Qbt(t))return t;if(Xbt(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=l3(o)?[await o.arrayBuffer()]:[o];return new rQ(i,e,r)}let n=await iBr(t);if(e||(e=sBr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new rQ(n,e,r)}async function iBr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(l3(t))e.push(await t.arrayBuffer());else if(uBr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${aBr(t)}`);return e}function aBr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function sBr(t){return SCe(t.name)||SCe(t.filename)||SCe(t.path)?.split(/[\\/]/).pop()}var SCe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},uBr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",OCe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var ih=async t=>{let e=await e_t(t.body);return hCe(e,t)},e_t=async t=>{let e=new pCe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>xCe(e,r,n))),e};var xCe=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(oBr(r)){let n=await CCe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>xCe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>xCe(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var cBr=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},dBr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},sQ;bCe();async function a_t(t){let{response:e}=t;if(t.options.stream)return aC("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Ww.fromSSEResponse(e,t.controller);if(e.status===204)return null;if(t.options.__binaryResponse)return e;let n=e.headers.get("content-type")?.split(";")[0]?.trim();if(n?.includes("application/json")||n?.endsWith("+json")){let a=await e.json();return aC("response",e.status,e.url,e.headers,a),s_t(a,e)}let i=await e.text();return aC("response",e.status,e.url,e.headers,i),i}function s_t(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var lQ=class t extends Promise{constructor(e,r=a_t){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>s_t(e(await this.parseResponse(r),r),r.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},cQ=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=ECe("maxRetries",r),this.timeout=ECe("timeout",n),this.httpAgent=o,this.fetch=i??fCe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...hBr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${_Br()}`}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&l3(o?.body)?new DataView(await o.body.arrayBuffer()):o?.body instanceof DataView?o.body:o?.body instanceof ArrayBuffer?new DataView(o.body):o&&ArrayBuffer.isView(o?.body)?new DataView(o.body.buffer):o?.body;return{method:e,path:r,...o,body:i}}))}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:a,headers:s={}}=n,u=ArrayBuffer.isView(n.body)||n.__binaryRequest&&typeof n.body=="string"?n.body:OCe(n.body)?n.body.body:n.body?JSON.stringify(n.body,null,2):null,l=this.calculateContentLength(u),c=this.buildURL(i,a);"timeout"in n&&ECe("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??gCe(c),f=n.timeout+1e3;typeof d?.options?.timeout=="number"&&f>(d.options.timeout??0)&&(d.options.timeout=f),this.idempotencyHeader&&o!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);let p=this.buildHeaders({options:n,headers:s,contentLength:l,retryCount:r});return{req:{method:o,...u&&{body:u},headers:p,...d&&{agent:d},signal:n.signal??null},url:c,timeout:n.timeout}}buildHeaders({options:e,headers:r,contentLength:n,retryCount:o}){let i={};n&&(i["content-length"]=n);let a=this.defaultHeaders(e);return o_t(i,a),o_t(i,r),OCe(e.body)&&BR!=="node"&&delete i["content-type"],uQ(a,"x-stainless-retry-count")===void 0&&uQ(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),uQ(a,"x-stainless-timeout")===void 0&&uQ(r,"x-stainless-timeout")===void 0&&e.timeout&&(i["x-stainless-timeout"]=String(Math.trunc(e.timeout/1e3))),this.validateHeaders(i,r),i}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return vs.generate(e,r,n,o)}request(e,r=null){return new lQ(this.makeRequest(e,r))}async makeRequest(e,r){let n=await e,o=n.maxRetries??this.maxRetries;r==null&&(r=o),await this.prepareOptions(n);let{req:i,url:a,timeout:s}=this.buildRequest(n,{retryCount:o-r});if(await this.prepareRequest(i,{url:a,options:n}),aC("request",a,n,i.headers),n.signal?.aborted)throw new di;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(iQ);if(l instanceof Error){if(n.signal?.aborted)throw new di;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new ef:new iC({cause:l})}let c=wCe(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let v=`retrying, ${r} attempts remaining`;return aC(`response (error; ${v})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(v=>iQ(v).message),f=gBr(d),p=f?void 0:d;throw aC(`response (error; ${r?"(error; no more retries left)":"(error; not retryable)"})`,l.status,a,c,p),this.makeStatusError(l.status,f,p,c)}return{response:l,options:n,controller:u}}requestAPIList(e,r){let n=this.makeRequest(r,null);return new PCe(this,n,e)}buildURL(e,r){let n=bBr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return u_t(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new ut(`Cannot stringify type ${typeof n}; 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("&")}async fetchWithTimeout(e,r,n,o){let{signal:i,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let s=setTimeout(()=>o.abort(),n),u={signal:o.signal,...a};return u.method&&(u.method=u.method.toUpperCase()),this.fetch.call(void 0,e,u).finally(()=>{clearTimeout(s)})}shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n){let o,i=n?.["retry-after-ms"];if(i){let s=parseFloat(i);Number.isNaN(s)||(o=s)}let a=n?.["retry-after"];if(a&&!o){let s=parseFloat(a);Number.isNaN(s)?o=Date.parse(a)-Date.now():o=s*1e3}if(!(o&&0<=o&&o<60*1e3)){let s=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await sC(o),this.makeRequest(e,r-1)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${kR}`}},c3=class{constructor(e,r,n,o){sQ.set(this,void 0),cBr(this,sQ,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new ut("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in e&&typeof r.query=="object")r.query={...r.query,...e.params};else if("url"in e){let n=[...Object.entries(r.query||{}),...e.url.searchParams.entries()];for(let[o,i]of n)e.url.searchParams.set(o,i);r.query=void 0,r.path=e.url.toString()}return await dBr(this,sQ,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(sQ=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},PCe=class extends lQ{constructor(e,r,n){super(r,async o=>new n(e,o.response,await a_t(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},wCe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),fBr={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__metadata:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},Ir=t=>typeof t=="object"&&t!==null&&!u_t(t)&&Object.keys(t).every(e=>l_t(fBr,e)),pBr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":kR,"X-Stainless-OS":r_t(Deno.build.os),"X-Stainless-Arch":t_t(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":kR,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":kR,"X-Stainless-OS":r_t(process.platform),"X-Stainless-Arch":t_t(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=mBr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":kR,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":kR,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function mBr(){if(typeof navigator>"u"||!navigator)return null;let t=[{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(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}var t_t=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",r_t=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),n_t,hBr=()=>n_t??(n_t=pBr()),gBr=t=>{try{return JSON.parse(t)}catch{return}},yBr=/^[a-z][a-z0-9+.-]*:/i,bBr=t=>yBr.test(t),sC=t=>new Promise(e=>setTimeout(e,t)),ECe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new ut(`${t} must be an integer`);if(e<0)throw new ut(`${t} must be a positive integer`);return e},iQ=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null)try{return new Error(JSON.stringify(t))}catch{}return new Error(t)};var WP=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function u_t(t){if(!t)return!0;for(let e in t)return!1;return!0}function l_t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function o_t(t,e){for(let r in e){if(!l_t(e,r))continue;let n=r.toLowerCase();if(!n)continue;let o=e[r];o===null?delete t[n]:o!==void 0&&(t[n]=o)}}var i_t=new Set(["authorization","api-key"]);function aC(t,...e){if(typeof process<"u"&&process?.env?.DEBUG==="true"){let r=e.map(n=>{if(!n)return n;if(n.headers){let i={...n,headers:{...n.headers}};for(let a in n.headers)i_t.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)i_t.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}var _Br=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),c_t=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",vBr=t=>typeof t?.get=="function";var uQ=(t,e)=>{let r=e.toLowerCase();if(vBr(t)){let n=e[0]?.toUpperCase()+e.substring(1).replace(/([^\w])(\w)/g,(o,i,a)=>i+a.toUpperCase());for(let o of[e,r,e.toUpperCase(),n]){let i=t.get(o);if(i)return i}}for(let[n,o]of Object.entries(t))if(n.toLowerCase()===r)return Array.isArray(o)?(o.length<=1||console.warn(`Received ${o.length} entries for the ${e} header, using the first entry.`),o[0]):o};var d_t=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=e.charCodeAt(o);return Array.from(new Float32Array(n.buffer))}};function rk(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Kw=class extends c3{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageParams(){return null}nextPageInfo(){return null}},Dn=class extends c3{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageParams(){let e=this.nextPageInfo();if(!e)return null;if("params"in e)return e.params;let r=Object.fromEntries(e.url.searchParams);return Object.keys(r).length?r:null}nextPageInfo(){let e=this.getPaginatedItems();if(!e.length)return null;let r=e[e.length-1]?.id;return r?{params:{after:r}}:null}};var Je=class{constructor(e){this._client=e}};var nk=class extends Je{list(e,r={},n){return Ir(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,dQ,{query:r,...n})}};var JP=class extends Je{constructor(){super(...arguments),this.messages=new nk(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return Ir(e)?this.list({},e):this._client.getAPIList("/chat/completions",GP,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},GP=class extends Dn{},dQ=class extends Dn{};JP.ChatCompletionsPage=GP;JP.Messages=nk;var uC=class extends Je{constructor(){super(...arguments),this.completions=new JP(this._client)}};uC.Completions=JP;uC.ChatCompletionsPage=GP;var ok=class extends Je{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}};var ik=class extends Je{create(e,r){return this._client.post("/audio/transcriptions",ih({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}};var ak=class extends Je{create(e,r){return this._client.post("/audio/translations",ih({body:e,...r,__metadata:{model:e.model}}))}};var Jw=class extends Je{constructor(){super(...arguments),this.transcriptions=new ik(this._client),this.translations=new ak(this._client),this.speech=new ok(this._client)}};Jw.Transcriptions=ik;Jw.Translations=ak;Jw.Speech=ok;var YP=class extends Je{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(`/batches/${e}`,r)}list(e={},r){return Ir(e)?this.list({},e):this._client.getAPIList("/batches",UR,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},UR=class extends Dn{};YP.BatchesPage=UR;var zR=class extends Je{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,r){return this._client.get(`/assistants/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,r,n){return this._client.post(`/assistants/${e}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(e={},r){return Ir(e)?this.list({},e):this._client.getAPIList("/assistants",sk,{query:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(e,r){return this._client.delete(`/assistants/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}},sk=class extends Dn{};zR.AssistantsPage=sk;function TCe(t){return typeof t.parse=="function"}var ZP=t=>t?.role==="assistant",ACe=t=>t?.role==="function",ICe=t=>t?.role==="tool";var Lg=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},_a=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},MCe,fQ,pQ,d3,f3,mQ,p3,lC,m3,hQ,gQ,uk,f_t,XP=class{constructor(){MCe.add(this),this.controller=new AbortController,fQ.set(this,void 0),pQ.set(this,()=>{}),d3.set(this,()=>{}),f3.set(this,void 0),mQ.set(this,()=>{}),p3.set(this,()=>{}),lC.set(this,{}),m3.set(this,!1),hQ.set(this,!1),gQ.set(this,!1),uk.set(this,!1),Lg(this,fQ,new Promise((e,r)=>{Lg(this,pQ,e,"f"),Lg(this,d3,r,"f")}),"f"),Lg(this,f3,new Promise((e,r)=>{Lg(this,mQ,e,"f"),Lg(this,p3,r,"f")}),"f"),_a(this,fQ,"f").catch(()=>{}),_a(this,f3,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},_a(this,MCe,"m",f_t).bind(this))},0)}_connected(){this.ended||(_a(this,pQ,"f").call(this),this._emit("connect"))}get ended(){return _a(this,m3,"f")}get errored(){return _a(this,hQ,"f")}get aborted(){return _a(this,gQ,"f")}abort(){this.controller.abort()}on(e,r){return(_a(this,lC,"f")[e]||(_a(this,lC,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=_a(this,lC,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(_a(this,lC,"f")[e]||(_a(this,lC,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Lg(this,uk,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Lg(this,uk,!0,"f"),await _a(this,f3,"f")}_emit(e,...r){if(_a(this,m3,"f"))return;e==="end"&&(Lg(this,m3,!0,"f"),_a(this,mQ,"f").call(this));let n=_a(this,lC,"f")[e];if(n&&(_a(this,lC,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!_a(this,uk,"f")&&!n?.length&&Promise.reject(o),_a(this,d3,"f").call(this,o),_a(this,p3,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!_a(this,uk,"f")&&!n?.length&&Promise.reject(o),_a(this,d3,"f").call(this,o),_a(this,p3,"f").call(this,o),this._emit("end")}}_emitFinal(){}};fQ=new WeakMap,pQ=new WeakMap,d3=new WeakMap,f3=new WeakMap,mQ=new WeakMap,p3=new WeakMap,lC=new WeakMap,m3=new WeakMap,hQ=new WeakMap,gQ=new WeakMap,uk=new WeakMap,MCe=new WeakSet,f_t=function(e){if(Lg(this,hQ,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new di),e instanceof di)return Lg(this,gQ,!0,"f"),this._emit("abort",e);if(e instanceof ut)return this._emit("error",e);if(e instanceof Error){let r=new ut(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new ut(String(e)))};function p_t(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function h3(t){return t?.$brand==="auto-parseable-response-format"}function m_t(t,{parser:e,callback:r}){let n={...t};return Object.defineProperties(n,{$brand:{value:"auto-parseable-tool",enumerable:!1},$parseRaw:{value:e,enumerable:!1},$callback:{value:r,enumerable:!1}}),n}function HR(t){return t?.$brand==="auto-parseable-tool"}function h_t(t,e){return!e||!RCe(e)?{...t,choices:t.choices.map(r=>({...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:g3(t,e)}function g3(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new ek;if(n.finish_reason==="content_filter")throw new tk;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>TBr(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?PBr(e,n.message.content):null}}});return{...t,choices:r}}function PBr(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function TBr(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:HR(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function g_t(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return HR(r)||r?.function.strict||!1}function RCe(t){return h3(t.response_format)?!0:t.tools?.some(e=>HR(e)||e.type==="function"&&e.function.strict===!0)??!1}function y_t(t){for(let e of t??[]){if(e.type!=="function")throw new ut(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new ut(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Yf=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},md,jCe,yQ,DCe,NCe,LCe,__t,FCe,b_t=10,lk=class extends XP{constructor(){super(...arguments),md.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),(ACe(e)||ICe(e))&&e.content)this._emit("functionCallResult",e.content);else if(ZP(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(ZP(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new ut("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Yf(this,md,"m",jCe).call(this)}async finalMessage(){return await this.done(),Yf(this,md,"m",yQ).call(this)}async finalFunctionCall(){return await this.done(),Yf(this,md,"m",DCe).call(this)}async finalFunctionCallResult(){return await this.done(),Yf(this,md,"m",NCe).call(this)}async totalUsage(){return await this.done(),Yf(this,md,"m",LCe).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=Yf(this,md,"m",yQ).call(this);r&&this._emit("finalMessage",r);let n=Yf(this,md,"m",jCe).call(this);n&&this._emit("finalContent",n);let o=Yf(this,md,"m",DCe).call(this);o&&this._emit("finalFunctionCall",o);let i=Yf(this,md,"m",NCe).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",Yf(this,md,"m",LCe).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Yf(this,md,"m",__t).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(g3(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runFunctions(e,r,n){let o="function",{function_call:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.name,{maxChatCompletions:l=b_t}=n||{},c={};for(let f of r.functions)c[f.name||f.function.name]=f;let d=r.functions.map(f=>({name:f.name||f.function.name,parameters:f.parameters,description:f.description}));for(let f of r.messages)this._addMessage(f,!1);for(let f=0;f<l;++f){let m=(await this._createChatCompletion(e,{...s,function_call:i,functions:d,messages:[...this.messages]},n)).choices[0]?.message;if(!m)throw new ut("missing message in ChatCompletion response");if(!m.function_call)return;let{name:h,arguments:v}=m.function_call,g=c[h];if(g){if(u&&u!==h){let C=`Invalid function_call: ${JSON.stringify(h)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:h,content:C});continue}}else{let C=`Invalid function_call: ${JSON.stringify(h)}. Available options are: ${d.map(P=>JSON.stringify(P.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:C});continue}let _;try{_=TCe(g)?await g.parse(v):v}catch(C){this._addMessage({role:o,name:h,content:C instanceof Error?C.message:String(C)});continue}let w=await g.function(_,this),x=Yf(this,md,"m",FCe).call(this,w);if(this._addMessage({role:o,name:h,content:x}),u)return}}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i?.function?.name,{maxChatCompletions:l=b_t}=n||{},c=r.tools.map(p=>{if(HR(p)){if(!p.$callback)throw new ut("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;p<l;++p){let h=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new ut("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let v of h.tool_calls){if(v.type!=="function")continue;let g=v.id,{name:_,arguments:w}=v.function,x=d[_];if(x){if(u&&u!==_){let A=`Invalid tool_call: ${JSON.stringify(_)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:A});continue}}else{let A=`Invalid tool_call: ${JSON.stringify(_)}. Available options are: ${Object.keys(d).map(M=>JSON.stringify(M)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:A});continue}let C;try{C=TCe(x)?await x.parse(w):w}catch(A){let M=A instanceof Error?A.message:String(A);this._addMessage({role:o,tool_call_id:g,content:M});continue}let P=await x.function(C,this),E=Yf(this,md,"m",FCe).call(this,P);if(this._addMessage({role:o,tool_call_id:g,content:E}),u)return}}}};md=new WeakSet,jCe=function(){return Yf(this,md,"m",yQ).call(this).content??null},yQ=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(ZP(r)){let{function_call:n,...o}=r,i={...o,content:r.content??null,refusal:r.refusal??null};return n&&(i.function_call=n),i}}throw new ut("stream ended without producing a ChatCompletionMessage with role=assistant")},DCe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(ZP(r)&&r?.function_call)return r.function_call;if(ZP(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},NCe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(ACe(r)&&r.content!=null||ICe(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(n=>n.role==="assistant"&&n.tool_calls?.some(o=>o.type==="function"&&o.id===r.tool_call_id)))return r.content}},LCe=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},__t=function(e){if(e.n!=null&&e.n>1)throw new ut("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},FCe=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var y3=class t extends lk{static runFunctions(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return o._run(()=>o._runFunctions(e,r,i)),o}static runTools(e,r,n){let o=new t,i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}_addMessage(e,r=!0){super._addMessage(e,r),ZP(e)&&e.content&&this._emit("content",e.content)}};var Il={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},kCe=class extends Error{},BCe=class extends Error{};function ABr(t,e=Il.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return IBr(t.trim(),e)}var IBr=(t,e)=>{let r=t.length,n=0,o=f=>{throw new kCe(`${f} at position ${n}`)},i=f=>{throw new BCe(`${f} at position ${n}`)},a=()=>(d(),n>=r&&o("Unexpected end of input"),t[n]==='"'?s():t[n]==="{"?u():t[n]==="["?l():t.substring(n,n+4)==="null"||Il.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Il.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Il.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Il.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Il.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Il.NAN&e&&r-n<3&&"NaN".startsWith(t.substring(n))?(n+=3,NaN):c()),s=()=>{let f=n,p=!1;for(n++;n<r&&(t[n]!=='"'||p&&t[n-1]==="\\");)p=t[n]==="\\"?!p:!1,n++;if(t.charAt(n)=='"')try{return JSON.parse(t.substring(f,++n-Number(p)))}catch(m){i(String(m))}else if(Il.STR&e)try{return JSON.parse(t.substring(f,n-Number(p))+'"')}catch{return JSON.parse(t.substring(f,t.lastIndexOf("\\"))+'"')}o("Unterminated string literal")},u=()=>{n++,d();let f={};try{for(;t[n]!=="}";){if(d(),n>=r&&Il.OBJ&e)return f;let p=s();d(),n++;try{let m=a();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if(Il.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Il.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},l=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(a()),d(),t[n]===","&&n++}catch{if(Il.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Il.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Il.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}i(String(p))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(Il.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Il.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;n<r&&`
\r `.includes(t[n]);)n++};return a()},$Ce=t=>ABr(t,Il.ALL^Il.NUM);var ck=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},oi=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},il,cC,dk,QP,qCe,bQ,UCe,zCe,HCe,_Q,VCe,v_t,fk=class t extends lk{constructor(e){super(),il.add(this),cC.set(this,void 0),dk.set(this,void 0),QP.set(this,void 0),ck(this,cC,e,"f"),ck(this,dk,[],"f")}get currentChatCompletionSnapshot(){return oi(this,QP,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),oi(this,il,"m",qCe).call(this);let i=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)oi(this,il,"m",UCe).call(this,a);if(i.controller.signal?.aborted)throw new di;return this._addChatCompletion(oi(this,il,"m",_Q).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),oi(this,il,"m",qCe).call(this),this._connected();let o=Ww.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(oi(this,il,"m",_Q).call(this)),oi(this,il,"m",UCe).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new di;return this._addChatCompletion(oi(this,il,"m",_Q).call(this))}[(cC=new WeakMap,dk=new WeakMap,QP=new WeakMap,il=new WeakSet,qCe=function(){this.ended||ck(this,QP,void 0,"f")},bQ=function(r){let n=oi(this,dk,"f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},oi(this,dk,"f")[r.index]=n,n)},UCe=function(r){if(this.ended)return;let n=oi(this,il,"m",v_t).call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let i=n.choices[o.index];o.delta.content!=null&&i.message?.role==="assistant"&&i.message?.content&&(this._emit("content",o.delta.content,i.message.content),this._emit("content.delta",{delta:o.delta.content,snapshot:i.message.content,parsed:i.message.parsed})),o.delta.refusal!=null&&i.message?.role==="assistant"&&i.message?.refusal&&this._emit("refusal.delta",{delta:o.delta.refusal,snapshot:i.message.refusal}),o.logprobs?.content!=null&&i.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:o.logprobs?.content,snapshot:i.logprobs?.content??[]}),o.logprobs?.refusal!=null&&i.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:o.logprobs?.refusal,snapshot:i.logprobs?.refusal??[]});let a=oi(this,il,"m",bQ).call(this,i);i.finish_reason&&(oi(this,il,"m",HCe).call(this,i),a.current_tool_call_index!=null&&oi(this,il,"m",zCe).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(oi(this,il,"m",HCe).call(this,i),a.current_tool_call_index!=null&&oi(this,il,"m",zCe).call(this,i,a.current_tool_call_index)),a.current_tool_call_index=s.index;for(let s of o.delta.tool_calls??[]){let u=i.message.tool_calls?.[s.index];u?.type&&(u?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:u.function?.name,index:s.index,arguments:u.function.arguments,parsed_arguments:u.function.parsed_arguments,arguments_delta:s.function?.arguments??""}):(u?.type,void 0))}}},zCe=function(r,n){if(oi(this,il,"m",bQ).call(this,r).done_tool_calls.has(n))return;let i=r.message.tool_calls?.[n];if(!i)throw new Error("no tool call snapshot");if(!i.type)throw new Error("tool call snapshot missing `type`");if(i.type==="function"){let a=oi(this,cC,"f")?.tools?.find(s=>s.type==="function"&&s.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:HR(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},HCe=function(r){let n=oi(this,il,"m",bQ).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=oi(this,il,"m",VCe).call(this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(r.message.content):null})}r.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},_Q=function(){if(this.ended)throw new ut("stream has ended, this shouldn't happen");let r=oi(this,QP,"f");if(!r)throw new ut("request ended without sending any chunks");return ck(this,QP,void 0,"f"),ck(this,dk,[],"f"),MBr(r,oi(this,cC,"f"))},VCe=function(){let r=oi(this,cC,"f")?.response_format;return h3(r)?r:null},v_t=function(r){var n,o,i,a;let s=oi(this,QP,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=ck(this,QP,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=s.choices[f];if(h||(h=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:P,refusal:E,...A}=p;Object.assign(h.logprobs,A),P&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...P)),E&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...E))}if(d&&(h.finish_reason=d,oi(this,cC,"f")&&RCe(oi(this,cC,"f")))){if(d==="length")throw new ek;if(d==="content_filter")throw new tk}if(Object.assign(h,m),!c)continue;let{content:v,refusal:g,function_call:_,role:w,tool_calls:x,...C}=c;if(Object.assign(h.message,C),g&&(h.message.refusal=(h.message.refusal||"")+g),w&&(h.message.role=w),_&&(h.message.function_call?(_.name&&(h.message.function_call.name=_.name),_.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=_.arguments)):h.message.function_call=_),v&&(h.message.content=(h.message.content||"")+v,!h.message.refusal&&oi(this,il,"m",VCe).call(this)&&(h.message.parsed=$Ce(h.message.content))),x){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:P,id:E,type:A,function:M,...R}of x){let N=(a=h.message.tool_calls)[P]??(a[P]={});Object.assign(N,R),E&&(N.id=E),A&&(N.type=A),M&&(N.function??(N.function={name:M.name??"",arguments:""})),M?.name&&(N.function.name=M.name),M?.arguments&&(N.function.arguments+=M.arguments,g_t(oi(this,cC,"f"),N)&&(N.function.parsed_arguments=$Ce(N.function.arguments)))}}}return s},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Ww(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function MBr(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:a,...s}=t,u={...s,id:r,choices:n.map(({message:l,finish_reason:c,index:d,logprobs:f,...p})=>{if(!c)throw new ut(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:v,...g}=l,_=l.role;if(!_)throw new ut(`missing role for choice ${d}`);if(h){let{arguments:w,name:x}=h;if(w==null)throw new ut(`missing function_call.arguments for choice ${d}`);if(!x)throw new ut(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:w,name:x},role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return v?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:_,content:m,refusal:l.refusal??null,tool_calls:v.map((w,x)=>{let{function:C,type:P,id:E,...A}=w,{arguments:M,name:R,...N}=C||{};if(E==null)throw new ut(`missing choices[${d}].tool_calls[${x}].id
${vQ(t)}`);if(P==null)throw new ut(`missing choices[${d}].tool_calls[${x}].type
${vQ(t)}`);if(R==null)throw new ut(`missing choices[${d}].tool_calls[${x}].function.name
${vQ(t)}`);if(M==null)throw new ut(`missing choices[${d}].tool_calls[${x}].function.arguments
${vQ(t)}`);return{...A,id:E,type:P,function:{...N,name:R,arguments:M}}})}}:{...p,message:{...g,content:m,role:_,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return h_t(u,e)}function vQ(t){return JSON.stringify(t)}var b3=class t extends fk{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runFunctions(e,r,n){let o=new t(null),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return o._run(()=>o._runFunctions(e,r,i)),o}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}};var _3=class extends Je{parse(e,r){return y_t(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>g3(n,e))}runFunctions(e,r){return e.stream?b3.runFunctions(this._client,e,r):y3.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?b3.runTools(this._client,e,r):y3.runTools(this._client,e,r)}stream(e,r){return fk.createChatCompletion(this._client,e,r)}};var pk=class extends Je{constructor(){super(...arguments),this.completions=new _3(this._client)}};(function(t){t.Completions=_3})(pk||(pk={}));var mk=class extends Je{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}};var hk=class extends Je{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}};var eT=class extends Je{constructor(){super(...arguments),this.sessions=new mk(this._client),this.transcriptionSessions=new hk(this._client)}};eT.Sessions=mk;eT.TranscriptionSessions=hk;var Dt=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Jp=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},yc,WCe,Gw,wQ,Fg,WR,gk,VR,CQ,Gp,SQ,xQ,S3,v3,w3,w_t,S_t,x_t,C_t,O_t,E_t,P_t,Yw=class t extends XP{constructor(){super(...arguments),yc.add(this),WCe.set(this,[]),Gw.set(this,{}),wQ.set(this,{}),Fg.set(this,void 0),WR.set(this,void 0),gk.set(this,void 0),VR.set(this,void 0),CQ.set(this,void 0),Gp.set(this,void 0),SQ.set(this,void 0),xQ.set(this,void 0),S3.set(this,void 0)}[(WCe=new WeakMap,Gw=new WeakMap,wQ=new WeakMap,Fg=new WeakMap,WR=new WeakMap,gk=new WeakMap,VR=new WeakMap,CQ=new WeakMap,Gp=new WeakMap,SQ=new WeakMap,xQ=new WeakMap,S3=new WeakMap,yc=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=Ww.fromReadableStream(e,this.controller);for await(let i of o)Dt(this,yc,"m",v3).call(this,i);if(o.controller.signal?.aborted)throw new di;return this._addRun(Dt(this,yc,"m",w3).call(this))}toReadableStream(){return new Ww(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o,i){let a=new t;return a._run(()=>a._runToolAssistantStream(e,r,n,o,{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),a}async _createToolAssistantStream(e,r,n,o,i){let a=i?.signal;a&&(a.aborted&&this.controller.abort(),a.addEventListener("abort",()=>this.controller.abort()));let s={...o,stream:!0},u=await e.submitToolOutputs(r,n,s,{...i,signal:this.controller.signal});this._connected();for await(let l of u)Dt(this,yc,"m",v3).call(this,l);if(u.controller.signal?.aborted)throw new di;return this._addRun(Dt(this,yc,"m",w3).call(this))}static createThreadAssistantStream(e,r,n){let o=new t;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let i=new t;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return Dt(this,SQ,"f")}currentRun(){return Dt(this,xQ,"f")}currentMessageSnapshot(){return Dt(this,Fg,"f")}currentRunStepSnapshot(){return Dt(this,S3,"f")}async finalRunSteps(){return await this.done(),Object.values(Dt(this,Gw,"f"))}async finalMessages(){return await this.done(),Object.values(Dt(this,wQ,"f"))}async finalRun(){if(await this.done(),!Dt(this,WR,"f"))throw Error("Final run was not received.");return Dt(this,WR,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},a=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let s of a)Dt(this,yc,"m",v3).call(this,s);if(a.controller.signal?.aborted)throw new di;return this._addRun(Dt(this,yc,"m",w3).call(this))}async _createAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let a={...n,stream:!0},s=await e.create(r,a,{...o,signal:this.controller.signal});this._connected();for await(let u of s)Dt(this,yc,"m",v3).call(this,u);if(s.controller.signal?.aborted)throw new di;return this._addRun(Dt(this,yc,"m",w3).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let i=e[n];if(i==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(rk(i)&&rk(o))i=this.accumulateDelta(i,o);else if(Array.isArray(i)&&Array.isArray(o)){if(i.every(a=>typeof a=="string"||typeof a=="number")){i.push(...o);continue}for(let a of o){if(!rk(a))throw new Error(`Expected array delta entry to be an object but got: ${a}`);let s=a.index;if(s==null)throw console.error(a),new Error("Expected array delta entry to have an `index` property");if(typeof s!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${s}`);let u=i[s];u==null?i.push(a):i[s]=this.accumulateDelta(u,a)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o,i){return await this._createToolAssistantStream(n,e,r,o,i)}};v3=function(e){if(!this.ended)switch(Jp(this,SQ,e,"f"),Dt(this,yc,"m",x_t).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":Dt(this,yc,"m",P_t).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":Dt(this,yc,"m",S_t).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":Dt(this,yc,"m",w_t).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},w3=function(){if(this.ended)throw new ut("stream has ended, this shouldn't happen");if(!Dt(this,WR,"f"))throw Error("Final run has not been received");return Dt(this,WR,"f")},w_t=function(e){let[r,n]=Dt(this,yc,"m",O_t).call(this,e,Dt(this,Fg,"f"));Jp(this,Fg,r,"f"),Dt(this,wQ,"f")[r.id]=r;for(let o of n){let i=r.content[o.index];i?.type=="text"&&this._emit("textCreated",i.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,a=r.content[o.index];if(a&&a.type=="text")this._emit("textDelta",i,a.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=Dt(this,gk,"f")){if(Dt(this,VR,"f"))switch(Dt(this,VR,"f").type){case"text":this._emit("textDone",Dt(this,VR,"f").text,Dt(this,Fg,"f"));break;case"image_file":this._emit("imageFileDone",Dt(this,VR,"f").image_file,Dt(this,Fg,"f"));break}Jp(this,gk,o.index,"f")}Jp(this,VR,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Dt(this,gk,"f")!==void 0){let o=e.data.content[Dt(this,gk,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Dt(this,Fg,"f"));break;case"text":this._emit("textDone",o.text,Dt(this,Fg,"f"));break}}Dt(this,Fg,"f")&&this._emit("messageDone",e.data),Jp(this,Fg,void 0,"f")}},S_t=function(e){let r=Dt(this,yc,"m",C_t).call(this,e);switch(Jp(this,S3,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let i of n.step_details.tool_calls)i.index==Dt(this,CQ,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Dt(this,Gp,"f")&&this._emit("toolCallDone",Dt(this,Gp,"f")),Jp(this,CQ,i.index,"f"),Jp(this,Gp,r.step_details.tool_calls[i.index],"f"),Dt(this,Gp,"f")&&this._emit("toolCallCreated",Dt(this,Gp,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":Jp(this,S3,void 0,"f"),e.data.step_details.type=="tool_calls"&&Dt(this,Gp,"f")&&(this._emit("toolCallDone",Dt(this,Gp,"f")),Jp(this,Gp,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},x_t=function(e){Dt(this,WCe,"f").push(e),this._emit("event",e)},C_t=function(e){switch(e.event){case"thread.run.step.created":return Dt(this,Gw,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=Dt(this,Gw,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=Yw.accumulateDelta(r,n.delta);Dt(this,Gw,"f")[e.data.id]=o}return Dt(this,Gw,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":Dt(this,Gw,"f")[e.data.id]=e.data;break}if(Dt(this,Gw,"f")[e.data.id])return Dt(this,Gw,"f")[e.data.id];throw new Error("No snapshot available")},O_t=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let i of o.delta.content)if(i.index in r.content){let a=r.content[i.index];r.content[i.index]=Dt(this,yc,"m",E_t).call(this,i,a)}else r.content[i.index]=i,n.push(i);return[r,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},E_t=function(e,r){return Yw.accumulateDelta(r,e)},P_t=function(e){switch(Jp(this,xQ,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":Jp(this,WR,e.data,"f"),Dt(this,Gp,"f")&&(this._emit("toolCallDone",Dt(this,Gp,"f")),Jp(this,Gp,void 0,"f"));break;case"thread.run.cancelling":break}};var KR=class extends Je{create(e,r,n){return this._client.post(`/threads/${e}/messages`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(e,r,n){return this._client.get(`/threads/${e}/messages/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(e,r,n,o){return this._client.post(`/threads/${e}/messages/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(e,r={},n){return Ir(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,yk,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(e,r,n){return this._client.delete(`/threads/${e}/messages/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},yk=class extends Dn{};KR.MessagesPage=yk;var JR=class extends Je{retrieve(e,r,n,o={},i){return Ir(o)?this.retrieve(e,r,n,{},o):this._client.get(`/threads/${e}/runs/${r}/steps/${n}`,{query:o,...i,headers:{"OpenAI-Beta":"assistants=v2",...i?.headers}})}list(e,r,n={},o){return Ir(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,bk,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},bk=class extends Dn{};JR.RunStepsPage=bk;var dC=class extends Je{constructor(){super(...arguments),this.steps=new JR(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers},stream:r.stream??!1})}retrieve(e,r,n){return this._client.get(`/threads/${e}/runs/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(e,r,n,o){return this._client.post(`/threads/${e}/runs/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(e,r={},n){return Ir(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,_k,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}cancel(e,r,n){return this._client.post(`/threads/${e}/runs/${r}/cancel`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}createAndStream(e,r,n){return Yw.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o={...n?.headers,"X-Stainless-Poll-Helper":"true"};for(n?.pollIntervalMs&&(o["X-Stainless-Custom-Poll-Interval"]=n.pollIntervalMs.toString());;){let{data:i,response:a}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await sC(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return Yw.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n,o){return this._client.post(`/threads/${e}/runs/${r}/submit_tool_outputs`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers},stream:n.stream??!1})}async submitToolOutputsAndPoll(e,r,n,o){let i=await this.submitToolOutputs(e,r,n,o);return await this.poll(e,i.id,o)}submitToolOutputsStream(e,r,n,o){return Yw.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},_k=class extends Dn{};dC.RunsPage=_k;dC.Steps=JR;dC.RunStepsPage=bk;var Zw=class extends Je{constructor(){super(...arguments),this.runs=new dC(this._client),this.messages=new KR(this._client)}create(e={},r){return Ir(e)?this.create({},e):this._client.post("/threads",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,r){return this._client.get(`/threads/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,r,n){return this._client.post(`/threads/${e}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(e,r){return this._client.delete(`/threads/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers},stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.thread_id,n.id,r)}createAndRunStream(e,r){return Yw.createThreadAssistantStream(e,this._client.beta.threads,r)}};Zw.Runs=dC;Zw.RunsPage=_k;Zw.Messages=KR;Zw.MessagesPage=yk;var kg=class extends Je{constructor(){super(...arguments),this.realtime=new eT(this._client),this.chat=new pk(this._client),this.assistants=new zR(this._client),this.threads=new Zw(this._client)}};kg.Realtime=eT;kg.Assistants=zR;kg.AssistantsPage=sk;kg.Threads=Zw;var GR=class extends Je{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}};var YR=class extends Je{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&aC("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(aC("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=d_t(u)}),a)))}};var ZR=class extends Je{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return Ir(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,vk,{query:n,...o})}},vk=class extends Dn{};ZR.OutputItemListResponsesPage=vk;var fC=class extends Je{constructor(){super(...arguments),this.outputItems=new ZR(this._client)}create(e,r,n){return this._client.post(`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){return this._client.get(`/evals/${e}/runs/${r}`,n)}list(e,r={},n){return Ir(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,wk,{query:r,...n})}del(e,r,n){return this._client.delete(`/evals/${e}/runs/${r}`,n)}cancel(e,r,n){return this._client.post(`/evals/${e}/runs/${r}`,n)}},wk=class extends Dn{};fC.RunListResponsesPage=wk;fC.OutputItems=ZR;fC.OutputItemListResponsesPage=vk;var Xw=class extends Je{constructor(){super(...arguments),this.runs=new fC(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(`/evals/${e}`,r)}update(e,r,n){return this._client.post(`/evals/${e}`,{body:r,...n})}list(e={},r){return Ir(e)?this.list({},e):this._client.getAPIList("/evals",XR,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},XR=class extends Dn{};Xw.EvalListResponsesPage=XR;Xw.Runs=fC;Xw.RunListResponsesPage=wk;var tT=class extends Je{create(e,r){return this._client.post("/files",ih({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return Ir(e)?this.list({},e):this._client.getAPIList("/files",QR,{query:e,...r})}del(e,r){return this._client.delete(`/files/${e}`,r)}content(e,r){return this._client.get(`/files/${e}/content`,{...r,headers:{Accept:"application/binary",...r?.headers},__binaryResponse:!0})}retrieveContent(e,r){return this._client.get(`/files/${e}/content`,r)}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=30*60*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),a=await this.retrieve(e);for(;!a.status||!o.has(a.status);)if(await sC(r),a=await this.retrieve(e),Date.now()-i>n)throw new ef({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},QR=class extends Dn{};tT.FileObjectsPage=QR;var e1=class extends Je{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,Sk,{body:r,method:"post",...n})}retrieve(e,r={},n){return Ir(r)?this.retrieve(e,{},r):this._client.get(`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}del(e,r){return this._client.delete(`/fine_tuning/checkpoints/${e}/permissions`,r)}},Sk=class extends Kw{};e1.PermissionCreateResponsesPage=Sk;var rT=class extends Je{constructor(){super(...arguments),this.permissions=new e1(this._client)}};rT.Permissions=e1;rT.PermissionCreateResponsesPage=Sk;var t1=class extends Je{list(e,r={},n){return Ir(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,xk,{query:r,...n})}},xk=class extends Dn{};t1.FineTuningJobCheckpointsPage=xk;var Qw=class extends Je{constructor(){super(...arguments),this.checkpoints=new t1(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(`/fine_tuning/jobs/${e}`,r)}list(e={},r){return Ir(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",Ck,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return Ir(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,Ok,{query:r,...n})}},Ck=class extends Dn{},Ok=class extends Dn{};Qw.FineTuningJobsPage=Ck;Qw.FineTuningJobEventsPage=Ok;Qw.Checkpoints=t1;Qw.FineTuningJobCheckpointsPage=xk;var Bg=class extends Je{constructor(){super(...arguments),this.jobs=new Qw(this._client),this.checkpoints=new rT(this._client)}};Bg.Jobs=Qw;Bg.FineTuningJobsPage=Ck;Bg.FineTuningJobEventsPage=Ok;Bg.Checkpoints=rT;var r1=class extends Je{createVariation(e,r){return this._client.post("/images/variations",ih({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",ih({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}};var nT=class extends Je{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",n1,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},n1=class extends Kw{};nT.ModelsPage=n1;var o1=class extends Je{create(e,r){return this._client.post("/moderations",{body:e,...r})}};function T_t(t,e){return!e||!JBr(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:KCe(t,e)}function KCe(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:ZBr(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:KBr(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||JCe(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),n}function KBr(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function JBr(t){return!!h3(t.text?.format)}function GBr(t){return t?.$brand==="auto-parseable-tool"}function YBr(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function ZBr(t,e){let r=YBr(t.tools??[],e.name);return{...e,...e,parsed_arguments:GBr(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function JCe(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var Ek=class extends Je{list(e,r={},n){return Ir(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,OQ,{query:r,...n})}};var Pk=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},oT=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Tk,EQ,iT,PQ,A_t,I_t,M_t,R_t,TQ=class t extends XP{constructor(e){super(),Tk.add(this),EQ.set(this,void 0),iT.set(this,void 0),PQ.set(this,void 0),Pk(this,EQ,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),oT(this,Tk,"m",A_t).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)oT(this,Tk,"m",I_t).call(this,a);if(i.controller.signal?.aborted)throw new di;return oT(this,Tk,"m",M_t).call(this)}[(EQ=new WeakMap,iT=new WeakMap,PQ=new WeakMap,Tk=new WeakSet,A_t=function(){this.ended||Pk(this,iT,void 0,"f")},I_t=function(r){if(this.ended)return;let n=oT(this,Tk,"m",R_t).call(this,r);switch(this._emit("event",r),r.type){case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new ut(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new ut(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new ut(`expected content to be 'output_text', got ${i.type}`);this._emit("response.output_text.delta",{...r,snapshot:i.text})}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new ut(`missing output at index ${r.output_index}`);o.type==="function_call"&&this._emit("response.function_call_arguments.delta",{...r,snapshot:o.arguments});break}default:this._emit(r.type,r);break}},M_t=function(){if(this.ended)throw new ut("stream has ended, this shouldn't happen");let r=oT(this,iT,"f");if(!r)throw new ut("request ended without sending any events");Pk(this,iT,void 0,"f");let n=QBr(r,oT(this,EQ,"f"));return Pk(this,PQ,n,"f"),n},R_t=function(r){let n=oT(this,iT,"f");if(!n){if(r.type!=="response.created")throw new ut(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=Pk(this,iT,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new ut(`missing output at index ${r.output_index}`);o.type==="message"&&o.content.push(r.part);break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new ut(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new ut(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new ut(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new ut(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{Pk(this,iT,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=oT(this,PQ,"f");if(!e)throw new ut("stream ended without producing a ChatCompletion");return e}};function QBr(t,e){return T_t(t,e)}var aT=class extends Je{constructor(){super(...arguments),this.inputItems=new Ek(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1})._thenUnwrap(n=>("object"in n&&n.object==="response"&&JCe(n),n))}retrieve(e,r={},n){return Ir(r)?this.retrieve(e,{},r):this._client.get(`/responses/${e}`,{query:r,...n})}del(e,r){return this._client.delete(`/responses/${e}`,{...r,headers:{Accept:"*/*",...r?.headers}})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>KCe(n,e))}stream(e,r){return TQ.createResponse(this._client,e,r)}},OQ=class extends Dn{};aT.InputItems=Ek;var Ak=class extends Je{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,ih({body:r,...n}))}};var sT=class extends Je{constructor(){super(...arguments),this.parts=new Ak(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(`/uploads/${e}/complete`,{body:r,...n})}};sT.Parts=Ak;var j_t=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n};var uT=class extends Je{create(e,r,n){return this._client.post(`/vector_stores/${e}/files`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(e,r,n){return this._client.get(`/vector_stores/${e}/files/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}update(e,r,n,o){return this._client.post(`/vector_stores/${e}/files/${r}`,{body:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}list(e,r={},n){return Ir(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,lT,{query:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}del(e,r,n){return this._client.delete(`/vector_stores/${e}/files/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o={...n?.headers,"X-Stainless-Poll-Helper":"true"};for(n?.pollIntervalMs&&(o["X-Stainless-Custom-Poll-Interval"]=n.pollIntervalMs.toString());;){let i=await this.retrieve(e,r,{...n,headers:o}).withResponse(),a=i.data;switch(a.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=i.response.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await sC(s);break;case"failed":case"completed":return a}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){return this._client.getAPIList(`/vector_stores/${e}/files/${r}/content`,Ik,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},lT=class extends Dn{},Ik=class extends Kw{};uT.VectorStoreFilesPage=lT;uT.FileContentResponsesPage=Ik;var Mk=class extends Je{create(e,r,n){return this._client.post(`/vector_stores/${e}/file_batches`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}retrieve(e,r,n){return this._client.get(`/vector_stores/${e}/file_batches/${r}`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}cancel(e,r,n){return this._client.post(`/vector_stores/${e}/file_batches/${r}/cancel`,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n={},o){return Ir(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,lT,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}async poll(e,r,n){let o={...n?.headers,"X-Stainless-Poll-Helper":"true"};for(n?.pollIntervalMs&&(o["X-Stainless-Custom-Poll-Interval"]=n.pollIntervalMs.toString());;){let{data:i,response:a}=await this.retrieve(e,r,{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await sC(s);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=o?.maxConcurrency??5,a=Math.min(i,r.length),s=this._client,u=r.values(),l=[...n];async function c(f){for(let p of f){let m=await s.files.create({file:p,purpose:"assistants"},o);l.push(m.id)}}let d=Array(a).fill(u).map(c);return await j_t(d),await this.createAndPoll(e,{file_ids:l})}};var Yp=class extends Je{constructor(){super(...arguments),this.files=new uT(this._client),this.fileBatches=new Mk(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,r){return this._client.get(`/vector_stores/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,r,n){return this._client.post(`/vector_stores/${e}`,{body:r,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(e={},r){return Ir(e)?this.list({},e):this._client.getAPIList("/vector_stores",i1,{query:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(e,r){return this._client.delete(`/vector_stores/${e}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}search(e,r,n){return this._client.getAPIList(`/vector_stores/${e}/search`,a1,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},i1=class extends Dn{},a1=class extends Kw{};Yp.VectorStoresPage=i1;Yp.VectorStoreSearchResponsesPage=a1;Yp.Files=uT;Yp.VectorStoreFilesPage=lT;Yp.FileContentResponsesPage=Ik;Yp.FileBatches=Mk;var N_t,jt=class extends cQ{constructor({baseURL:e=WP("OPENAI_BASE_URL"),apiKey:r=WP("OPENAI_API_KEY"),organization:n=WP("OPENAI_ORG_ID")??null,project:o=WP("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new ut("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");let a={apiKey:r,organization:n,project:o,...i,baseURL:e||"https://api.openai.com/v1"};if(!a.dangerouslyAllowBrowser&&c_t())throw new ut(`It looks like you're running in a browser-like environment.
This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
`);super({baseURL:a.baseURL,timeout:a.timeout??6e5,httpAgent:a.httpAgent,maxRetries:a.maxRetries,fetch:a.fetch}),this.completions=new GR(this),this.chat=new uC(this),this.embeddings=new YR(this),this.files=new tT(this),this.images=new r1(this),this.audio=new Jw(this),this.moderations=new o1(this),this.models=new nT(this),this.fineTuning=new Bg(this),this.vectorStores=new Yp(this),this.beta=new kg(this),this.batches=new YP(this),this.uploads=new sT(this),this.responses=new aT(this),this.evals=new Xw(this),this._options=a,this.apiKey=r,this.organization=n,this.project=o}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project,...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}stringifyQuery(e){return dCe(e,{arrayFormat:"brackets"})}};N_t=jt;jt.OpenAI=N_t;jt.DEFAULT_TIMEOUT=6e5;jt.OpenAIError=ut;jt.APIError=vs;jt.APIConnectionError=iC;jt.APIConnectionTimeoutError=ef;jt.APIUserAbortError=di;jt.NotFoundError=GF;jt.ConflictError=YF;jt.RateLimitError=XF;jt.BadRequestError=WF;jt.AuthenticationError=KF;jt.InternalServerError=QF;jt.PermissionDeniedError=JF;jt.UnprocessableEntityError=ZF;jt.toFile=CCe;jt.fileFromPath=nQ;jt.Completions=GR;jt.Chat=uC;jt.ChatCompletionsPage=GP;jt.Embeddings=YR;jt.Files=tT;jt.FileObjectsPage=QR;jt.Images=r1;jt.Audio=Jw;jt.Moderations=o1;jt.Models=nT;jt.ModelsPage=n1;jt.FineTuning=Bg;jt.VectorStores=Yp;jt.VectorStoresPage=i1;jt.VectorStoreSearchResponsesPage=a1;jt.Beta=kg;jt.Batches=YP;jt.BatchesPage=UR;jt.Uploads=sT;jt.Responses=aT;jt.Evals=Xw;jt.EvalListResponsesPage=XR;var AQ=class extends jt{constructor({baseURL:e=WP("OPENAI_BASE_URL"),apiKey:r=WP("AZURE_OPENAI_API_KEY"),apiVersion:n=WP("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new ut("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof a=="function"&&(s=!0),!a&&!r)throw new ut("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new ut("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(r??(r=D_t),u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new ut("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new ut("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");e=`${o}/openai`}super({apiKey:r,baseURL:e,...u,...s!==void 0?{dangerouslyAllowBrowser:s}:{}}),this.apiVersion="",this._azureADTokenProvider=a,this.apiVersion=n,this.deploymentName=i}buildRequest(e,r={}){if(o$r.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!rk(e.body))throw new Error("Expected request body to be an object");let n=this.deploymentName||e.body.model||e.__metadata?.model;n!==void 0&&!this.baseURL.includes("/deployments")&&(e.path=`/deployments/${n}${e.path}`)}return super.buildRequest(e,r)}async _getAzureADToken(){if(typeof this._azureADTokenProvider=="function"){let e=await this._azureADTokenProvider();if(!e||typeof e!="string")throw new ut(`Expected 'azureADTokenProvider' argument to return a string but it returned ${e}`);return e}}authHeaders(e){return{}}async prepareOptions(e){if(e.headers?.["api-key"])return super.prepareOptions(e);let r=await this._getAzureADToken();if(e.headers??(e.headers={}),r)e.headers.Authorization=`Bearer ${r}`;else if(this.apiKey!==D_t)e.headers["api-key"]=this.apiKey;else throw new ut("Unable to handle auth");return super.prepareOptions(e)}},o$r=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations"]),D_t="<Missing Key>";fd();Wp();Cp();og();AD();oce();XO();TI();function Zf(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=wD(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new Sp([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(`
`))}let n={name:t.function.name,args:r,type:"tool_call"};return e?.returnId&&(n.id=t.id),n}function eS(t){if(t.id===void 0)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.args)}}}function Zp(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var GCe=class extends NI{static lc_name(){return"JsonOutputToolsParser"}constructor(e){super(e),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this.returnId=e?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(e){return await this.parsePartialResult(e,!1)}async parsePartialResult(e,r=!0){let n=e[0].message,o;if(ei(n)&&n.tool_calls?.length?o=n.tool_calls.map(a=>{let{id:s,...u}=a;return this.returnId?{id:s,...u}:u}):n.additional_kwargs.tool_calls!==void 0&&(o=JSON.parse(JSON.stringify(n.additional_kwargs.tool_calls)).map(s=>Zf(s,{returnId:this.returnId,partial:r}))),!o)return[];let i=[];for(let a of o)if(a!==void 0){let s={type:a.name,args:a.args,id:a.id};i.push(s)}return i}},bc=class extends GCe{static lc_name(){return"JsonOutputKeyToolsParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","output_parsers","openai_tools"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await this.zodSchema.safeParseAsync(e);if(r.success)return r.data;throw new Sp(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error.errors)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let n=(await super.parsePartialResult(e)).filter(i=>i.type===this.keyName),o=n;if(n.length)return this.returnId||(o=n.map(i=>i.args)),this.returnSingle?o[0]:o}async parseResult(e){let n=(await super.parsePartialResult(e,!1)).filter(a=>a.type===this.keyName),o=n;return n.length?(this.returnId||(o=n.map(a=>a.args)),this.returnSingle?this._validateResult(o[0]):await Promise.all(o.map(a=>this._validateResult(a)))):void 0}};Gl();var F_t=Symbol("Let zodToJsonSchema decide on which parser to use"),L_t={name:void 0,$refStrategy:"root",effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",nullableStrategy:"from-target",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},k_t=t=>typeof t=="string"?{...L_t,basePath:["#"],definitions:{},name:t}:{...L_t,basePath:["#"],definitions:{},...t};var x3=t=>"_def"in t?t._def:t;function B_t(t){if(!t)return!0;for(let e in t)return!1;return!0}var $_t=t=>{let e=k_t(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seenRefs:new Set,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[x3(o),{def:x3(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function YCe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function En(t,e,r,n,o){t[e]=r,YCe(t,e,n,o)}Uc();function q_t(){return{}}Uc();function U_t(t,e){let r={type:"array"};return t.type?._def?.typeName!==ne.ZodAny&&(r.items=Jt(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&En(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&En(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(En(r,"minItems",t.exactLength.value,t.exactLength.message,e),En(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function z_t(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?En(r,"minimum",n.value,n.message,e):En(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),En(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?En(r,"maximum",n.value,n.message,e):En(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),En(r,"maximum",n.value,n.message,e));break;case"multipleOf":En(r,"multipleOf",n.value,n.message,e);break}return r}function H_t(){return{type:"boolean"}}function V_t(t,e){return Jt(t.type._def,e)}var W_t=(t,e)=>Jt(t.innerType._def,e);function ZCe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>ZCe(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return i$r(t,e)}}var i$r=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":En(r,"minimum",n.value,n.message,e);break;case"max":En(r,"maximum",n.value,n.message,e);break}return r};function K_t(t,e){return{...Jt(t.innerType._def,e),default:t.defaultValue()}}function J_t(t,e,r){return e.effectStrategy==="input"?Jt(t.schema._def,e,r):{}}function G_t(t){return{type:"string",enum:[...t.values]}}var a$r=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Y_t(t,e){let r=[Jt(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Jt(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(a$r(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...u}=i;a=u}else n=void 0;o.push(a)}}),o.length?{allOf:o,...n}:void 0}function Z_t(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}Uc();var XCe,s1={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(XCe===void 0&&(XCe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),XCe),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/};function IQ(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?s$r(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":En(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":En(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":$g(r,"email",o.message,e);break;case"format:idn-email":$g(r,"idn-email",o.message,e);break;case"pattern:zod":qg(r,s1.email,o.message,e);break}break;case"url":$g(r,"uri",o.message,e);break;case"uuid":$g(r,"uuid",o.message,e);break;case"regex":qg(r,o.regex,o.message,e);break;case"cuid":qg(r,s1.cuid,o.message,e);break;case"cuid2":qg(r,s1.cuid2,o.message,e);break;case"startsWith":qg(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":qg(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":$g(r,"date-time",o.message,e);break;case"date":$g(r,"date",o.message,e);break;case"time":$g(r,"time",o.message,e);break;case"duration":$g(r,"duration",o.message,e);break;case"length":En(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),En(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{qg(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&$g(r,"ipv4",o.message,e),o.version!=="v4"&&$g(r,"ipv6",o.message,e);break}case"emoji":qg(r,s1.emoji,o.message,e);break;case"ulid":{qg(r,s1.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{$g(r,"binary",o.message,e);break}case"contentEncoding:base64":{En(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{qg(r,s1.base64,o.message,e);break}}break}case"nanoid":qg(r,s1.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var s$r=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),$g=(t,e,r,n)=>{t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):En(t,"format",e,r,n)},qg=(t,e,r,n)=>{t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:X_t(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):En(t,"pattern",X_t(e,n),r,n)},X_t=(t,e)=>{let r=typeof t=="function"?t():t;if(!e.applyRegexFlags||!r.flags)return r.source;let n={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},o=n.i?r.source.toLowerCase():r.source,i="",a=!1,s=!1,u=!1;for(let l=0;l<o.length;l++){if(a){i+=o[l],a=!1;continue}if(n.i){if(s){if(o[l].match(/[a-z]/)){u?(i+=o[l],i+=`${o[l-2]}-${o[l]}`.toUpperCase(),u=!1):o[l+1]==="-"&&o[l+2]?.match(/[a-z]/)?(i+=o[l],u=!0):i+=`${o[l]}${o[l].toUpperCase()}`;continue}}else if(o[l].match(/[a-z]/)){i+=`[${o[l]}${o[l].toUpperCase()}]`;continue}}if(n.m){if(o[l]==="^"){i+=`(^|(?<=[\r
]))`;continue}else if(o[l]==="$"){i+=`($|(?=[\r
]))`;continue}}if(n.s&&o[l]==="."){i+=s?`${o[l]}\r
`:`[${o[l]}\r
]`;continue}i+=o[l],o[l]==="\\"?a=!0:s&&o[l]==="]"?s=!1:!s&&o[l]==="["&&(s=!0)}try{let l=new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return i};function MQ(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===ne.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Jt(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Jt(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===ne.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(IQ(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===ne.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}function Q_t(t,e){if(e.mapStrategy==="record")return MQ(t,e);let r=Jt(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Jt(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function evt(t){let e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function tvt(){return{not:{}}}function rvt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var C3={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ovt(t,e){if(e.target==="openApi3")return nvt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in C3&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=C3[i._def.typeName];return a&&!o.includes(a)?[...o,a]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,i)=>{let a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...o,a];case"bigint":return[...o,"integer"];case"object":if(i._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((i,a,s)=>s.indexOf(i)===a);return{type:o.length>1?o:o[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return nvt(t,e)}var nvt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Jt(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function ivt(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"||e.nullableStrategy==="property"?{type:C3[t.innerType._def.typeName],nullable:!0}:{type:[C3[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Jt(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Jt(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function avt(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",YCe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?En(r,"minimum",n.value,n.message,e):En(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),En(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?En(r,"maximum",n.value,n.message,e):En(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),En(r,"maximum",n.value,n.message,e));break;case"multipleOf":En(r,"multipleOf",n.value,n.message,e);break}return r}function u$r(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Jt(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Jt(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function svt(t,e){let r={type:"object",...Object.entries(t.shape()).reduce((n,[o,i])=>{if(i===void 0||i._def===void 0)return n;let a=[...e.currentPath,"properties",o],s=Jt(i._def,{...e,currentPath:a,propertyPath:a});return s===void 0?n:(e.openaiStrictMode&&i.isOptional()&&!i.isNullable()&&console.warn(`Zod field at \`${a.join("/")}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required
This will become an error in a future version of the SDK.`),{properties:{...n.properties,[o]:s},required:i.isOptional()&&!e.openaiStrictMode?n.required:[...n.required,o]})},{properties:{},required:[]}),additionalProperties:u$r(t,e)};return r.required.length||delete r.required,r}var uvt=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Jt(t.innerType._def,e);let r=Jt(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};var lvt=(t,e)=>{if(e.pipeStrategy==="input")return Jt(t.in._def,e);if(e.pipeStrategy==="output")return Jt(t.out._def,e);let r=Jt(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Jt(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function cvt(t,e){return Jt(t.type._def,e)}function dvt(t,e){let n={type:"array",uniqueItems:!0,items:Jt(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&En(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&En(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function fvt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Jt(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Jt(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Jt(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function pvt(){return{not:{}}}function mvt(){return{}}var hvt=(t,e)=>Jt(t.innerType._def,e);function Jt(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==F_t)return a}if(n&&!r){let a=l$r(n,e);if(a!==void 0)return"$ref"in a&&e.seenRefs.add(a.$ref),a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=d$r(t,t.typeName,e,r);return i&&f$r(t,e,i),o.jsonSchema=i,i}var l$r=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"extract-to-root":let r=t.path.slice(e.basePath.length+1).join("_");return r!==e.name&&e.nameStrategy==="duplicate-ref"&&(e.definitions[r]=t.def),{$ref:[...e.basePath,e.definitionPath,r].join("/")};case"relative":return{$ref:c$r(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,o)=>e.currentPath[o]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},c$r=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},d$r=(t,e,r,n)=>{switch(e){case ne.ZodString:return IQ(t,r);case ne.ZodNumber:return avt(t,r);case ne.ZodObject:return svt(t,r);case ne.ZodBigInt:return z_t(t,r);case ne.ZodBoolean:return H_t();case ne.ZodDate:return ZCe(t,r);case ne.ZodUndefined:return pvt();case ne.ZodNull:return rvt(r);case ne.ZodArray:return U_t(t,r);case ne.ZodUnion:case ne.ZodDiscriminatedUnion:return ovt(t,r);case ne.ZodIntersection:return Y_t(t,r);case ne.ZodTuple:return fvt(t,r);case ne.ZodRecord:return MQ(t,r);case ne.ZodLiteral:return Z_t(t,r);case ne.ZodEnum:return G_t(t);case ne.ZodNativeEnum:return evt(t);case ne.ZodNullable:return ivt(t,r);case ne.ZodOptional:return uvt(t,r);case ne.ZodMap:return Q_t(t,r);case ne.ZodSet:return dvt(t,r);case ne.ZodLazy:return Jt(t.getter()._def,r);case ne.ZodPromise:return cvt(t,r);case ne.ZodNaN:case ne.ZodNever:return tvt();case ne.ZodEffects:return J_t(t,r,n);case ne.ZodAny:return q_t();case ne.ZodUnknown:return mvt();case ne.ZodDefault:return K_t(t,r);case ne.ZodBranded:return V_t(t,r);case ne.ZodReadonly:return hvt(t,r);case ne.ZodCatch:return W_t(t,r);case ne.ZodPipeline:return lvt(t,r);case ne.ZodFunction:case ne.ZodVoid:case ne.ZodSymbol:return;default:return(o=>{})(e)}},f$r=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var gvt=(t,e)=>{let r=$_t(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Jt(t._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??{},i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i);let a=(()=>{if(B_t(r.definitions))return;let u={},l=new Set;for(let c=0;c<500;c++){let d=Object.entries(r.definitions).filter(([f])=>!l.has(f));if(d.length===0)break;for(let[f,p]of d)u[f]=Jt(x3(p),{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0)??{},l.add(f)}return u})(),s=n===void 0?a?{...o,[r.definitionPath]:a}:o:r.nameStrategy==="duplicate-ref"?{...o,...a||r.seenRefs.size?{[r.definitionPath]:{...a,...r.seenRefs.size?{[n]:o}:void 0}}:void 0}:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...a,[n]:o}};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),s};function yvt(t,e){return gvt(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function Rk(t,e,r){return p_t({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:yvt(t,{name:e})}},n=>t.parse(JSON.parse(n)))}function RQ(t){return m_t({type:"function",function:{name:t.name,parameters:yvt(t.parameters,{name:t.name}),strict:!0,...t.description?{description:t.description}:void 0}},{callback:t.function,parser:e=>t.parameters.parse(JSON.parse(e))})}function pC(t){let{azureOpenAIApiDeploymentName:e,azureOpenAIApiInstanceName:r,azureOpenAIApiKey:n,azureOpenAIBasePath:o,baseURL:i,azureADTokenProvider:a,azureOpenAIEndpoint:s}=t;if((n||a)&&o&&e)return`${o}/${e}`;if((n||a)&&s&&e)return`${s}/openai/deployments/${e}`;if(n||a){if(!r)throw new Error("azureOpenAIApiInstanceName is required when using azureOpenAIApiKey");if(!e)throw new Error("azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey");return`https://${r}.openai.azure.com/openai/deployments/${e}`}return i}Gl();function O3(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function mC(t){let e;return t.constructor.name===ef.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===di.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=O3(t,"INVALID_TOOL_RESULTS"):t.status===401?e=O3(t,"MODEL_AUTHENTICATION"):t.status===429?e=O3(t,"MODEL_RATE_LIMIT"):t.status===404?e=O3(t,"MODEL_NOT_FOUND"):e=t,e}function QCe(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}function p$r(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function bvt(t){let e=["namespace functions {",""];for(let r of t)r.description&&e.push(`// ${r.description}`),Object.keys(r.parameters.properties??{}).length>0?(e.push(`type ${r.name} = (_: {`),e.push(_vt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function _vt(t,e){let r=[];for(let[n,o]of Object.entries(t.properties??{}))o.description&&e<2&&r.push(`// ${o.description}`),t.required?.includes(n)?r.push(`${n}: ${jQ(o,e)},`):r.push(`${n}?: ${jQ(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function jQ(t,e){if(p$r(t))return t.anyOf.map(r=>jQ(r,e)).join(" | ");switch(t.type){case"string":return t.enum?t.enum.map(r=>`"${r}"`).join(" | "):"string";case"number":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"integer":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",_vt(t,e+2),"}"].join(`
`);case"array":return t.items?`${jQ(t.items,e)}[]`:"any[]";default:return""}}function vvt(t,e){let r;return pc(t)?r=qw(t):r=t,e?.strict!==void 0&&(r.function.strict=e.strict),r}function m$r(t){return t.role!=="system"&&t.role!=="developer"&&t.role!=="assistant"&&t.role!=="user"&&t.role!=="function"&&t.role!=="tool"&&console.warn(`Unknown message role: ${t.role}`),t.role}function rOe(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":{if(!Ja.isInstance(t))throw new Error("Invalid generic chat message");return m$r(t)}default:throw new Error(`Unknown message type: ${e}`)}}function tOe(t,e){return t.flatMap(r=>{let n=rOe(r);n==="system"&&nOe(e)&&(n="developer");let o={role:n,content:r.content};if(r.name!=null&&(o.name=r.name),r.additional_kwargs.function_call!=null&&(o.function_call=r.additional_kwargs.function_call,o.content=""),ei(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(eS),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}var jk="__openai_function_call_ids__";function wvt(t,e){return t.flatMap(r=>{let n=rOe(r);if(n==="system"&&nOe(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let i=r;return i.additional_kwargs?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof i.content=="string")return{type:"computer_screenshot",image_url:i.content};if(Array.isArray(i.content)){let s=i.content.find(l=>l.type==="computer_screenshot");if(s)return s;let u=i.content.find(l=>l.type==="image_url");if(u)return{type:"computer_screenshot",image_url:typeof u.image_url=="string"?u.image_url:u.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:i.tool_call_id}:{type:"function_call_output",call_id:i.tool_call_id,id:i.id,output:typeof i.content!="string"?JSON.stringify(i.content):i.content}}if(n==="assistant"){let i=[];r.additional_kwargs.reasoning!=null&&(c=>typeof c=="object"&&c!=null&&"type"in c&&c.type==="reasoning")(r.additional_kwargs.reasoning)&&i.push(r.additional_kwargs.reasoning);let{content:a}=r;r.additional_kwargs.refusal!=null&&(typeof a=="string"&&(a=[{type:"output_text",text:a,annotations:[]}]),a=[...a,{type:"refusal",refusal:r.additional_kwargs.refusal}]),i.push({type:"message",role:"assistant",content:typeof a=="string"?a:a.flatMap(l=>l.type==="text"?{type:"output_text",text:l.text,annotations:l.annotations??[]}:l.type==="output_text"||l.type==="refusal"?l:[])});let s=r.additional_kwargs[jk];ei(r)&&r.tool_calls?.length?i.push(...r.tool_calls.map(l=>({type:"function_call",name:l.name,arguments:JSON.stringify(l.args),call_id:l.id,id:s?.[l.id]}))):r.additional_kwargs.tool_calls!=null&&i.push(...r.additional_kwargs.tool_calls.map(l=>({type:"function_call",name:l.function.name,call_id:l.id,id:s?.[l.id],arguments:l.function.arguments})));let u=r.response_metadata.output?.length?r.response_metadata.output:r.additional_kwargs.tool_outputs;if(u!=null){let l=u,c=l?.filter(f=>f.type==="reasoning"),d=l?.filter(f=>f.type==="computer_call");c.length>0&&d.length>0&&i.push(...c),d.length>0&&i.push(...d)}return i}let o=typeof r.content=="string"?r.content:r.content.flatMap(i=>{if(i.type==="text")return{type:"input_text",text:i.text};if(i.type==="image_url"){let a=typeof i.image_url=="string"?i.image_url:i.image_url.url,s=typeof i.image_url=="string"?"auto":i.image_url.detail;return{type:"input_image",image_url:a,detail:s}}return i.type==="input_text"||i.type==="input_image"||i.type==="input_file"?i:[]});return n==="user"||n==="system"||n==="developer"?{type:"message",role:n,content:o}:(console.warn(`Unsupported role found when converting to OpenAI Responses API: ${n}`),[])})}function xvt(t){if(t.error){let a=new Error(t.error.message);throw a.name=t.error.code,a}let e=[],r=[],n=[],o={model:t.model,created_at:t.created_at,id:t.id,incomplete_details:t.incomplete_details,metadata:t.metadata,object:t.object,status:t.status,user:t.user,model_name:t.model},i={};for(let a of t.output)if(a.type==="message")e.push(...a.content.flatMap(s=>s.type==="output_text"?("parsed"in s&&s.parsed!=null&&(i.parsed=s.parsed),{type:"text",text:s.text,annotations:s.annotations}):s.type==="refusal"?(i.refusal=s.refusal,[]):s));else if(a.type==="function_call"){let s={function:{name:a.name,arguments:a.arguments},id:a.call_id};try{r.push(Zf(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Zp(s,l))}i[jk]??(i[jk]={}),a.id&&(i[jk][a.call_id]=a.id)}else a.type==="reasoning"?i.reasoning=a:(i.tool_outputs??(i.tool_outputs=[]),i.tool_outputs.push(a));return new en({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function h$r(t){let e=[],r={},n,o=[],i={},a={},s;if(t.type==="response.output_text.delta")e.push({type:"text",text:t.delta,index:t.content_index});else if(t.type==="response.output_text.annotation.added")e.push({type:"text",text:"",annotations:[t.annotation],index:t.content_index});else if(t.type==="response.output_item.added"&&t.item.type==="message")s=t.item.id;else if(t.type==="response.output_item.added"&&t.item.type==="function_call")o.push({type:"tool_call_chunk",name:t.item.name,args:t.item.arguments,id:t.item.id,index:t.output_index}),a[jk]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&(t.item.type==="web_search_call"||t.item.type==="file_search_call"||t.item.type==="computer_call"))a.tool_outputs=[t.item];else if(t.type==="response.created")i.id=t.response.id,i.model_name=t.response.model,i.model=t.response.model;else if(t.type==="response.completed"){let u=xvt(t.response);n=t.response.usage,t.response.text?.format?.type==="json_schema"&&(a.parsed??(a.parsed=JSON.parse(u.text)));for(let[l,c]of Object.entries(t.response))l!=="id"&&(i[l]=c)}else if(t.type==="response.function_call_arguments.delta")o.push({type:"tool_call_chunk",args:t.delta,index:t.output_index});else if(t.type==="response.web_search_call.completed"||t.type==="response.file_search_call.completed")r={tool_outputs:{id:t.item_id,type:t.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(t.type==="response.refusal.done")a.refusal=t.refusal;else return null;return new Sn({text:e.map(u=>u.text).join(""),message:new or({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function eOe(t){return"type"in t&&t.type!=="function"}function g$r(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function Svt(t,e){return fc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:vvt(t,e)}function nOe(t){return t?.startsWith("o1")||t?.startsWith("o3")||t?.startsWith("o4")}var tS=class extends _s{static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning_effort"]}get lc_secrets(){return{openAIApiKey:"OPENAI_API_KEY",apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{modelName:"model",openAIApiKey:"openai_api_key",apiKey:"openai_api_key"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","reasoningEffort","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","modelName","model","modelKwargs","stop","stopSequences","timeout","openAIApiKey","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming"]}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??Ye("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??Ye("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.useResponsesApi=e?.useResponsesApi??this.useResponsesApi,this.disableStreaming=e?.disableStreaming??this.disableStreaming,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.disableStreaming&&(this.streaming=!1),this.streamUsage=e?.streamUsage??this.streamUsage,this.disableStreaming&&(this.streamUsage=!1),this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>eOe(o)?o:Svt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&DQ(e.json_schema.schema)?Rk(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}invocationParams(e,r){let n;if(e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this._useResponseApi(e)){let s={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:e?.previous_response_id,truncation:e?.truncation,include:e?.include,tools:e?.tools?.length?e.tools.map(l=>eOe(l)?l:fc(l)?{type:"function",name:l.function.name,parameters:l.function.parameters,description:l.function.description,strict:n}:null).filter(l=>l!==null):void 0,tool_choice:g$r(e?.tool_choice)?e?.tool_choice:(()=>{let l=QCe(e?.tool_choice);if(typeof l=="object"&&"type"in l)return{type:"function",name:l.function.name}})(),text:(()=>{if(e?.text)return e.text;let l=this.createResponseFormat(e?.response_format);return l?.type==="json_schema"?l.json_schema.schema!=null?{format:{type:"json_schema",schema:l.json_schema.schema,description:l.json_schema.description,name:l.json_schema.name,strict:l.json_schema.strict}}:void 0:{format:l}})(),parallel_tool_calls:e?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,...this.modelKwargs},u=e?.reasoning_effort??this.reasoningEffort;return u!==void 0&&(s.reasoning={effort:u}),s}let o={};e?.stream_options!==void 0?o={stream_options:e.stream_options}:this.streamUsage&&(this.streaming||r?.streaming)&&(o={stream_options:{include_usage:!0}});let i={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:e?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:e?.functions,function_call:e?.function_call,tools:e?.tools?.length?e.tools.map(s=>Svt(s,{strict:n})):void 0,tool_choice:QCe(e?.tool_choice),response_format:this.createResponseFormat(e?.response_format),seed:e?.seed,...o,parallel_tool_calls:e?.parallel_tool_calls,...this.audio||e?.audio?{audio:this.audio||e?.audio}:{},...this.modalities||e?.modalities?{modalities:this.modalities||e?.modalities}:{},...this.modelKwargs};e?.prediction!==void 0&&(i.prediction=e.prediction);let a=e?.reasoning_effort??this.reasoningEffort;return a!==void 0&&(i.reasoning_effort=a),nOe(i.model)?i.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:i.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,i}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(Zf(u,{returnId:!0}))}catch(l){i.push(Zp(u,l.message))}let a={function_call:e.function_call,tool_calls:n};this.__includeRawResponse!==void 0&&(a.__raw_response=r);let s={model_name:r.model,...r.system_fingerprint?{usage:{...r.usage},system_fingerprint:r.system_fingerprint}:{}};return e.audio&&(a.audio=e.audio),new en({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Ja(e.content||"",e.role??"unknown")}}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=e.role??n,i=e.content??"",a;e.function_call?a={function_call:e.function_call}:e.tool_calls?a={tool_calls:e.tool_calls}:a={},this.__includeRawResponse&&(a.__raw_response=r),e.audio&&(a.audio={...e.audio,index:r.choices[0].index});let s={usage:{...r.usage}};if(o==="user")return new Nd({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(e.tool_calls))for(let l of e.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new or({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Wc({content:i,response_metadata:s}):o==="developer"?new Wc({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new _p({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Pm({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Dd({content:i,role:o,response_metadata:s})}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}async*_streamResponseChunks(e,r,n){if(this._useResponseApi(r)){let l=await this.responseApiWithRetry({...this.invocationParams(r,{streaming:!0}),input:wvt(e,this.model),stream:!0},r);for await(let c of l){let d=h$r(c);d!=null&&(yield d)}return}let o=tOe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new Sn({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new Sn({message:new or({content:"",response_metadata:{usage:{...u}},usage_metadata:{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,total_tokens:u.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(r.signal?.aborted)throw new Error("AbortError")}identifyingParams(){return this._identifyingParams()}async _responseApiGenerate(e,r,n){let o=this.invocationParams(r);if(o.stream){let s=this._streamResponseChunks(e,r,n),u;for await(let l of s)l.message.response_metadata={...l.generationInfo,...l.message.response_metadata},u=u?.concat(l)??l;return{generations:u?[u]:[],llmOutput:{estimatedTokenUsage:u?.message?.usage_metadata}}}let i=wvt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:xvt(a)}],llmOutput:{id:a.id,estimatedTokenUsage:a.usage?{promptTokens:a.usage.input_tokens,completionTokens:a.usage.output_tokens,totalTokens:a.usage.total_tokens}:void 0}}}_useResponseApi(e){let r=e?.tools?.some(eOe),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null;return this.useResponsesApi||r||n}async _generate(e,r,n){if(this._useResponseApi(r))return this._responseApiGenerate(e,r,n);let o={},i=this.invocationParams(r),a=tOe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let v={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};v.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},ei(v.message)&&(v.message.usage_metadata=o),v.message=new en(Object.fromEntries(Object.entries(v.message).filter(([g])=>!g.startsWith("lc_")))),p.push(v)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=bvt(r);o+=await this.getNumTokens(i),o+=9}return r&&e.find(i=>i._getType()==="system")&&(o-=4),n==="none"?o+=1:typeof n=="object"&&(o+=await this.getNumTokens(n.name)+4),o}async getNumTokensFromGenerations(e){return(await Promise.all(e.map(async n=>n.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([n.message])).countPerMessage[0]:await this.getNumTokens(n.message.content)))).reduce((n,o)=>n+o,0)}async getNumTokensFromMessages(e){let r=0,n=0,o=0;this.model==="gpt-3.5-turbo-0301"?(n=4,o=-1):(n=3,o=1);let i=await Promise.all(e.map(async a=>{let s=await this.getNumTokens(a.content),u=await this.getNumTokens(rOe(a)),l=a.name!==void 0?o+await this.getNumTokens(a.name):0,c=s+n+u+l,d=a;if(d._getType()==="function"&&(c-=2),d.additional_kwargs?.function_call&&(c+=3),d?.additional_kwargs.function_call?.name&&(c+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{c+=await this.getNumTokens(JSON.stringify(JSON.parse(d.additional_kwargs.function_call?.arguments)))}catch(f){console.error("Error parsing function arguments",f,JSON.stringify(d.additional_kwargs.function_call)),c+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return r+=c,c}));return r+=3,{totalCount:r,countPerMessage:i}}async completionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.chat.completions.create(e,n)}catch(o){throw mC(o)}})}async responseApiWithRetry(e,r){return this.caller.call(async()=>{let n=this._getClientOptions(r);try{return e.text?.format?.type==="json_schema"&&!e.stream?await this.client.responses.parse(e,n):await this.client.responses.create(e,n)}catch(o){throw mC(o)}})}async betaParsedCompletionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.beta.chat.completions.parse(e,n)}catch(o){throw mC(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=pC(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new jt(i)}return{...this.clientConfig,...e}}_llmType(){return"openai"}_combineLLMOutput(...e){return e.reduce((r,n)=>(n&&n.tokenUsage&&(r.tokenUsage.completionTokens+=n.tokenUsage.completionTokens??0,r.tokenUsage.promptTokens+=n.tokenUsage.promptTokens??0,r.tokenUsage.totalTokens+=n.tokenUsage.totalTokens??0),r),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}withStructuredOutput(e,r){let n,o,i,a;y$r(e)?(n=e.schema,o=e.name,i=e.method,a=e.includeRaw):(n=e,o=r?.name,i=r?.method,a=r?.includeRaw);let s,u;if(r?.strict!==void 0&&i==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"?i===void 0&&(i="jsonSchema"):i==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`),i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),DQ(n)?u=Yl.fromZodSchema(n):u=new Zl;else if(i==="jsonSchema")if(s=this.bind({response_format:{type:"json_schema",json_schema:{name:o??"extract",description:n.description,schema:n,strict:r?.strict}}}),DQ(n)){let f=Yl.fromZodSchema(n);u=kd.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Zl;else{let f=o??"extract";if(DQ(n)){let p=Xn(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:f}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new bc({returnSingle:!0,keyName:f,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,f=n.name):(f=n.title??f,p={name:f,description:n.description??"",parameters:n}),s=this.bind({tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:f}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new bc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Kn.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Kn.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Wo.from([{raw:s},d])}};function DQ(t){return typeof t?.parse=="function"}function y$r(t){return t!==void 0&&typeof t.schema=="object"}Wp();fd();var hC=class extends Zd{constructor(e){let r={maxConcurrency:2,...e};super(r),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"text-embedding-ada-002"}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSize",{enumerable:!0,configurable:!0,writable:!0,value:512}),Object.defineProperty(this,"stripNewLines",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"dimensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let n=r?.apiKey??r?.openAIApiKey??Ye("OPENAI_API_KEY");this.organization=r?.configuration?.organization??Ye("OPENAI_ORGANIZATION"),this.model=r?.model??r?.modelName??this.model,this.modelName=this.model,this.batchSize=r?.batchSize??this.batchSize,this.stripNewLines=r?.stripNewLines??this.stripNewLines,this.timeout=r?.timeout,this.dimensions=r?.dimensions,this.clientConfig={apiKey:n,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration}}async embedDocuments(e){let r=Xd(this.stripNewLines?e.map(a=>a.replace(/\n/g," ")):e,this.batchSize),n=r.map(a=>{let s={model:this.model,input:a};return this.dimensions&&(s.dimensions=this.dimensions),this.embeddingWithRetry(s)}),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],{data:u}=o[a];for(let l=0;l<s.length;l+=1)i.push(u[l].embedding)}return i}async embedQuery(e){let r={model:this.model,input:this.stripNewLines?e.replace(/\n/g," "):e};this.dimensions&&(r.dimensions=this.dimensions);let{data:n}=await this.embeddingWithRetry(r);return n[0].embedding}async embeddingWithRetry(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=pC(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new jt(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw mC(n)}})}};var NQ=class extends hC{constructor(e){super(e),Object.defineProperty(this,"azureOpenAIApiVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureADTokenProvider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIApiInstanceName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIApiDeploymentName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"azureOpenAIBasePath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.batchSize=e?.batchSize??1,this.azureOpenAIApiKey=e?.azureOpenAIApiKey??e?.apiKey??Ye("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??Ye("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??Ye("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??Ye("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(Ye("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||Ye("AZURE_OPENAI_API_DEPLOYMENT_NAME")),this.azureADTokenProvider=e?.azureADTokenProvider}async embeddingWithRetry(e){if(!this.client){let n={azureOpenAIApiDeploymentName:this.azureOpenAIApiDeploymentName,azureOpenAIApiInstanceName:this.azureOpenAIApiInstanceName,azureOpenAIApiKey:this.azureOpenAIApiKey,azureOpenAIBasePath:this.azureOpenAIBasePath,azureADTokenProvider:this.azureADTokenProvider,baseURL:this.clientConfig.baseURL},o=pC(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(i.apiKey=n.azureOpenAIApiKey),i.baseURL||delete i.baseURL,i.defaultHeaders={...i.defaultHeaders,"User-Agent":i.defaultHeaders?.["User-Agent"]?`${i.defaultHeaders["User-Agent"]}: langchainjs-azure-openai-v2`:"langchainjs-azure-openai-v2"},this.client=new AQ({apiVersion:this.azureOpenAIApiVersion,azureADTokenProvider:this.azureADTokenProvider,deployment:this.azureOpenAIApiDeploymentName,...i})}let r={};return this.azureOpenAIApiKey&&(r.headers={"api-key":this.azureOpenAIApiKey,...r.headers},r.query={"api-version":this.azureOpenAIApiVersion,...r.query}),this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw mC(n)}})}};Uc();Zq();GO();r3();Oy();SD();OD();y5();var LQ=class extends $F{get lc_namespace(){return["langchain","tools"]}constructor(e){super(e??{}),Object.defineProperty(this,"returnDirect",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"verboseParsingErrors",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"responseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"content"}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat}async invoke(e,r){let n,o,i=Wr(r);return vD(e)?(n=e.id,o=e.args,i={...i,toolCall:e,configurable:{...i.configurable,tool_call_id:n}}):o=e,this.call(o,i)}async call(e,r,n){let o=e;if(rl(this.schema))try{o=await this.schema.parseAsync(e)}catch(p){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m}
Details: ${p.message}`),new PI(m,JSON.stringify(e))}else{let p=Ei(e,this.schema);if(!p.valid){let m="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(m=`${m}
Details: ${p.errors.map(h=>`${h.keywordLocation}: ${h.error}`).join(`
`)}`),new PI(m,JSON.stringify(e))}}let i=II(r),s=await ls.configure(i.callbacks,this.callbacks,i.tags||n,this.tags,i.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof o=="string"?o:JSON.stringify(o),i.runId,void 0,void 0,void 0,i.runName);delete i.runId;let u;try{u=await this._call(o,s,i)}catch(p){throw await s?.handleToolError(p),p}let l,c;if(this.responseFormat==="content_and_artifact")if(Array.isArray(u)&&u.length===2)[l,c]=u;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
Result: ${JSON.stringify(u)}`);else l=u;let d;i&&"configurable"in i&&(d=i.configurable.tool_call_id);let f=b$r({content:l,artifact:c,toolCallId:d,name:this.name});return await s?.handleToolEnd(f),f}},gC=class extends LQ{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:Pr.object({input:Pr.string().optional()}).transform(r=>r.input)})}call(e,r){return super.call(typeof e=="string"||!e?{input:e}:e,r)}},oOe=class extends gC{static lc_name(){return"DynamicTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect}async call(e,r){let n=II(r);return n.runName===void 0&&(n.runName=this.name),super.call(e,n)}async _call(e,r,n){return this.func(e,r,n)}},iOe=class extends LQ{static lc_name(){return"DynamicStructuredTool"}constructor(e){super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"func",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}async call(e,r,n){let o=II(r);return o.runName===void 0&&(o.runName=this.name),super.call(e,o,n)}_call(e,r,n){return this.func(e,r,n)}};function Xp(t,e){let r=e.schema&&rl(e.schema)&&(!("shape"in e.schema)||!e.schema.shape),n=n3(e.schema);if(!e.schema||r||n)return new oOe({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(a,s,u)=>new Promise((l,c)=>{let d=Da(u,{callbacks:s?.getChild()});Kc.runWithConfig(vp(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new iOe({...e,description:i,schema:o,func:async(a,s,u)=>new Promise((l,c)=>{let d=Da(u,{callbacks:s?.getChild()});Kc.runWithConfig(vp(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})})}function b$r(t){let{content:e,artifact:r,toolCallId:n}=t;return n&&!tke(e)?typeof e=="string"||Array.isArray(e)&&e.every(o=>typeof o=="object")?new JS({content:e,artifact:r,tool_call_id:n,name:t.name}):new JS({content:_$r(e),artifact:r,tool_call_id:n,name:t.name}):e}function _$r(t){try{return JSON.stringify(t,null,2)}catch{return`${t}`}}var aOe=class extends gC{static lc_name(){return"DallEAPIWrapper"}constructor(e){e?.responseFormat!==void 0&&["url","b64_json"].includes(e.responseFormat)&&(e.dallEResponseFormat=e.responseFormat,e.responseFormat="content"),super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:"A wrapper around OpenAI DALL-E API. Useful for when you need to generate images from a text description. Input should be an image description."}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"dall-e-3"}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:"vivid"}),Object.defineProperty(this,"quality",{enumerable:!0,configurable:!0,writable:!0,value:"standard"}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:"1024x1024"}),Object.defineProperty(this,"dallEResponseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"url"}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let r=e?.apiKey??e?.openAIApiKey??Ye("OPENAI_API_KEY"),n=e?.organization??Ye("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseURL:e?.baseUrl};this.client=new jt(o),this.model=e?.model??e?.modelName??this.model,this.style=e?.style??this.style,this.quality=e?.quality??this.quality,this.n=e?.n??this.n,this.size=e?.size??this.size,this.dallEResponseFormat=e?.dallEResponseFormat??this.dallEResponseFormat,this.user=e?.user}processMultipleGeneratedUrls(e){return this.dallEResponseFormat==="url"?e.flatMap(r=>r.data.flatMap(o=>o.url?{type:"image_url",image_url:o.url}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="string"&&o.image_url!==void 0)):e.flatMap(r=>r.data.flatMap(o=>o.b64_json?{type:"image_url",image_url:{url:o.b64_json}}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="object"&&"url"in o.image_url&&typeof o.image_url.url=="string"&&o.image_url.url!==void 0))}async _call(e){let r={model:this.model,prompt:e,n:1,size:this.size,response_format:this.dallEResponseFormat,style:this.style,quality:this.quality,user:this.user};if(this.n>1){let i=await Promise.all(Array.from({length:this.n}).map(()=>this.client.images.generate(r)));return this.processMultipleGeneratedUrls(i)}let n=await this.client.images.generate(r),o="";return this.dallEResponseFormat==="url"?[o]=n.data.map(i=>i.url).filter(i=>i!=="undefined"):[o]=n.data.map(i=>i.b64_json).filter(i=>i!=="undefined"),o}};Object.defineProperty(aOe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var BQ=require("obsidian");var FQ=class extends Zd{constructor(e){let r={maxConcurrency:2,...e};super(r),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"jina-clip-v2"}),Object.defineProperty(this,"batchSize",{enumerable:!0,configurable:!0,writable:!0,value:24}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:"https://api.jina.ai/v1/embeddings"}),Object.defineProperty(this,"stripNewLines",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"dimensions",{enumerable:!0,configurable:!0,writable:!0,value:1024}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"normalized",{enumerable:!0,configurable:!0,writable:!0,value:!0});let n=r?.apiKey||Ye("JINA_API_KEY")||Ye("JINA_AUTH_TOKEN");if(!n)throw new Error("Jina API key not found");this.apiKey=n,this.model=r?.model??this.model,this.dimensions=r?.dimensions??this.dimensions,this.batchSize=r?.batchSize??this.batchSize,this.stripNewLines=r?.stripNewLines??this.stripNewLines,this.normalized=r?.normalized??this.normalized}doStripNewLines(e){return this.stripNewLines?e.map(r=>typeof r=="string"?r.replace(/\n/g," "):r.text?{text:r.text.replace(/\n/g," ")}:r):e}async embedDocuments(e){let r=Xd(this.doStripNewLines(e),this.batchSize),n=r.map(a=>{let s=this.getParams(a);return this.embeddingWithRetry(s)}),o=await Promise.all(n),i=[];for(let a=0;a<o.length;a+=1){let s=r[a],u=o[a]||[];for(let l=0;l<s.length;l+=1)i.push(u[l])}return i}async embedQuery(e){let r=this.getParams(this.doStripNewLines([e]),!0);return(await this.embeddingWithRetry(r)||[[]])[0]}getParams(e,r){return{model:this.model,input:e,dimensions:this.dimensions,task:r?"retrieval.query":"retrieval.passage",normalized:this.normalized}}async embeddingWithRetry(e){let n=await(await fetch(this.baseUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify(e)})).json();if("detail"in n&&n.detail)throw new Error(`${n.detail}`);return n.data.map(({embedding:o})=>o)}};var kQ=class extends FQ{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}};var v$r={"copilot-plus":hC,"copilot-plus-jina":kQ,openai:hC,cohereai:zX,google:GX,"azure openai":NQ,ollama:QX,"lm-studio":hC,"3rd party (openai-format)":hC},ws=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>de().plusLicenseKey,"copilot-plus-jina":()=>de().plusLicenseKey,openai:()=>de().openAIApiKey,cohereai:()=>de().cohereApiKey,google:()=>de().googleApiKey,"azure openai":()=>de().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>""};this.initialize(),bl(()=>this.initialize())}initialize(){let e=de().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=v$r[e.provider];if(!r)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return r}buildModelMap(e){t.modelMap={};let r=t.modelMap;e.forEach(n=>{if(n.enabled){if(!Object.values(oE).contains(n.provider)){console.warn(`Unknown provider: ${n.provider} for embedding model: ${n.name}`);return}let o=this.getProviderConstructor(n),i=n.apiKey||this.providerApiKeyMap[n.provider](),a=Kr(n);r[a]={hasApiKey:!!i,EmbeddingConstructor:o,vendor:n.provider}}})}static getModelName(e){let r=e;if("model"in r&&r.model)return r.model;if("modelName"in r&&r.modelName)return r.modelName;throw new Error(`Embeddings instance missing model or modelName properties: ${e}`)}getCustomModel(e){return this.activeEmbeddingModels.filter(r=>{let n=Kr(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=de();if(!t.modelMap.hasOwnProperty(e))throw new hr(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!de().isPlusUser)throw new BQ.Notice("Plus-only model, please consider upgrading to Plus to access it."),new hr("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await Ss.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new BQ.Notice("Believer-only model, please consider upgrading to Believer to access it."),new hr("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new hr(`API key is not provided for the embedding model: ${e}`);let o=await this.getEmbeddingConfig(r);try{return t.embeddingModel=new n.EmbeddingConstructor(o),t.embeddingModel}catch(i){throw new hr(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=de(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await Io(r.plusLicenseKey),timeout:1e4,batchSize:de().embeddingBatchSize,configuration:{baseURL:UI,fetch:e.enableCors?vl:void 0}},"copilot-plus-jina":{model:n,apiKey:await Io(r.plusLicenseKey),timeout:1e4,batchSize:de().embeddingBatchSize,dimensions:e.dimensions,baseUrl:UI+"/embeddings",configuration:{fetch:e.enableCors?vl:void 0}},openai:{modelName:n,apiKey:await Io(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:de().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?vl:void 0}},cohereai:{model:n,apiKey:await Io(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await Io(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await Io(e.apiKey||r.azureOpenAIApiKey),azureOpenAIApiInstanceName:e.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:e.azureOpenAIApiEmbeddingDeploymentName||r.azureOpenAIApiEmbeddingDeploymentName,azureOpenAIApiVersion:e.azureOpenAIApiVersion||r.azureOpenAIApiVersion},ollama:{baseUrl:e.baseUrl||"http://localhost:11434",model:n,truncate:!0,headers:{Authorization:`Bearer ${await Io(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await Io(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?vl:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await Io(e.apiKey||""),batchSize:de().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?vl:void 0,dangerouslyAllowBrowser:!0}}}[e.provider]||{};return{...o,...a}}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getEmbeddingConfig(o);await new(this.getProviderConstructor(o))(i).embedQuery("test")};try{return await r(!1),!0}catch(n){console.log("First ping attempt failed, trying with CORS...");try{return await r(!0),new BQ.Notice("Connection successful, but requires CORS to be enabled. Please enable CORS for this model once you add it above."),!0}catch(o){let i=`
without CORS Error: `+Pi(n)+`
with CORS Error: `+Pi(o);throw new Error(i)}}}};var N3=require("obsidian");var Evt={arabic:"ar",armenian:"am",bulgarian:"bg",danish:"dk",dutch:"nl",english:"en",finnish:"fi",french:"fr",german:"de",greek:"gr",hungarian:"hu",indian:"in",indonesian:"id",irish:"ie",italian:"it",lithuanian:"lt",nepali:"np",norwegian:"no",portuguese:"pt",romanian:"ro",russian:"ru",serbian:"rs",slovenian:"ru",spanish:"es",swedish:"se",tamil:"ta",turkish:"tr",ukrainian:"uk",sanskrit:"sk"},Pvt={dutch:/[^A-Za-zàèéìòóù0-9_'-]+/gim,english:/[^A-Za-zàèéìòóù0-9_'-]+/gim,french:/[^a-z0-9äâàéèëêïîöôùüûœç-]+/gim,italian:/[^A-Za-zàèéìòóù0-9_'-]+/gim,norwegian:/[^a-z0-9_æøåÆØÅäÄöÖüÜ]+/gim,portuguese:/[^a-z0-9à-úÀ-Ú]/gim,russian:/[^a-z0-9а-яА-ЯёЁ]+/gim,spanish:/[^a-z0-9A-Zá-úÁ-ÚñÑüÜ]+/gim,swedish:/[^a-z0-9_åÅäÄöÖüÜ-]+/gim,german:/[^a-z0-9A-ZäöüÄÖÜß]+/gim,finnish:/[^a-z0-9äöÄÖ]+/gim,danish:/[^a-z0-9æøåÆØÅ]+/gim,hungarian:/[^a-z0-9áéíóöőúüűÁÉÍÓÖŐÚÜŰ]+/gim,romanian:/[^a-z0-9ăâîșțĂÂÎȘȚ]+/gim,serbian:/[^a-z0-9čćžšđČĆŽŠĐ]+/gim,turkish:/[^a-z0-9çÇğĞıİöÖşŞüÜ]+/gim,lithuanian:/[^a-z0-9ąčęėįšųūžĄČĘĖĮŠŲŪŽ]+/gim,arabic:/[^a-z0-9أ-ي]+/gim,nepali:/[^a-z0-9अ-ह]+/gim,irish:/[^a-z0-9áéíóúÁÉÍÓÚ]+/gim,indian:/[^a-z0-9अ-ह]+/gim,armenian:/[^a-z0-9ա-ֆ]+/gim,greek:/[^a-z0-9α-ωά-ώ]+/gim,indonesian:/[^a-z0-9]+/gim,ukrainian:/[^a-z0-9а-яА-ЯіїєІЇЄ]+/gim,slovenian:/[^a-z0-9螚ȎŠ]+/gim,bulgarian:/[^a-z0-9а-яА-Я]+/gim,tamil:/[^a-z0-9அ-ஹ]+/gim,sanskrit:/[^a-z0-9A-Zāīūṛḷṃṁḥśṣṭḍṇṅñḻḹṝ]+/gim},E3=Object.keys(Evt);function Tvt(t){return t!==void 0&&E3.includes(t)?Evt[t]:void 0}var w$r=Date.now().toString().slice(5),S$r=0;var Avt=BigInt(1e3),Ivt=BigInt(1e6),Mvt=BigInt(1e9);var sOe=65535;function fi(t,e){if(e.length<sOe)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=sOe)Array.prototype.push.apply(t,e.slice(n,n+sOe))}}function jvt(t,...e){return t.replace(/%(?:(?<position>\d+)\$)?(?<width>-?\d*\.?\d*)(?<type>[dfs])/g,function(...r){let n=r[r.length-1],{width:o,type:i,position:a}=n,s=a?e[Number.parseInt(a)-1]:e.shift(),u=o===""?0:Number.parseInt(o);switch(i){case"d":return s.toString().padStart(u,"0");case"f":{let l=s,[c,d]=o.split(".").map(f=>Number.parseFloat(f));return typeof d=="number"&&d>=0&&(l=l.toFixed(d)),typeof c=="number"&&c>=0?l.toString().padStart(u,"0"):l.toString()}case"s":return u<0?s.toString().padEnd(-u," "):s.toString().padStart(u," ");default:return s}})}function x$r(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function C$r(){return typeof process<"u"&&process.release&&process.release.name==="node"}function Rvt(){return BigInt(Math.floor(performance.now()*1e6))}function u1(t){return typeof t=="number"&&(t=BigInt(t)),t<Avt?`${t}ns`:t<Ivt?`${t/Avt}\u03BCs`:t<Mvt?`${t/Ivt}ms`:`${t/Mvt}s`}function Ug(){return x$r()?Rvt():C$r()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?Rvt():BigInt(0)}function P3(){return`${w$r}-${S$r++}`}function Dk(t,e){return Object.hasOwn===void 0?Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0:Object.hasOwn(t,e)?t[e]:void 0}function Dvt(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function Nk(t){if(t.length===0)return[];if(t.length===1)return t[0];for(let r=1;r<t.length;r++)if(t[r].length<t[0].length){let n=t[0];t[0]=t[r],t[r]=n}let e=new Map;for(let r of t[0])e.set(r,1);for(let r=1;r<t.length;r++){let n=0;for(let o of t[r]){let i=e.get(o);i===r&&(e.set(o,i+1),n++)}if(n===0)return[]}return t[0].filter(r=>{let n=e.get(r);return n!==void 0&&e.set(r,0),n===t.length})}function $Q(t,e){let r={},n=e.length;for(let o=0;o<n;o++){let i=e[o],a=i.split("."),s=t,u=a.length;for(let l=0;l<u;l++)if(s=s[a[l]],typeof s=="object"){if(s!==null&&"lat"in s&&"lon"in s&&typeof s.lat=="number"&&typeof s.lon=="number"){s=r[i]=s;break}else if(!Array.isArray(s)&&s!==null&&l===u-1){s=void 0;break}}else if((s===null||typeof s!="object")&&l<u-1){s=void 0;break}typeof s<"u"&&(r[i]=s)}return r}function Lk(t,e){return $Q(t,[e])[e]}var O$r={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344};function uOe(t,e){let r=O$r[e];if(r===void 0)throw new Error(At("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function qQ(t,e){t.hits=t.hits.map(r=>({...r,document:{...r.document,...e.reduce((n,o)=>{let i=o.split("."),a=i.pop(),s=n;for(let u of i)s[u]=s[u]??{},s=s[u];return s[a]=null,n},r.document)}}))}function xs(t){return t?.constructor?.name==="AsyncFunction"}var E$r=E3.join(`
- `),P$r={NO_LANGUAGE_WITH_CUSTOM_TOKENIZER:"Do not pass the language option to create when using a custom tokenizer.",LANGUAGE_NOT_SUPPORTED:`Language "%s" is not supported.
Supported languages are:
- ${E$r}`,INVALID_STEMMER_FUNCTION_TYPE:"config.stemmer property must be a function.",MISSING_STEMMER:'As of version 1.0.0 @orama/orama does not ship non English stemmers by default. To solve this, please explicitly import and specify the "%s" stemmer from the package @orama/stemmers. See https://docs.oramasearch.com/open-source/text-analysis/stemming for more information.',CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY:"Custom stop words array must only contain strings.",UNSUPPORTED_COMPONENT:'Unsupported component "%s".',COMPONENT_MUST_BE_FUNCTION:'The component "%s" must be a function.',COMPONENT_MUST_BE_FUNCTION_OR_ARRAY_FUNCTIONS:'The component "%s" must be a function or an array of functions.',INVALID_SCHEMA_TYPE:'Unsupported schema type "%s" at "%s". Expected "string", "boolean" or "number" or array of them.',DOCUMENT_ID_MUST_BE_STRING:'Document id must be of type "string". Got "%s" instead.',DOCUMENT_ALREADY_EXISTS:'A document with id "%s" already exists.',DOCUMENT_DOES_NOT_EXIST:'A document with id "%s" does not exists.',MISSING_DOCUMENT_PROPERTY:'Missing searchable property "%s".',INVALID_DOCUMENT_PROPERTY:'Invalid document property "%s": expected "%s", got "%s"',UNKNOWN_INDEX:'Invalid property name "%s". Expected a wildcard string ("*") or array containing one of the following properties: %s',INVALID_BOOST_VALUE:"Boost value must be a number greater than, or less than 0.",INVALID_FILTER_OPERATION:"You can only use one operation per filter, you requested %d.",SCHEMA_VALIDATION_FAILURE:'Cannot insert document due schema validation failure on "%s" property.',INVALID_SORT_SCHEMA_TYPE:'Unsupported sort schema type "%s" at "%s". Expected "string" or "number".',CANNOT_SORT_BY_ARRAY:'Cannot configure sort for "%s" because it is an array (%s).',UNABLE_TO_SORT_ON_UNKNOWN_FIELD:'Unable to sort on unknown field "%s". Allowed fields: %s',SORT_DISABLED:"Sort is disabled. Please read the documentation at https://docs.oramasearch for more information.",UNKNOWN_GROUP_BY_PROPERTY:'Unknown groupBy property "%s".',INVALID_GROUP_BY_PROPERTY:'Invalid groupBy property "%s". Allowed types: "%s", but given "%s".',UNKNOWN_FILTER_PROPERTY:'Unknown filter property "%s".',INVALID_VECTOR_SIZE:'Vector size must be a number greater than 0. Got "%s" instead.',INVALID_VECTOR_VALUE:'Vector value must be a number greater than 0. Got "%s" instead.',INVALID_INPUT_VECTOR:`Property "%s" was declared as a %s-dimensional vector, but got a %s-dimensional vector instead.
Input vectors must be of the size declared in the schema, as calculating similarity between vectors of different sizes can lead to unexpected results.`,WRONG_SEARCH_PROPERTY_TYPE:'Property "%s" is not searchable. Only "string" properties are searchable.',FACET_NOT_SUPPORTED:`Facet doens't support the type "%s".`,INVALID_DISTANCE_SUFFIX:'Invalid distance suffix "%s". Valid suffixes are: cm, m, km, mi, yd, ft.',INVALID_SEARCH_MODE:'Invalid search mode "%s". Valid modes are: "fulltext", "vector", "hybrid".',MISSING_VECTOR_AND_SECURE_PROXY:"No vector was provided and no secure proxy was configured. Please provide a vector or configure an Orama Secure Proxy to perform hybrid search.",MISSING_TERM:'"term" is a required parameter when performing hybrid search. Please provide a search term.',INVALID_VECTOR_INPUT:'Invalid "vector" property. Expected an object with "value" and "property" properties, but got "%s" instead.',PLUGIN_CRASHED:"A plugin crashed during initialization. Please check the error message for more information:",PLUGIN_SECURE_PROXY_NOT_FOUND:`Could not find '@orama/secure-proxy-plugin' installed in your Orama instance.
Please install it before proceeding with creating an answer session.
Read more at https://docs.orama.com/open-source/plugins/plugin-secure-proxy
`,PLUGIN_SECURE_PROXY_MISSING_CHAT_MODEL:`Could not find a chat model defined in the secure proxy plugin configuration.
Please provide a chat model before proceeding with creating an answer session.
Read more at https://docs.orama.com/open-source/plugins/plugin-secure-proxy
`,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:"The last message in the session is not an assistant message. Cannot regenerate non-assistant messages."};function At(t,...e){let r=new Error(jvt(P$r[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}function Nvt(t){return{raw:Number(t),formatted:u1(t)}}function Lvt(t){if(t.id){if(typeof t.id!="string")throw At("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return P3()}function lOe(t,e){for(let[r,n]of Object.entries(e)){let o=t[r];if(!(typeof o>"u")&&!(n==="geopoint"&&typeof o=="object"&&typeof o.lon=="number"&&typeof o.lat=="number")&&!(n==="enum"&&(typeof o=="string"||typeof o=="number"))){if(n==="enum[]"&&Array.isArray(o)){let i=o.length;for(let a=0;a<i;a++)if(typeof o[a]!="string"&&typeof o[a]!="number")return r+"."+a;continue}if(yC(n)){let i=dOe(n);if(!Array.isArray(o)||o.length!==i)throw At("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(Fk(n)){if(!Array.isArray(o))return r;let i=cOe(n),a=o.length;for(let s=0;s<a;s++)if(typeof o[s]!==i)return r+"."+s;continue}if(typeof n=="object"){if(!o||typeof o!="object")return r;let i=lOe(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}var T$r={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},A$r={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"};function Fvt(t){return t==="geopoint"}function yC(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function Fk(t){return typeof t=="string"&&T$r[t]}function cOe(t){return A$r[t]}function dOe(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw At("INVALID_VECTOR_VALUE",t);case e<=0:throw At("INVALID_VECTOR_SIZE",t);default:return e}}function kvt(){return{idToInternalId:new Map,internalIdToId:[],save:I$r,load:M$r}}function I$r(t){return{internalIdToId:t.internalIdToId}}function M$r(t,e){let{internalIdToId:r}=e;t.internalDocumentIDStore.idToInternalId.clear(),t.internalDocumentIDStore.internalIdToId=[];let n=r.length;for(let o=0;o<n;o++){let i=r[o];t.internalDocumentIDStore.idToInternalId.set(i,o+1),t.internalDocumentIDStore.internalIdToId.push(i)}}function Go(t,e){if(typeof e=="string"){let r=t.idToInternalId.get(e);if(r)return r;let n=t.idToInternalId.size+1;return t.idToInternalId.set(e,n),t.internalIdToId.push(e),n}return e>t.internalIdToId.length?Go(t,e.toString()):e}function ah(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}function j$r(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function D$r(t,e){let r=Go(t.sharedInternalDocumentStore,e);return t.docs[r]}function N$r(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=Go(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function L$r(t){return t.docs}function F$r(t,e,r){let n=Go(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function k$r(t,e){let r=Go(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function B$r(t){return t.count}function $$r(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function q$r(t){return{docs:t.docs,count:t.count}}function Bvt(){return{create:j$r,get:D$r,getMultiple:N$r,getAll:L$r,store:F$r,remove:k$r,count:B$r,load:$$r,save:q$r}}var $vt=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"];function qvt(t,e){let r=[],n=t.plugins?.length;if(!n)return r;for(let o=0;o<n;o++)try{let i=t.plugins[o];typeof i[e]=="function"&&r.push(i[e])}catch(i){throw console.error("Caught error in getAllPluginsByHook:",i),At("PLUGIN_CRASHED")}return r}var Uvt=["tokenizer","index","documentsStore","sorter"],fOe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"];function zg(t,e,r,n){if(t.some(xs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function l1(t,e,r){if(t.some(xs))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function kk(t,e,r,n,o){if(t.some(xs))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function Bk(t,e,r,n){if(t.some(xs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function zvt(t,e){if(t.some(xs))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}function pOe(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(sh(t.l),sh(t.r))+1,e.h=Math.max(sh(e.l),sh(e.r))+1,e}function mOe(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(sh(t.l),sh(t.r))+1,e.h=Math.max(sh(e.l),sh(e.r))+1,e}function Vvt(t,e,r){let n=[];function o(i){i!==null&&(e<i.k&&o(i.l),i.k>=e&&i.k<=r&&fi(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function hOe(t,e,r=!1){let n=[];if(t===null)return n;let o=[t.root];for(;o.length>0;){let i=o.pop();i&&(r&&i.k>=e&&fi(n,i.v),!r&&i.k>e&&fi(n,i.v),o.push(i.r),o.push(i.l))}return n}function gOe(t,e,r=!1){let n=[];if(t===null)return n;let o=[t.root];for(;o.length>0;){let i=o.pop();i&&(r&&i.k<=e&&fi(n,i.v),!r&&i.k<e&&fi(n,i.v),o.push(i.r),o.push(i.l))}return n}function Wvt(t,e){for(;t!==null;)if(e<t.k)t=t.l;else if(e>t.k)t=t.r;else return t;return null}function Kvt(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}var Hvt=0;function Jvt(t,e,r,n=500){function o(i,a,s){if(i===null)return Hvt++,{k:a,v:s,l:null,r:null,h:0};if(a<i.k)i.l=o(i.l,a,s);else if(a>i.k)i.r=o(i.r,a,s);else return i.v.push(...s),i;return Hvt%n===0?z$r(i,a):i}t.root=o(t.root,e,r)}function z$r(t,e){t.h=1+Math.max(sh(t.l),sh(t.r));let r=sh(t.l)-sh(t.r);return r>1&&e<t.l.k?mOe(t):r<-1&&e>t.r.k?pOe(t):r>1&&e>t.l.k?(t.l=pOe(t.l),mOe(t)):r<-1&&e<t.r.k?(t.r=mOe(t.r),pOe(t)):t}function sh(t){return t!==null?t.h:-1}function Gvt(t,e){let r=Wvt(t.root,e);return r===null?null:r.v}function H$r(t,e){if(t===null||t.root===null)return;let r=t.root,n=null;for(;r!=null&&r.k!==e;)n=r,e<r.k?r=r.l:r=r.r;if(r===null)return;(()=>{if(r.l===null&&r.r===null)n===null?t.root=null:n.l===r?n.l=null:n.r=null;else if(r.l!=null&&r.r!=null){let i=r.r,a=r;for(;i.l!=null;)a=i,i=i.l;r.k=i.k,a===r?a.r=i.r:a.l=i.r}else{let i=r.l!=null?r.l:r.r;n===null?t.root=i:n.l===r?n.l=i:n.r=i}})()}function Yvt(t,e,r){let n=Wvt(t.root,r);if(n){if(n.v.length===1){H$r(t,r);return}n.v.splice(n.v.indexOf(e),1)}}function Zvt(){return{numberToDocumentId:new Map}}function Xvt(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function Qvt(t,e,r){t?.numberToDocumentId.set(r,t?.numberToDocumentId.get(r)?.filter(n=>n!==e)??[]),t?.numberToDocumentId.get(r)?.length===0&&t?.numberToDocumentId.delete(r)}function e0t(t,e){let r=Object.keys(e);if(r.length!==1)throw new Error("Invalid operation");let n=r[0];switch(n){case"eq":{let o=e[n];return t.numberToDocumentId.get(o)??[]}case"in":{let o=e[n],i=[];for(let a of o){let s=t.numberToDocumentId.get(a);s!=null&&fi(i,s)}return i}case"nin":{let o=e[n],i=[],a=t.numberToDocumentId.keys();for(let s of a){if(o.includes(s))continue;let u=t.numberToDocumentId.get(s);u!=null&&fi(i,u)}return i}}throw new Error("Invalid operation")}function t0t(t,e){let r=Object.keys(e);if(r.length!==1)throw new Error("Invalid operation");let n=r[0];switch(n){case"containsAll":{let i=e[n].map(a=>t.numberToDocumentId.get(a)??[]);return Nk(i)}}throw new Error("Invalid operation")}function V$r(t,e,r){if(r<0)return-1;if(t===e)return 0;let n=t.length,o=e.length;if(n===0)return o<=r?o:-1;if(o===0)return n<=r?n:-1;if(t=t.toLowerCase(),e=e.toLowerCase(),e.startsWith(t)||t.startsWith(e))return 0;if(Math.abs(n-o)>r)return-1;let i=[];for(let a=0;a<=n;a++){i[a]=[a];for(let s=1;s<=o;s++)i[a][s]=a===0?s:0}for(let a=1;a<=n;a++){let s=1/0;for(let u=1;u<=o;u++)t[a-1]===e[u-1]?i[a][u]=i[a-1][u-1]:i[a][u]=Math.min(i[a-1][u]+1,i[a][u-1]+1,i[a-1][u-1]+1),s=Math.min(s,i[a][u]);if(s>r)return-1}return i[n][o]<=r?i[n][o]:-1}function yOe(t,e,r){let n=V$r(t,e,r);return{distance:n,isBounded:n>=0}}var bOe=class{constructor(e,r,n){Wl(this,"k");Wl(this,"s");Wl(this,"c",{});Wl(this,"d",[]);Wl(this,"e");Wl(this,"w","");this.k=e,this.s=r,this.e=n}toJSON(){return{w:this.w,s:this.s,c:this.c,d:this.d,e:this.e}}};function $k(t,e){t.w=e.w+t.s}function UQ(t,e){t.d.push(e)}function W$r(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function _Oe(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(Dk(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&yOe(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),Dk(e,i)!=null&&a.length>0){let s=new Set(e[i]),u=a.length;for(let l=0;l<u;l++)s.add(a[l]);e[i]=Array.from(s)}}for(let i of Object.keys(t.c))_Oe(t.c[i],e,r,n,o);return e}function r0t(t,e){let r="",n=Math.min(t.length,e.length);for(let o=0;o<n;o++){if(t[o]!==e[o])return r;r+=t[o]}return r}function c1(t=!1,e="",r=""){return new bOe(r,e,t)}function n0t(t,e,r){let n=e.length;for(let o=0;o<n;o++){let i=e[o],a=e.substring(o),s=t.c[i];if(s){let u=s.s,l=u.length,c=r0t(u,a),d=c.length;if(u===a){UQ(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=c1(!0,a,i);p.c[f]=s;let m=p.c[f];m.s=u.substring(d),m.k=f,t.c[i]=p,$k(p,t),$k(m,p),UQ(p,r);return}if(d<l&&d<a.length){let p=c1(!1,c,i);p.c[f]=s,t.c[i]=p;let m=p.c[f];m.s=u.substring(d),m.k=f;let h=a[d],v=c1(!0,e.substring(o+d),h);UQ(v,r),p.c[h]=v,$k(p,t),$k(v,p),$k(m,p);return}o+=l-1,t=s}else{let u=c1(!0,a,i);UQ(u,r),t.c[i]=u,$k(u,t);return}}}function T3(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){_Oe(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(yOe(e,a,o).isBounded&&(i[a]=[]),Dk(i,a)!=null&&s.length>0)){let u=new Set(i[a]),l=s.length;for(let c=0;c<l;c++)u.add(s[c]);i[a]=Array.from(u)}}if(!(r>=e.length)){e[r]in t.c&&T3(t.c[e[r]],e,r+1,n,o,i),T3(t,e,r+1,n-1,o,i);for(let a in t.c)T3(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&T3(t.c[a],e,r+1,n-1,o,i)}}}function vOe(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,T3(t,e,0,n||0,n,o),o}else{let o=e.length;for(let a=0;a<o;a++){let s=e[a];if(s in t.c){let u=t.c[s],l=u.s,c=e.substring(a),f=r0t(l,c).length;if(f!==l.length&&f!==c.length){if(n)break;return{}}a+=u.s.length-1,t=u}else return{}}let i={};return _Oe(t,i,e,r,n),i}}function o0t(t,e,r,n=!0){if(!e)return!0;let o=e.length;for(let i=0;i<o;i++){let a=e[i];if(a in t.c){let s=t.c[a];i+=s.s.length-1,t=s,n&&t.w!==e||W$r(t,r)}else return!1}return!0}function i0t(){return{root:null}}function a0t(t,e,r){let n={point:e,docIDs:r};if(t.root==null){t.root=n;return}let o=t.root,i=0;for(;o!==null;){if(o.point.lon===e.lon&&o.point.lat===e.lat){let s=o.docIDs??[];o.docIDs=Array.from(new Set([...s,...r||[]]));return}if(i%2===0)if(e.lon<o.point.lon){if(o.left==null){o.left=n;return}o=o.left}else{if(o.right==null){o.right=n;return}o=o.right}else if(e.lat<o.point.lat){if(o.left==null){o.left=n;return}o=o.left}else{if(o.right==null){o.right=n;return}o=o.right}i++}}function s0t(t,e,r){let n=t.root,o=0,i=null,a=null;for(;n!==null;){if(n?.point.lon===e.lon&&n.point.lat===e.lat){let u=n.docIDs?.indexOf(r);if(u!==void 0&&u>-1){n.docIDs?.splice(u,1),(n.docIDs==null||n.docIDs.length===0)&&(i!=null?a==="left"?i.left=n.left!==null?n.left:n.right:a==="right"&&(i.right=n.right!==null?n.right:n.left):t.root=n.left!==null?n.left:n.right);return}}let s=o%2;i=n,s===0?e.lon<n.point.lon?(n=n?.left,a="left"):(n=n?.right,a="right"):e.lat<n.point.lat?(n=n?.left,a="left"):(n=n?.right,a="right"),o++}}function u0t(t,e,r,n=!0,o="asc",i=!1){let a=i?d0t:c0t,s=[{node:t,depth:0}],u=[];for(;s.length>0;){let{node:l,depth:c}=s.pop();if(l===null)continue;let d=a(e,l.point);(n?d<=r:d>r)&&u.push({point:l.point,docIDs:l.docIDs??[]}),l.left!=null&&s.push({node:l.left,depth:c+1}),l.right!=null&&s.push({node:l.right,depth:c+1})}return o&&u.sort((l,c)=>{let d=a(e,l.point),f=a(e,c.point);return o.toLowerCase()==="asc"?d-f:f-d}),u}function l0t(t,e,r=!0,n=null,o=!1){let i=[{node:t,depth:0}],a=[];for(;i.length>0;){let u=i.pop();if(u==null||u.node==null)continue;let{node:l,depth:c}=u,d=c+1;l.left!=null&&i.push({node:l.left,depth:d}),l.right!=null&&i.push({node:l.right,depth:d});let f=J$r(e,l.point);f&&r?a.push({point:l.point,docIDs:l.docIDs??[]}):!f&&!r&&a.push({point:l.point,docIDs:l.docIDs??[]})}let s=K$r(e);if(n){let u=o?d0t:c0t;a.sort((l,c)=>{let d=u(s,l.point),f=u(s,c.point);return n.toLowerCase()==="asc"?d-f:f-d})}return a}function K$r(t){let e=0,r=0,n=0,o=t.length;for(let a=0,s=o-1;a<o;s=a++){let u=t[a].lon,l=t[a].lat,c=t[s].lon,d=t[s].lat,f=u*d-c*l;e+=f,r+=(u+c)*f,n+=(l+d)*f}e/=2;let i=6*e;return r/=i,n/=i,{lon:r,lat:n}}function J$r(t,e){let r=!1,n=e.lon,o=e.lat,i=t.length;for(let a=0,s=i-1;a<i;s=a++){let u=t[a].lon,l=t[a].lat,c=t[s].lon,d=t[s].lat;l>o!=d>o&&n<(c-u)*(o-l)/(d-l)+u&&(r=!r)}return r}function c0t(t,e){let r=Math.PI/180,n=t.lat*r,o=e.lat*r,i=(e.lat-t.lat)*r,a=(e.lon-t.lon)*r,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(o)*Math.sin(a/2)*Math.sin(a/2);return 6371e3*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}function d0t(t,e){let n=.0033528106647474805,o=(1-n)*6378137,i=Math.PI/180,a=t.lat*i,s=e.lat*i,u=(e.lon-t.lon)*i,l=Math.atan((1-n)*Math.tan(a)),c=Math.atan((1-n)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(c),m=Math.cos(c),h=u,v,g=1e3,_,w,x,C,P;do{let L=Math.sin(h),k=Math.cos(h);x=Math.sqrt(m*L*(m*L)+(f*p-d*m*k)*(f*p-d*m*k)),C=d*p+f*m*k,P=Math.atan2(x,C),_=f*m*L/x,w=1-_*_;let F=C-2*d*p/w,$=n/16*w*(4+n*(4-3*w));v=h,h=u+(1-$)*n*_*(P+$*x*(F+$*C*(-1+2*F*F)))}while(Math.abs(h-v)>1e-12&&--g>0);let E=w*(6378137*6378137-o*o)/(o*o),A=1+E/16384*(4096+E*(-768+E*(320-175*E))),M=E/1024*(256+E*(-128+E*(74-47*E))),R=M*x*(C-2*d*p/w+M/4*(C*(-1+2*x*x)-M/6*P*(-3+4*x*x)*(-3+4*P*P)));return o*A*(P-R)}function zQ(t,e,r=0,n){if(e===0)throw At("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let h=0;h<i;h++){let v=t[h],g=v.length;for(let _=0;_<g;_++){let[w,x]=v[_],C=x*e,P=o.get(w)?.[0];P!==void 0?o.set(w,[P*1.5+C,(o?.get(w)?.[1]||0)+1]):o.set(w,[C,1])}}let a=[];for(let h of o.entries())a.push([h[0],h[1][0]]);let s=a.sort((h,v)=>v[1]-h[1]);if(r===1)return s;let u=s.length,l=[];for(let h of o.entries())l.push([h[0],h[1][0],h[1][1]]);let c=l.sort((h,v)=>h[2]>v[2]?-1:h[2]<v[2]?1:h[1]>v[1]?-1:h[1]<v[1]?1:0),d;for(let h=0;h<u&&c[h][2]===n;h++)d=h;if(typeof d>"u"){if(r===0)return[];d=0}let f=c.length,p=new Array(f);for(let h=0;h<f;h++)p[h]=[c[h][0],c[h][1]];if(r===0)return p.slice(0,d+1);let m=d+Math.ceil(r*100*(u-d)/100);return p.slice(0,u+m)}function wOe(t,e,r,n,o,{k:i,b:a,d:s}){return Math.log(1+(r-e+.5)/(e+.5))*(s+t*(i+1))/(t+i*(1-a+a*n/o))}function SOe(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function HQ(t,e,r,n=.8){let o=SOe(t,r),i=[];for(let[a,[s,u]]of Object.entries(e)){let l=0;for(let d=0;d<r;d++)l+=t[d]*u[d];let c=l/(o*s);c>=n&&i.push([a,c])}return i.sort((a,s)=>s[1]-a[1])}function G$r(t,e,r,n,o){let i=Go(t.sharedInternalDocumentStore,r);t.avgFieldLength[e]=((t.avgFieldLength[e]??0)*(o-1)+n.length)/o,t.fieldLengths[e][i]=n.length,t.frequencies[e][i]={}}function Y$r(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=Go(t.sharedInternalDocumentStore,r),s=i/n.length;t.frequencies[e][a][o]=s,o in t.tokenOccurrences[e]||(t.tokenOccurrences[e][o]=0),t.tokenOccurrences[e][o]=(t.tokenOccurrences[e][o]??0)+1}function Z$r(t,e,r,n){let o=Go(t.sharedInternalDocumentStore,r);n>1?t.avgFieldLength[e]=(t.avgFieldLength[e]*n-t.fieldLengths[e][o])/(n-1):t.avgFieldLength[e]=void 0,t.fieldLengths[e][o]=void 0,t.frequencies[e][o]=void 0}function X$r(t,e,r){t.tokenOccurrences[e][r]--}function Q$r(t,e,r,n,o){let i=Array.from(o),a=e.avgFieldLength[r],s=e.fieldLengths[r],u=e.tokenOccurrences[r],l=e.frequencies[r],c=typeof u[n]=="number"?u[n]??0:0,d=[],f=i.length;for(let p=0;p<f;p++){let m=Go(e.sharedInternalDocumentStore,i[p]),h=l?.[m]?.[n]??0,v=wOe(h,c,t.docsCount,s[m],a,t.params.relevance);d.push([m,v])}return d}function p0t(t,e,r,n,o=""){n||(n={sharedInternalDocumentStore:e,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}});for(let[i,a]of Object.entries(r)){let s=`${o}${o?".":""}${i}`;if(typeof a=="object"&&!Array.isArray(a)){p0t(t,e,a,n,s);continue}if(yC(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:dOe(a),vectors:{}};else{let u=/\[/.test(a);switch(a){case"boolean":case"boolean[]":n.indexes[s]={type:"Bool",node:{true:[],false:[]},isArray:u};break;case"number":case"number[]":n.indexes[s]={type:"AVL",node:Kvt(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:c1(),isArray:u},n.avgFieldLength[s]=0,n.frequencies[s]={},n.tokenOccurrences[s]={},n.fieldLengths[s]={};break;case"enum":case"enum[]":n.indexes[s]={type:"Flat",node:Zvt(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:i0t(),isArray:u};break;default:throw At("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function eqr(t,e,r,n,o,i,a,s){return u=>{let l=Go(e.sharedInternalDocumentStore,n),{type:c,node:d}=e.indexes[r];switch(c){case"Bool":{d[u?"true":"false"].push(l);break}case"AVL":{let f=s?.avlRebalanceThreshold??1;Jvt(d,u,[l],f);break}case"Radix":{let f=i.tokenize(u,o,r);t.insertDocumentScoreParameters(e,r,l,f,a);for(let p of f)t.insertTokenScoreParameters(e,r,l,f,p),n0t(d,p,l);break}case"Flat":{Xvt(d,u,l);break}case"BKD":{a0t(d,u,[l]);break}}}}function tqr(t,e,r,n,o,i,a,s,u,l){if(yC(i))return rqr(e,r,o,n);let c=eqr(t,e,r,n,a,s,u,l);if(!Fk(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function rqr(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=SOe(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function f0t(t,e,r,n,o,i,a,s,u){let l=Go(e.sharedInternalDocumentStore,n);if(yC(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return Yvt(d,l,o),!0;case"Bool":{let p=d[o?"true":"false"].indexOf(l);return d[o?"true":"false"].splice(p,1),!0}case"Radix":{let f=s.tokenize(o,a,r);t.removeDocumentScoreParameters(e,r,n,u);for(let p of f)t.removeTokenScoreParameters(e,r,p),o0t(d,p,l);return!0}case"Flat":return Qvt(d,l,o),!0;case"BKD":return s0t(d,o,l),!1}}function nqr(t,e,r,n,o,i,a,s,u){if(!Fk(i))return f0t(t,e,r,n,o,i,a,s,u);let l=cOe(i),c=o,d=c.length;for(let f=0;f<d;f++)f0t(t,e,r,n,c[f],l,a,s,u);return!0}function oqr(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw At("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=vOe(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(Dk(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function iqr(t,e,r){let n=Object.keys(r),o=n.reduce((i,a)=>({[a]:[],...i}),{});for(let i of n){let a=r[i];if(typeof e.indexes[i]>"u")throw At("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];fi(o[i],f);continue}if(u==="BKD"){let d;if("radius"in a)d="radius";else if("polygon"in a)d="polygon";else throw new Error(`Invalid operation ${a}`);if(d==="radius"){let{value:f,coordinates:p,unit:m="m",inside:h=!0,highPrecision:v=!1}=a[d],g=uOe(f,m),_=u0t(s.root,p,g,h,void 0,v);fi(o[i],_.flatMap(({docIDs:w})=>w))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=l0t(s.root,f,p,void 0,m);fi(o[i],h.flatMap(({docIDs:v})=>v))}continue}if(u==="Radix"&&(typeof a=="string"||Array.isArray(a))){for(let d of[a].flat()){let f=t.tokenizer.tokenize(d,t.language,i);for(let p of f){let m=vOe(s,{term:p,exact:!0});fi(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw At("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?t0t:e0t;fi(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=hOe(s,f,!1);break}case"gte":{p=hOe(s,f,!0);break}case"lt":{p=gOe(s,f,!1);break}case"lte":{p=gOe(s,f,!0);break}case"eq":{p=Gvt(s,f)??[];break}case"between":{let[m,h]=f;p=Vvt(s,m,h);break}}fi(o[i],p)}}return Nk(Object.values(o))}function aqr(t){return t.searchableProperties}function sqr(t){return t.searchablePropertiesWithTypes}function m0t(t){let e=c1(t.e,t.s,t.k);e.d=t.d,e.w=t.w;for(let r of Object.keys(t.c))e.c[r]=m0t(t.c[r]);return e}function uqr(t){return{numberToDocumentId:new Map(t)}}function lqr(t){return Array.from(t.numberToDocumentId.entries())}function cqr(t,e){let{indexes:r,vectorIndexes:n,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}=e,c={},d={};for(let f of Object.keys(r)){let{node:p,type:m,isArray:h}=r[f];switch(m){case"Radix":c[f]={type:"Radix",node:m0t(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:uqr(p),isArray:h};break;default:c[f]=r[f]}}for(let f of Object.keys(n)){let p=n[f].vectors;for(let m in p)p[m]=[p[m][0],new Float32Array(p[m][1])];d[f]={size:n[f].size,vectors:p}}return{sharedInternalDocumentStore:t,indexes:c,vectorIndexes:d,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:s,avgFieldLength:u,fieldLengths:l}}function dqr(t){let{indexes:e,vectorIndexes:r,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}=t,l={};for(let d of Object.keys(r)){let f=r[d].vectors;for(let p in f)f[p]=[f[p][0],Array.from(f[p][1])];l[d]={size:r[d].size,vectors:f}}let c={};for(let d of Object.keys(e)){let{type:f,node:p,isArray:m}=e[d];if(f!=="Flat"){c[d]=e[d];continue}c[d]={type:"Flat",node:lqr(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function h0t(){return{create:p0t,insert:tqr,remove:nqr,insertDocumentScoreParameters:G$r,insertTokenScoreParameters:Y$r,removeDocumentScoreParameters:Z$r,removeTokenScoreParameters:X$r,calculateResultScores:Q$r,search:oqr,searchByWhereClause:iqr,getSearchableProperties:aqr,getSearchablePropertiesWithTypes:sqr,load:cqr,save:dqr}}function g0t(t,e,r,n,o){let i={language:t.tokenizer.language,sharedInternalDocumentStore:e,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[a,s]of Object.entries(r)){let u=`${o}${o?".":""}${a}`;if(!n.includes(u)){if(typeof s=="object"&&!Array.isArray(s)){let l=g0t(t,e,s,n,u);fi(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!yC(s))switch(s){case"boolean":case"number":case"string":i.sortableProperties.push(u),i.sortablePropertiesWithTypes[u]=s,i.sorts[u]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:s};break;case"geopoint":case"enum":continue;case"enum[]":case"boolean[]":case"number[]":case"string[]":continue;default:throw At("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function pqr(t,e,r,n){return n?.enabled!==!1?g0t(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function mqr(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=Go(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&xOe(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function y0t(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)bqr(t,r);t.isSorted=!0}function hqr(t,e,r){return e[1].localeCompare(r[1],Tvt(t))}function gqr(t,e){return t[1]-e[1]}function yqr(t,e){return e[1]?-1:1}function bqr(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=hqr.bind(null,t.language);break;case"number":n=gqr.bind(null);break;case"boolean":n=yqr.bind(null);break}r.orderedDocs.sort(n);let o=r.orderedDocs.length;for(let i=0;i<o;i++){let a=r.orderedDocs[i][0];r.docs.set(a,i)}}function _qr(t){let e=Object.keys(t.sorts);for(let r of e)xOe(t,r)}function xOe(t,e){let r=t.sorts[e];r.orderedDocsToRemove.size&&(r.orderedDocs=r.orderedDocs.filter(n=>!r.orderedDocsToRemove.has(n[0])),r.orderedDocsToRemove.clear())}function vqr(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=Go(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function wqr(t,e,r){if(!t.enabled)throw At("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw At("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return xOe(t,n),y0t(t),e.sort((a,s)=>{let u=i.docs.get(Go(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(Go(t.sharedInternalDocumentStore,s[0])),c=typeof u<"u",d=typeof l<"u";return!c&&!d?0:c?d?o?l-u:u-l:-1:1}),e}function Sqr(t){return t.enabled?t.sortableProperties:[]}function xqr(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function Cqr(t,e){let r=e;if(!r.enabled)return{enabled:!1};let n=Object.keys(r.sorts).reduce((o,i)=>{let{docs:a,orderedDocs:s,type:u}=r.sorts[i];return o[i]={docs:new Map(Object.entries(a).map(([l,c])=>[+l,c])),orderedDocsToRemove:new Map,orderedDocs:s,type:u},o},{});return{sharedInternalDocumentStore:t,language:r.language,sortableProperties:r.sortableProperties,sortablePropertiesWithTypes:r.sortablePropertiesWithTypes,sorts:n,enabled:!0,isSorted:r.isSorted}}function Oqr(t){if(!t.enabled)return{enabled:!1};_qr(t),y0t(t);let e=Object.keys(t.sorts).reduce((r,n)=>{let{docs:o,orderedDocs:i,type:a}=t.sorts[n];return r[n]={docs:Object.fromEntries(o.entries()),orderedDocs:i,type:a},r},{});return{language:t.language,sortableProperties:t.sortableProperties,sortablePropertiesWithTypes:t.sortablePropertiesWithTypes,sorts:e,enabled:t.enabled,isSorted:t.isSorted}}function b0t(){return{create:pqr,insert:mqr,remove:vqr,save:Oqr,load:Cqr,sortBy:wqr,getSortableProperties:Sqr,getSortablePropertiesWithTypes:xqr}}var Pqr=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115];function Tqr(t){return t<192||t>383?t:Pqr[t-192]||t}function _0t(t){let e=[];for(let r=0;r<t.length;r++)e[r]=Tqr(t.charCodeAt(r));return String.fromCharCode(...e)}var Aqr={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},Iqr={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},Mqr="[^aeiou]",WQ="[aeiouy]",rS=Mqr+"[^aeiouy]*",A3=WQ+"[aeiou]*",COe="^("+rS+")?"+A3+rS,Rqr="^("+rS+")?"+A3+rS+"("+A3+")?$",VQ="^("+rS+")?"+A3+rS+A3+rS,v0t="^("+rS+")?"+WQ;function w0t(t){let e,r,n,o,i,a;if(t.length<3)return t;let s=t.substring(0,1);if(s=="y"&&(t=s.toUpperCase()+t.substring(1)),n=/^(.+?)(ss|i)es$/,o=/^(.+?)([^s])s$/,n.test(t)?t=t.replace(n,"$1$2"):o.test(t)&&(t=t.replace(o,"$1$2")),n=/^(.+?)eed$/,o=/^(.+?)(ed|ing)$/,n.test(t)){let u=n.exec(t);n=new RegExp(COe),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(v0t),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+rS+WQ+"[^aeiouwxy]$"),o.test(t)?t=t+"e":i.test(t)?(n=/.$/,t=t.replace(n,"")):a.test(t)&&(t=t+"e")));if(n=/^(.+?)y$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(v0t),e&&n.test(e)&&(t=e+"i")),n=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,n.test(t)){let u=n.exec(t);e=u?.[1],r=u?.[2],n=new RegExp(COe),e&&n.test(e)&&(t=e+Aqr[r])}if(n=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,n.test(t)){let u=n.exec(t);e=u?.[1],r=u?.[2],n=new RegExp(COe),e&&n.test(e)&&(t=e+Iqr[r])}if(n=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,o=/^(.+?)(s|t)(ion)$/,n.test(t))e=n.exec(t)?.[1],n=new RegExp(VQ),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(VQ),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(VQ),o=new RegExp(Rqr),i=new RegExp("^"+rS+WQ+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(VQ),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}function OOe(t,e){let r=`${this.language}:${t}:${e}`;return this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(e)?(this.normalizationCache.set(r,""),""):(this.stemmer&&!this.stemmerSkipProperties.has(t)&&(e=this.stemmer(e)),e=_0t(e),this.normalizationCache.set(r,e),e)}function jqr(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function S0t(t,e,r){if(e&&e!==this.language)throw At("LANGUAGE_NOT_SUPPORTED",e);if(typeof t!="string")return[t];let n;if(r&&this.tokenizeSkipProperties.has(r))n=[this.normalizeToken.bind(this,r??"")(t)];else{let i=Pvt[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=jqr(n);return this.allowDuplicates?o:Array.from(new Set(o))}function EOe(t={}){if(!t.language)t.language="english";else if(!E3.includes(t.language))throw At("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw At("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=w0t;else throw At("MISSING_STEMMER",t.language);let r;if(t.stopWords!==!1){if(r=[],Array.isArray(t.stopWords))r=t.stopWords;else if(typeof t.stopWords=="function")r=t.stopWords(r);else if(t.stopWords)throw At("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw At("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw At("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:S0t,language:t.language,stemmer:e,stemmerSkipProperties:new Set(t.stemmerSkipProperties?[t.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(t.tokenizeSkipProperties?[t.tokenizeSkipProperties].flat():[]),stopWords:r,allowDuplicates:!!t.allowDuplicates,normalizeToken:OOe,normalizationCache:new Map};return n.tokenize=S0t.bind(n),n.normalizeToken=OOe,n}function Nqr(t){let e={formatElapsedTime:Nvt,getDocumentIndexId:Lvt,getDocumentProperties:$Q,validateSchema:lOe};for(let r of fOe){let n=r;if(t[n]){if(typeof t[n]!="function")throw At("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!Uvt.includes(r)&&!fOe.includes(r))throw At("UNSUPPORTED_COMPONENT",r)}function qk({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=P3());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=EOe(a):a=EOe({language:r??"english"}),n.tokenizer&&r)throw At("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=kvt();s||(s=h0t()),l||(l=b0t()),u||(u=Bvt()),Nqr(n);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:m}=n,h={data:{},caches:{},schema:t,tokenizer:a,index:s,sorter:l,documentsStore:u,internalDocumentIDStore:c,getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],afterUpdateMultiple:[],beforeUpdateMultiple:[],afterCreate:[],formatElapsedTime:m,id:o,plugins:i,version:Lqr()};h.data={index:h.index.create(h,c,t),docs:h.documentsStore.create(h,c),sorting:h.sorter.create(h,c,t,e)};for(let g of $vt)h[g]=(h[g]??[]).concat(qvt(h,g));let v=h.afterCreate;return v&&zvt(v,h),h}function Lqr(){return"{{VERSION}}"}var KQ="fulltext",POe="hybrid",TOe="vector";var cT=Symbol("orama.insertions"),dT=Symbol("orama.removals");var x0t=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)};function AOe(t){typeof t[cT]!="number"&&(queueMicrotask(()=>{t[cT]=void 0}),t[cT]=0),t[cT]>1e3?(x0t("Orama's insert operation is synchronous. Please avoid inserting a large number of document in a single operation in order not to block the main thread or, in alternative, please use insertMultiple.",{code:"ORAMA0001"}),t[cT]=-1):t[cT]>=0&&t[cT]++}function IOe(t){typeof t[dT]!="number"&&(queueMicrotask(()=>{t[dT]=void 0}),t[dT]=0),t[dT]>1e3?(x0t("Orama's remove operation is synchronous. Please avoid removing a large number of document in a single operation in order not to block the main thread, in alternative, please use updateMultiple.",{code:"ORAMA0002"}),t[dT]=-1):t[dT]>=0&&t[dT]++}function I3(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw At("SCHEMA_VALIDATION_FAILURE",i);return xs(t.index.beforeInsert)||xs(t.index.insert)||xs(t.index.afterInsert)?$qr(t,e,r,n,o):qqr(t,e,r,n,o)}var kqr=new Set(["enum","enum[]"]),Bqr=new Set(["string","number"]);async function $qr(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw At("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw At("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await zg(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];C0t(m,h,f,p)}return await Uqr(t,s,l,d,u,r,e,o),n||await zg(t.afterInsert,t,s,e),AOe(t),s}function qqr(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw At("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw At("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||zg(t.beforeInsert,t,s,e);let l=t.index.getSearchableProperties(i),c=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,l);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=c[f];C0t(m,h,f,p)}return zqr(t,s,l,d,u,r,e,o),n||zg(t.afterInsert,t,s,e),AOe(t),s}function C0t(t,e,r,n){if(!(Fvt(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(yC(e)&&Array.isArray(n))&&!(Fk(e)&&Array.isArray(n))&&!(kqr.has(e)&&Bqr.has(t))&&t!==e)throw At("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function Uqr(t,e,r,n,o,i,a,s){for(let c of r){let d=n[c];if(typeof d>"u")continue;let f=t.index.getSearchablePropertiesWithTypes(t.data.index)[c];await t.index.beforeInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o),await t.index.insert(t.index,t.data.index,c,e,d,f,i,t.tokenizer,o,s),await t.index.afterInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o)}let u=t.sorter.getSortableProperties(t.data.sorting),l=t.getDocumentProperties(a,u);for(let c of u){let d=l[c];if(typeof d>"u")continue;let f=t.sorter.getSortablePropertiesWithTypes(t.data.sorting)[c];t.sorter.insert(t.data.sorting,c,e,d,f,i)}}function zqr(t,e,r,n,o,i,a,s){for(let c of r){let d=n[c];if(typeof d>"u")continue;let f=t.index.getSearchablePropertiesWithTypes(t.data.index)[c];t.index.beforeInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o),t.index.insert(t.index,t.data.index,c,e,d,f,i,t.tokenizer,o,s),t.index.afterInsert?.(t.data.index,c,e,d,f,i,t.tokenizer,o)}let u=t.sorter.getSortableProperties(t.data.sorting),l=t.getDocumentProperties(a,u);for(let c of u){let d=l[c];if(typeof d>"u")continue;let f=t.sorter.getSortablePropertiesWithTypes(t.data.sorting)[c];t.sorter.insert(t.data.sorting,c,e,d,f,i)}}function d1(t,e,r,n){return xs(t.index.beforeRemove)||xs(t.index.remove)||xs(t.index.afterRemove)?Hqr(t,e,r,n):Vqr(t,e,r,n)}async function Hqr(t,e,r,n){let o=!0,{index:i,docs:a}=t.data,s=t.documentsStore.get(a,e);if(!s)return!1;let u=ah(t.internalDocumentIDStore,Go(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await zg(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let v=f[h];if(typeof v>"u")continue;let g=d[h];await t.index.beforeRemove?.(t.data.index,h,u,v,g,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,h,e,v,g,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,h,u,v,g,r,t.tokenizer,l)}let p=await t.sorter.getSortableProperties(t.data.sorting),m=await t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||await zg(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),IOe(t),o}function Vqr(t,e,r,n){let o=!0,{index:i,docs:a}=t.data,s=t.documentsStore.get(a,e);if(!s)return!1;let u=ah(t.internalDocumentIDStore,Go(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||zg(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let v=f[h];if(typeof v>"u")continue;let g=d[h];t.index.beforeRemove?.(t.data.index,h,u,v,g,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,h,e,v,g,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,h,u,v,g,r,t.tokenizer,l)}let p=t.sorter.getSortableProperties(t.data.sorting),m=t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||zg(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),IOe(t),o}function M3(t,e,r,n,o){return xs(t.index.beforeRemove)||xs(t.index.remove)||xs(t.index.afterRemove)||xs(t.beforeRemoveMultiple)||xs(t.afterRemoveMultiple)?Wqr(t,e,r,n,o):Kqr(t,e,r,n,o)}async function Wqr(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>ah(t.internalDocumentIDStore,Go(t.internalDocumentIDStore,s)));return o||await l1(t.beforeRemoveMultiple,t,a),await new Promise((s,u)=>{let l=0;async function c(){let d=e.slice(l*r,++l*r);if(!d.length)return s();for(let f of d)try{await d1(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await l1(t.afterRemoveMultiple,t,a),i}function Kqr(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>ah(t.internalDocumentIDStore,Go(t.internalDocumentIDStore,l)));o||l1(t.beforeRemoveMultiple,t,a);let s=0;function u(){let l=e.slice(s*r,++s*r);if(l.length){for(let c of l)d1(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||l1(t.afterRemoveMultiple,t,a),i}function Jqr(t,e){return t[1]-e[1]}function Gqr(t,e){return e[1]-t[1]}function Yqr(t="desc"){return t.toLowerCase()==="asc"?Jqr:Gqr}function Uk(t,e,r){let n={},o=e.map(([l])=>l),i=t.documentsStore.getMultiple(t.data.docs,o),a=Object.keys(r),s=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let l of a){let c;if(s[l]==="number"){let{ranges:d}=r[l],f=d.length,p=Array.from({length:f});for(let m=0;m<f;m++){let h=d[m];p[m]=[`${h.from}-${h.to}`,0]}c=Object.fromEntries(p)}n[l]={count:0,values:c??{}}}let u=i.length;for(let l=0;l<u;l++){let c=i[l];for(let d of a){let f=d.includes(".")?Lk(c,d):c[d],p=s[d],m=n[d].values;switch(p){case"number":{let h=r[d].ranges;O0t(h,m)(f);break}case"number[]":{let h=new Set,v=r[d].ranges,g=O0t(v,m,h);for(let _ of f)g(_);break}case"boolean":case"enum":case"string":{E0t(m,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let g=E0t(m,p==="boolean[]"?"boolean":"string",new Set);for(let _ of f)g(_);break}default:throw At("FACET_NOT_SUPPORTED",p)}}}for(let l of a){let c=n[l];if(c.count=Object.keys(c.values).length,s[l]==="string"){let d=r[l],f=Yqr(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function O0t(t,e,r){return n=>{for(let o of t){let i=`${o.from}-${o.to}`;r?.has(i)||n>=o.from&&n<=o.to&&(e[i]===void 0?e[i]=1:(e[i]++,r?.add(i)))}}}function E0t(t,e,r){let n=e==="boolean"?"false":"";return o=>{let i=o?.toString()??n;r?.has(i)||(t[i]=(t[i]??0)+1,r?.add(i))}}function zk(t,e){let r=new Map,n=[];for(let o of t)r.set(o,!0);for(let o of e){let[i]=o;r.has(i)&&(n.push(o),r.delete(i))}return n}var Zqr={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},P0t=["string","number","boolean"];function Hk(t,e,r){let n=r.properties,o=n.length,i=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let g=0;g<o;g++){let _=n[g];if(typeof i[_]>"u")throw At("UNKNOWN_GROUP_BY_PROPERTY",_);if(!P0t.includes(i[_]))throw At("INVALID_GROUP_BY_PROPERTY",_,P0t.join(", "),i[_])}let a=e.map(([g])=>ah(t.internalDocumentIDStore,g)),s=t.documentsStore.getMultiple(t.data.docs,a),u=s.length,l=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],d={};for(let g=0;g<o;g++){let _=n[g],w={property:_,perValue:{}},x=new Set;for(let C=0;C<u;C++){let P=s[C],E=Lk(P,_);if(typeof E>"u")continue;let A=typeof E!="boolean"?E:""+E,M=w.perValue[A]??{indexes:[],count:0};M.count>=l||(M.indexes.push(C),M.count++,w.perValue[A]=M,x.add(E))}c.push(Array.from(x)),d[_]=w}let f=T0t(c),p=f.length,m=[];for(let g=0;g<p;g++){let _=f[g],w=_.length,x={values:[],indexes:[]},C=[];for(let P=0;P<w;P++){let E=_[P],A=n[P];C.push(d[A].perValue[typeof E!="boolean"?E:""+E].indexes),x.values.push(E)}x.indexes=Nk(C).sort((P,E)=>P-E),x.indexes.length!==0&&m.push(x)}let h=m.length,v=Array.from({length:h});for(let g=0;g<h;g++){let _=m[g],w=r.reduce||Zqr,x=_.indexes.map(A=>({id:a[A],score:e[A][1],document:s[A]})),C=w.reducer.bind(null,_.values),P=w.getInitialValue(_.indexes.length),E=x.reduce(C,P);v[g]={values:_.values,result:E}}return v}function T0t(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=T0t(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];fi(s,a),o.push(s)}return o}function A0t(t,e,r){let n=Ug(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(JQ,e.relevance??{});let s=Object.keys(t.data.index.vectorIndexes),u=e.facets&&Object.keys(e.facets).length>0,{limit:l=10,offset:c=0,term:d,properties:f,threshold:p=0,distinctOn:m,includeVectors:h=!1}=e,v=e.preflight===!0,{index:g,docs:_}=t.data,w=t.tokenizer.tokenize(d??"",r),x=t.caches.propertiesToSearch;if(!x){let L=t.index.getSearchablePropertiesWithTypes(g);x=t.index.getSearchableProperties(g),x=x.filter(k=>L[k].startsWith("string")),t.caches.propertiesToSearch=x}if(f&&f!=="*"){for(let L of f)if(!x.includes(L))throw At("UNKNOWN_INDEX",L,x.join(", "));x=x.filter(L=>f.includes(L))}let C=f1(t.tokenizer,t.index,t.documentsStore,r,e,x,w,t.documentsStore.count(_),n),P=Object.keys(e.where??{}).length>0,E=[];P&&(E=t.index.searchByWhereClause(C,g,e.where));let A=w.length;if(A||f?.length){let L=x.length;for(let k=0;k<L;k++){let F=x[k],$=C.indexMap[F];if(A!==0)for(let j=0;j<A;j++){let z=w[j],W=t.index.search(C,g,F,z);fi($[z],W)}else{$[""]=[];let j=t.index.search(C,g,F,"");fi($[""],j)}let U=Object.values($);C.docsIntersection[F]=zQ(U,e?.boost?.[F]??1,p,A);let J=C.docsIntersection[F],V=J.length;for(let j=0;j<V;j++){let[z,W]=J[j],K=C.uniqueDocsIDs[z];K?C.uniqueDocsIDs[z]=K+W+.5:C.uniqueDocsIDs[z]=W}}}else w.length===0&&d?C.uniqueDocsIDs={}:C.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(L=>[L,0]));let M=Object.entries(C.uniqueDocsIDs).map(([L,k])=>[+L,k]);if(P&&(M=zk(E,M)),e.sortBy)if(typeof e.sortBy=="function"){let L=M.map(([$])=>$),F=t.documentsStore.getMultiple(t.data.docs,L).map(($,U)=>[M[U][0],M[U][1],$]);F.sort(e.sortBy),M=F.map(([$,U])=>[$,U])}else M=t.sorter.sortBy(t.data.sorting,M,e.sortBy).map(([L,k])=>[Go(t.internalDocumentIDStore,L),k]);else M=M.sort(Dvt);let R;v||(R=m?I0t(t,M,c,l,m):GQ(t,M,c,l));let N={elapsed:{formatted:"",raw:0},hits:[],count:M.length};if(typeof R<"u"&&(N.hits=R.filter(Boolean),h||qQ(N,s)),u){let L=Uk(t,M,e.facets);N.facets=L}return e.groupBy&&(N.groups=Hk(t,M,e.groupBy)),N.elapsed=t.formatElapsedTime(Ug()-C.timeStart),N}async function a(){t.beforeSearch&&await Bk(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await kk(t.afterSearch,t,e,r,s),s}return o?a():i()}function MOe(t,e,r="english"){let n=Ug(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw At("INVALID_VECTOR_INPUT",Object.keys(s).join(", "));let{limit:u=10,offset:l=0,includeVectors:c=!1}=e,d=t.data.index.vectorIndexes[s.property],f=d.size,p=d.vectors,m=e.facets&&Object.keys(e.facets).length>0,h=Object.keys(e.where??{}).length>0,{index:v,docs:g}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?At("INVALID_INPUT_VECTOR","undefined",f,"undefined"):At("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let _=HQ(s.value,p,f,e.similarity).map(([L,k])=>[Go(t.internalDocumentIDStore,L),k]),w=t.caches.propertiesToSearch;if(!w){let L=t.index.getSearchablePropertiesWithTypes(v);w=t.index.getSearchableProperties(v),w=w.filter(k=>L[k].startsWith("string")),t.caches.propertiesToSearch=w}let x=[],C=f1(t.tokenizer,t.index,t.documentsStore,r,e,w,x,t.documentsStore.count(g),n),P=[];h&&(P=t.index.searchByWhereClause(C,v,e.where),_=zk(P,_));let E=[];m&&(E=Uk(t,_,e.facets));let A=Array.from({length:u});for(let L=0;L<u;L++){let k=_[L+l];if(!k)break;let F=t.data.docs.docs[k[0]];if(F){c||(F[s.property]=null);let $={id:ah(t.internalDocumentIDStore,k[0]),score:k[1],document:F};A[L]=$}}let M=[];e.groupBy&&(M=Hk(t,_,e.groupBy));let N=Ug()-n;return{count:_.length,hits:A.filter(Boolean),elapsed:{raw:Number(N),formatted:u1(N)},...E?{facets:E}:{},...M?{groups:M}:{}}}async function a(){t.beforeSearch&&await Bk(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await kk(t.afterSearch,t,e,r,s),s}return o?a():i()}function R0t(t,e,r){let n=Ug(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{offset:s=0,limit:u=10,includeVectors:l=!1}=e,c=e.facets&&Object.keys(e.facets).length>0,d=Xqr(t,e,r),f=Qqr(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,v=tUr(d,f,e.term??"",h),g=t.tokenizer.tokenize(e.term??"",r),_=t.caches.propertiesToSearch;if(!_){let N=t.index.getSearchablePropertiesWithTypes(p);_=t.index.getSearchableProperties(p),_=_.filter(L=>N[L].startsWith("string")),t.caches.propertiesToSearch=_}if(e.properties&&e.properties!=="*"){for(let N of e.properties)if(!_.includes(N))throw At("UNKNOWN_INDEX",N,_.join(", "));_=_.filter(N=>e.properties.includes(N))}let w=f1(t.tokenizer,t.index,t.documentsStore,r,e,_,g,t.documentsStore.count(m),n),x=Object.keys(e.where??{}).length>0,C=[];x&&(C=t.index.searchByWhereClause(w,p,e.where),v=zk(C,v));let P;c&&(P=Uk(t,v,e.facets));let E;e.groupBy&&(E=Hk(t,v,e.groupBy));let A=GQ(t,v,s,u).filter(Boolean),M=Ug(),R={count:v.length,elapsed:{raw:Number(M-n),formatted:u1(M-n)},hits:A,...P?{facets:P}:{},...E?{groups:E}:{}};if(!l){let N=Object.keys(t.data.index.vectorIndexes);qQ(R,N)}return R}async function a(){t.beforeSearch&&await Bk(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await kk(t.afterSearch,t,e,r,s),s}return o?a():i()}function Xqr(t,e,r){let n=Ug();e.relevance=Object.assign(JQ,e.relevance??{});let{term:o="",properties:i,threshold:a=0}=e,{index:s,docs:u}=t.data,l=t.tokenizer.tokenize(o,r),c=t.caches.propertiesToSearch;if(!c){let m=t.index.getSearchablePropertiesWithTypes(s);c=t.index.getSearchableProperties(s),c=c.filter(h=>m[h].startsWith("string")),t.caches.propertiesToSearch=c}if(i&&i!=="*"){let m=new Set(c),h=new Set(i);for(let v of i)if(!m.has(v))throw At("UNKNOWN_INDEX",v,c.join(", "));c=c.filter(v=>h.has(v))}let d=f1(t.tokenizer,t.index,t.documentsStore,r,e,c,l,t.documentsStore.count(u),n),f=l.length;if(f||i&&i.length>0){let m=c.length;for(let h=0;h<m;h++){let v=c[h];if(f!==0)for(let C=0;C<f;C++){let P=l[C],E=t.index.search(d,s,v,P);fi(d.indexMap[v][P],E)}else{let C=[];d.indexMap[v][""]=C;let P=t.index.search(d,s,v,"");fi(C,P)}let g=d.indexMap[v],_=Object.values(g);d.docsIntersection[v]=zQ(_,e?.boost?.[v]??1,a,f);let w=d.docsIntersection[v],x=w.length;for(let C=0;C<x;C++){let[P,E]=w[C],A=d.uniqueDocsIDs[P];d.uniqueDocsIDs[P]=A?A+E+.5:E}}}else l.length===0&&o?d.uniqueDocsIDs={}:d.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(m=>[m,0]));let p=Object.entries(d.uniqueDocsIDs).map(([m,h])=>[+m,h]).sort((m,h)=>h[1]-m[1]);return j0t(p)}function Qqr(t,e){let r=e.vector,n=t.data.index.vectorIndexes[r?.property],o=n.size,i=n.vectors;if(r&&(!r.value||!r.property))throw At("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw At("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=HQ(r.value,i,o,e.similarity).map(([s,u])=>[Go(t.internalDocumentIDStore,s),u]);return j0t(a)}function ROe([,t]){return t}function j0t(t){let e=Math.max.apply(Math,t.map(ROe));return t.map(([r,n])=>[r,n/e])}function M0t(t,e){return t/e}function eUr(t,e){return(r,n)=>r*t+n*e}function tUr(t,e,r,n){let o=Math.max.apply(Math,t.map(ROe)),i=Math.max.apply(Math,e.map(ROe)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:rUr(r),l=new Map,c=t.length,d=eUr(s,u);for(let p=0;p<c;p++){let[m,h]=t[p],v=M0t(h,o),g=d(v,0);l.set(m,g)}let f=e.length;for(let p=0;p<f;p++){let[m,h]=e[p],v=M0t(h,i),g=l.get(m)??0;l.set(m,g+d(0,v))}return[...l].sort((p,m)=>m[1]-p[1])}function rUr(t){return{text:.5,vector:.5}}var JQ={k:1.2,b:.75,d:.5};function f1(t,e,r,n,o,i,a,s,u){let l={},c={};for(let d of i){let f={};for(let p of a)f[p]=[];l[d]=f,c[d]=[]}return{timeStart:u,tokenizer:t,index:e,documentsStore:r,language:n,params:o,docsCount:s,uniqueDocsIDs:{},indexMap:l,docsIntersection:c}}function _c(t,e,r){let n=e.mode??KQ;if(n===KQ)return A0t(t,e,r);if(n===TOe)return MOe(t,e);if(n===POe)return R0t(t,e);throw At("INVALID_SEARCH_MODE",n)}function I0t(t,e,r,n,o){let i=t.data.docs,a=new Map,s=[],u=new Set,l=e.length,c=0;for(let d=0;d<l;d++){let f=e[d];if(typeof f>"u")continue;let[p,m]=f;if(u.has(p))continue;let h=t.documentsStore.get(i,p),v=Lk(h,o);if(!(typeof v>"u"||a.has(v))&&(a.set(v,!0),c++,!(c<=r)&&(s.push({id:ah(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function GQ(t,e,r,n){let o=t.data.docs,i=Array.from({length:n}),a=new Set;for(let s=r;s<n+r;s++){let u=e[s];if(typeof u>"u")break;let[l,c]=u;if(!a.has(l)){let d=t.documentsStore.get(o,l);i[s]={id:ah(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}function YQ(t,e){t.internalDocumentIDStore.load(t,e.internalDocumentIDStore),t.data.index=t.index.load(t.internalDocumentIDStore,e.index),t.data.docs=t.documentsStore.load(t.internalDocumentIDStore,e.docs),t.data.sorting=t.sorter.load(t.internalDocumentIDStore,e.sorting),t.tokenizer.language=e.language}function jOe(t){return{internalDocumentIDStore:t.internalDocumentIDStore.save(t.internalDocumentIDStore),index:t.index.save(t.data.index),docs:t.documentsStore.save(t.data.docs),sorting:t.sorter.save(t.data.sorting),language:t.tokenizer.language}}var LOo=new Error("timeout while waiting for mutex to become available"),FOo=new Error("mutex already locked"),oUr=new Error("request for lock canceled"),iUr=function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},DOe=class{constructor(e,r=oUr){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,o)=>{let i={resolve:n,reject:o,weight:e,priority:r},a=D0t(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return iUr(this,arguments,void 0,function*(r,n=1,o=0){let[i,a]=yield this.acquire(n,o);try{return yield r(i)}finally{a()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),aUr(this._weightedWaiters[e-1],{resolve:n,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){let r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let r=this._weightedWaiters[e-1];r&&(r.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let r=this._value;r>0;r--){let n=this._weightedWaiters[r-1];if(!n)continue;let o=n.findIndex(i=>i.priority<=e);(o===-1?n:n.splice(0,o)).forEach(i=>i.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}};function aUr(t,e){let r=D0t(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function D0t(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var sUr=function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},ZQ=class{constructor(e){this._semaphore=new DOe(1,e)}acquire(){return sUr(this,arguments,void 0,function*(e=0){let[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}};var Kwt=B(Lee()),nS=require("obsidian");var FOe="copilot-index-chunk-",uUr=".json",Fee=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${FOe}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${FOe}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${uUr}`}assignDocumentToPartition(e,r){let o=Array.from(e).reduce((i,a)=>(i<<5)-i+a.charCodeAt(0),0);return Math.abs(o)%r}distributeDocumentsToPartitions(e,r){let n=new Map,o={};for(let a=0;a<r;a++)n.set(a,[]);de().debug&&console.log(`Total documents to distribute: ${e.length}`);for(let a of e){let s=this.assignDocumentToPartition(a.id,r),u=n.get(s);if(!u)throw new Error(`Invalid partition index: ${s}`);u.push(a),o[a.id]=s}let i=0;return n.forEach((a,s)=>{i+=a.length,de().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),de().debug&&(console.log(`Total documents distributed: ${i}`),i!==e.length&&console.error(`Document count mismatch! Original: ${e.length}, Distributed: ${i}`)),n}async ensureDirectoryExists(e){let r=e.substring(0,e.lastIndexOf("/"));await this.app.vault.adapter.exists(r)||await this.app.vault.adapter.mkdir(r)}async saveDatabase(e){try{let r=await jOe(e),n=de().numPartitions;if(n===1){let l=this.getLegacyPath();await this.ensureDirectoryExists(l),await this.app.vault.adapter.write(l,JSON.stringify({...r,schema:e.schema}));return}let o=r.docs?.docs,i=Array.isArray(o)?o:Object.values(o||{});if(de().debug&&console.log(`Starting save with ${i.length??0} total documents`),!i||i.length===0){let l={numPartitions:n,vectorLength:e.schema.embedding.match(/\d+/)[0],schema:e.schema,lastModified:Date.now(),documentPartitions:{}},c=this.getMetadataPath();await this.ensureDirectoryExists(c),await this.app.vault.adapter.write(c,JSON.stringify(l)),de().debug&&console.log("Saved empty database state");return}let a=this.distributeDocumentsToPartitions(i,n),s={numPartitions:n,vectorLength:e.schema.embedding.match(/\d+/)[0],schema:e.schema,lastModified:Date.now(),documentPartitions:Object.fromEntries(i.map(l=>[l.id,this.assignDocumentToPartition(l.id,n)]))};await this.saveMetadata(s);let u={...r,docs:{docs:{},count:0},index:{...r.index,vectorIndexes:void 0}};for(let[l,c]of a.entries()){let d={index:{vectorIndexes:{embedding:{size:r.index.vectorIndexes.embedding.size,vectors:Object.fromEntries(Object.entries(r.index.vectorIndexes.embedding.vectors).filter(([m])=>c.some(h=>h.id===m)))}}},docs:{docs:Object.fromEntries(c.map((m,h)=>[(h+1).toString(),m])),count:c.length}},f=l===0?{...u,docs:d.docs,index:{...u.index,vectorIndexes:d.index.vectorIndexes}}:d,p=this.getChunkPath(l);await this.ensureDirectoryExists(p),await this.app.vault.adapter.write(p,JSON.stringify(f)),de().debug&&console.log(`Saved partition ${l+1}/${n}`)}de().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new hr(`Failed to save database: ${r.message}`)}}async loadDatabase(){try{let e=this.getLegacyPath();if(await this.app.vault.adapter.exists(e)){let u=JSON.parse(await this.app.vault.adapter.read(e));if(!u?.schema)throw new hr("Invalid legacy database format");let l=await qk({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await YQ(l,u),l}let r=await this.loadMetadata(),n=await qk({schema:r.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}}),o=null,i=[];for(let u=0;u<r.numPartitions;u++){let l=this.getChunkPath(u);if(await this.app.vault.adapter.exists(l)){let c=JSON.parse(await this.app.vault.adapter.read(l));i.push(c),u===0&&(o=c)}}if(!o)throw new hr("No data found in chunks");let a={},s=1;for(let u of o.internalDocumentIDStore.internalIdToId){let l=i.flatMap(c=>Object.values(c.docs.docs)).find(c=>c.id===u);l?(a[s.toString()]=l,s++):de().debug&&console.warn(`Document ${u} not found in any chunk`)}return o.docs.docs=a,o.docs.count=Object.keys(a).length,o.index.vectorIndexes.embedding.vectors=Object.assign({},...i.map(u=>u.index?.vectorIndexes?.embedding?.vectors||{})),await YQ(n,o),n}catch(e){throw console.error("Error loading database:",e),new hr(`Failed to load database: ${e.message}`)}}async clearStorage(){try{let e=this.getLegacyPath();await this.app.vault.adapter.exists(e)&&await this.app.vault.adapter.remove(e);let r=await this.app.vault.adapter.list(this.baseDir);for(let n of r.files)n.startsWith(`${this.baseDir}/${FOe}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new hr(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(de().numPartitions===1)return await this.app.vault.adapter.exists(e);let r=this.getMetadataPath();return await this.app.vault.adapter.exists(r)||await this.app.vault.adapter.exists(e)}async loadMetadata(){let e=this.getMetadataPath();if(!await this.app.vault.adapter.exists(e))throw new hr("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new hr("Invalid metadata file: missing schema");return r}async saveMetadata(e){let r=this.getMetadataPath();await this.ensureDirectoryExists(r),await this.app.vault.adapter.write(r,JSON.stringify(e))}};var kOe=require("obsidian");async function Hwt(t){if(!t)throw new hr("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new hr("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${ws.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new hr("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function Vwt(t){let e="",{inclusions:r,exclusions:n}=p1(),o=t.vault.getMarkdownFiles().filter(i=>hT(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function mT(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function lUr(){return de().qaExclusions?mT(de().qaExclusions):[]}function cUr(){return de().qaInclusions?mT(de().qaInclusions):[]}function p1(){let t=cUr(),e=lUr();return{inclusions:t.length>0?j3(t):null,exclusions:e.length>0?j3(e):null}}function hT(t,e,r){return!(r&&zwt(t.path,r)||e&&!zwt(t.path,e))}function j3(t){let e=[],r=[],n=[],o=[],i=/^#[^\s#]+$/,a=/^\*\.([a-zA-Z0-9.]+)$/,s=/^\[\[(.*?)\]\]$/;return t.forEach(u=>{i.test(u)?e.push(u):a.test(u)?r.push(u):s.test(u)?o.push(u):n.push(u)}),{tagPatterns:e,extensionPatterns:r,folderPatterns:n,notePatterns:o}}function Wwt({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function dUr(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof kOe.TFile){let n=dU(r);if(e.some(o=>n.includes(qD(o))))return!0}return!1}function fUr(t,e){if(e.length===0)return!1;let r=t.toLowerCase();return e.some(n=>{let o=n.slice(1).toLowerCase();return r.endsWith(o)})}function pUr(t,e){if(e.length===0)return!1;let r=t.replace(/\\/g,"/");return e.some(n=>{let o=n.replace(/\\/g,"/").replace(/\/$/,"");return r.startsWith(o)&&(r.length===o.length||r[o.length]==="/")})}function mUr(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof kOe.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function zwt(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return dUr(t,r??[])||fUr(t,n??[])||pUr(t,o??[])||mUr(t,i??[])}function kee(t){let e=[];try{let r=t.vault.getConfig("userIgnoreFilters");r&&Array.isArray(r)&&r.forEach(n=>{typeof n=="string"&&e.push(n.endsWith("/")?n.slice(0,-1):n)})}catch(r){console.warn("Error getting userIgnoreFilters from Obsidian config",r)}return e}var _C=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new ZQ;bl(async()=>{let r=de();nS.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):nS.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await ws.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(ar("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await ws.getInstance().getEmbeddingsAPI()),ar("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new hr("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new Fee(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),nS.Platform.isMobile&&de().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new hr("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),ar("Loaded existing chunked Orama database from disk."),this.oramaDb}catch(n){nt("Failed to load existing database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){nt("Error initializing Orama database:",r),new nS.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(nS.Platform.isMobile&&de().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await ws.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new hr("Orama database not found.")}catch(e){throw nt("Failed to initialize database during save:",e),new hr("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,de().debug&&ar("Orama database saved successfully at:",this.dbPath)}catch(e){throw nt("Error saving Orama database:",e),e}}}async clearIndex(e){try{this.oramaDb||await this.initializeDB(e),await this.chunkedStorage?.clearStorage(),await new Promise(r=>setTimeout(r,100)),this.oramaDb=await this.createNewDb(e),await this.saveDB(),new nS.Notice("Local Copilot index cleared successfully."),ar("Local Copilot index cleared successfully, new instance created.")}catch(r){throw nt("Error clearing the local Copilot index:",r),new nS.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new hr("Orama database not found.");try{let r=await _c(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await M3(this.oramaDb,r.hits.map(n=>n.id),500),de().debug&&ar(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){nt("Error deleting document from local Copilotindex:",r)}}getDb(){return this.oramaDb||console.warn("Database not initialized. Some features may be limited."),this.oramaDb}async getIsIndexLoaded(){return this.isIndexLoaded}async waitForInitialization(){await this.initializationPromise}onunload(){this.hasUnsavedChanges&&this.saveDB()}getCurrentDbPath(){return this.dbPath}async getDbPath(){let e=this.app.vault.getRoot().path,r;if(de().enableIndexSync)r=this.app.vault.configDir;else{let n=e==="/"?"":e;r=`${n===""||n.startsWith("/")?"":"/"}${n}/.copilot-index`,await this.app.vault.adapter.exists(r)||(await this.app.vault.adapter.mkdir(r),ar("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,Kwt.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new hr("Embedding instance not found.");let r=await Hwt(e);if(!r||r===0)throw new hr("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await qk({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return ar(`Created new Orama database for ${this.dbPath}. Embedding model: ${ws.getModelName(e)} with vector length ${r}.`),this.isIndexLoaded=!0,o}static async getDocsByPath(e,r){if(!e)throw new Error("DB not initialized");return r?(await _c(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await _c(e,{mode:"vector",vector:{value:r,property:"embedding"},limit:n.limit,similarity:n.similarity,includeVectors:!0})).hits}static async getLatestFileMtime(e){if(!e)throw new Error("DB not initialized");try{let r=await _c(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return nt("Error getting latest file mtime from VectorDB:",r),0}}createDynamicSchema(e){return{id:"string",title:"string",path:"string",content:"string",embedding:`vector[${e}]`,embeddingModel:"string",created_at:"number",ctime:"number",mtime:"number",tags:"string[]",extension:"string"}}async upsert(e){if(!this.oramaDb)throw new Error("DB not initialized");let r=this.oramaDb;return await this.upsertMutex.runExclusive(async()=>{try{let n=this.chunkedStorage?.assignDocumentToPartition(e.id,de().numPartitions),o=await _c(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await d1(r,o.hits[0].id);try{return await I3(r,e),ar(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(nt(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await I3(r,o.hits[0].document)}catch(a){nt("Failed to restore previous document version:",a)}return}}catch(n){nt(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await _c(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return nt("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){ar("Embedding model change detected. Orama database not found. Initializing new database...");try{return await this.initializeDB(e),!0}catch(o){throw nt("Failed to initialize database:",o),new hr("Failed to initialize Orama database. Please check your embedding model settings.")}}let r=await _c(this.oramaDb,{term:"",limit:1}),n;if(r.hits.length>0){let o=r.hits[0];typeof o=="object"&&o!==null&&"document"in o&&(n=o.document.embeddingModel)}if(n){let o=ws.getModelName(e);if(!g$e(n,o))return new nS.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),ar("Detected change in embedding model. Rebuilding Copilot index from scratch."),this.oramaDb=await this.createNewDb(e),await this.saveDB(),!0}else ar("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await _c(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){ar("Orama database not found during garbage collection. Attempting to initialize...");try{let e=await ws.getInstance().getEmbeddingsAPI();if(!e)throw new hr("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new hr("Failed to initialize database after attempt.")}catch(e){throw nt("Failed to initialize database during garbage collection:",e),new hr("Failed to initialize database. Please check your embedding model settings.")}}try{let e=this.app.vault.getMarkdownFiles(),r=new Set(e.map(i=>i.path)),o=(await t.getAllDocuments(this.oramaDb)).filter(i=>!r.has(i.path));return o.length===0?0:(ar("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(o.map(i=>i.path))).join(", ")),o.length===1?await d1(this.oramaDb,o[0].id):await M3(this.oramaDb,o.map(i=>i.id),500),await this.saveDB(),o.length)}catch(e){throw nt("Error garbage collecting the Copilot index:",e),new hr("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new hr("Orama database not found.");try{let e=await t.getAllDocuments(this.oramaDb),r=new Set;return e.forEach(n=>{r.add(n.path)}),Array.from(r).sort()}catch(e){throw nt("Error getting indexed files:",e),new hr("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await _c(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw nt("Error checking if database is empty:",e),new hr("Failed to check if database is empty.")}}async hasIndex(e){if(!this.oramaDb)return!1;let r=await t.getDocsByPath(this.oramaDb,e);return r!==void 0&&r.length>0}async hasEmbeddings(e){if(!this.oramaDb)return!1;let r=await t.getDocsByPath(this.oramaDb,e);return!r||r.length===0?!1:r.every(n=>n?.document?.embedding&&Array.isArray(n.document.embedding)&&n.document.embedding.length>0)}async getDocsJsonByPaths(e){if(!this.oramaDb)throw new hr("Orama database not found.");let r={};for(let n of e){let o=await t.getDocsByPath(this.oramaDb,n);o&&o.length>0&&(r[n]=o.map(i=>({id:i.document.id,title:i.document.title,path:i.document.path,content:i.document.content,metadata:i.document.metadata,embedding:i.document.embedding,embeddingModel:i.document.embeddingModel,tags:i.document.tags,extension:i.document.extension,nchars:i.document.nchars})))}return r}markFileMissingEmbeddings(e){this.filesWithoutEmbeddings.add(e)}clearFilesMissingEmbeddings(){this.filesWithoutEmbeddings.clear()}getFilesMissingEmbeddings(){return Array.from(this.filesWithoutEmbeddings)}isFileMissingEmbeddings(e){return this.filesWithoutEmbeddings.has(e)}async checkIndexIntegrity(){if(!this.oramaDb)throw new hr("Orama database not found.");try{let e=await this.getIndexedFiles();for(let n of e)await this.hasEmbeddings(n)||this.markFileMissingEmbeddings(n);let r=this.getFilesMissingEmbeddings();r.length>0?ar("Files missing embeddings after integrity check:",r.join(", ")):ar("Index integrity check completed. All documents have embeddings.")}catch(e){throw nt("Error checking index integrity:",e),new hr("Failed to check index integrity.")}}};var Vk=require("obsidian");var hUr=5e3,Bee=class{constructor(e,r,n){this.app=e;this.indexOps=r;this.dbOps=n;this.debounceTimer=null;this.lastActiveFile=null;this.lastActiveFileMtime=null;this.handleActiveLeafChange=async e=>{if(Vk.Platform.isMobile&&de().disableIndexOnMobile||ug()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof Vk.MarkdownView?i.file:null,this.lastActiveFileMtime=this.lastActiveFile?.stat?.mtime??null,!(!n||n===this.lastActiveFile)&&!(!n?.stat?.mtime||o===null)&&n.extension==="md"){let{inclusions:a,exclusions:s}=p1(),u=hT(n,a,s),l=o!==null&&n.stat.mtime>o;u&&l&&this.debouncedReindexFile(n)}};this.debouncedReindexFile=e=>{this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{de().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},hUr)};this.handleFileDelete=async e=>{e instanceof Vk.TFile&&await this.dbOps.removeDocs(e.path)};this.initializeEventListeners()}initializeEventListeners(){de().debug&&console.log("Copilot Plus: Initializing event listeners"),this.app.workspace.on("active-leaf-change",this.handleActiveLeafChange),this.app.vault.on("delete",this.handleFileDelete)}cleanup(){this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.app.workspace.off("active-leaf-change",this.handleActiveLeafChange),this.app.vault.off("delete",this.handleFileDelete)}unload(){this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.lastActiveFile=null,this.lastActiveFileMtime=null,this.app.workspace.off("active-leaf-change",this.handleActiveLeafChange),this.app.vault.off("delete",this.handleFileDelete)}};var D3=class{constructor(e){this.lastRequestTime=0;this.requestsPerMin=e}setRequestsPerMin(e){this.requestsPerMin=e}getRequestsPerMin(){return this.requestsPerMin}async wait(){let r=Date.now()-this.lastRequestTime,n=Math.max(0,6e4/this.requestsPerMin-r);n>0&&await new Promise(o=>setTimeout(o,n)),this.lastRequestTime=Date.now()}};var Gwt=B(Lee());Jwt();xf();var $ee=class extends ln{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","documents","transformers"]})}invoke(e,r){return this.transformDocuments(e)}};$xe();var BOe=class extends $ee{constructor(e){if(super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","document_transformers","text_splitters"]}),Object.defineProperty(this,"chunkSize",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),Object.defineProperty(this,"chunkOverlap",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(this,"keepSeparator",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"lengthFunction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chunkSize=e?.chunkSize??this.chunkSize,this.chunkOverlap=e?.chunkOverlap??this.chunkOverlap,this.keepSeparator=e?.keepSeparator??this.keepSeparator,this.lengthFunction=e?.lengthFunction??(r=>r.length),this.chunkOverlap>=this.chunkSize)throw new Error("Cannot have chunkOverlap >= chunkSize")}async transformDocuments(e,r={}){return this.splitDocuments(e,r)}splitOnSeparator(e,r){let n;if(r)if(this.keepSeparator){let o=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");n=e.split(new RegExp(`(?=${o})`))}else n=e.split(r);else n=e.split("");return n.filter(o=>o!=="")}async createDocuments(e,r=[],n={}){let o=r.length>0?r:[...Array(e.length)].map(()=>({})),{chunkHeader:i="",chunkOverlapHeader:a="(cont'd) ",appendChunkOverlapHeader:s=!1}=n,u=new Array;for(let l=0;l<e.length;l+=1){let c=e[l],d=1,f=null,p=-1;for(let m of await this.splitText(c)){let h=i,v=c.indexOf(m,p+1);if(f===null){let x=this.numberOfNewLines(c,0,v);d+=x}else{let x=p+await this.lengthFunction(f);if(x<v){let C=this.numberOfNewLines(c,x,v);d+=C}else if(x>v){let C=this.numberOfNewLines(c,v,x);d-=C}s&&(h+=a)}let g=this.numberOfNewLines(m),_=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};_.lines={from:d,to:d+g};let w={...o[l],loc:_};h+=m,u.push(new vC({pageContent:h,metadata:w})),d+=g,f=m,p=v}}return u}numberOfNewLines(e,r,n){return(e.slice(r,n).match(/\n/g)||[]).length}async splitDocuments(e,r={}){let n=e.filter(a=>a.pageContent!==void 0),o=n.map(a=>a.pageContent),i=n.map(a=>a.metadata);return this.createDocuments(o,i,r)}joinDocs(e,r){let n=e.join(r).trim();return n===""?null:n}async mergeSplits(e,r){let n=[],o=[],i=0;for(let s of e){let u=await this.lengthFunction(s);if(i+u+o.length*r.length>this.chunkSize&&(i>this.chunkSize&&console.warn(`Created a chunk of size ${i}, +
which is longer than the specified ${this.chunkSize}`),o.length>0)){let l=this.joinDocs(o,r);for(l!==null&&n.push(l);i>this.chunkOverlap||i+u+o.length*r.length>this.chunkSize&&i>0;)i-=await this.lengthFunction(o[0]),o.shift()}o.push(s),i+=u}let a=this.joinDocs(o,r);return a!==null&&n.push(a),n}};var qee=class t extends BOe{static lc_name(){return"RecursiveCharacterTextSplitter"}constructor(e){super(e),Object.defineProperty(this,"separators",{enumerable:!0,configurable:!0,writable:!0,value:[`
`,`
`," ",""]}),this.separators=e?.separators??this.separators,this.keepSeparator=e?.keepSeparator??!0}async _splitText(e,r){let n=[],o=r[r.length-1],i;for(let l=0;l<r.length;l+=1){let c=r[l];if(c===""){o=c;break}if(e.includes(c)){o=c,i=r.slice(l+1);break}}let a=this.splitOnSeparator(e,o),s=[],u=this.keepSeparator?"":o;for(let l of a)if(await this.lengthFunction(l)<this.chunkSize)s.push(l);else{if(s.length){let c=await this.mergeSplits(s,u);n.push(...c),s=[]}if(!i)n.push(l);else{let c=await this._splitText(l,i);n.push(...c)}}if(s.length){let l=await this.mergeSplits(s,u);n.push(...l)}return n}async splitText(e){return this._splitText(e,this.separators)}static fromLanguage(e,r){return new t({...r,separators:t.getSeparatorsForLanguage(e)})}static getSeparatorsForLanguage(e){if(e==="cpp")return[`
class `,`
void `,`
int `,`
float `,`
double `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="go")return[`
func `,`
var `,`
const `,`
type `,`
if `,`
for `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="java")return[`
class `,`
public `,`
protected `,`
private `,`
static `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="js")return[`
function `,`
const `,`
let `,`
var `,`
class `,`
if `,`
for `,`
while `,`
switch `,`
case `,`
default `,`
`,`
`," ",""];if(e==="php")return[`
function `,`
class `,`
if `,`
foreach `,`
while `,`
do `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="proto")return[`
message `,`
service `,`
enum `,`
option `,`
import `,`
syntax `,`
`,`
`," ",""];if(e==="python")return[`
class `,`
def `,`
def `,`
`,`
`," ",""];if(e==="rst")return[`
===
`,`
---
`,`
***
`,`
.. `,`
`,`
`," ",""];if(e==="ruby")return[`
def `,`
class `,`
if `,`
unless `,`
while `,`
for `,`
do `,`
begin `,`
rescue `,`
`,`
`," ",""];if(e==="rust")return[`
fn `,`
const `,`
let `,`
if `,`
while `,`
for `,`
loop `,`
match `,`
const `,`
`,`
`," ",""];if(e==="scala")return[`
class `,`
object `,`
def `,`
val `,`
var `,`
if `,`
for `,`
while `,`
match `,`
case `,`
`,`
`," ",""];if(e==="swift")return[`
func `,`
class `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do `,`
switch `,`
case `,`
`,`
`," ",""];if(e==="markdown")return[`
## `,`
### `,`
#### `,`
##### `,`
###### `,"```\n\n",`
***
`,`
---
`,`
___
`,`
`,`
`," ",""];if(e==="latex")return[`
\\chapter{`,`
\\section{`,`
\\subsection{`,`
\\subsubsection{`,`
\\begin{enumerate}`,`
\\begin{itemize}`,`
\\begin{description}`,`
\\begin{list}`,`
\\begin{quote}`,`
\\begin{quotation}`,`
\\begin{verse}`,`
\\begin{verbatim}`,`
\\begin{align}`,"$$","$",`
`,`
`," ",""];if(e==="html")return["<body>","<div>","<p>","<br>","<li>","<h1>","<h2>","<h3>","<h4>","<h5>","<h6>","<span>","<table>","<tr>","<td>","<th>","<ul>","<ol>","<header>","<footer>","<nav>","<head>","<style>","<script>","<meta>","<title>"," ",""];if(e==="sol")return[`
pragma `,`
using `,`
contract `,`
interface `,`
library `,`
constructor `,`
type `,`
function `,`
event `,`
modifier `,`
error `,`
struct `,`
enum `,`
if `,`
for `,`
while `,`
do while `,`
assembly `,`
`,`
`," ",""];throw new Error(`Language ${e} is not supported.`)}};var oS=require("obsidian");var Uee=class{constructor(e,r,n){this.app=e;this.dbOps=r;this.embeddingsManager=n;this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:0,processedFiles:new Set,currentIndexingNotice:null,indexNoticeMessage:null};let o=de();this.rateLimiter=new D3(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,bl(async()=>{let i=de();this.rateLimiter=new D3(i.embeddingRequestsPerMin),this.embeddingBatchSize=i.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize})}async indexVaultToVectorStore(e){let r=[];try{let n=await this.embeddingsManager.getEmbeddingsAPI();if(!n)return console.error("Embedding instance not found."),0;await this.dbOps.checkAndHandleEmbeddingModelChange(n)&&(e=!0),e?(await this.dbOps.clearIndex(n),this.dbOps.clearFilesMissingEmbeddings()):await this.dbOps.garbageCollect();let i=await this.getFilesToIndex(e);if(i.length===0)return new oS.Notice("Copilot vault index is up-to-date."),0;this.initializeIndexingState(i.length),this.createIndexingNotice(),this.dbOps.clearFilesMissingEmbeddings();let a=await this.prepareAllChunks(i);if(a.length===0)return new oS.Notice("No valid content to index."),0;for(let s=0;s<a.length&&!this.state.isIndexingCancelled;s+=this.embeddingBatchSize){await this.handlePause();let u=a.slice(s,s+this.embeddingBatchSize);try{await this.rateLimiter.wait();let l=await n.embedDocuments(u.map(f=>f.content));if(!l||l.length!==u.length)throw new Error(`Embedding model returned ${l?.length??0} embeddings for ${u.length} documents`);for(let f=0;f<u.length;f++){let p=u[f],m=l[f];if(!m||!Array.isArray(m)||m.length===0){nt(`Invalid embedding for document ${p.fileInfo.path}: ${m}`),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}try{await this.dbOps.upsert({...p.fileInfo,id:this.getDocHash(p.content),content:p.content,embedding:m,created_at:Date.now(),nchars:p.content.length}),this.state.processedFiles.add(p.fileInfo.path)}catch(h){this.handleError(h,{filePath:p.fileInfo.path,errors:r}),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}}this.state.indexedCount=this.state.processedFiles.size,this.updateIndexingNoticeMessage();let c=Math.floor((this.state.indexedCount-u.length)/this.checkpointInterval);Math.floor(this.state.indexedCount/this.checkpointInterval)>c&&(await this.dbOps.saveDB(),console.log("Copilot index checkpoint save completed."))}catch(l){if(this.handleError(l,{filePath:u?.[0]?.fileInfo?.path,errors:r,batch:u}),this.isRateLimitError(l))break}}return this.finalizeIndexing(r),await this.dbOps.saveDB(),console.log("Copilot index final save completed."),setTimeout(()=>{this.dbOps.checkIndexIntegrity().catch(s=>{nt("Background integrity check failed:",s)})},1e3),this.state.indexedCount}catch(n){return this.handleError(n),0}}async prepareAllChunks(e){let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return console.error("Embedding instance not found."),[];let n=ws.getModelName(r),o=qee.fromLanguage("markdown",{chunkSize:x$e}),i=[];for(let a of e){let s=await this.app.vault.cachedRead(a);if(!s?.trim())continue;let u=this.app.metadataCache.getFileCache(a),l={title:a.basename,path:a.path,embeddingModel:n,ctime:a.stat.ctime,mtime:a.stat.mtime,tags:u?.tags?.map(d=>d.tag)??[],extension:a.extension,metadata:{...u?.frontmatter??{},created:_l(new Date(a.stat.ctime)).display,modified:_l(new Date(a.stat.mtime)).display}};(await o.createDocuments([s],[],{chunkHeader:`
NOTE TITLE: [[${l.title}]]
METADATA:${JSON.stringify(l.metadata)}
NOTE BLOCK CONTENT:
`,appendChunkOverlapHeader:!0})).forEach(d=>{d.pageContent.trim()&&i.push({content:d.pageContent,fileInfo:l})})}return i}getDocHash(e){return(0,Gwt.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=p1(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>hT(c,r,n));let i=new Set(await this.dbOps.getIndexedFiles()),a=await this.dbOps.getLatestFileMtime(),s=new Set(this.dbOps.getFilesMissingEmbeddings()),u=new Set,l=new Set;for(let c of o){if(!hT(c,r,n))continue;let d=await this.app.vault.cachedRead(c);if(!d||d.trim().length===0){l.add(c.path);continue}let f=i.has(c.path),p=s.has(c.path);(!f||p||c.stat.mtime>a)&&u.add(c)}return ar([`Files to index: ${u.size}`,`Previously indexed: ${i.size}`,`Empty files skipped: ${l.size}`,`Files missing embeddings: ${s.size}`].join(`
`)),Array.from(u)}initializeIndexingState(e){this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:e,processedFiles:new Set,currentIndexingNotice:null,indexNoticeMessage:null}}createIndexingNotice(){let e=document.createDocumentFragment(),r=e.createEl("div",{cls:"copilot-notice-container"});this.state.indexNoticeMessage=r.createEl("div",{cls:"copilot-notice-message"}),this.updateIndexingNoticeMessage();let n=r.createEl("div",{cls:"copilot-notice-buttons"}),o=n.createEl("button");o.textContent="Pause",o.addEventListener("click",a=>{a.stopPropagation(),a.preventDefault(),this.state.isIndexingPaused?(this.resumeIndexing(),o.textContent="Pause"):(this.pauseIndexing(),o.textContent="Resume")});let i=n.createEl("button");return i.textContent="Stop",i.style.marginLeft="8px",i.addEventListener("click",a=>{a.stopPropagation(),a.preventDefault(),this.cancelIndexing()}),e.appendChild(this.state.indexNoticeMessage),e.appendChild(n),this.state.currentIndexingNotice=new oS.Notice(e,0),this.state.currentIndexingNotice}async handlePause(){if(this.state.isIndexingPaused){for(;this.state.isIndexingPaused&&!this.state.isIndexingCancelled;)await new Promise(e=>setTimeout(e,100));if(!this.state.isIndexingCancelled){let e=await this.getFilesToIndex();if(e.length===0){console.log("No files to index after filter change, stopping indexing"),this.cancelIndexing(),new oS.Notice("No files to index with current filters");return}this.state.totalFilesToIndex=e.length,console.log("Total files to index:",this.state.totalFilesToIndex),console.log("Files to index:",e),this.updateIndexingNoticeMessage()}}}pauseIndexing(){this.state.isIndexingPaused=!0}resumeIndexing(){this.state.isIndexingPaused=!1}updateIndexingNoticeMessage(){if(this.state.indexNoticeMessage){let e=this.state.isIndexingPaused?" (Paused)":"",r=["Copilot is indexing your vault...",`${this.state.indexedCount}/${this.state.totalFilesToIndex} files processed${e}`],n=de(),o=mT(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...kee(this.app),...mT(n.qaExclusions)];a.length>0&&r.push(`Exclusions: ${a.join(", ")}`),this.state.indexNoticeMessage.textContent=r.join(`
`)}}isStringLengthError(e){if(!e)return!1;if(e instanceof RangeError&&e.message.toLowerCase().includes("string length"))return!0;let n=(e.message||e.toString()).toLowerCase();return n.includes("string length")||n.includes("rangeerror")}handleError(e,r){let n=r?.filePath;if(n?(r.batch?console.error("Batch processing error:",{error:e,batchSize:r.batch.length||0,firstChunk:r.batch[0]?{path:r.batch[0].fileInfo?.path,contentLength:r.batch[0].content?.length,hasFileInfo:!!r.batch[0].fileInfo}:"No chunks in batch",errorType:e?.constructor?.name,errorMessage:e?.message}):console.error(`Error indexing file ${n}:`,e),r.errors?.push(n)):console.error("Fatal error during indexing:",e),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide(),this.isStringLengthError(e)){new oS.Notice("Vault is too large for 1 partition, please increase the number of partitions in your Copilot QA settings!",1e4);return}if(this.isRateLimitError(e))return;let o=n?`Error indexing file ${n}. Check console for details.`:"Fatal error during indexing. Check console for details.";new oS.Notice(o)}isRateLimitError(e){return e?.message?.includes?.("rate limit")||!1}finalizeIndexing(e){if(this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide(),this.state.isIndexingCancelled){new oS.Notice("Indexing cancelled");return}e.length>0?new oS.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new oS.Notice("Indexing completed successfully!")}async reindexFile(e){try{let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return;if(await this.dbOps.removeDocs(e.path),await this.dbOps.checkAndHandleEmbeddingModelChange(r)){await this.indexVaultToVectorStore(!0);return}let o=await this.prepareAllChunks([e]);if(o.length===0)return;let i=await r.embedDocuments(o.map(a=>a.content));for(let a=0;a<o.length;a++){let s=o[a];await this.dbOps.upsert({...s.fileInfo,id:this.getDocHash(s.content),content:s.content,embedding:i[a],created_at:Date.now(),nchars:s.content.length})}this.dbOps.markUnsavedChanges(),de().debug&&console.log(`Reindexed file: ${e.path}`)}catch(r){this.handleError(r,{filePath:e.path})}}async cancelIndexing(){console.log("Indexing cancelled by user"),this.state.isIndexingCancelled=!0,await new Promise(e=>setTimeout(e,100)),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide()}};var va=class t{constructor(){this.embeddingsManager=ws.getInstance(),this.dbOps=new _C(app),this.indexOps=new Uee(app,this.dbOps,this.embeddingsManager),this.eventHandler=new Bee(app,this.indexOps,this.dbOps),this.initializationPromise=this.initialize(),this.setupSettingsSubscription()}static getInstance(){return t.instance||(t.instance=new t),t.instance}setupSettingsSubscription(){this.lastKnownSettings={...de()};let e=async()=>{let r=de(),n=this.lastKnownSettings;if(this.lastKnownSettings={...r},r.enableIndexSync!==n?.enableIndexSync){let o=await this.dbOps.getDbPath();this.dbOps.getCurrentDbPath()!==o&&await this.dbOps.initializeDB(await this.embeddingsManager.getEmbeddingsAPI())}};bl(()=>{this.initializationPromise=e()})}async initialize(){try{let e=3;for(;e>0;)try{await this.dbOps.initializeDB(await this.embeddingsManager.getEmbeddingsAPI());break}catch(r){if(r instanceof hr&&r.message.includes("Vault adapter not available")&&(e--,e>0)){await new Promise(n=>setTimeout(n,100));continue}new N3.Notice("Failed to initialize vector store. Please make sure you have a valid API key for your embedding model and restart the plugin."),console.error("Failed to initialize vector store:",r);break}}catch(e){console.error("Failed to initialize vector store:",e)}}async waitForInitialization(){await this.initializationPromise}async indexVaultToVectorStore(e){return await this.waitForInitialization(),N3.Platform.isMobile&&de().disableIndexOnMobile?(new N3.Notice("Indexing is disabled on mobile devices"),0):this.indexOps.indexVaultToVectorStore(e)}async clearIndex(){await this.waitForInitialization(),await this.dbOps.clearIndex(await this.embeddingsManager.getEmbeddingsAPI())}async garbageCollectVectorStore(){return await this.waitForInitialization(),this.dbOps.garbageCollect()}async getIndexedFiles(){return await this.waitForInitialization(),this.dbOps.getIndexedFiles()}async isIndexEmpty(){return await this.waitForInitialization(),this.dbOps.isIndexEmpty()}async hasIndex(e){return await this.waitForInitialization(),this.dbOps.hasIndex(e)}onunload(){this.eventHandler.cleanup(),this.dbOps.onunload()}async getDbOps(){return await this.waitForInitialization(),this.dbOps}async getDb(){await this.waitForInitialization();let e=this.dbOps.getDb();if(!e)throw new Error("Database is not loaded. Please restart the plugin.");return e}async reindexFile(e){await this.waitForInitialization(),await this.indexOps.reindexFile(e)}};var $Oe="copilot-plus-flash",gUr=$Oe+"|"+"copilot-plus",qOe="copilot-plus-small",UOe=qOe+"|"+"copilot-plus";function Ppe(t){return t.split("|")[1]==="copilot-plus"}function zee(){return Bo().isPlusUser}async function Hee(){return(await Ss.getInstance().validateLicenseKey()).isValid}function Ywt(){let t=gUr,e=UOe,r=de().embeddingModelKey;v9(t),XD("copilot_plus"),rE({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e&&va.getInstance().indexVaultToVectorStore()}function zOe(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function DN(t){window.open(zOe(t),"_blank")}function Zwt(){xt("isPlusUser",!0)}function Xwt(){let t=de().isPlusUser;xt("isPlusUser",!1),t&&new WW(app).open()}var Qwt=B(Tf()),eSt=require("obsidian"),Ss=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!de().plusLicenseKey)throw new eSt.Notice("Copilot Plus license key not found. Please enter your license key in the settings."),new Error("License key not initialized")}setPluginVersion(e){this.pluginVersion=e}async makeRequest(e,r,n="POST",o=!1,i=!1){i||this.checkLicenseKey(),r.user_id=de().userId;let a=new URL(`${UI}${e}`);n==="GET"&&Object.entries(r).forEach(([l,c])=>{a.searchParams.append(l,c)});let s=await fetch(a.toString(),{method:n,headers:{"Content-Type":"application/json",...!o&&{Authorization:`Bearer ${await Io(de().plusLicenseKey)}`},"X-Client-Version":this.pluginVersion},...n==="POST"&&{body:JSON.stringify(r)}}),u=await s.json();if(!s.ok)try{let l=u.detail,c=new Error(l.reason);return c.name=l.error,{data:null,error:c}}catch{return{data:null,error:new Error("Unknown error")}}return ar(`==== ${e} request ====:`,u),{data:u}}async validateLicenseKey(){let{data:e,error:r}=await this.makeRequest("/license",{license_key:await Io(de().plusLicenseKey)},"POST",!0,!0);return r?r.message==="Invalid license key"?(Xwt(),{isValid:!1}):{isValid:void 0}:(Zwt(),{isValid:!0,plan:e?.plan})}async broca(e){let{data:r,error:n}=await this.makeRequest("/broca",{message:e});if(n)throw n;if(!r)throw new Error("No data returned from broca");return r}async rerank(e,r){let{data:n,error:o}=await this.makeRequest("/rerank",{query:e,documents:r,model:"rerank-2"});if(o)throw o;if(!n)throw new Error("No data returned from rerank");return n}async url4llm(e){let{data:r,error:n}=await this.makeRequest("/url4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from url4llm");return r}async pdf4llm(e){let r=Qwt.Buffer.from(e).toString("base64"),{data:n,error:o}=await this.makeRequest("/pdf4llm",{pdf:r});if(o)throw o;if(!n)throw new Error("No data returned from pdf4llm");return n}async webSearch(e){let{data:r,error:n}=await this.makeRequest("/websearch",{query:e});if(n)throw n;if(!r)throw new Error("No data returned from websearch");return r}async youtube4llm(e){let{data:r,error:n}=await this.makeRequest("/youtube4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from youtube4llm");return r}};var QOe={};ff(QOe,{APIConnectionError:()=>wC,APIConnectionTimeoutError:()=>g1,APIError:()=>sl,APIUserAbortError:()=>Ml,AnthropicError:()=>tn,AuthenticationError:()=>Gk,BadRequestError:()=>Jk,ConflictError:()=>Xk,InternalServerError:()=>tB,NotFoundError:()=>Zk,PermissionDeniedError:()=>Yk,RateLimitError:()=>eB,UnprocessableEntityError:()=>Qk});var m1="0.27.3";var tSt=!1,h1,HOe,yUr,bUr,_Ur,rSt,vUr,Vee,VOe,nSt,WOe,Wee,oSt;function iSt(t,e={auto:!1}){if(tSt)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${t.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(h1)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${t.kind}'\` after \`import '@anthropic-ai/sdk/shims/${h1}'\``);tSt=e.auto,h1=t.kind,HOe=t.fetch,yUr=t.Request,bUr=t.Response,_Ur=t.Headers,rSt=t.FormData,vUr=t.Blob,Vee=t.File,VOe=t.ReadableStream,nSt=t.getMultipartRequestOptions,WOe=t.getDefaultAgent,Wee=t.fileFromPath,oSt=t.isFsReadStream}var Kee=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function aSt({manuallyImported:t}={}){let e=t?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from '@anthropic-ai/sdk'`:\n- `import '@anthropic-ai/sdk/shims/node'` (if you're running on Node)\n- `import '@anthropic-ai/sdk/shims/web'` (otherwise)\n",r,n,o,i;try{r=fetch,n=Request,o=Response,i=Headers}catch(a){throw new Error(`this environment is missing the following Web Fetch API type: ${a.message}. ${e}`)}return{kind:"web",fetch:r,Request:n,Response:o,Headers:i,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new Kee(a)}),getDefaultAgent:a=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/anthropics/anthropic-sdk-typescript#file-uploads")},isFsReadStream:a=>!1}}h1||iSt(aSt(),{auto:!0});var iS=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;async function*o(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let i=!1;try{for await(let a of SUr(e,r)){if(a.event==="completion")try{yield JSON.parse(a.data)}catch(s){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),s}if(a.event==="message_start"||a.event==="message_delta"||a.event==="message_stop"||a.event==="content_block_start"||a.event==="content_block_delta"||a.event==="content_block_stop")try{yield JSON.parse(a.data)}catch(s){throw console.error("Could not parse message into JSON:",a.data),console.error("From chunk:",a.raw),s}if(a.event!=="ping"&&a.event==="error")throw sl.generate(void 0,`SSE Error: ${a.data}`,a.data,JOe(e.headers))}i=!0}catch(a){if(a instanceof Error&&a.name==="AbortError")return;throw a}finally{i||r.abort()}}return new t(o,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new Wk,s=sSt(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new VOe({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}};async function*SUr(t,e){if(!t.body)throw e.abort(),new tn("Attempted to iterate over a response with no body");let r=new KOe,n=new Wk,o=sSt(t.body);for await(let i of xUr(o))for(let a of n.decode(i)){let s=r.decode(a);s&&(yield s)}for(let i of n.flush()){let a=r.decode(i);a&&(yield a)}}async function*xUr(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?new TextEncoder().encode(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=CUr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function CUr(t){for(let n=0;n<t.length-2;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var KOe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=OUr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},Wk=class t{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=t.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(t.NEWLINE_REGEXP);return n&&o.pop(),o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new tn(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new tn(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new tn("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}};Wk.NEWLINE_CHARS=new Set([`
`,"\r"]);Wk.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function OUr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function sSt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var EUr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",PUr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&L3(t),L3=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function";async function uSt(t,e,r){if(t=await t,PUr(t))return t;if(EUr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=L3(o)?[await o.arrayBuffer()]:[o];return new Vee(i,e,r)}let n=await TUr(t);if(e||(e=IUr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Vee(n,e,r)}async function TUr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(L3(t))e.push(await t.arrayBuffer());else if(MUr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${AUr(t)}`);return e}function AUr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function IUr(t){return GOe(t.name)||GOe(t.filename)||GOe(t.path)?.split(/[\\/]/).pop()}var GOe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},MUr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",YOe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var jUr=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},DUr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Jee;async function mSt(t){let{response:e}=t;if(t.options.stream)return Kk("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):iS.fromSSEResponse(e,t.controller);if(e.status===204)return null;if(t.options.__binaryResponse)return e;let r=e.headers.get("content-type");if(r?.includes("application/json")||r?.includes("application/vnd.api+json")){let i=await e.json();return Kk("response",e.status,e.url,e.headers,i),i}let o=await e.text();return Kk("response",e.status,e.url,e.headers,o),o}var Gee=class t extends Promise{constructor(e,r=mSt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>e(await this.parseResponse(r)))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},Yee=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=ZOe("maxRetries",r),this.timeout=ZOe("timeout",n),this.httpAgent=o,this.fetch=i??HOe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...FUr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${zUr()}`}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&L3(o?.body)?new DataView(await o.body.arrayBuffer()):o?.body instanceof DataView?o.body:o?.body instanceof ArrayBuffer?new DataView(o.body):o&&ArrayBuffer.isView(o?.body)?new DataView(o.body.buffer):o?.body;return{method:e,path:r,...o,body:i}}))}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e){let{method:r,path:n,query:o,headers:i={}}=e,a=ArrayBuffer.isView(e.body)||e.__binaryRequest&&typeof e.body=="string"?e.body:YOe(e.body)?e.body.body:e.body?JSON.stringify(e.body,null,2):null,s=this.calculateContentLength(a),u=this.buildURL(n,o);"timeout"in e&&ZOe("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??WOe(u),d=l+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let f=this.buildHeaders({options:e,headers:i,contentLength:s});return{req:{method:r,...a&&{body:a},headers:f,...c&&{agent:c},signal:e.signal??null},url:u,timeout:l}}buildHeaders({options:e,headers:r,contentLength:n}){let o={};n&&(o["content-length"]=n);let i=this.defaultHeaders(e);return pSt(o,i),pSt(o,r),YOe(e.body)&&h1!=="node"&&delete o["content-type"],this.validateHeaders(o,r),o}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return sl.generate(e,r,n,o)}request(e,r=null){return new Gee(this.makeRequest(e,r))}async makeRequest(e,r){let n=await e;r==null&&(r=n.maxRetries??this.maxRetries),await this.prepareOptions(n);let{req:o,url:i,timeout:a}=this.buildRequest(n);if(await this.prepareRequest(o,{url:i,options:n}),Kk("request",i,n,o.headers),n.signal?.aborted)throw new Ml;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(Zee);if(u instanceof Error){if(n.signal?.aborted)throw new Ml;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new g1:new wC({cause:u})}let l=JOe(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let h=`retrying, ${r} attempts remaining`;return Kk(`response (error; ${h})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(h=>Zee(h).message),d=kUr(c),f=d?void 0:c;throw Kk(`response (error; ${r?"(error; no more retries left)":"(error; not retryable)"})`,u.status,i,l,f),this.makeStatusError(u.status,d,f,l)}return{response:u,options:n,controller:s}}requestAPIList(e,r){let n=this.makeRequest(r,null);return new XOe(this,n,e)}buildURL(e,r){let n=$Ur(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return Qee(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new tn(`Cannot stringify type ${typeof n}; 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("&")}async fetchWithTimeout(e,r,n,o){let{signal:i,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let s=setTimeout(()=>o.abort(),n);return this.getRequestClient().fetch.call(void 0,e,{signal:o.signal,...a}).finally(()=>{clearTimeout(s)})}getRequestClient(){return{fetch:this.fetch}}shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n){let o,i=n?.["retry-after-ms"];if(i){let s=parseFloat(i);Number.isNaN(s)||(o=s)}let a=n?.["retry-after"];if(a&&!o){let s=parseFloat(a);Number.isNaN(s)?o=Date.parse(a)-Date.now():o=s*1e3}if(!(o&&0<=o&&o<60*1e3)){let s=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await qUr(o),this.makeRequest(e,r-1)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${m1}`}},lSt=class{constructor(e,r,n,o){Jee.set(this,void 0),jUr(this,Jee,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new tn("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in e&&typeof r.query=="object")r.query={...r.query,...e.params};else if("url"in e){let n=[...Object.entries(r.query||{}),...e.url.searchParams.entries()];for(let[o,i]of n)e.url.searchParams.set(o,i);r.query=void 0,r.path=e.url.toString()}return await DUr(this,Jee,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Jee=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},XOe=class extends Gee{constructor(e,r,n){super(r,async o=>new n(e,o.response,await mSt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},JOe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}});var NUr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":m1,"X-Stainless-OS":dSt(Deno.build.os),"X-Stainless-Arch":cSt(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":m1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":m1,"X-Stainless-OS":dSt(process.platform),"X-Stainless-Arch":cSt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=LUr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":m1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":m1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function LUr(){if(typeof navigator>"u"||!navigator)return null;let t=[{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(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}var cSt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",dSt=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),fSt,FUr=()=>fSt??(fSt=NUr()),kUr=t=>{try{return JSON.parse(t)}catch{return}},BUr=new RegExp("^(?:[a-z]+:)?//","i"),$Ur=t=>BUr.test(t),qUr=t=>new Promise(e=>setTimeout(e,t)),ZOe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new tn(`${t} must be an integer`);if(e<0)throw new tn(`${t} must be a positive integer`);return e},Zee=t=>t instanceof Error?t:new Error(t);var Xee=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function Qee(t){if(!t)return!0;for(let e in t)return!1;return!0}function UUr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function pSt(t,e){for(let r in e){if(!UUr(e,r))continue;let n=r.toLowerCase();if(!n)continue;let o=e[r];o===null?delete t[n]:o!==void 0&&(t[n]=o)}}function Kk(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${t}`,...e)}var zUr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),hSt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var tn=class extends Error{},sl=class t extends tn{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.request_id=o?.["request-id"],this.error=r}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e)return new wC({message:n,cause:Zee(r)});let i=r;return e===400?new Jk(e,i,n,o):e===401?new Gk(e,i,n,o):e===403?new Yk(e,i,n,o):e===404?new Zk(e,i,n,o):e===409?new Xk(e,i,n,o):e===422?new Qk(e,i,n,o):e===429?new eB(e,i,n,o):e>=500?new tB(e,i,n,o):new t(e,i,n,o)}},Ml=class extends sl{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},wC=class extends sl{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},g1=class extends wC{constructor({message:e}={}){super({message:e??"Request timed out."})}},Jk=class extends sl{constructor(){super(...arguments),this.status=400}},Gk=class extends sl{constructor(){super(...arguments),this.status=401}},Yk=class extends sl{constructor(){super(...arguments),this.status=403}},Zk=class extends sl{constructor(){super(...arguments),this.status=404}},Xk=class extends sl{constructor(){super(...arguments),this.status=409}},Qk=class extends sl{constructor(){super(...arguments),this.status=422}},eB=class extends sl{constructor(){super(...arguments),this.status=429}},tB=class extends sl{};var uh=class{constructor(e){this._client=e}};var VUr=t=>{let e=0,r=[];for(;e<t.length;){let n=t[e];if(n==="\\"){e++;continue}if(n==="{"){r.push({type:"brace",value:"{"}),e++;continue}if(n==="}"){r.push({type:"brace",value:"}"}),e++;continue}if(n==="["){r.push({type:"paren",value:"["}),e++;continue}if(n==="]"){r.push({type:"paren",value:"]"}),e++;continue}if(n===":"){r.push({type:"separator",value:":"}),e++;continue}if(n===","){r.push({type:"delimiter",value:","}),e++;continue}if(n==='"'){let s="",u=!1;for(n=t[++e];n!=='"';){if(e===t.length){u=!0;break}if(n==="\\"){if(e++,e===t.length){u=!0;break}s+=n+t[e],n=t[++e]}else s+=n,n=t[++e]}n=t[++e],u||r.push({type:"string",value:s});continue}if(n&&/\s/.test(n)){e++;continue}let i=/[0-9]/;if(n&&i.test(n)||n==="-"||n==="."){let s="";for(n==="-"&&(s+=n,n=t[++e]);n&&i.test(n)||n===".";)s+=n,n=t[++e];r.push({type:"number",value:s});continue}let a=/[a-z]/i;if(n&&a.test(n)){let s="";for(;n&&a.test(n)&&e!==t.length;)s+=n,n=t[++e];if(s=="true"||s=="false"||s==="null")r.push({type:"name",value:s});else{e++;continue}continue}e++}return r},rB=t=>{if(t.length===0)return t;let e=t[t.length-1];switch(e.type){case"separator":return t=t.slice(0,t.length-1),rB(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),rB(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),rB(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),rB(t);break;case"delimiter":return t=t.slice(0,t.length-1),rB(t);break}return t},WUr=t=>{let e=[];return t.map(r=>{r.type==="brace"&&(r.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),r.type==="paren"&&(r.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(r=>{r==="}"?t.push({type:"brace",value:"}"}):r==="]"&&t.push({type:"paren",value:"]"})}),t},KUr=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},ete=t=>JSON.parse(KUr(WUr(rB(VUr(t)))));var Xf=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},mn=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},lh,gT,tte,rte,F3,k3,nte,B3,SC,$3,ote,ite,nB,eEe,gSt,tEe,rEe,nEe,oEe,ySt,bSt="__json_buf",ate=class t{constructor(){lh.add(this),this.messages=[],this.receivedMessages=[],gT.set(this,void 0),this.controller=new AbortController,tte.set(this,void 0),rte.set(this,()=>{}),F3.set(this,()=>{}),k3.set(this,void 0),nte.set(this,()=>{}),B3.set(this,()=>{}),SC.set(this,{}),$3.set(this,!1),ote.set(this,!1),ite.set(this,!1),nB.set(this,!1),tEe.set(this,e=>{if(Xf(this,ote,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Ml),e instanceof Ml)return Xf(this,ite,!0,"f"),this._emit("abort",e);if(e instanceof tn)return this._emit("error",e);if(e instanceof Error){let r=new tn(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new tn(String(e)))}),Xf(this,tte,new Promise((e,r)=>{Xf(this,rte,e,"f"),Xf(this,F3,r,"f")}),"f"),Xf(this,k3,new Promise((e,r)=>{Xf(this,nte,e,"f"),Xf(this,B3,r,"f")}),"f"),mn(this,tte,"f").catch(()=>{}),mn(this,k3,"f").catch(()=>{})}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let o=new t;for(let i of r.messages)o._addPromptCachingBetaMessageParam(i);return o._run(()=>o._createPromptCachingBetaMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},mn(this,tEe,"f"))}_addPromptCachingBetaMessageParam(e){this.messages.push(e)}_addPromptCachingBetaMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createPromptCachingBetaMessage(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),mn(this,lh,"m",rEe).call(this);let i=await e.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)mn(this,lh,"m",nEe).call(this,a);if(i.controller.signal?.aborted)throw new Ml;mn(this,lh,"m",oEe).call(this)}_connected(){this.ended||(mn(this,rte,"f").call(this),this._emit("connect"))}get ended(){return mn(this,$3,"f")}get errored(){return mn(this,ote,"f")}get aborted(){return mn(this,ite,"f")}abort(){this.controller.abort()}on(e,r){return(mn(this,SC,"f")[e]||(mn(this,SC,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=mn(this,SC,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(mn(this,SC,"f")[e]||(mn(this,SC,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Xf(this,nB,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Xf(this,nB,!0,"f"),await mn(this,k3,"f")}get currentMessage(){return mn(this,gT,"f")}async finalMessage(){return await this.done(),mn(this,lh,"m",eEe).call(this)}async finalText(){return await this.done(),mn(this,lh,"m",gSt).call(this)}_emit(e,...r){if(mn(this,$3,"f"))return;e==="end"&&(Xf(this,$3,!0,"f"),mn(this,nte,"f").call(this));let n=mn(this,SC,"f")[e];if(n&&(mn(this,SC,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!mn(this,nB,"f")&&!n?.length&&Promise.reject(o),mn(this,F3,"f").call(this,o),mn(this,B3,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!mn(this,nB,"f")&&!n?.length&&Promise.reject(o),mn(this,F3,"f").call(this,o),mn(this,B3,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalPromptCachingBetaMessage",mn(this,lh,"m",eEe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),mn(this,lh,"m",rEe).call(this),this._connected();let o=iS.fromReadableStream(e,this.controller);for await(let i of o)mn(this,lh,"m",nEe).call(this,i);if(o.controller.signal?.aborted)throw new Ml;mn(this,lh,"m",oEe).call(this)}[(gT=new WeakMap,tte=new WeakMap,rte=new WeakMap,F3=new WeakMap,k3=new WeakMap,nte=new WeakMap,B3=new WeakMap,SC=new WeakMap,$3=new WeakMap,ote=new WeakMap,ite=new WeakMap,nB=new WeakMap,tEe=new WeakMap,lh=new WeakSet,eEe=function(){if(this.receivedMessages.length===0)throw new tn("stream ended without producing a PromptCachingBetaMessage with role=assistant");return this.receivedMessages.at(-1)},gSt=function(){if(this.receivedMessages.length===0)throw new tn("stream ended without producing a PromptCachingBetaMessage with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new tn("stream ended without producing a content block with type=text");return r.join(" ")},rEe=function(){this.ended||Xf(this,gT,void 0,"f")},nEe=function(r){if(this.ended)return;let n=mn(this,lh,"m",ySt).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);r.delta.type==="text_delta"&&o.type==="text"?this._emit("text",r.delta.text,o.text||""):r.delta.type==="input_json_delta"&&o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"message_stop":{this._addPromptCachingBetaMessageParam(n),this._addPromptCachingBetaMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{Xf(this,gT,n,"f");break}case"content_block_start":case"message_delta":break}},oEe=function(){if(this.ended)throw new tn("stream has ended, this shouldn't happen");let r=mn(this,gT,"f");if(!r)throw new tn("request ended without sending any chunks");return Xf(this,gT,void 0,"f"),r},ySt=function(r){let n=mn(this,gT,"f");if(r.type==="message_start"){if(n)throw new tn(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new tn(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let o=n.content.at(r.index);if(o?.type==="text"&&r.delta.type==="text_delta")o.text+=r.delta.text;else if(o?.type==="tool_use"&&r.delta.type==="input_json_delta"){let i=o[bSt]||"";i+=r.delta.partial_json,Object.defineProperty(o,bSt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=ete(i))}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new iS(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var y1=class extends uh{create(e,r){return this._client.post("/v1/messages?beta=prompt_caching",{body:e,timeout:this._client._options.timeout??6e5,...r,headers:{"anthropic-beta":"prompt-caching-2024-07-31",...r?.headers},stream:e.stream??!1})}stream(e,r){return ate.createMessage(this,e,r)}};y1||(y1={});var b1=class extends uh{constructor(){super(...arguments),this.messages=new y1(this._client)}};(function(t){t.Messages=y1})(b1||(b1={}));var yT=class extends uh{constructor(){super(...arguments),this.promptCaching=new b1(this._client)}};(function(t){t.PromptCaching=b1})(yT||(yT={}));var bT=class extends uh{create(e,r){return this._client.post("/v1/complete",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}};bT||(bT={});var Qf=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},hn=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ch,_T,ste,ute,q3,U3,lte,z3,xC,H3,cte,dte,oB,iEe,_St,aEe,sEe,uEe,lEe,vSt,wSt="__json_buf",fte=class t{constructor(){ch.add(this),this.messages=[],this.receivedMessages=[],_T.set(this,void 0),this.controller=new AbortController,ste.set(this,void 0),ute.set(this,()=>{}),q3.set(this,()=>{}),U3.set(this,void 0),lte.set(this,()=>{}),z3.set(this,()=>{}),xC.set(this,{}),H3.set(this,!1),cte.set(this,!1),dte.set(this,!1),oB.set(this,!1),aEe.set(this,e=>{if(Qf(this,cte,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Ml),e instanceof Ml)return Qf(this,dte,!0,"f"),this._emit("abort",e);if(e instanceof tn)return this._emit("error",e);if(e instanceof Error){let r=new tn(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new tn(String(e)))}),Qf(this,ste,new Promise((e,r)=>{Qf(this,ute,e,"f"),Qf(this,q3,r,"f")}),"f"),Qf(this,U3,new Promise((e,r)=>{Qf(this,lte,e,"f"),Qf(this,z3,r,"f")}),"f"),hn(this,ste,"f").catch(()=>{}),hn(this,U3,"f").catch(()=>{})}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let o=new t;for(let i of r.messages)o._addMessageParam(i);return o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},hn(this,aEe,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),hn(this,ch,"m",sEe).call(this);let i=await e.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)hn(this,ch,"m",uEe).call(this,a);if(i.controller.signal?.aborted)throw new Ml;hn(this,ch,"m",lEe).call(this)}_connected(){this.ended||(hn(this,ute,"f").call(this),this._emit("connect"))}get ended(){return hn(this,H3,"f")}get errored(){return hn(this,cte,"f")}get aborted(){return hn(this,dte,"f")}abort(){this.controller.abort()}on(e,r){return(hn(this,xC,"f")[e]||(hn(this,xC,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=hn(this,xC,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(hn(this,xC,"f")[e]||(hn(this,xC,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Qf(this,oB,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Qf(this,oB,!0,"f"),await hn(this,U3,"f")}get currentMessage(){return hn(this,_T,"f")}async finalMessage(){return await this.done(),hn(this,ch,"m",iEe).call(this)}async finalText(){return await this.done(),hn(this,ch,"m",_St).call(this)}_emit(e,...r){if(hn(this,H3,"f"))return;e==="end"&&(Qf(this,H3,!0,"f"),hn(this,lte,"f").call(this));let n=hn(this,xC,"f")[e];if(n&&(hn(this,xC,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!hn(this,oB,"f")&&!n?.length&&Promise.reject(o),hn(this,q3,"f").call(this,o),hn(this,z3,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!hn(this,oB,"f")&&!n?.length&&Promise.reject(o),hn(this,q3,"f").call(this,o),hn(this,z3,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",hn(this,ch,"m",iEe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),hn(this,ch,"m",sEe).call(this),this._connected();let o=iS.fromReadableStream(e,this.controller);for await(let i of o)hn(this,ch,"m",uEe).call(this,i);if(o.controller.signal?.aborted)throw new Ml;hn(this,ch,"m",lEe).call(this)}[(_T=new WeakMap,ste=new WeakMap,ute=new WeakMap,q3=new WeakMap,U3=new WeakMap,lte=new WeakMap,z3=new WeakMap,xC=new WeakMap,H3=new WeakMap,cte=new WeakMap,dte=new WeakMap,oB=new WeakMap,aEe=new WeakMap,ch=new WeakSet,iEe=function(){if(this.receivedMessages.length===0)throw new tn("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},_St=function(){if(this.receivedMessages.length===0)throw new tn("stream ended without producing a Message with role=assistant");let r=this.receivedMessages.at(-1).content.filter(n=>n.type==="text").map(n=>n.text);if(r.length===0)throw new tn("stream ended without producing a content block with type=text");return r.join(" ")},sEe=function(){this.ended||Qf(this,_T,void 0,"f")},uEe=function(r){if(this.ended)return;let n=hn(this,ch,"m",vSt).call(this,r);switch(this._emit("streamEvent",r,n),r.type){case"content_block_delta":{let o=n.content.at(-1);r.delta.type==="text_delta"&&o.type==="text"?this._emit("text",r.delta.text,o.text||""):r.delta.type==="input_json_delta"&&o.type==="tool_use"&&o.input&&this._emit("inputJson",r.delta.partial_json,o.input);break}case"message_stop":{this._addMessageParam(n),this._addMessage(n,!0);break}case"content_block_stop":{this._emit("contentBlock",n.content.at(-1));break}case"message_start":{Qf(this,_T,n,"f");break}case"content_block_start":case"message_delta":break}},lEe=function(){if(this.ended)throw new tn("stream has ended, this shouldn't happen");let r=hn(this,_T,"f");if(!r)throw new tn("request ended without sending any chunks");return Qf(this,_T,void 0,"f"),r},vSt=function(r){let n=hn(this,_T,"f");if(r.type==="message_start"){if(n)throw new tn(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new tn(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n;case"content_block_start":return n.content.push(r.content_block),n;case"content_block_delta":{let o=n.content.at(r.index);if(o?.type==="text"&&r.delta.type==="text_delta")o.text+=r.delta.text;else if(o?.type==="tool_use"&&r.delta.type==="input_json_delta"){let i=o[wSt]||"";i+=r.delta.partial_json,Object.defineProperty(o,wSt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=ete(i))}return n}case"content_block_stop":return n}},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("streamEvent",o=>{let i=r.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let i of r)i.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((i,a)=>r.push({resolve:i,reject:a})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new iS(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var vT=class extends uh{create(e,r){return e.model in SSt&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${SSt[e.model]}
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),this._client.post("/v1/messages",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}stream(e,r){return fte.createMessage(this,e,r)}},SSt={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024"};vT||(vT={});var xSt,pi=class extends Yee{constructor({baseURL:e=Xee("ANTHROPIC_BASE_URL"),apiKey:r=Xee("ANTHROPIC_API_KEY")??null,authToken:n=Xee("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&hSt())throw new tn(`It looks like you're running in a browser-like environment.
This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
TODO: link!
`);super({baseURL:i.baseURL,timeout:i.timeout??6e5,httpAgent:i.httpAgent,maxRetries:i.maxRetries,fetch:i.fetch}),this.completions=new bT(this),this.messages=new vT(this),this.beta=new yT(this),this._options=i,this.apiKey=r,this.authToken=n}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01",...this._options.defaultHeaders}}validateHeaders(e,r){if(!(this.apiKey&&e["x-api-key"])&&r["x-api-key"]!==null&&!(this.authToken&&e.authorization)&&r.authorization!==null)throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}authHeaders(e){let r=this.apiKeyAuth(e),n=this.bearerAuth(e);return r!=null&&!Qee(r)?r:n!=null&&!Qee(n)?n:{}}apiKeyAuth(e){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(e){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};xSt=pi;pi.Anthropic=xSt;pi.HUMAN_PROMPT=`
Human:`;pi.AI_PROMPT=`
Assistant:`;pi.DEFAULT_TIMEOUT=6e5;pi.AnthropicError=tn;pi.APIError=sl;pi.APIConnectionError=wC;pi.APIConnectionTimeoutError=g1;pi.APIUserAbortError=Ml;pi.NotFoundError=Zk;pi.ConflictError=Xk;pi.RateLimitError=eB;pi.BadRequestError=Jk;pi.AuthenticationError=Gk;pi.InternalServerError=tB;pi.PermissionDeniedError=Yk;pi.UnprocessableEntityError=Qk;pi.toFile=uSt;pi.fileFromPath=Wee;var{HUMAN_PROMPT:gTo,AI_PROMPT:yTo}=pi,{AnthropicError:bTo,APIError:_To,APIConnectionError:vTo,APIConnectionTimeoutError:wTo,APIUserAbortError:STo,NotFoundError:xTo,ConflictError:CTo,RateLimitError:OTo,BadRequestError:ETo,AuthenticationError:PTo,InternalServerError:TTo,PermissionDeniedError:ATo,UnprocessableEntityError:ITo}=QOe;(function(t){t.Completions=bT,t.Messages=vT,t.Beta=yT})(pi||(pi={}));fd();Wp();Gl();Cp();og();var V3=class extends RI{static lc_name(){return"AnthropicToolsOutputParser"}constructor(e){super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","anthropic","output_parsers"]}),Object.defineProperty(this,"returnId",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnSingle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"zodSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}async _validateResult(e){let r=e;if(typeof e=="string")try{r=JSON.parse(e)}catch(o){throw new Sp(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(o.message)}`,e)}else r=e;if(this.zodSchema===void 0)return r;let n=await this.zodSchema.safeParseAsync(r);if(n.success)return n.data;throw new Sp(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(n.error.errors)}`,JSON.stringify(r,null,2))}async parseResult(e){let r=e.flatMap(i=>{let{message:a}=i;return Array.isArray(a.content)?cEe(a.content)[0]:[]});if(r[0]===void 0)throw new Error("No parseable tool calls provided to AnthropicToolsOutputParser.");let[n]=r;return await this._validateResult(n.args)}};function cEe(t){let e=[];for(let r of t)r.type==="tool_use"&&e.push({name:r.name,args:r.input,id:r.id,type:"tool_call"});return e}function CSt(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:typeof t=="string"?{type:"tool",name:t}:t}function OSt(t){let e,r=Array.isArray(t.content)?t.content.find(o=>o.type==="tool_use"):void 0;r&&"index"in r&&"name"in r&&"id"in r&&(e={args:"",id:r.id,name:r.name,index:r.index,type:"tool_call_chunk"});let n=Array.isArray(t.content)?t.content.find(o=>o.type==="input_json_delta"):void 0;return n&&"index"in n&&"input"in n&&(typeof n.input=="string"?e={id:n.id,name:n.name,args:n.input,index:n.index,type:"tool_call_chunk"}:e={id:n.id,name:n.name,args:JSON.stringify(n.input,null,2),index:n.index,type:"tool_call_chunk"}),e}function ESt(t){let e=/^data:(image\/.+);base64,(.+)$/,r=t.match(e);if(r===null)throw new Error(["Anthropic only supports base64-encoded images currently.","Example: data:image/png;base64,/9j/4AAQSk..."].join(`
`));return{type:"base64",media_type:r[1]??"",data:r[2]??""}}function ZUr(t){let e=[];for(let r of t)if(r._getType()==="tool")if(typeof r.content=="string"){let n=e[e.length-1];n?._getType()==="human"&&Array.isArray(n.content)&&"type"in n.content[0]&&n.content[0].type==="tool_result"?n.content.push({type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}):e.push(new Ga({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new Ga({content:r.content}));else{let n=e[e.length-1];if(n?._getType()==="human"&&r._getType()==="human"){let o;typeof n.content=="string"?o=[{type:"text",text:n.content}]:o=n.content,typeof r.content=="string"?o.push({type:"text",text:r.content}):o=o.concat(r.content),n.content=o}else e.push(r)}return e}function PSt(t){if(t.id===void 0)throw new Error('Anthropic requires all tool calls to have an "id".');return{type:"tool_use",id:t.id,name:t.name,input:t.args}}function TSt(t){let e=["tool_use","tool_result","input_json_delta"],r=["text","text_delta"];return typeof t=="string"?t:t.map(o=>{let i="cache_control"in o?o.cache_control:void 0;if(o.type==="image_url"){let a;return typeof o.image_url=="string"?a=ESt(o.image_url):a=ESt(o.image_url.url),{type:"image",source:a,...i?{cache_control:i}:{}}}else{if(r.find(a=>a===o.type)&&"text"in o)return{type:"text",text:o.text,...i?{cache_control:i}:{}};if(e.find(a=>a===o.type)){let a={...o};if("index"in a&&delete a.index,a.type==="input_json_delta"&&(a.type="tool_use"),"input"in a)try{a.input=JSON.parse(a.input)}catch{}return{...a,...i?{cache_control:i}:{}}}else throw new Error("Unsupported message content format")}})}function pte(t){let e=ZUr(t),r;return e.length>0&&e[0]._getType()==="system"&&(r=t[0].content),{messages:(r!==void 0?e.slice(1):e).map(i=>{let a;if(i._getType()==="human")a="user";else if(i._getType()==="ai")a="assistant";else if(i._getType()==="tool")a="user";else throw i._getType()==="system"?new Error("System messages are only permitted as the first passed message."):new Error(`Message type "${i._getType()}" is not supported.`);if(ei(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(PSt)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(PSt)]};{let{content:s}=i;return!i.tool_calls.every(l=>s.find(c=>(c.type==="tool_use"||c.type==="input_json_delta")&&c.id===l.id))&&console.warn('The "tool_calls" field on a message is only respected if content is a string.'),{role:a,content:TSt(i.content)}}}else return{role:a,content:TSt(i.content)}}),system:r}}function ASt(t,e){if(t.type==="message_start"){let{content:r,usage:n,...o}=t.message,i={};for(let[s,u]of Object.entries(o))u!=null&&(i[s]=u);let a={input_tokens:n.input_tokens,output_tokens:n.output_tokens,total_tokens:n.input_tokens+n.output_tokens};return{chunk:new or({content:e.coerceContentToString?"":[],additional_kwargs:i,usage_metadata:e.streamUsage?a:void 0,id:t.message.id})}}else if(t.type==="message_delta"){let r={input_tokens:0,output_tokens:t.usage.output_tokens,total_tokens:t.usage.output_tokens};return{chunk:new or({content:e.coerceContentToString?"":[],additional_kwargs:{...t.delta},usage_metadata:e.streamUsage?r:void 0})}}else{if(t.type==="content_block_start"&&t.content_block.type==="tool_use")return{chunk:new or({content:e.coerceContentToString?"":[{index:t.index,...t.content_block,input:""}],additional_kwargs:{}})};if(t.type==="content_block_delta"&&t.delta.type==="text_delta"){let r=t.delta?.text;if(r!==void 0)return{chunk:new or({content:e.coerceContentToString?r:[{index:t.index,...t.delta}],additional_kwargs:{}})}}else{if(t.type==="content_block_delta"&&t.delta.type==="input_json_delta")return{chunk:new or({content:e.coerceContentToString?"":[{index:t.index,input:t.delta.partial_json,type:t.delta.type}],additional_kwargs:{}})};if(t.type==="content_block_start"&&t.content_block.type==="text"){let r=t.content_block?.text;if(r!==void 0)return{chunk:new or({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}],additional_kwargs:{}})}}}}return null}function ISt(t,e){let r=e.usage,n=r!=null?{input_tokens:r.input_tokens??0,output_tokens:r.output_tokens??0,total_tokens:(r.input_tokens??0)+(r.output_tokens??0)}:void 0;if(t.length===1&&t[0].type==="text")return[{text:t[0].text,message:new en({content:t[0].text,additional_kwargs:e,usage_metadata:n,response_metadata:e,id:e.id})}];{let o=cEe(t);return[{text:"",message:new en({content:t,additional_kwargs:e,tool_calls:o,usage_metadata:n,response_metadata:e,id:e.id})}]}}function XUr(t){return!!(t.tools&&t.tools.length>0)}function QUr(t){return"input_schema"in t}function ezr(t){if(typeof t.content=="string")return t.content;if(Array.isArray(t.content)&&t.content.length>=1&&"input"in t.content[0])return typeof t.content[0].input=="string"?t.content[0].input:JSON.stringify(t.content[0].input);if(Array.isArray(t.content)&&t.content.length>=1&&"text"in t.content[0])return t.content[0].text}var dEe=class extends _s{static lc_name(){return"ChatAnthropic"}get lc_secrets(){return{anthropicApiKey:"ANTHROPIC_API_KEY",apiKey:"ANTHROPIC_API_KEY"}}get lc_aliases(){return{modelName:"model"}}constructor(e){if(super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"anthropicApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"topK",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:2048}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"claude-2.1"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"claude-2.1"}),Object.defineProperty(this,"invocationKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clientOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streamingClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"createClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.anthropicApiKey=e?.apiKey??e?.anthropicApiKey??Ye("ANTHROPIC_API_KEY"),!this.anthropicApiKey&&!e?.createClient)throw new Error("Anthropic API key not found");this.clientOptions=e?.clientOptions??{},this.apiKey=this.anthropicApiKey,this.apiUrl=e?.anthropicApiUrl,this.modelName=e?.model??e?.modelName??this.model,this.model=this.modelName,this.invocationKwargs=e?.invocationKwargs??{},this.temperature=e?.temperature??this.temperature,this.topK=e?.topK??this.topK,this.topP=e?.topP??this.topP,this.maxTokens=e?.maxTokensToSample??e?.maxTokens??this.maxTokens,this.stopSequences=e?.stopSequences??this.stopSequences,this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.createClient=e?.createClient??(r=>new pi(r))}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"anthropic",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}formatStructuredToolToAnthropic(e){if(!(!e||!e.length))return e.map(r=>{if(QUr(r))return r;if(fc(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(pc(r))return{name:r.name,description:r.description,input_schema:Xn(r.schema)};throw new Error(`Unknown tool type passed to ChatAnthropic: ${JSON.stringify(r,null,2)}`)})}bindTools(e,r){return this.bind({tools:this.formatStructuredToolToAnthropic(e),...r})}invocationParams(e){let r=CSt(e?.tool_choice);return{model:this.model,temperature:this.temperature,top_k:this.topK,top_p:this.topP,stop_sequences:e?.stop??this.stopSequences,stream:this.streaming,max_tokens:this.maxTokens,tools:this.formatStructuredToolToAnthropic(e?.tools),tool_choice:r,...this.invocationKwargs}}_identifyingParams(){return{model_name:this.model,...this.invocationParams()}}identifyingParams(){return{model_name:this.model,...this.invocationParams()}}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=pte(e),a=!XUr({...o,...i,stream:!1}),s=await this.createStreamWithRetry({...o,...i,stream:!0},{headers:r.headers});for await(let u of s){if(r.signal?.aborted)throw s.controller.abort(),new Error("AbortError: User aborted the request.");let l=this.streamUsage??r.streamUsage,c=ASt(u,{streamUsage:l,coerceContentToString:a});if(!c)continue;let{chunk:d}=c,f=OSt(d),p=ezr(d);yield new Sn({message:new or({content:d.content,additional_kwargs:d.additional_kwargs,tool_call_chunks:f?[f]:void 0,usage_metadata:l?d.usage_metadata:void 0,response_metadata:d.response_metadata,id:d.id}),text:p??""}),p&&await n?.handleLLMNewToken(p)}}async _generateNonStreaming(e,r,n){let o=await this.completionWithRetry({...r,stream:!1,...pte(e)},n),{content:i,...a}=o,s=ISt(i,a),{role:u,type:l,...c}=a;return{generations:s,llmOutput:c}}async _generate(e,r,n){if(this.stopSequences&&r.stop)throw new Error('"stopSequence" parameter found in input and default params');let o=this.invocationParams(r);if(o.stream){let i,a=this._streamResponseChunks(e,r,n);for await(let s of a)i===void 0?i=s:i=i.concat(s);if(i===void 0)throw new Error("No chunks returned from Anthropic API.");return{generations:[{text:i.text,message:i.message}]}}else return this._generateNonStreaming(e,o,{signal:r.signal,headers:r.headers})}async createStreamWithRetry(e,r){if(!this.streamingClient){let o=this.apiUrl?{baseURL:this.apiUrl}:void 0;this.streamingClient=this.createClient({dangerouslyAllowBrowser:!0,...this.clientOptions,...o,apiKey:this.apiKey,maxRetries:0})}let n=async()=>this.streamingClient.messages.create({...e,...this.invocationKwargs,stream:!0},r);return this.caller.call(n)}async completionWithRetry(e,r){if(!this.batchClient){let o=this.apiUrl?{baseURL:this.apiUrl}:void 0;this.batchClient=this.createClient({dangerouslyAllowBrowser:!0,...this.clientOptions,...o,apiKey:this.apiKey,maxRetries:0})}let n=async()=>this.batchClient.messages.create({...e,...this.invocationKwargs},r);return this.caller.callWithOptions({signal:r.signal??void 0},n)}_llmType(){return"anthropic"}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw;if(i==="jsonMode")throw new Error('Anthropic only supports "functionCalling" as a method.');let s=o??"extract",u,l;if(rl(n)){let m=Xn(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new V3({returnSingle:!0,keyName:s,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.description=="string"&&typeof n.input_schema=="object"&&n.input_schema!=null?(m=n,s=n.name):m={name:s,description:n.description??"",input_schema:n},l=[m],u=new V3({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:{type:"tool",name:s}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=Kn.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=Kn.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Wo.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},mte=class extends dEe{};fd();Wp();Cp();og();Gl();function _1(t){let{azureOpenAIApiDeploymentName:e,azureOpenAIApiInstanceName:r,azureOpenAIApiKey:n,azureOpenAIBasePath:o,baseURL:i,azureADTokenProvider:a,azureOpenAIEndpoint:s}=t;if((n||a)&&o&&e)return`${o}/${e}`;if((n||a)&&s&&e)return`${s}/openai/deployments/${e}`;if(n||a){if(!r)throw new Error("azureOpenAIApiInstanceName is required when using azureOpenAIApiKey");if(!e)throw new Error("azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey");return`https://${r}.openai.azure.com/openai/deployments/${e}`}return i}Gl();function W3(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function v1(t){let e;return t.constructor.name===ef.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===di.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=W3(t,"INVALID_TOOL_RESULTS"):t.status===401?e=W3(t,"MODEL_AUTHENTICATION"):t.status===429?e=W3(t,"MODEL_RATE_LIMIT"):t.status===404?e=W3(t,"MODEL_NOT_FOUND"):e=t,e}function fEe(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}function tzr(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function MSt(t){let e=["namespace functions {",""];for(let r of t)r.description&&e.push(`// ${r.description}`),Object.keys(r.parameters.properties??{}).length>0?(e.push(`type ${r.name} = (_: {`),e.push(RSt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function RSt(t,e){let r=[];for(let[n,o]of Object.entries(t.properties??{}))o.description&&e<2&&r.push(`// ${o.description}`),t.required?.includes(n)?r.push(`${n}: ${hte(o,e)},`):r.push(`${n}?: ${hte(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function hte(t,e){if(tzr(t))return t.anyOf.map(r=>hte(r,e)).join(" | ");switch(t.type){case"string":return t.enum?t.enum.map(r=>`"${r}"`).join(" | "):"string";case"number":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"integer":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",RSt(t,e+2),"}"].join(`
`);case"array":return t.items?`${hte(t.items,e)}[]`:"any[]";default:return""}}function jSt(t,e){let r;if(pc(t)){let n=RQ({name:t.name,parameters:t.schema,description:t.description});n.function.parameters?r={type:n.type,function:{name:n.function.name,description:n.function.description,parameters:n.function.parameters,...e?.strict!==void 0?{strict:e.strict}:{}}}:r={type:"function",function:zP(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function rzr(t){return t.role!=="system"&&t.role!=="developer"&&t.role!=="assistant"&&t.role!=="user"&&t.role!=="function"&&t.role!=="tool"&&console.warn(`Unknown message role: ${t.role}`),t.role}function hEe(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":{if(!Ja.isInstance(t))throw new Error("Invalid generic chat message");return rzr(t)}default:throw new Error(`Unknown message type: ${e}`)}}function mEe(t,e){return t.flatMap(r=>{let n=hEe(r);n==="system"&&gEe(e)&&(n="developer");let o={role:n,content:r.content};if(r.name!=null&&(o.name=r.name),r.additional_kwargs.function_call!=null&&(o.function_call=r.additional_kwargs.function_call,o.content=""),ei(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(eS),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}var iB="__openai_function_call_ids__";function DSt(t,e){return t.flatMap(r=>{let n=hEe(r);if(n==="system"&&gEe(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let o=r;return o.additional_kwargs?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof o.content=="string")return{type:"computer_screenshot",image_url:o.content};if(Array.isArray(o.content)){let a=o.content.find(u=>u.type==="computer_screenshot");if(a)return a;let s=o.content.find(u=>u.type==="image_url");if(s)return{type:"computer_screenshot",image_url:typeof s.image_url=="string"?s.image_url:s.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:o.tool_call_id}:{type:"function_call_output",call_id:o.tool_call_id,id:o.id,output:typeof o.content!="string"?JSON.stringify(o.content):o.content}}if(n==="assistant"){let o=[];r.additional_kwargs.reasoning!=null&&(u=>typeof u=="object"&&u!=null&&"type"in u&&u.type==="reasoning")(r.additional_kwargs.reasoning)&&o.push(r.additional_kwargs.reasoning);let{content:i}=r;r.additional_kwargs.refusal!=null&&(typeof i=="string"&&(i=[{type:"output_text",text:i,annotations:[]}]),i=[...i,{type:"refusal",refusal:r.additional_kwargs.refusal}]),o.push({type:"message",role:"assistant",content:typeof i=="string"?i:i.flatMap(s=>s.type==="text"?{type:"output_text",text:s.text,annotations:s.annotations??[]}:s.type==="output_text"||s.type==="refusal"?s:[])});let a=r.additional_kwargs[iB];if(ei(r)&&r.tool_calls?.length?o.push(...r.tool_calls.map(s=>({type:"function_call",name:s.name,arguments:JSON.stringify(s.args),call_id:s.id,id:a?.[s.id]}))):r.additional_kwargs.tool_calls!=null&&o.push(...r.additional_kwargs.tool_calls.map(s=>({type:"function_call",name:s.function.name,call_id:s.id,id:a?.[s.id],arguments:s.function.arguments}))),r.additional_kwargs.tool_outputs!=null){let u=r.additional_kwargs.tool_outputs?.filter(l=>l.type==="computer_call");u.length>0&&o.push(...u)}return o}return n==="user"?{type:"message",role:"user",content:typeof r.content=="string"?r.content:r.content.flatMap(o=>{if(o.type==="text")return{type:"input_text",text:o.text};if(o.type==="image_url"){let i=typeof o.image_url=="string"?o.image_url:o.image_url.url,a=typeof o.image_url=="string"?"auto":o.image_url.detail;return{type:"input_image",image_url:i,detail:a}}return o.type==="input_text"||o.type==="input_image"||o.type==="input_file"?o:[]})}:[]})}function LSt(t){if(t.error){let a=new Error(t.error.message);throw a.name=t.error.code,a}let e=[],r=[],n=[],o={model:t.model,created_at:t.created_at,id:t.id,incomplete_details:t.incomplete_details,metadata:t.metadata,object:t.object,status:t.status,user:t.user,model_name:t.model},i={};for(let a of t.output)if(a.type==="message")e.push(...a.content.flatMap(s=>s.type==="output_text"?("parsed"in s&&s.parsed!=null&&(i.parsed=s.parsed),{type:"text",text:s.text,annotations:s.annotations}):s.type==="refusal"?(i.refusal=s.refusal,[]):s));else if(a.type==="function_call"){let s={function:{name:a.name,arguments:a.arguments},id:a.call_id};try{r.push(Zf(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Zp(s,l))}i[iB]??(i[iB]={}),i[iB][a.call_id]=a.id}else a.type==="reasoning"?i.reasoning=a:(i.tool_outputs??(i.tool_outputs=[]),i.tool_outputs.push(a));return new en({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function nzr(t){let e=[],r={},n,o=[],i={},a={},s;if(t.type==="response.output_text.delta")e.push({type:"text",text:t.delta,index:t.content_index});else if(t.type==="response.output_text.annotation.added")e.push({type:"text",text:"",annotations:[t.annotation],index:t.content_index});else if(t.type==="response.output_item.added"&&t.item.type==="message")s=t.item.id;else if(t.type==="response.output_item.added"&&t.item.type==="function_call")o.push({type:"tool_call_chunk",name:t.item.name,args:t.item.arguments,id:t.item.id,index:t.output_index}),a[iB]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&(t.item.type==="web_search_call"||t.item.type==="file_search_call"||t.item.type==="computer_call"))a.tool_outputs=[t.item];else if(t.type==="response.created")i.id=t.response.id,i.model_name=t.response.model,i.model=t.response.model;else if(t.type==="response.completed"){let u=LSt(t.response);n=t.response.usage,t.response.text?.format?.type==="json_schema"&&(a.parsed??(a.parsed=JSON.parse(u.text)));for(let[l,c]of Object.entries(t.response))l!=="id"&&(i[l]=c)}else if(t.type==="response.function_call_arguments.delta")o.push({type:"tool_call_chunk",args:t.delta,index:t.output_index});else if(t.type==="response.web_search_call.completed"||t.type==="response.file_search_call.completed")r={tool_outputs:{id:t.item_id,type:t.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(t.type==="response.refusal.done")a.refusal=t.refusal;else return null;return new Sn({text:e.map(u=>u.text).join(""),message:new or({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function pEe(t){return"type"in t&&t.type!=="function"}function ozr(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function NSt(t,e){return fc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:jSt(t,e)}function gEe(t){return t?.startsWith("o1")||t?.startsWith("o3")}var K3=class extends _s{static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning_effort"]}get lc_secrets(){return{openAIApiKey:"OPENAI_API_KEY",apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{modelName:"model",openAIApiKey:"openai_api_key",apiKey:"openai_api_key"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","reasoningEffort","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","modelName","model","modelKwargs","stop","stopSequences","timeout","openAIApiKey","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming"]}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??Ye("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??Ye("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.useResponsesApi=e?.useResponsesApi??this.useResponsesApi,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>pEe(o)?o:NSt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&gte(e.json_schema.schema)?Rk(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}invocationParams(e,r){let n;if(e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this._useResponseApi(e)){let s={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:e?.previous_response_id,truncation:e?.truncation,include:e?.include,tools:e?.tools?.length?e.tools.map(l=>pEe(l)?l:fc(l)?{type:"function",name:l.function.name,parameters:l.function.parameters,description:l.function.description,strict:n}:null).filter(l=>l!==null):void 0,tool_choice:ozr(e?.tool_choice)?e?.tool_choice:(()=>{let l=fEe(e?.tool_choice);if(typeof l=="object"&&"type"in l)return{type:"function",name:l.function.name}})(),text:(()=>{if(e?.text)return e.text;let l=this.createResponseFormat(e?.response_format);return l?.type==="json_schema"?l.json_schema.schema!=null?{format:{type:"json_schema",schema:l.json_schema.schema,description:l.json_schema.description,name:l.json_schema.name,strict:l.json_schema.strict}}:void 0:{format:l}})(),parallel_tool_calls:e?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,...this.modelKwargs},u=e?.reasoning_effort??this.reasoningEffort;return u!==void 0&&(s.reasoning={effort:u}),s}let o={};e?.stream_options!==void 0?o={stream_options:e.stream_options}:this.streamUsage&&(this.streaming||r?.streaming)&&(o={stream_options:{include_usage:!0}});let i={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:e?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:e?.functions,function_call:e?.function_call,tools:e?.tools?.length?e.tools.map(s=>NSt(s,{strict:n})):void 0,tool_choice:fEe(e?.tool_choice),response_format:this.createResponseFormat(e?.response_format),seed:e?.seed,...o,parallel_tool_calls:e?.parallel_tool_calls,...this.audio||e?.audio?{audio:this.audio||e?.audio}:{},...this.modalities||e?.modalities?{modalities:this.modalities||e?.modalities}:{},...this.modelKwargs};e?.prediction!==void 0&&(i.prediction=e.prediction);let a=e?.reasoning_effort??this.reasoningEffort;return a!==void 0&&(i.reasoning_effort=a),gEe(i.model)?i.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:i.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,i}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(Zf(u,{returnId:!0}))}catch(l){i.push(Zp(u,l.message))}let a={function_call:e.function_call,tool_calls:n};this.__includeRawResponse!==void 0&&(a.__raw_response=r);let s={model_name:r.model,...r.system_fingerprint?{usage:{...r.usage},system_fingerprint:r.system_fingerprint}:{}};return e.audio&&(a.audio=e.audio),new en({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Ja(e.content||"",e.role??"unknown")}}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=e.role??n,i=e.content??"",a;e.function_call?a={function_call:e.function_call}:e.tool_calls?a={tool_calls:e.tool_calls}:a={},this.__includeRawResponse&&(a.__raw_response=r),e.audio&&(a.audio={...e.audio,index:r.choices[0].index});let s={usage:{...r.usage}};if(o==="user")return new Nd({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(e.tool_calls))for(let l of e.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new or({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Wc({content:i,response_metadata:s}):o==="developer"?new Wc({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new _p({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Pm({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Dd({content:i,role:o,response_metadata:s})}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}async*_streamResponseChunks(e,r,n){if(this._useResponseApi(r)){let l=await this.responseApiWithRetry({...this.invocationParams(r,{streaming:!0}),input:DSt(e,this.model),stream:!0},r);for await(let c of l){let d=nzr(c);d!=null&&(yield d)}return}let o=mEe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new Sn({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new Sn({message:new or({content:"",response_metadata:{usage:{...u}},usage_metadata:{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,total_tokens:u.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(r.signal?.aborted)throw new Error("AbortError")}identifyingParams(){return this._identifyingParams()}async _responseApiGenerate(e,r,n){let o=this.invocationParams(r);if(o.stream){let s=this._streamResponseChunks(e,r,n),u;for await(let l of s)l.message.response_metadata={...l.generationInfo,...l.message.response_metadata},u=u?.concat(l)??l;return{generations:u?[u]:[],llmOutput:{estimatedTokenUsage:u?.message?.usage_metadata}}}let i=DSt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:LSt(a)}],llmOutput:{id:a.id,estimatedTokenUsage:a.usage?{promptTokens:a.usage.input_tokens,completionTokens:a.usage.output_tokens,totalTokens:a.usage.total_tokens}:void 0}}}_useResponseApi(e){let r=e?.tools?.some(pEe),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null;return this.useResponsesApi||r||n}async _generate(e,r,n){if(this._useResponseApi(r))return this._responseApiGenerate(e,r,n);let o={},i=this.invocationParams(r),a=mEe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let v={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};v.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},ei(v.message)&&(v.message.usage_metadata=o),v.message=new en(Object.fromEntries(Object.entries(v.message).filter(([g])=>!g.startsWith("lc_")))),p.push(v)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=MSt(r);o+=await this.getNumTokens(i),o+=9}return r&&e.find(i=>i._getType()==="system")&&(o-=4),n==="none"?o+=1:typeof n=="object"&&(o+=await this.getNumTokens(n.name)+4),o}async getNumTokensFromGenerations(e){return(await Promise.all(e.map(async n=>n.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([n.message])).countPerMessage[0]:await this.getNumTokens(n.message.content)))).reduce((n,o)=>n+o,0)}async getNumTokensFromMessages(e){let r=0,n=0,o=0;this.model==="gpt-3.5-turbo-0301"?(n=4,o=-1):(n=3,o=1);let i=await Promise.all(e.map(async a=>{let s=await this.getNumTokens(a.content),u=await this.getNumTokens(hEe(a)),l=a.name!==void 0?o+await this.getNumTokens(a.name):0,c=s+n+u+l,d=a;if(d._getType()==="function"&&(c-=2),d.additional_kwargs?.function_call&&(c+=3),d?.additional_kwargs.function_call?.name&&(c+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{c+=await this.getNumTokens(JSON.stringify(JSON.parse(d.additional_kwargs.function_call?.arguments)))}catch(f){console.error("Error parsing function arguments",f,JSON.stringify(d.additional_kwargs.function_call)),c+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return r+=c,c}));return r+=3,{totalCount:r,countPerMessage:i}}async completionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.chat.completions.create(e,n)}catch(o){throw v1(o)}})}async responseApiWithRetry(e,r){return this.caller.call(async()=>{let n=this._getClientOptions(r);try{return e.text?.format?.type==="json_schema"&&!e.stream?await this.client.responses.parse(e,n):await this.client.responses.create(e,n)}catch(o){throw v1(o)}})}async betaParsedCompletionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.beta.chat.completions.parse(e,n)}catch(o){throw v1(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=_1(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new jt(i)}return{...this.clientConfig,...e}}_llmType(){return"openai"}_combineLLMOutput(...e){return e.reduce((r,n)=>(n&&n.tokenUsage&&(r.tokenUsage.completionTokens+=n.tokenUsage.completionTokens??0,r.tokenUsage.promptTokens+=n.tokenUsage.promptTokens??0,r.tokenUsage.totalTokens+=n.tokenUsage.totalTokens??0),r),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}withStructuredOutput(e,r){let n,o,i,a;izr(e)?(n=e.schema,o=e.name,i=e.method,a=e.includeRaw):(n=e,o=r?.name,i=r?.method,a=r?.includeRaw);let s,u;if(r?.strict!==void 0&&i==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"?i===void 0&&(i="jsonSchema"):i==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`),i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),gte(n)?u=Yl.fromZodSchema(n):u=new Zl;else if(i==="jsonSchema")if(s=this.bind({response_format:{type:"json_schema",json_schema:{name:o??"extract",description:n.description,schema:n,strict:r?.strict}}}),gte(n)){let f=Yl.fromZodSchema(n);u=kd.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Zl;else{let f=o??"extract";if(gte(n)){let p=Xn(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:f}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new bc({returnSingle:!0,keyName:f,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,f=n.name):(f=n.title??f,p={name:f,description:n.description??"",parameters:n}),s=this.bind({tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:f}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new bc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Kn.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Kn.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Wo.from([{raw:s},d])}};function gte(t){return typeof t?.parse=="function"}function izr(t){return t!==void 0&&typeof t.schema=="object"}Wp();fd();var yEe=class extends gC{static lc_name(){return"DallEAPIWrapper"}constructor(e){e?.responseFormat!==void 0&&["url","b64_json"].includes(e.responseFormat)&&(e.dallEResponseFormat=e.responseFormat,e.responseFormat="content"),super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:"A wrapper around OpenAI DALL-E API. Useful for when you need to generate images from a text description. Input should be an image description."}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"dall-e-3"}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:"vivid"}),Object.defineProperty(this,"quality",{enumerable:!0,configurable:!0,writable:!0,value:"standard"}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:"1024x1024"}),Object.defineProperty(this,"dallEResponseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"url"}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let r=e?.apiKey??e?.openAIApiKey??Ye("OPENAI_API_KEY"),n=e?.organization??Ye("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new jt(o),this.model=e?.model??e?.modelName??this.model,this.style=e?.style??this.style,this.quality=e?.quality??this.quality,this.n=e?.n??this.n,this.size=e?.size??this.size,this.dallEResponseFormat=e?.dallEResponseFormat??this.dallEResponseFormat,this.user=e?.user}processMultipleGeneratedUrls(e){return this.dallEResponseFormat==="url"?e.flatMap(r=>r.data.flatMap(o=>o.url?{type:"image_url",image_url:o.url}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="string"&&o.image_url!==void 0)):e.flatMap(r=>r.data.flatMap(o=>o.b64_json?{type:"image_url",image_url:{url:o.b64_json}}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="object"&&"url"in o.image_url&&typeof o.image_url.url=="string"&&o.image_url.url!==void 0))}async _call(e){let r={model:this.model,prompt:e,n:1,size:this.size,response_format:this.dallEResponseFormat,style:this.style,quality:this.quality,user:this.user};if(this.n>1){let i=await Promise.all(Array.from({length:this.n}).map(()=>this.client.images.generate(r)));return this.processMultipleGeneratedUrls(i)}let n=await this.client.images.generate(r),o="";return this.dallEResponseFormat==="url"?[o]=n.data.map(i=>i.url).filter(i=>i!=="undefined"):[o]=n.data.map(i=>i.b64_json).filter(i=>i!=="undefined"),o}};Object.defineProperty(yEe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var yte=class extends K3{static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}constructor(e){let r=e?.apiKey||Ye("DEEPSEEK_API_KEY");if(!r)throw new Error('Deepseek API key not found. Please set the DEEPSEEK_API_KEY environment variable or pass the key into "apiKey" field.');super({...e,apiKey:r,configuration:{baseURL:"https://api.deepseek.com",...e?.configuration}}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","deepseek"]})}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=super._convertOpenAIDeltaToBaseMessageChunk(e,r,n);return o.additional_kwargs.reasoning_content=e.reasoning_content,o}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=super._convertOpenAIChatCompletionMessageToBaseMessage(e,r);return n.additional_kwargs.reasoning_content=e.reasoning_content,n}withStructuredOutput(e,r){let n={...r};return n?.method===void 0&&(n.method="functionCalling"),super.withStructuredOutput(e,n)}};Gl();fd();var w1="0.5.0";var FSt=!1,S1,bEe,azr,szr,uzr,_Ee,lzr,bte,vEe,wEe,SEe,_te,xEe;function kSt(t,e={auto:!1}){if(FSt)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(S1)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${S1}'\``);FSt=e.auto,S1=t.kind,bEe=t.fetch,azr=t.Request,szr=t.Response,uzr=t.Headers,_Ee=t.FormData,lzr=t.Blob,bte=t.File,vEe=t.ReadableStream,wEe=t.getMultipartRequestOptions,SEe=t.getDefaultAgent,_te=t.fileFromPath,xEe=t.isFsReadStream}var vte=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function BSt({manuallyImported:t}={}){let e=t?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from 'groq-sdk'`:\n- `import 'groq-sdk/shims/node'` (if you're running on Node)\n- `import 'groq-sdk/shims/web'` (otherwise)\n",r,n,o,i;try{r=fetch,n=Request,o=Response,i=Headers}catch(a){throw new Error(`this environment is missing the following Web Fetch API type: ${a.message}. ${e}`)}return{kind:"web",fetch:r,Request:n,Response:o,Headers:i,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new vte(a)}),getDefaultAgent:a=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/groq/groq-typescript#file-uploads")},isFsReadStream:a=>!1}}S1||kSt(BSt(),{auto:!0});var CEe={};ff(CEe,{APIConnectionError:()=>CC,APIConnectionTimeoutError:()=>x1,APIError:()=>ul,APIUserAbortError:()=>wT,AuthenticationError:()=>sB,BadRequestError:()=>aB,ConflictError:()=>cB,GroqError:()=>Rl,InternalServerError:()=>pB,NotFoundError:()=>lB,PermissionDeniedError:()=>uB,RateLimitError:()=>fB,UnprocessableEntityError:()=>dB});var Rl=class extends Error{},ul=class t extends Rl{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.error=r}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e)return new CC({cause:wte(r)});let i=r;return e===400?new aB(e,i,n,o):e===401?new sB(e,i,n,o):e===403?new uB(e,i,n,o):e===404?new lB(e,i,n,o):e===409?new cB(e,i,n,o):e===422?new dB(e,i,n,o):e===429?new fB(e,i,n,o):e>=500?new pB(e,i,n,o):new t(e,i,n,o)}},wT=class extends ul{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},CC=class extends ul{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},x1=class extends CC{constructor({message:e}={}){super({message:e??"Request timed out."})}},aB=class extends ul{constructor(){super(...arguments),this.status=400}},sB=class extends ul{constructor(){super(...arguments),this.status=401}},uB=class extends ul{constructor(){super(...arguments),this.status=403}},lB=class extends ul{constructor(){super(...arguments),this.status=404}},cB=class extends ul{constructor(){super(...arguments),this.status=409}},dB=class extends ul{constructor(){super(...arguments),this.status=422}},fB=class extends ul{constructor(){super(...arguments),this.status=429}},pB=class extends ul{};var Ste=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new OEe;async function*i(){if(!e.body)throw r.abort(),new Rl("Attempted to iterate over a response with no body");let s=new mB,u=$St(e.body);for await(let l of u)for(let c of s.decode(l)){let d=o.decode(c);d&&(yield d)}for(let l of s.flush()){let c=o.decode(l);c&&(yield c)}}async function*a(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let s=!1;try{for await(let u of i())if(!s){if(u.data.startsWith("[DONE]")){s=!0;continue}if(u.event===null){let l;try{l=JSON.parse(u.data)}catch(c){throw console.error("Could not parse message into JSON:",u.data),console.error("From chunk:",u.raw),c}if(l&&l.error)throw new ul(void 0,l.error,void 0,void 0);yield l}}s=!0}catch(u){if(u instanceof Error&&u.name==="AbortError")return;throw u}finally{s||r.abort()}}return new t(a,r)}static fromReadableStream(e,r){let n=!1;async function*o(){let a=new mB,s=$St(e);for await(let u of s)for(let l of a.decode(u))yield l;for(let u of a.flush())yield u}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let s of o())a||s&&(yield JSON.parse(s));a=!0}catch(s){if(s instanceof Error&&s.name==="AbortError")return;throw s}finally{a||r.abort()}}return new t(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller),new t(()=>o(r),this.controller)]}toReadableStream(){let e=this,r,n=new TextEncoder;return new vEe({async start(){r=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:a}=await r.next();if(a)return o.close();let s=n.encode(JSON.stringify(i)+`
`);o.enqueue(s)}catch(i){o.error(i)}},async cancel(){await r.return?.()}})}},OEe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=dzr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},mB=class t{constructor(){this.buffer=[],this.trailingCR=!1}decode(e){let r=this.decodeText(e);if(this.trailingCR&&(r="\r"+r,this.trailingCR=!1),r.endsWith("\r")&&(this.trailingCR=!0,r=r.slice(0,-1)),!r)return[];let n=t.NEWLINE_CHARS.has(r[r.length-1]||""),o=r.split(t.NEWLINE_REGEXP);return o.length===1&&!n?(this.buffer.push(o[0]),[]):(this.buffer.length>0&&(o=[this.buffer.join("")+o[0],...o.slice(1)],this.buffer=[]),n||(this.buffer=[o.pop()||""]),o)}decodeText(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof Buffer<"u"){if(e instanceof Buffer)return e.toString();if(e instanceof Uint8Array)return Buffer.from(e).toString();throw new Rl(`Unexpected: received non-Uint8Array (${e.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(e instanceof Uint8Array||e instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(e);throw new Rl(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Rl("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length&&!this.trailingCR)return[];let e=[this.buffer.join("")];return this.buffer=[],this.trailingCR=!1,e}};mB.NEWLINE_CHARS=new Set([`
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);mB.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;function dzr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function $St(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var qSt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",USt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&xte(t),xte=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",fzr=t=>USt(t)||qSt(t)||xEe(t);async function TEe(t,e,r){if(t=await t,r??(r=USt(t)?{lastModified:t.lastModified,type:t.type}:{}),qSt(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new bte([o],e,r)}let n=await pzr(t);if(e||(e=hzr(t)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new bte(n,e,r)}async function pzr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(xte(t))e.push(await t.arrayBuffer());else if(gzr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${mzr(t)}`);return e}function mzr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function hzr(t){return EEe(t.name)||EEe(t.filename)||EEe(t.path)?.split(/[\\/]/).pop()}var EEe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},gzr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",AEe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var J3=async t=>{let e=await zSt(t.body);return wEe(e,t)},zSt=async t=>{let e=new _Ee;return await Promise.all(Object.entries(t||{}).map(([r,n])=>PEe(e,r,n))),e};var PEe=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(fzr(r)){let n=await TEe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>PEe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>PEe(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var bzr=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},_zr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Cte;async function GSt(t){let{response:e}=t;if(t.options.stream)return hB("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Ste.fromSSEResponse(e,t.controller);if(e.status===204)return null;if(t.options.__binaryResponse)return e;let r=e.headers.get("content-type");if(r?.includes("application/json")||r?.includes("application/vnd.api+json")){let i=await e.json();return hB("response",e.status,e.url,e.headers,i),i}let o=await e.text();return hB("response",e.status,e.url,e.headers,o),o}var Ote=class t extends Promise{constructor(e,r=GSt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>e(await this.parseResponse(r)))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}},Ete=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=IEe("maxRetries",r),this.timeout=IEe("timeout",n),this.httpAgent=o,this.fetch=i??bEe}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...xzr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${Izr()}`}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(async o=>{let i=o&&xte(o?.body)?new DataView(await o.body.arrayBuffer()):o?.body instanceof DataView?o.body:o?.body instanceof ArrayBuffer?new DataView(o.body):o&&ArrayBuffer.isView(o?.body)?new DataView(o.body.buffer):o?.body;return{method:e,path:r,...o,body:i}}))}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}calculateContentLength(e){if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.byteLength(e,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e){let{method:r,path:n,query:o,headers:i={}}=e,a=ArrayBuffer.isView(e.body)||e.__binaryRequest&&typeof e.body=="string"?e.body:AEe(e.body)?e.body.body:e.body?JSON.stringify(e.body,null,2):null,s=this.calculateContentLength(a),u=this.buildURL(n,o);"timeout"in e&&IEe("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??SEe(u),d=l+1e3;typeof c?.options?.timeout=="number"&&d>(c.options.timeout??0)&&(c.options.timeout=d),this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let f=this.buildHeaders({options:e,headers:i,contentLength:s});return{req:{method:r,...a&&{body:a},headers:f,...c&&{agent:c},signal:e.signal??null},url:u,timeout:l}}buildHeaders({options:e,headers:r,contentLength:n}){let o={};n&&(o["content-length"]=n);let i=this.defaultHeaders(e);return JSt(o,i),JSt(o,r),AEe(e.body)&&S1!=="node"&&delete o["content-type"],this.validateHeaders(o,r),o}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(r=>[...r])):{...e}:{}}makeStatusError(e,r,n,o){return ul.generate(e,r,n,o)}request(e,r=null){return new Ote(this.makeRequest(e,r))}async makeRequest(e,r){let n=await e;r==null&&(r=n.maxRetries??this.maxRetries),await this.prepareOptions(n);let{req:o,url:i,timeout:a}=this.buildRequest(n);if(await this.prepareRequest(o,{url:i,options:n}),hB("request",i,n,o.headers),n.signal?.aborted)throw new wT;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(wte);if(u instanceof Error){if(n.signal?.aborted)throw new wT;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new x1:new CC({cause:u})}let l=vzr(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let h=`retrying, ${r} attempts remaining`;return hB(`response (error; ${h})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(h=>wte(h).message),d=Czr(c),f=d?void 0:c;throw hB(`response (error; ${r?"(error; no more retries left)":"(error; not retryable)"})`,u.status,i,l,f),this.makeStatusError(u.status,d,f,l)}return{response:u,options:n,controller:s}}requestAPIList(e,r){let n=this.makeRequest(r,null);return new MEe(this,n,e)}buildURL(e,r){let n=Ezr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return Tzr(o)||(r={...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(n.search=this.stringifyQuery(r)),n.toString()}stringifyQuery(e){return Object.entries(e).filter(([r,n])=>typeof n<"u").map(([r,n])=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return`${encodeURIComponent(r)}=${encodeURIComponent(n)}`;if(n===null)return`${encodeURIComponent(r)}=`;throw new Rl(`Cannot stringify type ${typeof n}; 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("&")}async fetchWithTimeout(e,r,n,o){let{signal:i,...a}=r||{};i&&i.addEventListener("abort",()=>o.abort());let s=setTimeout(()=>o.abort(),n);return this.getRequestClient().fetch.call(void 0,e,{signal:o.signal,...a}).finally(()=>{clearTimeout(s)})}getRequestClient(){return{fetch:this.fetch}}shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n){let o,i=n?.["retry-after-ms"];if(i){let s=parseFloat(i);Number.isNaN(s)||(o=s)}let a=n?.["retry-after"];if(a&&!o){let s=parseFloat(a);Number.isNaN(s)?o=Date.parse(a)-Date.now():o=s*1e3}if(!(o&&0<=o&&o<60*1e3)){let s=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,s)}return await Pzr(o),this.makeRequest(e,r-1)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}getUserAgent(){return`${this.constructor.name}/JS ${w1}`}},HSt=class{constructor(e,r,n,o){Cte.set(this,void 0),bzr(this,Cte,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageInfo()!=null:!1}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new Rl("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let r={...this.options};if("params"in e&&typeof r.query=="object")r.query={...r.query,...e.params};else if("url"in e){let n=[...Object.entries(r.query||{}),...e.url.searchParams.entries()];for(let[o,i]of n)e.url.searchParams.set(o,i);r.query=void 0,r.path=e.url.toString()}return await _zr(this,Cte,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Cte=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},MEe=class extends Ote{constructor(e,r,n){super(r,async o=>new n(e,o.response,await GSt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},vzr=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}});var wzr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w1,"X-Stainless-OS":WSt(Deno.build.os),"X-Stainless-Arch":VSt(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w1,"X-Stainless-OS":WSt(process.platform),"X-Stainless-Arch":VSt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=Szr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Szr(){if(typeof navigator>"u"||!navigator)return null;let t=[{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(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}var VSt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",WSt=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),KSt,xzr=()=>KSt??(KSt=wzr()),Czr=t=>{try{return JSON.parse(t)}catch{return}},Ozr=new RegExp("^(?:[a-z]+:)?//","i"),Ezr=t=>Ozr.test(t),Pzr=t=>new Promise(e=>setTimeout(e,t)),IEe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Rl(`${t} must be an integer`);if(e<0)throw new Rl(`${t} must be a positive integer`);return e},wte=t=>t instanceof Error?t:new Error(t);var REe=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function Tzr(t){if(!t)return!0;for(let e in t)return!1;return!0}function Azr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function JSt(t,e){for(let r in e){if(!Azr(e,r))continue;let n=r.toLowerCase();if(!n)continue;let o=e[r];o===null?delete t[n]:o!==void 0&&(t[n]=o)}}function hB(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var Izr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),YSt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var jl=class{constructor(e){this._client=e}};var C1=class extends jl{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",J3({body:e,...r}))}};C1||(C1={});var O1=class extends jl{create(e,r){return this._client.post("/openai/v1/audio/translations",J3({body:e,...r}))}};O1||(O1={});var ST=class extends jl{constructor(){super(...arguments),this.transcriptions=new C1(this._client),this.translations=new O1(this._client)}};(function(t){t.Transcriptions=C1,t.Translations=O1})(ST||(ST={}));var E1=class extends jl{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}};E1||(E1={});var xT=class extends jl{constructor(){super(...arguments),this.completions=new E1(this._client)}};(function(t){t.Completions=E1})(xT||(xT={}));var CT=class extends jl{};CT||(CT={});var OT=class extends jl{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}};OT||(OT={});var ET=class extends jl{retrieve(e,r){return this._client.get(`/openai/v1/models/${e}`,r)}list(e){return this._client.get("/openai/v1/models",e)}delete(e,r){return this._client.delete(`/openai/v1/models/${e}`,r)}};ET||(ET={});var ZSt,$a=class extends Ete{constructor({baseURL:e=REe("GROQ_BASE_URL"),apiKey:r=REe("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new Rl("The GROQ_API_KEY environment variable is missing or empty; either provide it, or instantiate the Groq client with an apiKey option, like new Groq({ apiKey: 'My API Key' }).");let o={apiKey:r,...n,baseURL:e||"https://api.groq.com"};if(!o.dangerouslyAllowBrowser&&YSt())throw new Rl(`It looks like you're running in a browser-like environment.
This is disabled by default, as it risks exposing your secret API credentials to attackers.
If you understand the risks and have appropriate mitigations in place,
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
new Groq({ apiKey, dangerouslyAllowBrowser: true })`);super({baseURL:o.baseURL,timeout:o.timeout??6e4,httpAgent:o.httpAgent,maxRetries:o.maxRetries,fetch:o.fetch}),this.completions=new CT(this),this.chat=new xT(this),this.embeddings=new OT(this),this.audio=new ST(this),this.models=new ET(this),this._options=o,this.apiKey=r}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}};ZSt=$a;$a.Groq=ZSt;$a.GroqError=Rl;$a.APIError=ul;$a.APIConnectionError=CC;$a.APIConnectionTimeoutError=x1;$a.APIUserAbortError=wT;$a.NotFoundError=lB;$a.ConflictError=cB;$a.RateLimitError=fB;$a.BadRequestError=aB;$a.AuthenticationError=sB;$a.InternalServerError=pB;$a.PermissionDeniedError=uB;$a.UnprocessableEntityError=dB;$a.toFile=TEe;$a.fileFromPath=_te;var{GroqError:DMo,APIError:NMo,APIConnectionError:LMo,APIConnectionTimeoutError:FMo,APIUserAbortError:kMo,NotFoundError:BMo,ConflictError:$Mo,RateLimitError:qMo,BadRequestError:UMo,AuthenticationError:zMo,InternalServerError:HMo,PermissionDeniedError:VMo,UnprocessableEntityError:WMo}=CEe;(function(t){t.Completions=CT,t.Chat=xT,t.Embeddings=OT,t.Audio=ST,t.Models=ET})($a||($a={}));var XSt=$a;Cp();og();function Lzr(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";default:throw new Error(`Unknown message type: ${e}`)}}function QSt(t){return t.map(e=>{if(typeof e.content!="string")throw new Error("Non string message content not supported");let r={role:Lzr(e),content:e.content,name:e.name,function_call:e.additional_kwargs.function_call,tool_calls:e.additional_kwargs.tool_calls,tool_call_id:e.tool_call_id};return ei(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(eS):(e.additional_kwargs.tool_calls!=null&&(r.tool_calls=e.additional_kwargs.tool_calls),e.tool_call_id!=null&&(r.tool_call_id=e.tool_call_id)),r})}function Fzr(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(Zf(i,{returnId:!0}))}catch(a){o.push(Zp(i,a.message))}return new en({content:t.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:e})}default:return new Ja(t.content||"",t.role??"unknown")}}function kzr(t,e){if(t?.length)return t.map(r=>({id:r.id,name:r.function?.name,args:r.function?.arguments,type:"tool_call_chunk",index:e}))}function Bzr(t,e,r){let{role:n}=t,o=t.content??"",i;t.function_call?i={function_call:t.function_call}:t.tool_calls?i={tool_calls:t.tool_calls}:i={};let a,s;if(r?.usage&&(a={input_tokens:r.usage.prompt_tokens,output_tokens:r.usage.completion_tokens,total_tokens:r.usage.total_tokens},s=r.id),n==="user")return{message:new Nd({content:o})};if(n==="assistant"){let u=kzr(t.tool_calls,e);return{message:new or({content:o,additional_kwargs:i,tool_call_chunks:u?u.map(l=>({type:l.type,args:l.args,index:l.index})):void 0,usage_metadata:a,id:s}),toolCallData:u?u.map(l=>({id:l.id??"",name:l.name??"",index:l.index??e,type:"tool_call_chunk"})):void 0}}else return n==="system"?{message:new Wc({content:o})}:{message:new Dd({content:o,role:n})}}var Pte=class extends _s{static lc_name(){return"ChatGroq"}_llmType(){return"groq"}get lc_secrets(){return{apiKey:"GROQ_API_KEY"}}constructor(e){super(e??{}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","groq"]}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:"mixtral-8x7b-32768"}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"mixtral-8x7b-32768"}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:.7}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0});let r=e?.apiKey||Ye("GROQ_API_KEY");if(!r)throw new Error('Groq API key not found. Please set the GROQ_API_KEY environment variable or provide the key into "apiKey"');this.client=new XSt({apiKey:r,dangerouslyAllowBrowser:!0}),this.apiKey=r,this.temperature=e?.temperature??this.temperature,this.modelName=e?.model??e?.modelName??this.model,this.model=this.modelName,this.streaming=e?.streaming??this.streaming,this.stop=e?.stopSequences??(typeof e?.stop=="string"?[e.stop]:e?.stop)??[],this.stopSequences=this.stop,this.maxTokens=e?.maxTokens}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"groq",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??this.temperature,ls_max_tokens:r.max_tokens??this.maxTokens,ls_stop:e.stop}}async completionWithRetry(e,r){return this.caller.call(async()=>this.client.chat.completions.create(e,r))}invocationParams(e){let r=super.invocationParams(e);return e.tool_choice!==void 0&&(r.tool_choice=e.tool_choice),e.tools!==void 0&&(r.tools=e.tools),e.response_format!==void 0&&(r.response_format=e.response_format),{...r,stop:e.stop??this.stopSequences,model:this.model,temperature:this.temperature,max_tokens:this.maxTokens}}bindTools(e,r){return this.bind({tools:e.map(n=>qw(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=QSt(e),a=await this.completionWithRetry({...o,messages:i,stream:!0},{signal:r?.signal,headers:r?.headers}),s="",u=[],l;for await(let c of a){l=c;let d=c?.choices[0];if(!d)continue;d.delta?.role&&(s=d.delta.role);let{message:f,toolCallData:p}=Bzr({...d.delta,role:s},d.index,c.x_groq);if(p){let h=p.filter(v=>u.every(g=>g.id!==v.id));u.push(...h),yield new Sn({message:new or({content:"",tool_call_chunks:h}),text:""})}let m=new Sn({message:f,text:d.delta.content??"",generationInfo:{finishReason:d.finish_reason}});yield m,n?.handleLLMNewToken(m.text??"")}if(l&&("choices"in l&&delete l.choices,yield new Sn({message:new or({content:"",response_metadata:l}),text:""})),r.signal?.aborted)throw new Error("AbortError")}async _generate(e,r,n){if(this.streaming){let o={},i=this._streamResponseChunks(e,r,n),a={};for await(let u of i){let l=u.generationInfo?.completion??0;a[l]===void 0?a[l]=u:a[l]=a[l].concat(u)}return{generations:Object.entries(a).sort(([u],[l])=>parseInt(u,10)-parseInt(l,10)).map(([u,l])=>l),llmOutput:{estimatedTokenUsage:o}}}else return this._generateNonStreaming(e,r,n)}async _generateNonStreaming(e,r,n){let o={},i=this.invocationParams(r),a=QSt(e),s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,headers:r?.headers});if("usage"in s&&s.usage){let{completion_tokens:l,prompt_tokens:c,total_tokens:d}=s.usage;l&&(o.completionTokens=(o.completionTokens??0)+l),c&&(o.promptTokens=(o.promptTokens??0)+c),d&&(o.totalTokens=(o.totalTokens??0)+d)}let u=[];if("choices"in s&&s.choices)for(let l of s.choices){let c=l.message?.content??"",d;o.totalTokens!==void 0&&(d={input_tokens:o.promptTokens??0,output_tokens:o.completionTokens??0,total_tokens:o.totalTokens});let f={text:c,message:Fzr(l.message??{role:"assistant"},d)};f.generationInfo={...l.finish_reason?{finish_reason:l.finish_reason}:{},...l.logprobs?{logprobs:l.logprobs}:{}},u.push(f)}return{generations:u,llmOutput:{tokenUsage:o}}}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw,s=o??"extract",u,l;if(i==="jsonMode")l=this.bind({response_format:{type:"json_object"}}),rl(n)?u=Yl.fromZodSchema(n):u=new Zl;else if(rl(n)){let p=Xn(n);l=this.bind({tools:[{type:"function",function:{name:s,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:s}}}),u=new bc({returnSingle:!0,keyName:s,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,s=n.name):(s=n.title??s,p={name:s,description:n.description??"",parameters:n}),l=this.bind({tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:s}}}),u=new bc({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=Kn.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=Kn.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return Wo.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}};var vc=[];for(Tte=0;Tte<256;++Tte)vc.push((Tte+256).toString(16).slice(1));var Tte;function ext(t,e=0){return(vc[t[e+0]]+vc[t[e+1]]+vc[t[e+2]]+vc[t[e+3]]+"-"+vc[t[e+4]]+vc[t[e+5]]+"-"+vc[t[e+6]]+vc[t[e+7]]+"-"+vc[t[e+8]]+vc[t[e+9]]+"-"+vc[t[e+10]]+vc[t[e+11]]+vc[t[e+12]]+vc[t[e+13]]+vc[t[e+14]]+vc[t[e+15]]).toLowerCase()}var Ate,$zr=new Uint8Array(16);function jEe(){if(!Ate&&(Ate=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ate))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ate($zr)}var qzr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),DEe={randomUUID:qzr};function Uzr(t,e,r){if(DEe.randomUUID&&!e&&!t)return DEe.randomUUID();t=t||{};var n=t.random||(t.rng||jEe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return ext(n)}var Ite=Uzr;var c1t=B(a1t(),1),d1t=B(iH(),1);fd();PD();og();Cp();Gl();var Uon=/^[a-zA-Z0-9]{9}$/;function zon(t){return Uon.test(t)}function Hon(t){let e=t,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";if(e===0)return r[0];let n=[],o=r.length;for(;e;)n.push(r[e%o]),e=Math.floor(e/o);return n.reverse().join("")}function Von(t){let e=0;for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);e=(e<<5)-e+n,e&=e}return Math.abs(e)}function _Ae(t){if(zon(t))return t;{let e=Von(t),r=Hon(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function vAe(t){return t?typeof t=="string"?t:t.map(e=>{if(e.type==="image_url"){if(typeof e.imageUrl!="string"&&e.imageUrl?.detail){let{detail:r}=e.imageUrl;if(r!=="high"&&r!=="auto"&&r!=="low")return{type:e.type,image_url:{url:e.imageUrl.url}}}return{type:e.type,image_url:e.imageUrl}}return e}):""}function s1t(t){let e=o=>{switch(o){case"human":return"user";case"ai":return"assistant";case"system":return"system";case"tool":return"tool";case"function":return"assistant";default:throw new Error(`Unknown message type: ${o}`)}},r=(o,i)=>{let a=(s,u)=>{if(s.type==="image_url"&&(u==="user"||u==="assistant"))return{type:s.type,imageUrl:s?.image_url};if(s.type==="text")return{type:s.type,text:s?.text};throw new Error(`ChatMistralAI only supports messages of "image_url" for roles "user" and "assistant", and "text" for all others.
Received: ${JSON.stringify(o,null,2)}`)};if(typeof o=="string")return o;if(Array.isArray(o)){let s=e(i),u=[];return o.forEach(l=>{if(l.type==="text"||l.type==="image_url")u.push(a(l,s));else throw new Error('Mistral only supports types "text" or "image_url" for complex message types.')}),u}throw new Error(`Message content must be a string or an array.
Received: ${JSON.stringify(o,null,2)}`)},n=o=>{if(ei(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:_Ae(i.id??"")})).map(eS)};return t.map(o=>{let i=n(o),a=r(o.content,o.getType());return"tool_call_id"in o&&typeof o.tool_call_id=="string"?{role:e(o.getType()),content:a,name:o.name,toolCallId:_Ae(o.tool_call_id)}:ei(o)?i===void 0?{role:e(o.getType()),content:a}:{role:e(o.getType()),toolCalls:i}:{role:e(o.getType()),content:a}})}function Won(t,e){let{message:r}=t;if(r===void 0)throw new Error("No message found in response");let n=[];"toolCalls"in r&&Array.isArray(r.toolCalls)&&(n=r.toolCalls);let o=vAe(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=Zf(s,{returnId:!0});i.push({...u,id:u.id??Ite().replace(/-/g,"")})}catch(u){a.push(Zp(s,u.message))}return new en({content:o,tool_calls:i,invalid_tool_calls:a,additional_kwargs:{},usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0})}default:return new Ga({content:o})}}function Kon(t,e){if(!t.content&&!t.toolCalls)return e?new or({content:"",usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0}):null;let r=t.toolCalls?.length?t.toolCalls?.map((s,u)=>({...s,index:u,id:s.id??Ite().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=vAe(t.content),i,a=[];if(r!==void 0)for(let s of r){let u=s.function?.arguments,l=u===void 0||typeof u=="string"?u:JSON.stringify(u);a.push({name:s.function?.name,args:l,id:s.id,index:s.index,type:"tool_call_chunk"})}else i={};return n==="user"?new Nd({content:o}):n==="assistant"?new or({content:o,tool_call_chunks:a,additional_kwargs:i,usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0}):n==="tool"?new Pm({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new _p({content:o,additional_kwargs:i}):new Dd({content:o,role:n})}function u1t(t){return t.map(e=>{if("function"in e)return e;let r=e.description??`Tool: ${e.name}`;return{type:"function",function:{name:e.name,description:r,parameters:Xn(e.schema)}}})}var Loe=class extends _s{static lc_name(){return"ChatMistralAI"}constructor(e){super(e??{}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","mistralai"]}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"mistral-small-latest"}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endpoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serverURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:.7}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"safeMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"safePrompt",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"randomSeed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"seed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"beforeRequestHooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestErrorHooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"responseHooks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"httpClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numCompletions",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let r=e?.apiKey??Ye("MISTRAL_API_KEY");if(!r)throw new Error("API key MISTRAL_API_KEY is missing for MistralAI, but it is required.");this.apiKey=r,this.streaming=e?.streaming??this.streaming,this.serverURL=e?.serverURL??this.serverURL,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.maxTokens=e?.maxTokens??this.maxTokens,this.safePrompt=e?.safePrompt??this.safePrompt,this.randomSeed=e?.seed??e?.randomSeed??this.seed,this.seed=this.randomSeed,this.maxRetries=e?.maxRetries,this.httpClient=e?.httpClient,this.model=e?.model??e?.modelName??this.model,this.streamUsage=e?.streamUsage??this.streamUsage,this.beforeRequestHooks=e?.beforeRequestHooks??this.beforeRequestHooks,this.requestErrorHooks=e?.requestErrorHooks??this.requestErrorHooks,this.responseHooks=e?.responseHooks??this.responseHooks,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.numCompletions=e?.numCompletions??this.numCompletions,this.addAllHooksToHttpClient()}get lc_secrets(){return{apiKey:"MISTRAL_API_KEY"}}get lc_aliases(){return{apiKey:"mistral_api_key"}}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"mistral",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.maxTokens??void 0}}_llmType(){return"mistral_ai"}invocationParams(e){let{response_format:r,tools:n,tool_choice:o}=e??{},i=n?.length?u1t(n):void 0;return{model:this.model,tools:i,temperature:this.temperature,maxTokens:this.maxTokens,topP:this.topP,randomSeed:this.seed,safePrompt:this.safePrompt,toolChoice:o,responseFormat:r,presencePenalty:this.presencePenalty,frequencyPenalty:this.frequencyPenalty,n:this.numCompletions}}bindTools(e,r){return this.bind({tools:u1t(e),...r})}async completionWithRetry(e,r){let n=new wp({maxRetries:this.maxRetries}),o=new c1t.Mistral({apiKey:this.apiKey,serverURL:this.serverURL,...this.httpClient?{httpClient:this.httpClient}:{}});return n.call(async()=>{try{let i;return r?i=await o.chat.stream(e):i=await o.chat.complete(e),i}catch(i){throw(i.message?.includes("status: 400")||i.message?.toLowerCase().includes("status 400")||i.message?.includes("validation failed"))&&(i.status=400),i}})}async _generate(e,r,n){let o={},i=this.invocationParams(r),a=s1t(e),s={...i,messages:a},u=r.signal??!!r.timeout;if(this.streaming||u){let m=this._streamResponseChunks(e,r,n),h={};for await(let g of m){let _=g.generationInfo?.completion??0;h[_]===void 0?h[_]=g:h[_]=h[_].concat(g)}return{generations:Object.entries(h).sort(([g],[_])=>parseInt(g,10)-parseInt(_,10)).map(([g,_])=>_),llmOutput:{estimatedTokenUsage:o}}}let l=await this.completionWithRetry(s,!1),{completionTokens:c,promptTokens:d,totalTokens:f}=l?.usage??{};c&&(o.completionTokens=(o.completionTokens??0)+c),d&&(o.promptTokens=(o.promptTokens??0)+d),f&&(o.totalTokens=(o.totalTokens??0)+f);let p=[];for(let m of l?.choices??[]){if("delta"in m)throw new Error("Delta not supported in non-streaming mode.");if(!("message"in m))throw new Error("No message found in the choice.");let h=m.message?.content??"";Array.isArray(h)&&(h=h[0].type==="text"?h[0].text:"");let v={text:h,message:Won(m,l?.usage)};m.finishReason&&(v.generationInfo={finishReason:m.finishReason}),p.push(v)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=s1t(e),a={...this.invocationParams(r),messages:o},s=await this.completionWithRetry(a,!0);for await(let{data:u}of s){if(r.signal?.aborted)throw new Error("AbortError");let l=u?.choices[0];if(!l||!("delta"in l))continue;let{delta:c}=l;if(!c)continue;let d={prompt:0,completion:l.index??0},f=this.streamUsage||r.streamUsage,p=Kon(c,f?u.usage:null);if(p===null)continue;let m=c.content??"";Array.isArray(m)&&(m=m[0].type==="text"?m[0].text:"");let h=new Sn({message:p,text:m,generationInfo:d});yield h,n?.handleLLMNewToken(h.text??"",d,void 0,void 0,void 0,{chunk:h})}}addAllHooksToHttpClient(){try{if(this.removeAllHooksFromHttpClient(),[this.beforeRequestHooks,this.requestErrorHooks,this.responseHooks].some(r=>r&&r.length>0)&&!this.httpClient&&(this.httpClient=new d1t.HTTPClient),this.beforeRequestHooks)for(let r of this.beforeRequestHooks)this.httpClient?.addHook("beforeRequest",r);if(this.requestErrorHooks)for(let r of this.requestErrorHooks)this.httpClient?.addHook("requestError",r);if(this.responseHooks)for(let r of this.responseHooks)this.httpClient?.addHook("response",r)}catch{throw new Error("Error in adding all hooks")}}removeAllHooksFromHttpClient(){try{if(this.beforeRequestHooks)for(let e of this.beforeRequestHooks)this.httpClient?.removeHook("beforeRequest",e);if(this.requestErrorHooks)for(let e of this.requestErrorHooks)this.httpClient?.removeHook("requestError",e);if(this.responseHooks)for(let e of this.responseHooks)this.httpClient?.removeHook("response",e)}catch{throw new Error("Error in removing hooks")}}removeHookFromHttpClient(e){try{this.httpClient?.removeHook("beforeRequest",e),this.httpClient?.removeHook("requestError",e),this.httpClient?.removeHook("response",e)}catch{throw new Error("Error in removing hook")}}_combineLLMOutput(){return[]}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw,s,u;if(i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),l1t(n)?u=Yl.fromZodSchema(n):u=new Zl;else{let f=o??"extract";if(l1t(n)){let p=Xn(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:"any"}),u=new bc({returnSingle:!0,keyName:f,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,f=n.name):p={name:f,description:n.description??"",parameters:n},s=this.bind({tools:[{type:"function",function:p}],tool_choice:"any"}),u=new bc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Kn.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Kn.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Wo.from([{raw:s},d])}};function l1t(t){return typeof t?.parse=="function"}fd();fd();Wp();Cp();og();Gl();function oj(t){let{azureOpenAIApiDeploymentName:e,azureOpenAIApiInstanceName:r,azureOpenAIApiKey:n,azureOpenAIBasePath:o,baseURL:i,azureADTokenProvider:a,azureOpenAIEndpoint:s}=t;if((n||a)&&o&&e)return`${o}/${e}`;if((n||a)&&s&&e)return`${s}/openai/deployments/${e}`;if(n||a){if(!r)throw new Error("azureOpenAIApiInstanceName is required when using azureOpenAIApiKey");if(!e)throw new Error("azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey");return`https://${r}.openai.azure.com/openai/deployments/${e}`}return i}Gl();function LH(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function ij(t){let e;return t.constructor.name===ef.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===di.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=LH(t,"INVALID_TOOL_RESULTS"):t.status===401?e=LH(t,"MODEL_AUTHENTICATION"):t.status===429?e=LH(t,"MODEL_RATE_LIMIT"):t.status===404?e=LH(t,"MODEL_NOT_FOUND"):e=t,e}function wAe(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}function Jon(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function f1t(t){let e=["namespace functions {",""];for(let r of t)r.description&&e.push(`// ${r.description}`),Object.keys(r.parameters.properties??{}).length>0?(e.push(`type ${r.name} = (_: {`),e.push(p1t(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function p1t(t,e){let r=[];for(let[n,o]of Object.entries(t.properties??{}))o.description&&e<2&&r.push(`// ${o.description}`),t.required?.includes(n)?r.push(`${n}: ${Foe(o,e)},`):r.push(`${n}?: ${Foe(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function Foe(t,e){if(Jon(t))return t.anyOf.map(r=>Foe(r,e)).join(" | ");switch(t.type){case"string":return t.enum?t.enum.map(r=>`"${r}"`).join(" | "):"string";case"number":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"integer":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",p1t(t,e+2),"}"].join(`
`);case"array":return t.items?`${Foe(t.items,e)}[]`:"any[]";default:return""}}function m1t(t,e){let r;if(pc(t)){let n=RQ({name:t.name,parameters:t.schema,description:t.description});n.function.parameters?r={type:n.type,function:{name:n.function.name,description:n.function.description,parameters:n.function.parameters,...e?.strict!==void 0?{strict:e.strict}:{}}}:r={type:"function",function:zP(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function Gon(t){return t.role!=="system"&&t.role!=="developer"&&t.role!=="assistant"&&t.role!=="user"&&t.role!=="function"&&t.role!=="tool"&&console.warn(`Unknown message role: ${t.role}`),t.role}function CAe(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":{if(!Ja.isInstance(t))throw new Error("Invalid generic chat message");return Gon(t)}default:throw new Error(`Unknown message type: ${e}`)}}function xAe(t,e){return t.flatMap(r=>{let n=CAe(r);n==="system"&&OAe(e)&&(n="developer");let o={role:n,content:r.content};if(r.name!=null&&(o.name=r.name),r.additional_kwargs.function_call!=null&&(o.function_call=r.additional_kwargs.function_call,o.content=""),ei(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(eS),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}var zB="__openai_function_call_ids__";function h1t(t,e){return t.flatMap(r=>{let n=CAe(r);if(n==="system"&&OAe(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let o=r;return o.additional_kwargs?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof o.content=="string")return{type:"computer_screenshot",image_url:o.content};if(Array.isArray(o.content)){let a=o.content.find(u=>u.type==="computer_screenshot");if(a)return a;let s=o.content.find(u=>u.type==="image_url");if(s)return{type:"computer_screenshot",image_url:typeof s.image_url=="string"?s.image_url:s.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:o.tool_call_id}:{type:"function_call_output",call_id:o.tool_call_id,id:o.id,output:typeof o.content!="string"?JSON.stringify(o.content):o.content}}if(n==="assistant"){let o=[];r.additional_kwargs.reasoning!=null&&(u=>typeof u=="object"&&u!=null&&"type"in u&&u.type==="reasoning")(r.additional_kwargs.reasoning)&&o.push(r.additional_kwargs.reasoning);let{content:i}=r;r.additional_kwargs.refusal!=null&&(typeof i=="string"&&(i=[{type:"output_text",text:i,annotations:[]}]),i=[...i,{type:"refusal",refusal:r.additional_kwargs.refusal}]),o.push({type:"message",role:"assistant",content:typeof i=="string"?i:i.flatMap(s=>s.type==="text"?{type:"output_text",text:s.text,annotations:s.annotations??[]}:s.type==="output_text"||s.type==="refusal"?s:[])});let a=r.additional_kwargs[zB];if(ei(r)&&r.tool_calls?.length?o.push(...r.tool_calls.map(s=>({type:"function_call",name:s.name,arguments:JSON.stringify(s.args),call_id:s.id,id:a?.[s.id]}))):r.additional_kwargs.tool_calls!=null&&o.push(...r.additional_kwargs.tool_calls.map(s=>({type:"function_call",name:s.function.name,call_id:s.id,id:a?.[s.id],arguments:s.function.arguments}))),r.additional_kwargs.tool_outputs!=null){let u=r.additional_kwargs.tool_outputs?.filter(l=>l.type==="computer_call");u.length>0&&o.push(...u)}return o}return n==="user"?{type:"message",role:"user",content:typeof r.content=="string"?r.content:r.content.flatMap(o=>{if(o.type==="text")return{type:"input_text",text:o.text};if(o.type==="image_url"){let i=typeof o.image_url=="string"?o.image_url:o.image_url.url,a=typeof o.image_url=="string"?"auto":o.image_url.detail;return{type:"input_image",image_url:i,detail:a}}return o.type==="input_text"||o.type==="input_image"||o.type==="input_file"?o:[]})}:[]})}function y1t(t){if(t.error){let a=new Error(t.error.message);throw a.name=t.error.code,a}let e=[],r=[],n=[],o={model:t.model,created_at:t.created_at,id:t.id,incomplete_details:t.incomplete_details,metadata:t.metadata,object:t.object,status:t.status,user:t.user,model_name:t.model},i={};for(let a of t.output)if(a.type==="message")e.push(...a.content.flatMap(s=>s.type==="output_text"?("parsed"in s&&s.parsed!=null&&(i.parsed=s.parsed),{type:"text",text:s.text,annotations:s.annotations}):s.type==="refusal"?(i.refusal=s.refusal,[]):s));else if(a.type==="function_call"){let s={function:{name:a.name,arguments:a.arguments},id:a.call_id};try{r.push(Zf(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Zp(s,l))}i[zB]??(i[zB]={}),i[zB][a.call_id]=a.id}else a.type==="reasoning"?i.reasoning=a:(i.tool_outputs??(i.tool_outputs=[]),i.tool_outputs.push(a));return new en({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function Yon(t){let e=[],r={},n,o=[],i={},a={},s;if(t.type==="response.output_text.delta")e.push({type:"text",text:t.delta,index:t.content_index});else if(t.type==="response.output_text.annotation.added")e.push({type:"text",text:"",annotations:[t.annotation],index:t.content_index});else if(t.type==="response.output_item.added"&&t.item.type==="message")s=t.item.id;else if(t.type==="response.output_item.added"&&t.item.type==="function_call")o.push({type:"tool_call_chunk",name:t.item.name,args:t.item.arguments,id:t.item.id,index:t.output_index}),a[zB]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&(t.item.type==="web_search_call"||t.item.type==="file_search_call"||t.item.type==="computer_call"))a.tool_outputs=[t.item];else if(t.type==="response.created")i.id=t.response.id,i.model_name=t.response.model,i.model=t.response.model;else if(t.type==="response.completed"){let u=y1t(t.response);n=t.response.usage,t.response.text?.format?.type==="json_schema"&&(a.parsed??(a.parsed=JSON.parse(u.text)));for(let[l,c]of Object.entries(t.response))l!=="id"&&(i[l]=c)}else if(t.type==="response.function_call_arguments.delta")o.push({type:"tool_call_chunk",args:t.delta,index:t.output_index});else if(t.type==="response.web_search_call.completed"||t.type==="response.file_search_call.completed")r={tool_outputs:{id:t.item_id,type:t.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(t.type==="response.refusal.done")a.refusal=t.refusal;else return null;return new Sn({text:e.map(u=>u.text).join(""),message:new or({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function SAe(t){return"type"in t&&t.type!=="function"}function Zon(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function g1t(t,e){return fc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:m1t(t,e)}function OAe(t){return t?.startsWith("o1")||t?.startsWith("o3")}var FH=class extends _s{static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning_effort"]}get lc_secrets(){return{openAIApiKey:"OPENAI_API_KEY",apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{modelName:"model",openAIApiKey:"openai_api_key",apiKey:"openai_api_key"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","reasoningEffort","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","modelName","model","modelKwargs","stop","stopSequences","timeout","openAIApiKey","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming"]}constructor(e){super(e??{}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"temperature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topP",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"frequencyPenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"presencePenalty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"logitBias",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modelName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"gpt-3.5-turbo"}),Object.defineProperty(this,"modelKwargs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stopSequences",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"streaming",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"streamUsage",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"topLogprobs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"openAIApiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"organization",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__includeRawResponse",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"supportsStrictToolCalling",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"audio",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"modalities",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reasoningEffort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"useResponsesApi",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.openAIApiKey=e?.apiKey??e?.openAIApiKey??e?.configuration?.apiKey??Ye("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??Ye("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoningEffort=e?.reasoningEffort,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.useResponsesApi=e?.useResponsesApi??this.useResponsesApi,this.model==="o1"&&(this.disableStreaming=!0),this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling)}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.bind({tools:e.map(o=>SAe(o)?o:g1t(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&koe(e.json_schema.schema)?Rk(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}invocationParams(e,r){let n;if(e?.strict!==void 0?n=e.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this._useResponseApi(e)){let s={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:e?.previous_response_id,truncation:e?.truncation,include:e?.include,tools:e?.tools?.length?e.tools.map(l=>SAe(l)?l:fc(l)?{type:"function",name:l.function.name,parameters:l.function.parameters,description:l.function.description,strict:n}:null).filter(l=>l!==null):void 0,tool_choice:Zon(e?.tool_choice)?e?.tool_choice:(()=>{let l=wAe(e?.tool_choice);if(typeof l=="object"&&"type"in l)return{type:"function",name:l.function.name}})(),text:(()=>{if(e?.text)return e.text;let l=this.createResponseFormat(e?.response_format);return l?.type==="json_schema"?l.json_schema.schema!=null?{format:{type:"json_schema",schema:l.json_schema.schema,description:l.json_schema.description,name:l.json_schema.name,strict:l.json_schema.strict}}:void 0:{format:l}})(),parallel_tool_calls:e?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,...this.modelKwargs},u=e?.reasoning_effort??this.reasoningEffort;return u!==void 0&&(s.reasoning={effort:u}),s}let o={};e?.stream_options!==void 0?o={stream_options:e.stream_options}:this.streamUsage&&(this.streaming||r?.streaming)&&(o={stream_options:{include_usage:!0}});let i={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:e?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:e?.functions,function_call:e?.function_call,tools:e?.tools?.length?e.tools.map(s=>g1t(s,{strict:n})):void 0,tool_choice:wAe(e?.tool_choice),response_format:this.createResponseFormat(e?.response_format),seed:e?.seed,...o,parallel_tool_calls:e?.parallel_tool_calls,...this.audio||e?.audio?{audio:this.audio||e?.audio}:{},...this.modalities||e?.modalities?{modalities:this.modalities||e?.modalities}:{},...this.modelKwargs};e?.prediction!==void 0&&(i.prediction=e.prediction);let a=e?.reasoning_effort??this.reasoningEffort;return a!==void 0&&(i.reasoning_effort=a),OAe(i.model)?i.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:i.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,i}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=e.tool_calls;switch(e.role){case"assistant":{let o=[],i=[];for(let u of n??[])try{o.push(Zf(u,{returnId:!0}))}catch(l){i.push(Zp(u,l.message))}let a={function_call:e.function_call,tool_calls:n};this.__includeRawResponse!==void 0&&(a.__raw_response=r);let s={model_name:r.model,...r.system_fingerprint?{usage:{...r.usage},system_fingerprint:r.system_fingerprint}:{}};return e.audio&&(a.audio=e.audio),new en({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Ja(e.content||"",e.role??"unknown")}}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=e.role??n,i=e.content??"",a;e.function_call?a={function_call:e.function_call}:e.tool_calls?a={tool_calls:e.tool_calls}:a={},this.__includeRawResponse&&(a.__raw_response=r),e.audio&&(a.audio={...e.audio,index:r.choices[0].index});let s={usage:{...r.usage}};if(o==="user")return new Nd({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(e.tool_calls))for(let l of e.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new or({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Wc({content:i,response_metadata:s}):o==="developer"?new Wc({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new _p({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Pm({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new Dd({content:i,role:o,response_metadata:s})}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}async*_streamResponseChunks(e,r,n){if(this._useResponseApi(r)){let l=await this.responseApiWithRetry({...this.invocationParams(r,{streaming:!0}),input:h1t(e,this.model),stream:!0},r);for await(let c of l){let d=Yon(c);d!=null&&(yield d)}return}let o=xAe(e,this.model),i={...this.invocationParams(r,{streaming:!0}),messages:o,stream:!0},a,s=await this.completionWithRetry(i,r),u;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(u=l.usage),!c)continue;let{delta:d}=c;if(!d)continue;let f=this._convertOpenAIDeltaToBaseMessageChunk(d,l,a);a=d.role??a;let p={prompt:r.promptIndex??0,completion:c.index??0};if(typeof f.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let m={...p};c.finish_reason!=null&&(m.finish_reason=c.finish_reason,m.system_fingerprint=l.system_fingerprint,m.model_name=l.model),this.logprobs&&(m.logprobs=c.logprobs);let h=new Sn({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(u){let l={...u.prompt_tokens_details?.audio_tokens!==null&&{audio:u.prompt_tokens_details?.audio_tokens},...u.prompt_tokens_details?.cached_tokens!==null&&{cache_read:u.prompt_tokens_details?.cached_tokens}},c={...u.completion_tokens_details?.audio_tokens!==null&&{audio:u.completion_tokens_details?.audio_tokens},...u.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:u.completion_tokens_details?.reasoning_tokens}};yield new Sn({message:new or({content:"",response_metadata:{usage:{...u}},usage_metadata:{input_tokens:u.prompt_tokens,output_tokens:u.completion_tokens,total_tokens:u.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(r.signal?.aborted)throw new Error("AbortError")}identifyingParams(){return this._identifyingParams()}async _responseApiGenerate(e,r,n){let o=this.invocationParams(r);if(o.stream){let s=this._streamResponseChunks(e,r,n),u;for await(let l of s)l.message.response_metadata={...l.generationInfo,...l.message.response_metadata},u=u?.concat(l)??l;return{generations:u?[u]:[],llmOutput:{estimatedTokenUsage:u?.message?.usage_metadata}}}let i=h1t(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:y1t(a)}],llmOutput:{id:a.id,estimatedTokenUsage:a.usage?{promptTokens:a.usage.input_tokens,completionTokens:a.usage.output_tokens,totalTokens:a.usage.total_tokens}:void 0}}}_useResponseApi(e){let r=e?.tools?.some(SAe),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null;return this.useResponsesApi||r||n}async _generate(e,r,n){if(this._useResponseApi(r))return this._responseApiGenerate(e,r,n);let o={},i=this.invocationParams(r),a=xAe(e,this.model);if(i.stream){let s=this._streamResponseChunks(e,r,n),u={};for await(let m of s){m.message.response_metadata={...m.generationInfo,...m.message.response_metadata};let h=m.generationInfo?.completion??0;u[h]===void 0?u[h]=m:u[h]=u[h].concat(m)}let l=Object.entries(u).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),{functions:c,function_call:d}=this.invocationParams(r),f=await this.getEstimatedTokenCountFromPrompt(e,c,d),p=await this.getNumTokensFromGenerations(l);return o.input_tokens=f,o.output_tokens=p,o.total_tokens=f+p,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}else{let s;r.response_format&&r.response_format.type==="json_schema"?s=await this.betaParsedCompletionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options}):s=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:r?.signal,...r?.options});let{completion_tokens:u,prompt_tokens:l,total_tokens:c,prompt_tokens_details:d,completion_tokens_details:f}=s?.usage??{};u&&(o.output_tokens=(o.output_tokens??0)+u),l&&(o.input_tokens=(o.input_tokens??0)+l),c&&(o.total_tokens=(o.total_tokens??0)+c),(d?.audio_tokens!==null||d?.cached_tokens!==null)&&(o.input_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.cached_tokens!==null&&{cache_read:d?.cached_tokens}}),(f?.audio_tokens!==null||f?.reasoning_tokens!==null)&&(o.output_token_details={...f?.audio_tokens!==null&&{audio:f?.audio_tokens},...f?.reasoning_tokens!==null&&{reasoning:f?.reasoning_tokens}});let p=[];for(let m of s?.choices??[]){let v={text:m.message?.content??"",message:this._convertOpenAIChatCompletionMessageToBaseMessage(m.message??{role:"assistant"},s)};v.generationInfo={...m.finish_reason?{finish_reason:m.finish_reason}:{},...m.logprobs?{logprobs:m.logprobs}:{}},ei(v.message)&&(v.message.usage_metadata=o),v.message=new en(Object.fromEntries(Object.entries(v.message).filter(([g])=>!g.startsWith("lc_")))),p.push(v)}return{generations:p,llmOutput:{tokenUsage:{promptTokens:o.input_tokens,completionTokens:o.output_tokens,totalTokens:o.total_tokens}}}}}async getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=f1t(r);o+=await this.getNumTokens(i),o+=9}return r&&e.find(i=>i._getType()==="system")&&(o-=4),n==="none"?o+=1:typeof n=="object"&&(o+=await this.getNumTokens(n.name)+4),o}async getNumTokensFromGenerations(e){return(await Promise.all(e.map(async n=>n.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([n.message])).countPerMessage[0]:await this.getNumTokens(n.message.content)))).reduce((n,o)=>n+o,0)}async getNumTokensFromMessages(e){let r=0,n=0,o=0;this.model==="gpt-3.5-turbo-0301"?(n=4,o=-1):(n=3,o=1);let i=await Promise.all(e.map(async a=>{let s=await this.getNumTokens(a.content),u=await this.getNumTokens(CAe(a)),l=a.name!==void 0?o+await this.getNumTokens(a.name):0,c=s+n+u+l,d=a;if(d._getType()==="function"&&(c-=2),d.additional_kwargs?.function_call&&(c+=3),d?.additional_kwargs.function_call?.name&&(c+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{c+=await this.getNumTokens(JSON.stringify(JSON.parse(d.additional_kwargs.function_call?.arguments)))}catch(f){console.error("Error parsing function arguments",f,JSON.stringify(d.additional_kwargs.function_call)),c+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return r+=c,c}));return r+=3,{totalCount:r,countPerMessage:i}}async completionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.chat.completions.create(e,n)}catch(o){throw ij(o)}})}async responseApiWithRetry(e,r){return this.caller.call(async()=>{let n=this._getClientOptions(r);try{return e.text?.format?.type==="json_schema"&&!e.stream?await this.client.responses.parse(e,n):await this.client.responses.create(e,n)}catch(o){throw ij(o)}})}async betaParsedCompletionWithRetry(e,r){let n=this._getClientOptions(r);return this.caller.call(async()=>{try{return await this.client.beta.chat.completions.parse(e,n)}catch(o){throw ij(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=oj(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new jt(i)}return{...this.clientConfig,...e}}_llmType(){return"openai"}_combineLLMOutput(...e){return e.reduce((r,n)=>(n&&n.tokenUsage&&(r.tokenUsage.completionTokens+=n.tokenUsage.completionTokens??0,r.tokenUsage.promptTokens+=n.tokenUsage.promptTokens??0,r.tokenUsage.totalTokens+=n.tokenUsage.totalTokens??0),r),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}withStructuredOutput(e,r){let n,o,i,a;Xon(e)?(n=e.schema,o=e.name,i=e.method,a=e.includeRaw):(n=e,o=r?.name,i=r?.method,a=r?.includeRaw);let s,u;if(r?.strict!==void 0&&i==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"?i===void 0&&(i="jsonSchema"):i==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`),i==="jsonMode")s=this.bind({response_format:{type:"json_object"}}),koe(n)?u=Yl.fromZodSchema(n):u=new Zl;else if(i==="jsonSchema")if(s=this.bind({response_format:{type:"json_schema",json_schema:{name:o??"extract",description:n.description,schema:n,strict:r?.strict}}}),koe(n)){let f=Yl.fromZodSchema(n);u=kd.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Zl;else{let f=o??"extract";if(koe(n)){let p=Xn(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:f}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new bc({returnSingle:!0,keyName:f,zodSchema:n})}else{let p;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(p=n,f=n.name):(f=n.title??f,p={name:f,description:n.description??"",parameters:n}),s=this.bind({tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:f}},...r?.strict!==void 0?{strict:r.strict}:{}}),u=new bc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Kn.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Kn.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Wo.from([{raw:s},d])}};function koe(t){return typeof t?.parse=="function"}function Xon(t){return t!==void 0&&typeof t.schema=="object"}Wp();fd();var EAe=class extends gC{static lc_name(){return"DallEAPIWrapper"}constructor(e){e?.responseFormat!==void 0&&["url","b64_json"].includes(e.responseFormat)&&(e.dallEResponseFormat=e.responseFormat,e.responseFormat="content"),super(e),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:"A wrapper around OpenAI DALL-E API. Useful for when you need to generate images from a text description. Input should be an image description."}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"model",{enumerable:!0,configurable:!0,writable:!0,value:"dall-e-3"}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:"vivid"}),Object.defineProperty(this,"quality",{enumerable:!0,configurable:!0,writable:!0,value:"standard"}),Object.defineProperty(this,"n",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:"1024x1024"}),Object.defineProperty(this,"dallEResponseFormat",{enumerable:!0,configurable:!0,writable:!0,value:"url"}),Object.defineProperty(this,"user",{enumerable:!0,configurable:!0,writable:!0,value:void 0});let r=e?.apiKey??e?.openAIApiKey??Ye("OPENAI_API_KEY"),n=e?.organization??Ye("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new jt(o),this.model=e?.model??e?.modelName??this.model,this.style=e?.style??this.style,this.quality=e?.quality??this.quality,this.n=e?.n??this.n,this.size=e?.size??this.size,this.dallEResponseFormat=e?.dallEResponseFormat??this.dallEResponseFormat,this.user=e?.user}processMultipleGeneratedUrls(e){return this.dallEResponseFormat==="url"?e.flatMap(r=>r.data.flatMap(o=>o.url?{type:"image_url",image_url:o.url}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="string"&&o.image_url!==void 0)):e.flatMap(r=>r.data.flatMap(o=>o.b64_json?{type:"image_url",image_url:{url:o.b64_json}}:[]).filter(o=>o!==void 0&&o.type==="image_url"&&typeof o.image_url=="object"&&"url"in o.image_url&&typeof o.image_url.url=="string"&&o.image_url.url!==void 0))}async _call(e){let r={model:this.model,prompt:e,n:1,size:this.size,response_format:this.dallEResponseFormat,style:this.style,quality:this.quality,user:this.user};if(this.n>1){let i=await Promise.all(Array.from({length:this.n}).map(()=>this.client.images.generate(r)));return this.processMultipleGeneratedUrls(i)}let n=await this.client.images.generate(r),o="";return this.dallEResponseFormat==="url"?[o]=n.data.map(i=>i.url).filter(i=>i!=="undefined"):[o]=n.data.map(i=>i.b64_json).filter(i=>i!=="undefined"),o}};Object.defineProperty(EAe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var Boe=class extends FH{static lc_name(){return"ChatXAI"}_llmType(){return"xai"}get lc_secrets(){return{apiKey:"XAI_API_KEY"}}constructor(e){let r=e?.apiKey||Ye("XAI_API_KEY");if(!r)throw new Error('xAI API key not found. Please set the XAI_API_KEY environment variable or provide the key into "apiKey" field.');super({...e,model:e?.model||"grok-beta",apiKey:r,configuration:{baseURL:"https://api.x.ai/v1"}}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","chat_models","xai"]})}toJSON(){let e=super.toJSON();return"kwargs"in e&&typeof e.kwargs=="object"&&e.kwargs!=null&&(delete e.kwargs.openai_api_key,delete e.kwargs.configuration),e}getLsParams(e){let r=super.getLsParams(e);return r.ls_provider="xai",r}async completionWithRetry(e,r){delete e.frequency_penalty,delete e.presence_penalty,delete e.logit_bias,delete e.functions;let n=e.messages.map(i=>i.content?i:{...i,content:""}),o={...e,messages:n};return o.stream===!0?super.completionWithRetry(o,r):super.completionWithRetry(o,r)}_convertOpenAIDeltaToBaseMessageChunk(e,r,n){let o=super._convertOpenAIDeltaToBaseMessageChunk(e,r,n);return r.choices[0]?.finish_reason?o.usage_metadata=o.response_metadata.usage:(delete o.response_metadata.usage,delete o.usage_metadata),o}_convertOpenAIChatCompletionMessageToBaseMessage(e,r){let n=super._convertOpenAIChatCompletionMessageToBaseMessage(e,r);return n.additional_kwargs.reasoning_content=e.reasoning_content,n}withStructuredOutput(e,r){let n={...r};return n?.method===void 0&&(n.method="functionCalling"),super.withStructuredOutput(e,n)}};var $oe=require("obsidian"),Qon={openai:tS,"azure openai":tS,anthropic:mte,cohereai:UX,google:JX,xai:Boe,openrouterai:tS,ollama:XX,"lm-studio":tS,groq:Pte,"3rd party (openai-format)":tS,"copilot-plus":tS,mistralai:Loe,deepseek:yte},of=class t{constructor(){this.providerApiKeyMap={openai:()=>de().openAIApiKey,google:()=>de().googleApiKey,"azure openai":()=>de().azureOpenAIApiKey,anthropic:()=>de().anthropicApiKey,cohereai:()=>de().cohereApiKey,openrouterai:()=>de().openRouterAiApiKey,groq:()=>de().groqApiKey,xai:()=>de().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>de().plusLicenseKey,mistralai:()=>de().mistralApiKey,deepseek:()=>de().deepseekApiKey};this.buildModelMap(),bl(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}async getModelConfig(e){let r=de(),n=e.name,o=$I(n),i={modelName:n,temperature:e.temperature??r.temperature,streaming:e.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:e.enableCors},s={openai:{modelName:n,openAIApiKey:await Io(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?vl:void 0,organization:await Io(e.openAIOrgId||r.openAIOrgId)},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},anthropic:{anthropicApiKey:await Io(e.apiKey||r.anthropicApiKey),modelName:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?vl:void 0}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,openAIApiKey:await Io(e.apiKey||r.azureOpenAIApiKey),configuration:{baseURL:e.baseUrl||`https://${e.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName}`,defaultQuery:{"api-version":e.azureOpenAIApiVersion||r.azureOpenAIApiVersion},defaultHeaders:{"Content-Type":"application/json","api-key":await Io(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?vl:void 0},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},cohereai:{apiKey:await Io(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await Io(e.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:MR.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:RR.BLOCK_NONE},{category:MR.HARM_CATEGORY_HATE_SPEECH,threshold:RR.BLOCK_NONE},{category:MR.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:RR.BLOCK_NONE},{category:MR.HARM_CATEGORY_HARASSMENT,threshold:RR.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await Io(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,openAIApiKey:await Io(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?vl:void 0}},groq:{apiKey:await Io(e.apiKey||r.groqApiKey),modelName:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await Io(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,openAIApiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?vl:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await Io(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?vl:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.handleOpenAIExtraArgs(o,r.maxTokens,r.temperature)},"copilot-plus":{modelName:n,openAIApiKey:await Io(r.plusLicenseKey),configuration:{baseURL:UI,fetch:e.enableCors?vl:void 0}},mistralai:{model:n,apiKey:await Io(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await Io(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||VD.deepseek.host,fetch:e.enableCors?vl:void 0}}}[e.provider]||{},u=this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature);return{...i,...s,...u}}handleOpenAIExtraArgs(e,r,n){return e?{maxCompletionTokens:r,temperature:1}:{maxTokens:r,temperature:n}}buildModelMap(){let e=de().activeModels;t.modelMap={};let r=t.modelMap;(e??nE).forEach(o=>{if(o.enabled){if(!Object.values(qI).contains(o.provider)){console.warn(`Unknown provider: ${o.provider} for model: ${o.name}`);return}let i=this.getProviderConstructor(o),a=this.providerApiKeyMap[o.provider],s=o.apiKey||a(),u=Kr(o);r[u]={hasApiKey:!!(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(e){let r=Qon[e.provider];if(!r)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return r}getChatModel(){if(!t.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return t.chatModel}async setChatModel(e){let r=Kr(e);v9(r);try{let n=await this.createModelInstance(e);t.chatModel=n}catch(n){nt(n),new $oe.Notice(`Error creating model: ${r}`)}}async createModelInstance(e){let r=Kr(e),n=t.modelMap[r];if(!n)throw new Error(`No model found for: ${r}`);if(!n.hasApiKey){let a=`API key is not provided for the model: ${r}.`;throw new $oe.Notice(a),new Error(a)}let o=await this.getModelConfig(e);return new n.AIConstructor({...o})}validateChatModel(e){return e!=null}async countTokens(e){return t.chatModel?.getNumTokens(e)??0}validateCurrentModel(){if(!t.chatModel)return;let e=w9();if(!e)return;t.modelMap[e]?.hasApiKey||(t.chatModel=null,console.log("Failed to reinitialize model due to missing API key"))}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getModelConfig(o),{streaming:a,maxTokens:s,maxCompletionTokens:u,...l}=i,c=$I(o.name),d=this.handleOpenAIExtraArgs(c,10,i.temperature);await new(this.getProviderConstructor(o))({...l,...d}).invoke([{role:"user",content:"hello"}],{timeout:3e3})};try{return await r(!1),!0}catch(n){console.log("First ping attempt failed, trying with CORS...");try{return await r(!0),new $oe.Notice("Connection successful, but requires CORS to be enabled. Please enable CORS for this model once you add it above."),!0}catch(o){let i=`
without CORS Error: `+Pi(n)+`
with CORS Error: `+Pi(o);throw new Error(i)}}}findModelByName(e){return de().activeModels.find(n=>n.name===e)}};async function qoe(t,e){let r=`Given the following conversation and a follow up question,
summarize the conversation as context and keep the follow up question unchanged, in its original language.
If the follow up question is unrelated to its preceding messages, return this follow up question directly.
If it is related, then combine the summary and the follow up question to construct a standalone question.
Make sure to keep any [[]] wrapped note titles in the question unchanged.
If there's nothing in the chat history, just return the follow up question.
Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:`,n=e.map(([a,s])=>`Human: ${a}
Assistant: ${s}`).join(`
`),i=await of.getInstance().getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);return HD(i.content)}var aj=require("obsidian"),bS=class{static async isImageUrl(e,r){try{let n,o=!1;try{let i=new URL(e),a=i.pathname,s=a.lastIndexOf("."),u=a.lastIndexOf("/");if(s>u&&s>-1&&(n=a.substring(s+1).toLowerCase()),n&&!this.IMAGE_EXTENSIONS.some(c=>c.toLowerCase()===`.${n}`))return nt(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await vl(e,{method:"HEAD",headers:{}})).headers.get("content-type");return c?.startsWith("image/")?!0:(console.warn(`HEAD request succeeded for ${e} but Content-Type (${c}) is not image/*.`),!1)}catch(l){console.warn(`HEAD request failed for URL: ${e}. Proceeding to heuristic check.`,l);let c=i.searchParams,f=[c.has("w")||c.has("width"),c.has("h")||c.has("height"),c.has("format"),c.has("fit"),c.has("quality"),i.pathname.includes("/image/"),i.pathname.includes("/images/"),i.pathname.includes("/img/"),c.has("auto"),c.has("crop")].filter(Boolean).length;return f>=2?(nt(`Identified as image based on URL heuristics (indicator count: ${f}): ${e}`),!0):!1}}catch{o=!0;let i=e.lastIndexOf(".");if(i>-1)n=e.substring(i+1).toLowerCase();else return!1}if(o)if(n&&this.IMAGE_EXTENSIONS.some(i=>i.toLowerCase()===`.${n}`)){let i=r.getAbstractFileByPath(e);return i instanceof aj.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(nt(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(nt(`File with image extension not found in vault: ${e}.`),!1)}else return n&&nt(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return nt(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return nt(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return nt(`Image too large: ${e.stat.size} bytes, skipping: ${e.path}`),null;let n=await r.readBinary(e),o=await this.getMimeType(n,e.extension);if(!o.startsWith("image/"))return nt(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let a=Buffer.from(n).toString("base64");return`data:${o};base64,${a}`}catch(n){return nt("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await vl(e,{method:"GET",headers:{}});if(!r.ok)return nt(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return nt(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return nt(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let a=Buffer.from(o).toString("base64");return`data:${n};base64,${a}`}catch(r){return nt("Error converting web image to base64:",r),null}}static async handleLocalImage(e,r){try{let n=decodeURIComponent(e.replace("app://","")),o=r.getAbstractFileByPath(n);if(!o||!(o instanceof aj.TFile))return nt(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return nt(`Image too large: ${o.stat.size} bytes, path: ${n}`),null;let i=await r.readBinary(o),a=await this.getMimeType(i,o.extension);if(!a.startsWith("image/"))return nt(`Invalid MIME type: ${a}, path: ${n}`),null;let u=Buffer.from(i).toString("base64");return`data:${a};base64,${u}`}catch(n){return nt("Error processing local image:",n),null}}static async imageToBase64(e,r){if(e.startsWith("data:"))return e;if(e.startsWith("attachment:")){let o=e.substring(11),i=r.getAbstractFileByPath(o);return i instanceof aj.TFile?await this.handleVaultImage(i,r):(console.warn(`Could not find attachment file in vault: ${o}`),null)}if(e.startsWith("app://"))return await this.handleLocalImage(e,r);let n=r.getAbstractFileByPath(e);return n instanceof aj.TFile?await this.handleVaultImage(n,r):await this.handleWebImage(e)}static async convertToBase64(e,r){let n=await this.imageToBase64(e,r);return n?{type:"image_url",image_url:{url:n}}:(nt(`Failed to convert image to base64: ${e}`),null)}static async getMimeType(e,r){let n=new Uint8Array(e.slice(0,4));if(n[0]===255&&n[1]===216)return"image/jpeg";if(n[0]===137&&n[1]===80)return"image/png";if(n[0]===71&&n[1]===73)return"image/gif";if(n[0]===82&&n[1]===73)return"image/webp";if(n[0]===66&&n[1]===77)return"image/bmp";if(n[0]===60&&n[1]===115)throw new Error("SVG files are not supported");let o=this.MIME_TYPES[r.toLowerCase()];if(!o){let i=`Unsupported image extension: ${r}`;throw nt(i),new Error(i)}return o}};bS.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],bS.MAX_IMAGE_SIZE=3*1024*1024,bS.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};var sj=class t{static async processUrlBatch(e,r,n){try{let i=(await Promise.all(e.map(s=>t.processSingleUrl(s,r,n)))).filter(s=>s!==null),a=r.map(s=>`Image read failed for: ${s}`);return{successfulImages:i,failureDescriptions:a}}catch(o){return nt("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await bS.isImageUrl(e,n))return null;let o=await bS.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return nt(`Failed to process image: ${e}`,o),r.push(e),null}}static async processChatImageBatch(e,r,n){try{let o=e.filter(u=>u.type==="image_url"&&!!u.image_url?.url),a=(await Promise.all(o.map(u=>t.processChatSingleImage(u,r,n)))).filter(u=>u!==null),s=r.map(u=>`Image read failed for: ${u}`);return{successfulImages:a,failureDescriptions:s}}catch(o){nt("Error processing chat image batch:",o);let i=e.filter(a=>a.type==="image_url"&&!!a.image_url?.url).map(a=>a.image_url.url);return{successfulImages:[],failureDescriptions:i.map(a=>`Image read failed for: ${a}`)}}}static async processChatSingleImage(e,r,n){try{let o=await bS.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return nt(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new aj.Notice(`Failed to process images:
${e.join(`
`)}`)}};var PAe=require("obsidian"),b1t=t=>{switch(t){case"@vault":return"Search through your vault for relevant information";case"@web":return"Search the web for information";case"@youtube":return"Get the transcript of a YouTube video. Example: @youtube <video_url>";case"@pomodoro":return"Start a pomodoro timer. Example: @pomodoro 25m";default:return""}},HB=class{static async callTool(e,r){try{if(!e)throw new Error("Tool is undefined");let n=await e.call(r);return n??(console.warn(`Tool ${e.name} returned null/undefined result`),null)}catch(n){return console.error("Error calling tool:",n),n instanceof Error?new PAe.Notice(n.message):new PAe.Notice("An error occurred while executing the tool. Check console for details."),null}}};var DDt=require("obsidian");eE();GO();xf();Oy();var Uoe=class extends ln{constructor(e){super(e),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"verbose",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.callbacks=e?.callbacks,this.tags=e?.tags??[],this.metadata=e?.metadata??{},this.verbose=e?.verbose??!1}_getRelevantDocuments(e,r){throw new Error("Not implemented!")}async invoke(e,r){return this.getRelevantDocuments(e,Wr(r))}async getRelevantDocuments(e,r){let n=Wr(II(r)),i=await(await ls.configure(n.callbacks,this.callbacks,n.tags,this.tags,n.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),e,n.runId,void 0,void 0,void 0,n.runName);try{let a=await this._getRelevantDocuments(e,i);return await i?.handleRetrieverEnd(a),a}catch(a){throw await i?.handleRetrieverError(a),a}}};var VT=class extends Uoe{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=Of.fromTemplate(`Please write a passage to answer the question. If you don't know the answer, just make up a passage.
Question: {question}
Passage:`)}async getRelevantDocuments(r,n){let o=rx(r,app.vault),i=o.map(h=>h.basename),a=[...new Set([...this.options.salientTerms,...i])],s=await this.getExplicitChunks(o),u=r;n?.runName!=="no_hyde"&&(u=await this.rewriteQuery(r));let l=await this.getOramaChunks(u,a,this.options.textWeight),c=this.filterAndFormatChunks(l,s),d=c;if(c.length===0)return de().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((h,v)=>{let g=v.metadata.score;return typeof g=="number"&&!isNaN(g)?Math.max(h,g):h},0),p=c.every(h=>typeof h.metadata.score!="number"||isNaN(h.metadata.score)),m=this.options.useRerankerThreshold&&(f<this.options.useRerankerThreshold||p);return m&&(d=(await Ss.getInstance().rerank(r,c.map(v=>v.pageContent.slice(0,3e3)))).response.data.map(v=>({...c[v.index],metadata:{...c[v.index].metadata,rerank_score:v.relevance_score}}))),de().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),n?.runName!=="no_hyde"&&(console.log(`
Original Query: `,r),console.log("Rewritten Query: ",u)),console.log(`
Explicit Chunks: `,s),console.log("Orama Chunks: ",l),console.log("Combined Chunks: ",c),console.log("Max Orama Score: ",f),m?console.log("Reranked Chunks: ",d):console.log("No reranking applied.")),d}async rewriteQuery(r){try{let n=await this.queryRewritePrompt.format({question:r}),i=await of.getInstance().getChatModel().bind({temperature:0}).invoke(n);return i&&"content"in i?HD(i.content):(console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await va.getInstance().getDb(),a=await _C.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new vC({pageContent:u.document.content,metadata:{...u.document.metadata,score:u.score,path:u.document.path,mtime:u.document.mtime,ctime:u.document.ctime,title:u.document.title,id:u.document.id,embeddingModel:u.document.embeddingModel,tags:u.document.tags,extension:u.document.extension,created_at:u.document.created_at,nchars:u.document.nchars}}));n.push(...s)}}return n}async getOramaChunks(r,n,o){let i;try{i=await this.convertQueryToVector(r)}catch(l){throw console.error("Error in convertQueryToVector, please ensure your embedding model is working and has an adequate context length:",l,`
Query:`,r),l}let a=await va.getInstance().getDb(),s={similarity:this.options.minSimilarityScore,limit:this.options.maxK,includeVectors:!0};if(n.length>0){let l;o||(o=.5),l=1-o;let c=!0;for(let d of n)if(!d.startsWith("#")){c=!1;break}c&&(de().debug&&console.log("Tag only query detected, setting textWeight to 1 and vectorWeight to 0."),o=1,l=0),s.mode="hybrid",s.term=n.join(" "),s.vector={value:i,property:"embedding"},s.hybridWeights={text:o,vector:l}}else s.mode="vector",s.vector={value:i,property:"embedding"};if(this.options.timeRange){let{startTime:l,endTime:c}=this.options.timeRange,d=this.generateDailyNoteDateRange(l,c);ar("==== Daily note date range: ====",d[0],d[d.length-1]);let f=rx(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(w=>({...w,metadata:{...w.metadata,includeInContext:!0}}));ar("==== Modified time range: ====",l,c),s.where={mtime:{between:[l,c]}};let v=(await _c(a,s)).hits.map(w=>new vC({pageContent:w.document.content,metadata:{...w.document.metadata,score:w.score,path:w.document.path,mtime:w.document.mtime,ctime:w.document.ctime,title:w.document.title,id:w.document.id,embeddingModel:w.document.embeddingModel,tags:w.document.tags,extension:w.document.extension,created_at:w.document.created_at,nchars:w.document.nchars}})),g=[...m,...v];return Array.from(new Set(g.map(w=>w.metadata.id))).map(w=>g.find(x=>x.metadata.id===w)).filter(w=>w!==void 0)}de().debug&&console.log(`==== Orama Search Params: ====
`,s);let u=await _c(a,s);return!u||!u.hits?(console.warn("Search results or hits are undefined"),[]):u.hits.map(l=>!l||!l.document?(console.warn("Invalid hit or document in search results"),null):((typeof l.score!="number"||isNaN(l.score))&&console.warn("NaN/invalid score detected:",{score:l.score,path:l.document.path,title:l.document.title}),new vC({pageContent:l.document.content||"",metadata:{...l.document.metadata||{},score:l.score,path:l.document.path||"",mtime:l.document.mtime,ctime:l.document.ctime,title:l.document.title||"",id:l.document.id,embeddingModel:l.document.embeddingModel,tags:l.document.tags||[],extension:l.document.extension,created_at:l.document.created_at,nchars:l.document.nchars}}))).filter(l=>l!==null)}async convertQueryToVector(r){let o=await(await ws.getInstance().getEmbeddingsAPI()).embedQuery(r);if(o.length===0)throw new Error("Query embedding returned an empty vector");return o}generateDailyNoteDateRange(r,n){let o=[],i=new Date(r),a=new Date(n),s=new Date(i);for(;s<=a;)o.push(`[[${s.toLocaleDateString("en-CA")}]]`),s.setDate(s.getDate()+1);return o}filterAndFormatChunks(r,n){let o=this.options.minSimilarityScore,i=r.filter(u=>{let l=u.metadata.score;return typeof l!="number"||isNaN(l)?!0:l>=o}),a=new Set(n.map(u=>u.pageContent)),s=[...n];for(let u of i){let l=u.pageContent;a.has(l)||(a.add(l),s.push(u))}return s.map(u=>({...u,metadata:{...u.metadata,includeInContext:!0}}))}};Uc();var TAe=Xp(async({timeRange:t,query:e,salientTerms:r})=>{if(await va.getInstance().isIndexEmpty())throw new hr(c9);let o=t!==void 0,i=de().maxSourceChunks<zce?zce:de().maxSourceChunks;de().debug&&console.log("returnAll:",o);let u=(await new VT({minSimilarityScore:o?0:.1,maxK:o?1e3:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:C$e,returnAll:o,useRerankerThreshold:.5}).getRelevantDocuments(e)).map(l=>({title:l.metadata.title,content:l.pageContent,path:l.metadata.path,score:l.metadata.score,rerank_score:l.metadata.rerank_score,includeInContext:l.metadata.includeInContext}));return JSON.stringify(u)},{name:"localSearch",description:"Search for notes based on the time range and query",schema:Pr.object({timeRange:Pr.object({startTime:Pr.any(),endTime:Pr.any()}).optional(),query:Pr.string().describe("The search query"),salientTerms:Pr.array(Pr.string()).describe("List of salient terms extracted from the query")})}),_1t=Xp(async()=>{try{let t=await va.getInstance().indexVaultToVectorStore();return`Please report whether the indexing was successful.
If success is true, just say it is successful. If 0 files is indexed, say there are no new files to index.`+JSON.stringify({success:!0,message:t===0?"No new files to index.":`Indexed ${t} files in the vault.`})}catch(t){return console.error("Error indexing vault:",t),JSON.stringify({success:!1,message:"An error occurred while indexing the vault."})}},{name:"indexVault",description:"Index the vault to the Copilot index"}),AAe=Xp(async({query:t,chatHistory:e})=>{try{let r=await qoe(t,e),n=await Ss.getInstance().webSearch(r),o=n.response.citations||[],i=o.length>0?`
Sources:
`+o.map((a,s)=>`[${s+1}] ${a}`).join(`
`):"";return`Here are the web search results. Please provide a response based on this information and include source citations listed at the end of your response under the heading '#### Sources' as a list of markdown links. For each URL, create a descriptive title based on the domain and path and return it in the markdown format '- [title](url)':
`+n.response.choices[0].message.content+i}catch(r){return console.error(`Error processing web search query ${t}:`,r),""}},{name:"webSearch",description:"Search the web for information",schema:Pr.object({query:Pr.string().describe("The search query"),chatHistory:Pr.array(Pr.tuple([Pr.string(),Pr.string()])).describe("Previous conversation turns")})});var x1t=B(v1t(),1),kH=B(WT(),1);var Un;(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(Un||(Un={}));var Fu;(function(t){t[t.SUNDAY=0]="SUNDAY",t[t.MONDAY=1]="MONDAY",t[t.TUESDAY=2]="TUESDAY",t[t.WEDNESDAY=3]="WEDNESDAY",t[t.THURSDAY=4]="THURSDAY",t[t.FRIDAY=5]="FRIDAY",t[t.SATURDAY=6]="SATURDAY"})(Fu||(Fu={}));var om;(function(t){t[t.JANUARY=1]="JANUARY",t[t.FEBRUARY=2]="FEBRUARY",t[t.MARCH=3]="MARCH",t[t.APRIL=4]="APRIL",t[t.MAY=5]="MAY",t[t.JUNE=6]="JUNE",t[t.JULY=7]="JULY",t[t.AUGUST=8]="AUGUST",t[t.SEPTEMBER=9]="SEPTEMBER",t[t.OCTOBER=10]="OCTOBER",t[t.NOVEMBER=11]="NOVEMBER",t[t.DECEMBER=12]="DECEMBER"})(om||(om={}));function w1t(t,e){e=e.add(1,"day"),uj(t,e),VB(t,e)}function Zg(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function zoe(t,e){t.assign("hour",e.hour()),t.assign("minute",e.minute()),t.assign("second",e.second()),t.assign("millisecond",e.millisecond()),t.get("hour")<12?t.assign("meridiem",Un.AM):t.assign("meridiem",Un.PM)}function uj(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function VB(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var DAe=B(WT(),1);var ein={ACDT:630,ACST:570,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,ALMT:360,AMST:-180,AMT:-240,ANAST:720,ANAT:720,AQTT:300,ART:-180,AST:-240,AWDT:540,AWST:480,AZOST:0,AZOT:-60,AZST:300,AZT:240,BNT:480,BOT:-240,BRST:-120,BRT:-180,BST:60,BTT:360,CAST:480,CAT:120,CCT:390,CDT:-300,CEST:120,CET:{timezoneOffsetDuringDst:2*60,timezoneOffsetNonDst:60,dstStart:t=>S1t(t,om.MARCH,Fu.SUNDAY,2),dstEnd:t=>S1t(t,om.OCTOBER,Fu.SUNDAY,3)},CHADT:825,CHAST:765,CKT:-600,CLST:-180,CLT:-240,COT:-300,CST:-360,CT:{timezoneOffsetDuringDst:-5*60,timezoneOffsetNonDst:-6*60,dstStart:t=>KT(t,om.MARCH,Fu.SUNDAY,2,2),dstEnd:t=>KT(t,om.NOVEMBER,Fu.SUNDAY,1,2)},CVT:-60,CXT:420,ChST:600,DAVT:420,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEST:180,EET:120,EGST:0,EGT:-60,EST:-300,ET:{timezoneOffsetDuringDst:-4*60,timezoneOffsetNonDst:-5*60,dstStart:t=>KT(t,om.MARCH,Fu.SUNDAY,2,2),dstEnd:t=>KT(t,om.NOVEMBER,Fu.SUNDAY,1,2)},FJST:780,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GMT:0,GST:240,GYT:-240,HAA:-180,HAC:-300,HADT:-540,HAE:-240,HAP:-420,HAR:-360,HAST:-600,HAT:-90,HAY:-480,HKT:480,HLV:-210,HNA:-240,HNC:-360,HNE:-300,HNP:-480,HNR:-420,HNT:-150,HNY:-540,HOVT:420,ICT:420,IDT:180,IOT:360,IRDT:270,IRKST:540,IRKT:540,IRST:210,IST:330,JST:540,KGT:360,KRAST:480,KRAT:480,KST:540,KUYT:240,LHDT:660,LHST:630,LINT:840,MAGST:720,MAGT:720,MART:-510,MAWT:300,MDT:-360,MESZ:120,MEZ:60,MHT:720,MMT:390,MSD:240,MSK:180,MST:-420,MT:{timezoneOffsetDuringDst:-6*60,timezoneOffsetNonDst:-7*60,dstStart:t=>KT(t,om.MARCH,Fu.SUNDAY,2,2),dstEnd:t=>KT(t,om.NOVEMBER,Fu.SUNDAY,1,2)},MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:690,NOVST:420,NOVT:360,NPT:345,NST:-150,NUT:-660,NZDT:780,NZST:720,OMSST:420,OMST:420,PDT:-420,PET:-300,PETST:720,PETT:720,PGT:600,PHOT:780,PHT:480,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PT:{timezoneOffsetDuringDst:-7*60,timezoneOffsetNonDst:-8*60,dstStart:t=>KT(t,om.MARCH,Fu.SUNDAY,2,2),dstEnd:t=>KT(t,om.NOVEMBER,Fu.SUNDAY,1,2)},PWT:540,PYST:-180,PYT:-240,RET:240,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SRT:-180,SST:-660,TAHT:-600,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TVT:720,ULAT:480,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-210,VLAST:660,VLAT:660,VUT:660,WAST:120,WAT:60,WEST:60,WESZ:60,WET:0,WEZ:0,WFT:720,WGST:-120,WGT:-180,WIB:420,WIT:540,WITA:480,WST:780,WT:0,YAKST:600,YAKT:600,YAPT:600,YEKST:360,YEKT:360};function KT(t,e,r,n,o=0){let i=0,a=0;for(;a<n;)i++,new Date(t,e-1,i).getDay()===r&&a++;return new Date(t,e-1,i,o)}function S1t(t,e,r,n=0){let o=r===0?7:r,i=new Date(t,e-1+1,1,12),a=i.getDay()===0?7:i.getDay(),s;return a===o?s=7:a<o?s=7+a-o:s=a-o,i.setDate(i.getDate()-s),new Date(t,e-1,i.getDate(),n)}function Hoe(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??ein[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,DAe.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,DAe.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}kH.default.extend(x1t.default);var JT=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=Hoe(e.timezone,this.instant))}getDateWithAdjustedTimezone(){return new Date(this.instant.getTime()+this.getSystemTimezoneAdjustmentMinute(this.instant)*6e4)}getSystemTimezoneAdjustmentMinute(e,r){(!e||e.getTime()<0)&&(e=new Date);let n=-e.getTimezoneOffset(),o=r??this.timezoneOffset??n;return n-o}},zn=class t{constructor(e,r){if(this._tags=new Set,this.reference=e,this.knownValues={},this.impliedValues={},r)for(let o in r)this.knownValues[o]=r[o];let n=(0,kH.default)(e.instant);this.imply("day",n.date()),this.imply("month",n.month()+1),this.imply("year",n.year()),this.imply("hour",12),this.imply("minute",0),this.imply("second",0),this.imply("millisecond",0)}get(e){return e in this.knownValues?this.knownValues[e]:e in this.impliedValues?this.impliedValues[e]:null}isCertain(e){return e in this.knownValues}getCertainComponents(){return Object.keys(this.knownValues)}imply(e,r){return e in this.knownValues?this:(this.impliedValues[e]=r,this)}assign(e,r){return this.knownValues[e]=r,delete this.impliedValues[e],this}delete(e){delete this.knownValues[e],delete this.impliedValues[e]}clone(){let e=new t(this.reference);e.knownValues={},e.impliedValues={};for(let r in this.knownValues)e.knownValues[r]=this.knownValues[r];for(let r in this.impliedValues)e.impliedValues[r]=this.impliedValues[r];return e}isOnlyDate(){return!this.isCertain("hour")&&!this.isCertain("minute")&&!this.isCertain("second")}isOnlyTime(){return!this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")&&!this.isCertain("year")}isOnlyWeekdayComponent(){return this.isCertain("weekday")&&!this.isCertain("day")&&!this.isCertain("month")}isDateWithUnknownYear(){return this.isCertain("month")&&!this.isCertain("year")}isValidDate(){let e=this.dateWithoutTimezoneAdjustment();return!(e.getFullYear()!==this.get("year")||e.getMonth()!==this.get("month")-1||e.getDate()!==this.get("day")||this.get("hour")!=null&&e.getHours()!=this.get("hour")||this.get("minute")!=null&&e.getMinutes()!=this.get("minute"))}toString(){return`[ParsingComponents {
tags: ${JSON.stringify(Array.from(this._tags).sort())},
knownValues: ${JSON.stringify(this.knownValues)},
impliedValues: ${JSON.stringify(this.impliedValues)}},
reference: ${JSON.stringify(this.reference)}]`}dayjs(){return(0,kH.default)(this.date())}date(){let e=this.dateWithoutTimezoneAdjustment(),r=this.reference.getSystemTimezoneAdjustmentMinute(e,this.get("timezoneOffset"));return new Date(e.getTime()+r*6e4)}addTag(e){return this._tags.add(e),this}addTags(e){for(let r of e)this._tags.add(r);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){let e=new Date(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond"));return e.setFullYear(this.get("year")),e}static createRelativeFromReference(e,r){let n=(0,kH.default)(e.instant);for(let i in r)n=n.add(r[i],i);let o=new t(e);return r.hour||r.minute||r.second?(zoe(o,n),Zg(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(VB(o,n),e.timezoneOffset!==null&&o.imply("timezoneOffset",-e.instant.getTimezoneOffset()),r.d?(o.assign("day",n.date()),o.assign("month",n.month()+1),o.assign("year",n.year())):r.week?(o.assign("day",n.date()),o.assign("month",n.month()+1),o.assign("year",n.year()),o.imply("weekday",n.day())):(o.imply("day",n.date()),r.month?(o.assign("month",n.month()+1),o.assign("year",n.year())):(o.imply("month",n.month()+1),r.year?o.assign("year",n.year()):o.imply("year",n.year())))),o}},dO=class t{constructor(e,r,n,o,i){this.reference=e,this.refDate=e.instant,this.index=r,this.text=n,this.start=o||new zn(e),this.end=i}clone(){let e=new t(this.reference,this.index,this.text);return e.start=this.start?this.start.clone():null,e.end=this.end?this.end.clone():null,e}date(){return this.start.date()}tags(){let e=new Set(this.start.tags());if(this.end)for(let r of this.end.tags())e.add(r);return e}toString(){let e=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`}};function NAe(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function tin(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function Ec(t){return`(?:${tin(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var C1t=B(WT(),1);function Voe(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function GT(t,e,r){let n=(0,C1t.default)(t),o=n;o=o.month(r-1),o=o.date(e),o=o.year(n.year());let i=o.add(1,"y"),a=o.add(-1,"y");return Math.abs(i.diff(n))<Math.abs(o.diff(n))?o=i:Math.abs(a.diff(n))<Math.abs(o.diff(n))&&(o=a),o.year()}var kAe={sunday:0,sun:0,"sun.":0,monday:1,mon:1,"mon.":1,tuesday:2,tue:2,"tue.":2,wednesday:3,wed:3,"wed.":3,thursday:4,thurs:4,"thurs.":4,thur:4,"thur.":4,thu:4,"thu.":4,friday:5,fri:5,"fri.":5,saturday:6,sat:6,"sat.":6},BAe={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Ph={...BAe,jan:1,"jan.":1,feb:2,"feb.":2,mar:3,"mar.":3,apr:4,"apr.":4,jun:6,"jun.":6,jul:7,"jul.":7,aug:8,"aug.":8,sep:9,"sep.":9,sept:9,"sept.":9,oct:10,"oct.":10,nov:11,"nov.":11,dec:12,"dec.":12},LAe={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},FAe={first:1,second:2,third:3,fourth:4,fifth:5,sixth:6,seventh:7,eighth:8,ninth:9,tenth:10,eleventh:11,twelfth:12,thirteenth:13,fourteenth:14,fifteenth:15,sixteenth:16,seventeenth:17,eighteenth:18,nineteenth:19,twentieth:20,"twenty first":21,"twenty-first":21,"twenty second":22,"twenty-second":22,"twenty third":23,"twenty-third":23,"twenty fourth":24,"twenty-fourth":24,"twenty fifth":25,"twenty-fifth":25,"twenty sixth":26,"twenty-sixth":26,"twenty seventh":27,"twenty-seventh":27,"twenty eighth":28,"twenty-eighth":28,"twenty ninth":29,"twenty-ninth":29,thirtieth:30,"thirty first":31,"thirty-first":31},E1t={second:"second",seconds:"second",minute:"minute",minutes:"minute",hour:"hour",hours:"hour",day:"d",days:"d",week:"week",weeks:"week",month:"month",months:"month",quarter:"quarter",quarters:"quarter",year:"year",years:"year"},BH={s:"second",sec:"second",second:"second",seconds:"second",m:"minute",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",hour:"hour",hours:"hour",d:"d",day:"d",days:"d",w:"w",week:"week",weeks:"week",mo:"month",mon:"month",mos:"month",month:"month",months:"month",qtr:"quarter",quarter:"quarter",quarters:"quarter",y:"year",yr:"year",year:"year",years:"year",...E1t},P1t=`(?:${Ec(LAe)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|the|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;function rin(t){let e=t.toLowerCase();return LAe[e]!==void 0?LAe[e]:e==="a"||e==="an"||e=="the"?1:e.match(/few/)?3:e.match(/half/)?.5:e.match(/couple/)?2:e.match(/several/)?7:parseFloat(e)}var WB=`(?:${Ec(FAe)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function KB(t){let e=t.toLowerCase();return FAe[e]!==void 0?FAe[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}var YT="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9]|2[0-5])";function ZT(t){if(/BE/i.test(t))return t=t.replace(/BE/i,""),parseInt(t)-543;if(/BCE?/i.test(t))return t=t.replace(/BCE?/i,""),-parseInt(t);if(/(AD|CE)/i.test(t))return t=t.replace(/(AD|CE)/i,""),parseInt(t);let e=parseInt(t);return Voe(e)}var T1t=`(${P1t})\\s{0,3}(${Ec(BH)})`,O1t=new RegExp(T1t,"i"),nin=`(${P1t})\\s{0,3}(${Ec(E1t)})`,A1t="\\s{0,5},?(?:\\s*and)?\\s{0,5}",fO=NAe("(?:(?:about|around)\\s{0,3})?",T1t,A1t),XT=NAe("(?:(?:about|around)\\s{0,3})?",nin,A1t);function Th(t){let e={},r=t,n=O1t.exec(r);for(;n;)oin(e,n),r=r.substring(n[0].length).trim(),n=O1t.exec(r);return Object.keys(e).length==0?null:e}function oin(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=rin(e[1]),n=BH[e[2].toLowerCase()];t[n]=r}var zo=class{constructor(){this.cachedInnerPattern=null,this.cachedPattern=null}innerPatternHasChange(e,r){return this.innerPattern(e)!==r}patternLeftBoundary(){return"(\\W|^)"}pattern(e){return this.cachedInnerPattern&&!this.innerPatternHasChange(e,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(e),this.cachedPattern=new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(e,r){let n=r[1]??"";r.index=r.index+n.length,r[0]=r[0].substring(n.length);for(let o=2;o<r.length;o++)r[o-1]=r[o];return this.innerExtract(e,r)}};var iin=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${fO})(?=\\W|$)`,"i"),ain=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${fO})(?=\\W|$)`,"i"),sin=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${XT})(?=\\W|$)`,"i"),$H=class extends zo{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?sin:e.option.forwardDate?iin:ain}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=Th(r[1]);return n?zn.createRelativeFromReference(e.reference,n):null}};var uin=new RegExp(`(?:on\\s{0,3})?(${WB})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${WB}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${Ec(Ph)})(?:(?:-|/|,?\\s{0,3})(${YT}(?!\\w)))?(?=\\W|$)`,"i"),I1t=1,M1t=2,lin=3,R1t=4,qH=class extends zo{innerPattern(){return uin}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=Ph[r[lin].toLowerCase()],i=KB(r[I1t]);if(i>31)return r.index=r.index+r[I1t].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[R1t]){let a=ZT(r[R1t]);n.start.assign("year",a)}else{let a=GT(e.refDate,i,o);n.start.imply("year",a)}if(r[M1t]){let a=KB(r[M1t]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};var cin=new RegExp(`(${Ec(Ph)})(?:-|/|\\s*,?\\s*)(${WB})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${WB})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${YT}))?(?=\\W|$)(?!\\:\\d)`,"i"),din=1,j1t=2,$Ae=3,qAe=4,UH=class extends zo{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return cin}innerExtract(e,r){let n=Ph[r[din].toLowerCase()],o=KB(r[j1t]);if(o>31||this.shouldSkipYearLikeDate&&!r[$Ae]&&!r[qAe]&&r[j1t].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[qAe]){let u=ZT(r[qAe]);i.assign("year",u)}else{let u=GT(e.refDate,o,n);i.imply("year",u)}if(!r[$Ae])return i;let a=KB(r[$Ae]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}};var fin=new RegExp(`((?:in)\\s*)?(${Ec(Ph)})\\s*(?:[,-]?\\s*(${YT})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),pin=1,min=2,D1t=3,zH=class extends zo{innerPattern(){return fin}innerExtract(e,r){let n=r[min].toLowerCase();if(r[0].length<=3&&!BAe[n])return null;let o=e.createParsingResult(r.index+(r[pin]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=Ph[n];if(o.start.assign("month",i),r[D1t]){let a=ZT(r[D1t]);o.start.assign("year",a)}else{let a=GT(e.refDate,1,i);o.start.imply("year",a)}return o}};var hin=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${Ec(Ph)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),gin=1,yin=2,N1t=3,bin=4,HH=class extends zo{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return hin}innerExtract(e,r){let n=parseInt(r[gin]),o=parseInt(r[bin]),i=r[N1t]?parseInt(r[N1t]):Ph[r[yin].toLowerCase()];if(i<1||i>12){if(this.strictMonthDateOrder)return null;o>=1&&o<=12&&([i,o]=[o,i])}return o<1||o>31?null:{day:o,month:i,year:n}}};var _in=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),vin=1,win=2,VH=class extends zo{innerPattern(){return _in}innerExtract(e,r){let n=parseInt(r[win]),o=parseInt(r[vin]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}};function Sin(t,e,r,n){return new RegExp(`${t}${e}(\\d{1,4})(?:(?:\\.|:|\uFF1A)(\\d{1,2})(?:(?::|\uFF1A)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${r}`,n)}function xin(t,e){return new RegExp(`^(${t})(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${e}`,"i")}var L1t=2,JB=3,Woe=4,Koe=5,WH=6,Joe=class{constructor(e=!1){this.cachedPrimaryPrefix=null,this.cachedPrimarySuffix=null,this.cachedPrimaryTimePattern=null,this.cachedFollowingPhase=null,this.cachedFollowingSuffix=null,this.cachedFollowingTimePatten=null,this.strictMode=e}patternFlags(){return"i"}primaryPatternLeftBoundary(){return"(^|\\s|T|\\b)"}primarySuffix(){return"(?!/)(?=\\W|$)"}followingSuffix(){return"(?!/)(?=\\W|$)"}pattern(e){return this.getPrimaryTimePatternThroughCache()}extract(e,r){let n=this.extractPrimaryTimeComponents(e,r);if(!n)return r[0].match(/^\d{4}/)?(r.index+=4,null):(r.index+=r[0].length,null);let o=r.index+r[1].length,i=r[0].substring(r[1].length),a=e.createParsingResult(o,i,n);r.index+=r[0].length;let s=e.text.substring(r.index),l=this.getFollowingTimePatternThroughCache().exec(s);return i.match(/^\d{3,4}/)&&l&&(l[0].match(/^\s*([+-])\s*\d{2,4}$/)||l[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/))?null:!l||l[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(a):(a.end=this.extractFollowingTimeComponents(e,l,a),a.end&&(a.text+=l[0]),this.checkAndReturnWithFollowingPattern(a))}extractPrimaryTimeComponents(e,r,n=!1){let o=e.createParsingComponents(),i=0,a=null,s=parseInt(r[L1t]);if(s>100){if(this.strictMode||r[JB]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[JB]!=null){if(r[JB].length==1&&!r[WH])return null;i=parseInt(r[JB])}if(i>=60)return null;if(s>12&&(a=Un.PM),r[WH]!=null){if(s>12)return null;let u=r[WH][0].toLowerCase();u=="a"&&(a=Un.AM,s==12&&(s=0)),u=="p"&&(a=Un.PM,s!=12&&(s+=12))}if(o.assign("hour",s),o.assign("minute",i),a!==null?o.assign("meridiem",a):s<12?o.imply("meridiem",Un.AM):o.imply("meridiem",Un.PM),r[Koe]!=null){let u=parseInt(r[Koe].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[Woe]!=null){let u=parseInt(r[Woe]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[Koe]!=null){let u=parseInt(r[Koe].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[Woe]!=null){let u=parseInt(r[Woe]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[L1t]),a=0,s=-1;if(r[JB]!=null?a=parseInt(r[JB]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=Un.PM),r[WH]!=null){if(i>12)return null;let u=r[WH][0].toLowerCase();u=="a"&&(s=Un.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=Un.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==Un.AM?(n.start.imply("meridiem",Un.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",Un.PM),n.start.get("hour")!=12&&n.start.assign("hour",n.start.get("hour")+12)))}return o.assign("hour",i),o.assign("minute",a),s>=0?o.assign("meridiem",s):n.start.isCertain("meridiem")&&n.start.get("hour")>12?n.start.get("hour")-12>i?o.imply("meridiem",Un.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",Un.PM)):i>12?o.imply("meridiem",Un.PM):i<=12&&o.imply("meridiem",Un.AM),o.date().getTime()<n.start.date().getTime()&&o.imply("day",o.get("day")+1),o}checkAndReturnWithoutFollowingPattern(e){if(e.text.match(/^\d$/)||e.text.match(/^\d\d\d+$/)||e.text.match(/\d[apAP]$/))return null;let r=e.text.match(/[^\d:.](\d[\d.]+)$/);if(r){let n=r[1];if(this.strictMode||n.includes(".")&&!n.match(/\d(\.\d{2})+$/)||parseInt(n)>24)return null}return e}checkAndReturnWithFollowingPattern(e){if(e.text.match(/^\d+-\d+$/))return null;let r=e.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(r){if(this.strictMode)return null;let n=r[1],o=r[2];if(o.includes(".")&&!o.match(/\d(\.\d{2})+$/))return null;let i=parseInt(o),a=parseInt(n);if(i>24||a>24)return null}return e}getPrimaryTimePatternThroughCache(){let e=this.primaryPrefix(),r=this.primarySuffix();return this.cachedPrimaryPrefix===e&&this.cachedPrimarySuffix===r?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=Sin(this.primaryPatternLeftBoundary(),e,r,this.patternFlags()),this.cachedPrimaryPrefix=e,this.cachedPrimarySuffix=r,this.cachedPrimaryTimePattern)}getFollowingTimePatternThroughCache(){let e=this.followingPhase(),r=this.followingSuffix();return this.cachedFollowingPhase===e&&this.cachedFollowingSuffix===r?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=xin(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}};var KH=class extends Joe{constructor(e){super(e)}followingPhase(){return"\\s*(?:\\-|\\\u2013|\\~|\\\u301C|to|until|through|till|\\?)\\s*"}primaryPrefix(){return"(?:(?:at|from)\\s*)??"}primarySuffix(){return"(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(e,r){let n=super.extractPrimaryTimeComponents(e,r);if(!n)return n;if(r[0].endsWith("night")){let o=n.get("hour");o>=6&&o<12?(n.assign("hour",n.get("hour")+12),n.assign("meridiem",Un.PM)):o<6&&n.assign("meridiem",Un.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",Un.PM);let o=n.get("hour");o>=0&&o<=6&&n.assign("hour",n.get("hour")+12)}return r[0].endsWith("morning")&&(n.assign("meridiem",Un.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}};function QT(t){let e={};for(let r in t)e[r]=-t[r];return e}function F1t(t,e){let r=t.clone(),n=t.dayjs();for(let o in e)n=n.add(e[o],o);return("day"in e||"d"in e||"week"in e||"month"in e||"year"in e)&&(r.imply("day",n.date()),r.imply("month",n.month()+1),r.imply("year",n.year())),("second"in e||"minute"in e||"hour"in e)&&(r.imply("second",n.second()),r.imply("minute",n.minute()),r.imply("hour",n.hour())),r}var Cin=new RegExp(`(${fO})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),Oin=new RegExp(`(${XT})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),JH=class extends zo{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?Oin:Cin}innerExtract(e,r){let n=Th(r[1]);if(!n)return null;let o=QT(n);return zn.createRelativeFromReference(e.reference,o)}};var Ein=new RegExp(`(${fO})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),Pin=new RegExp(`(${XT})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),Tin=1,GH=class extends zo{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?Pin:Ein}innerExtract(e,r){let n=Th(r[Tin]);return n?zn.createRelativeFromReference(e.reference,n):null}};var Goe=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},Ah=class{refine(e,r){if(r.length<2)return r;let n=[],o=r[0],i=null;for(let a=1;a<r.length;a++){i=r[a];let s=e.text.substring(o.index+o.text.length,i.index);if(!this.shouldMergeResults(s,o,i,e))n.push(o),o=i;else{let u=o,l=i,c=this.mergeResults(s,u,l,e);e.debug(()=>{console.log(`${this.constructor.name} merged ${u} and ${l} into ${c}`)}),o=c}}return o!=null&&n.push(o),n}};var YH=class extends Ah{shouldMergeResults(e,r,n){return!r.end&&!n.end&&e.match(this.patternBetween())!=null}mergeResults(e,r,n){if(!r.start.isOnlyWeekdayComponent()&&!n.start.isOnlyWeekdayComponent()&&(n.start.getCertainComponents().forEach(i=>{r.start.isCertain(i)||r.start.imply(i,n.start.get(i))}),r.start.getCertainComponents().forEach(i=>{n.start.isCertain(i)||n.start.imply(i,r.start.get(i))})),r.start.date().getTime()>n.start.date().getTime()){let i=r.start.dayjs(),a=n.start.dayjs();n.start.isOnlyWeekdayComponent()&&a.add(7,"days").isAfter(i)?(a=a.add(7,"days"),n.start.imply("day",a.date()),n.start.imply("month",a.month()+1),n.start.imply("year",a.year())):r.start.isOnlyWeekdayComponent()&&i.add(-7,"days").isBefore(a)?(i=i.add(-7,"days"),r.start.imply("day",i.date()),r.start.imply("month",i.month()+1),r.start.imply("year",i.year())):n.start.isDateWithUnknownYear()&&a.add(1,"years").isAfter(i)?(a=a.add(1,"years"),n.start.imply("year",a.year())):r.start.isDateWithUnknownYear()&&i.add(-1,"years").isBefore(a)?(i=i.add(-1,"years"),r.start.imply("year",i.year())):[n,r]=[r,n]}let o=r.clone();return o.start=r.start,o.end=n.start,o.index=Math.min(r.index,n.index),r.index<n.index?o.text=r.text+e+n.text:o.text=n.text+e+r.text,o}};var ZH=class extends YH{patternBetween(){return/^\s*(to|-||until|through|till)\s*$/i}};function UAe(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=k1t(n,o),t.end!=null||e.end!=null){let i=t.end==null?t.start:t.end,a=e.end==null?e.start:e.end,s=k1t(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?Zg(s,u):uj(s,u)}r.end=s}return r}function k1t(t,e){let r=t.clone();return e.isCertain("hour")?(r.assign("hour",e.get("hour")),r.assign("minute",e.get("minute")),e.isCertain("second")?(r.assign("second",e.get("second")),e.isCertain("millisecond")?r.assign("millisecond",e.get("millisecond")):r.imply("millisecond",e.get("millisecond"))):(r.imply("second",e.get("second")),r.imply("millisecond",e.get("millisecond")))):(r.imply("hour",e.get("hour")),r.imply("minute",e.get("minute")),r.imply("second",e.get("second")),r.imply("millisecond",e.get("millisecond"))),e.isCertain("timezoneOffset")&&r.assign("timezoneOffset",e.get("timezoneOffset")),e.isCertain("meridiem")?r.assign("meridiem",e.get("meridiem")):e.get("meridiem")!=null&&r.get("meridiem")==null&&r.imply("meridiem",e.get("meridiem")),r.get("meridiem")==Un.PM&&r.get("hour")<12&&(e.isCertain("hour")?r.assign("hour",r.get("hour")+12):r.imply("hour",r.get("hour")+12)),r.addTags(t.tags()),r.addTags(e.tags()),r}var XH=class extends Ah{shouldMergeResults(e,r,n){return(r.start.isOnlyDate()&&n.start.isOnlyTime()||n.start.isOnlyDate()&&r.start.isOnlyTime())&&e.match(this.patternBetween())!=null}mergeResults(e,r,n){let o=r.start.isOnlyDate()?UAe(r,n):UAe(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}};var GB=class extends XH{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}};var Ain=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),QH=class{constructor(e){this.timezoneOverrides=e}refine(e,r){let n=e.option.timezones??{};return r.forEach(o=>{let i=e.text.substring(o.index+o.text.length),a=Ain.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=Hoe(s,u,l);if(c==null)return;e.debug(()=>{console.log(`Extracting timezone: '${s}' into: ${c} for: ${o.start}`)});let d=o.start.get("timezoneOffset");d!==null&&c!=d&&(o.start.isCertain("timezoneOffset")||s!=a[1])||o.start.isOnlyDate()&&s!=a[1]||(o.text+=a[0],o.start.isCertain("timezoneOffset")||o.start.assign("timezoneOffset",c),o.end!=null&&!o.end.isCertain("timezoneOffset")&&o.end.assign("timezoneOffset",c))}),r}};var Iin=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),Min=1,Rin=2,jin=3,e8=class{refine(e,r){return r.forEach(function(n){if(n.start.isCertain("timezoneOffset"))return;let o=e.text.substring(n.index+n.text.length),i=Iin.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[Rin]),s=parseInt(i[jin]||"0"),u=a*60+s;u>14*60||(i[Min]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}};var eA=class{refine(e,r){if(r.length<2)return r;let n=[],o=r[0];for(let i=1;i<r.length;i++){let a=r[i];if(a.index>=o.index+o.text.length){n.push(o),o=a;continue}let s=null,u=null;a.text.length>o.text.length?(s=a,u=o):(s=o,u=a),e.debug(()=>{console.log(`${this.constructor.name} remove ${u} by ${s}`)}),o=s}return o!=null&&n.push(o),n}};var B1t=B(WT(),1);var t8=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,B1t.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),uj(n.start,o),n.end&&n.end.isOnlyTime()&&(uj(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),uj(n.end,o))),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} time result (${n.start})`)})),n.start.isOnlyWeekdayComponent()&&o.isAfter(n.start.dayjs())&&(o.day()>=n.start.get("weekday")?o=o.day(n.start.get("weekday")+7):o=o.day(n.start.get("weekday")),n.start.imply("day",o.date()),n.start.imply("month",o.month()+1),n.start.imply("year",o.year()),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.start})`)}),n.end&&n.end.isOnlyWeekdayComponent()&&(o.day()>n.end.get("weekday")?o=o.day(n.end.get("weekday")+7):o=o.day(n.end.get("weekday")),n.end.imply("day",o.date()),n.end.imply("month",o.month()+1),n.end.imply("year",o.year()),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} weekday (${n.end})`)}))),n.start.isDateWithUnknownYear()&&o.isAfter(n.start.dayjs()))for(let i=0;i<3&&o.isAfter(n.start.dayjs());i++)n.start.imply("year",n.start.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} year (${n.start})`)}),n.end&&!n.end.isCertain("year")&&(n.end.imply("year",n.end.get("year")+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${n} month (${n.start})`)}))}),r}};var r8=class extends Goe{constructor(e){super(),this.strictMode=e}isValid(e,r){return r.text.replace(" ","").match(/^\d*(\.\d*)?$/)?(e.debug(()=>{console.log(`Removing unlikely result '${r.text}'`)}),!1):r.start.isValidDate()?r.end&&!r.end.isValidDate()?(e.debug(()=>{console.log(`Removing invalid result: ${r} (${r.end})`)}),!1):this.strictMode?this.isStrictModeValid(e,r):!0:(e.debug(()=>{console.log(`Removing invalid result: ${r} (${r.start})`)}),!1)}isStrictModeValid(e,r){return r.start.isOnlyWeekdayComponent()?(e.debug(()=>{console.log(`(Strict) Removing weekday only component: ${r} (${r.end})`)}),!1):r.start.isOnlyTime()&&(!r.start.isCertain("hour")||!r.start.isCertain("minute"))?(e.debug(()=>{console.log(`(Strict) Removing uncertain time component: ${r} (${r.end})`)}),!1):!0}};var Din=new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})(?:T([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?(Z|([+-]\\d{2}):?(\\d{2})?)?)?(?=\\W|$)","i"),Nin=1,Lin=2,Fin=3,$1t=4,kin=5,q1t=6,U1t=7,Bin=8,z1t=9,H1t=10,n8=class extends zo{innerPattern(){return Din}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[Nin]),month:parseInt(r[Lin]),day:parseInt(r[Fin])});if(r[$1t]!=null&&(n.assign("hour",parseInt(r[$1t])),n.assign("minute",parseInt(r[kin])),r[q1t]!=null&&n.assign("second",parseInt(r[q1t])),r[U1t]!=null&&n.assign("millisecond",parseInt(r[U1t])),r[Bin]!=null)){let o=0;if(r[z1t]){let i=parseInt(r[z1t]),a=0;r[H1t]!=null&&(a=parseInt(r[H1t])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}};var o8=class extends Ah{mergeResults(e,r,n){let o=n.clone();return o.index=r.index,o.text=r.text+e+o.text,o.start.assign("weekday",r.start.get("weekday")),o.end&&o.end.assign("weekday",r.start.get("weekday")),o}shouldMergeResults(e,r,n){return r.start.isOnlyWeekdayComponent()&&!r.start.isCertain("hour")&&n.start.isCertain("day")&&e.match(/^,?\s*$/)!=null}};function V1t(t,e=!1){return t.parsers.unshift(new n8),t.refiners.unshift(new o8),t.refiners.unshift(new e8),t.refiners.unshift(new eA),t.refiners.push(new QH),t.refiners.push(new eA),t.refiners.push(new t8),t.refiners.push(new r8(e)),t}var ojt=B(WT(),1);var YB=B(WT(),1);function W1t(t){let e=(0,YB.default)(t.instant),r=new zn(t,{});return Zg(r,e),zoe(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function K1t(t){let e=(0,YB.default)(t.instant),r=new zn(t,{});return Zg(r,e),VB(r,e),r.addTag("casualReference/today"),r}function J1t(t){return $in(t,1).addTag("casualReference/yesterday")}function $in(t,e){return Y1t(t,-e)}function G1t(t){return Y1t(t,1).addTag("casualReference/tomorrow")}function Y1t(t,e){let r=(0,YB.default)(t.instant),n=new zn(t,{});return r=r.add(e,"day"),Zg(n,r),VB(n,r),n}function Z1t(t,e=22){let r=(0,YB.default)(t.instant),n=new zn(t,{});return Zg(n,r),n.imply("hour",e),n.imply("meridiem",Un.PM),n.addTag("casualReference/tonight"),n}function X1t(t,e=20){let r=new zn(t,{});return r.imply("meridiem",Un.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function Q1t(t){let e=new zn(t,{}),r=(0,YB.default)(t.instant);return r.hour()>2&&w1t(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function ejt(t,e=6){let r=new zn(t,{});return r.imply("meridiem",Un.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function tjt(t,e=15){let r=new zn(t,{});return r.imply("meridiem",Un.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function rjt(t){let e=new zn(t,{});return e.imply("meridiem",Un.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var qin=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,i8=class extends zo{innerPattern(e){return qin}innerExtract(e,r){let n=(0,ojt.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=W1t(e.reference);break;case"today":i=K1t(e.reference);break;case"yesterday":i=J1t(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=G1t(e.reference);break;case"tonight":i=Z1t(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),Zg(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}};var Uin=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,a8=class extends zo{innerPattern(){return Uin}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=tjt(e.reference);break;case"evening":case"night":n=X1t(e.reference);break;case"midnight":n=Q1t(e.reference);break;case"morning":n=ejt(e.reference);break;case"noon":case"midday":n=rjt(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}};function ijt(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=zin(n,e,r),i=new zn(t);return i=F1t(i,{day:o}),i.assign("weekday",e),i}function zin(t,e,r){let n=t.getDay();switch(r){case"this":return Yoe(t,e);case"last":return ajt(t,e);case"next":return n==Fu.SUNDAY?e==Fu.SUNDAY?7:e:n==Fu.SATURDAY?e==Fu.SATURDAY?7:e==Fu.SUNDAY?8:1+e:e<n&&e!=Fu.SUNDAY?Yoe(t,e):Yoe(t,e)+7}return Hin(t,e)}function Hin(t,e){let r=ajt(t,e),n=Yoe(t,e);return n<-r?n:r}function Yoe(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function ajt(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var Vin=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${Ec(kAe)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),Win=1,Kin=2,Jin=3,s8=class extends zo{innerPattern(){return Vin}innerExtract(e,r){let n=r[Kin].toLowerCase(),o=kAe[n],i=r[Win],a=r[Jin],s=i||a;s=s||"",s=s.toLowerCase();let u=null;return s=="last"||s=="past"?u="last":s=="next"?u="next":s=="this"&&(u="this"),ijt(e.reference,o,u)}};var sjt=B(WT(),1);var Gin=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${Ec(BH)})(?=\\s*)(?=\\W|$)`,"i"),Yin=1,Zin=2,u8=class extends zo{innerPattern(){return Gin}innerExtract(e,r){let n=r[Yin].toLowerCase(),o=r[Zin].toLowerCase(),i=BH[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,zn.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,zn.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,sjt.default)(e.reference.instant);return o.match(/week/i)?(s=s.add(-s.get("d"),"d"),a.imply("day",s.date()),a.imply("month",s.month()+1),a.imply("year",s.year())):o.match(/month/i)?(s=s.add(-s.date()+1,"d"),a.imply("day",s.date()),a.assign("year",s.year()),a.assign("month",s.month()+1)):o.match(/year/i)&&(s=s.add(-s.date()+1,"d"),s=s.add(-s.month(),"month"),a.imply("day",s.date()),a.imply("month",s.month()+1),a.assign("year",s.year())),a}};var Xin=new RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)","i"),Qin=1,ean=5,ujt=2,ljt=3,zAe=4,l8=class{constructor(e){this.groupNumberMonth=e?ljt:ujt,this.groupNumberDay=e?ujt:ljt}pattern(){return Xin}extract(e,r){let n=r.index+r[Qin].length,o=r.index+r[0].length-r[ean].length;if(n>0&&e.text.substring(0,n).match("\\d/?$")||o<e.text.length&&e.text.substring(o).match("^/?\\d"))return;let i=e.text.substring(n,o);if(i.match(/^\d\.\d$/)||i.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)||!r[zAe]&&i.indexOf("/")<0)return;let a=e.createParsingResult(n,i),s=parseInt(r[this.groupNumberMonth]),u=parseInt(r[this.groupNumberDay]);if((s<1||s>12)&&s>12)if(u>=1&&u<=12&&s<=31)[u,s]=[s,u];else return null;if(u<1||u>31)return null;if(a.start.assign("day",u),a.start.assign("month",s),r[zAe]){let l=parseInt(r[zAe]),c=Voe(l);a.start.assign("year",c)}else{let l=GT(e.refDate,u,s);a.start.imply("year",l)}return a}};var tan=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${fO})(?=\\W|$)`,"i"),ran=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${XT})(?=\\W|$)`,"i"),c8=class extends zo{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?tan:ran}innerExtract(e,r){let n=r[1].toLowerCase(),o=Th(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=QT(o);break}return zn.createRelativeFromReference(e.reference,o)}};function nan(t){return t.text.match(/^[+-]/i)!=null}function cjt(t){return t.text.match(/^-/i)!=null}var d8=class extends Ah{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?nan(n)||cjt(n):!1}mergeResults(e,r,n,o){let i=Th(n.text);cjt(n)&&(i=QT(i));let a=zn.createRelativeFromReference(new JT(r.start.date()),i);return new dO(r.reference,r.index,`${r.text}${e}${n.text}`,a)}};function djt(t){return t.text.match(/\s+(before|from)$/i)!=null}function oan(t){return t.text.match(/\s+(after|since)$/i)!=null}var f8=class extends Ah{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!djt(r)&&!oan(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=Th(r.text);djt(r)&&(o=QT(o));let i=zn.createRelativeFromReference(new JT(n.start.date()),o);return new dO(n.reference,r.index,`${r.text}${e}${n.text}`,i)}};var ian=new RegExp(`^\\s*(${YT})`,"i"),aan=1,p8=class{refine(e,r){return r.forEach(function(n){if(!n.start.isDateWithUnknownYear())return;let o=e.text.substring(n.index+n.text.length),i=ian.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=ZT(i[aan]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}};var lj=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new i8),r.parsers.push(new a8),r.parsers.push(new zH),r.parsers.push(new u8),r.parsers.push(new c8),r}createConfiguration(e=!0,r=!1){let n=V1t({parsers:[new l8(r),new $H(e),new qH,new UH(r),new s8,new VH,new KH(e),new JH(e),new GH(e)],refiners:[new GB]},e);return n.parsers.unshift(new HH(e)),n.refiners.unshift(new f8),n.refiners.unshift(new d8),n.refiners.unshift(new eA),n.refiners.push(new GB),n.refiners.push(new p8),n.refiners.push(new ZH),n}};var ZB=class t{constructor(e){this.defaultConfig=new lj,e=e||this.defaultConfig.createCasualConfiguration(),this.parsers=[...e.parsers],this.refiners=[...e.refiners]}clone(){return new t({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(e,r,n){let o=this.parse(e,r,n);return o.length>0?o[0].start.date():null}parse(e,r,n){let o=new HAe(e,r,n),i=[];return this.parsers.forEach(a=>{let s=t.executeParser(o,a);i=i.concat(s)}),i.sort((a,s)=>a.index-s.index),this.refiners.forEach(function(a){i=a.refine(o,i)}),i}static executeParser(e,r){let n=[],o=r.pattern(e),i=e.text,a=e.text,s=o.exec(a);for(;s;){let u=s.index+i.length-a.length;s.index=u;let l=r.extract(e,s);if(!l){a=i.substring(s.index+1),s=o.exec(a);continue}let c=null;l instanceof dO?c=l:l instanceof zn?(c=e.createParsingResult(s.index,s[0]),c.start=l):c=e.createParsingResult(s.index,s[0],l);let d=c.index,f=c.text;e.debug(()=>console.log(`${r.constructor.name} extracted (at index=${d}) '${f}'`)),n.push(c),a=i.substring(d+f.length),s=o.exec(a)}return n}},HAe=class{constructor(e,r,n){this.text=e,this.reference=new JT(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof zn?e:new zn(this.reference,e)}createParsingResult(e,r,n,o){let i=typeof r=="string"?r:this.text.substring(e,r),a=n?this.createParsingComponents(n):null,s=o?this.createParsingComponents(o):null;return new dO(this.reference,e,i,a,s)}debug(e){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(e):this.option.debug.debug(e))}};var VAe=new lj,fjt=new ZB(VAe.createCasualConfiguration(!1)),san=new ZB(VAe.createConfiguration(!0,!1)),kqo=new ZB(VAe.createCasualConfiguration(!0));var lan=fjt;function WAe(t,e,r){return lan.parse(t,e,r)}var pO=class extends Error{},Zoe=class extends pO{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Xoe=class extends pO{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Qoe=class extends pO{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Xg=class extends pO{},XB=class extends pO{constructor(e){super(`Invalid unit ${e}`)}},Ua=class extends pO{},Qg=class extends pO{constructor(){super("Zone is an abstract class")}};var et="numeric",ey="short",im="long",tA={year:et,month:et,day:et},m8={year:et,month:ey,day:et},KAe={year:et,month:ey,day:et,weekday:ey},h8={year:et,month:im,day:et},g8={year:et,month:im,day:et,weekday:im},y8={hour:et,minute:et},b8={hour:et,minute:et,second:et},_8={hour:et,minute:et,second:et,timeZoneName:ey},v8={hour:et,minute:et,second:et,timeZoneName:im},w8={hour:et,minute:et,hourCycle:"h23"},S8={hour:et,minute:et,second:et,hourCycle:"h23"},x8={hour:et,minute:et,second:et,hourCycle:"h23",timeZoneName:ey},C8={hour:et,minute:et,second:et,hourCycle:"h23",timeZoneName:im},O8={year:et,month:et,day:et,hour:et,minute:et},E8={year:et,month:et,day:et,hour:et,minute:et,second:et},P8={year:et,month:ey,day:et,hour:et,minute:et},T8={year:et,month:ey,day:et,hour:et,minute:et,second:et},JAe={year:et,month:ey,day:et,weekday:ey,hour:et,minute:et},A8={year:et,month:im,day:et,hour:et,minute:et,timeZoneName:ey},I8={year:et,month:im,day:et,hour:et,minute:et,second:et,timeZoneName:ey},M8={year:et,month:im,day:et,weekday:im,hour:et,minute:et,timeZoneName:im},R8={year:et,month:im,day:et,weekday:im,hour:et,minute:et,second:et,timeZoneName:im};var up=class{get type(){throw new Qg}get name(){throw new Qg}get ianaName(){return this.name}get isUniversal(){throw new Qg}offsetName(e,r){throw new Qg}formatOffset(e,r){throw new Qg}offset(e){throw new Qg}equals(e){throw new Qg}get isValid(){throw new Qg}};var GAe=null,rA=class t extends up{static get instance(){return GAe===null&&(GAe=new t),GAe}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return tie(e,r,n)}formatOffset(e,r){return nA(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var nie={};function dan(t){return nie[t]||(nie[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),nie[t]}var fan={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function pan(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,o,i,a,s,u,l,c]=n;return[a,o,i,s,u,l,c]}function man(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=fan[i];i==="era"?n[s]=a:Ht(s)||(n[s]=parseInt(a,10))}return n}var rie={},_d=class t extends up{static create(e){return rie[e]||(rie[e]=new t(e)),rie[e]}static resetCache(){rie={},nie={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return tie(e,r,n,this.name)}formatOffset(e,r){return nA(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=dan(this.name),[o,i,a,s,u,l,c]=n.formatToParts?man(n,r):pan(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=QB({year:o,month:i,day:a,hour:u===24?0:u,minute:l,second:c,millisecond:0}),p=+r,m=p%1e3;return p-=m>=0?m:1e3+m,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var pjt={};function han(t,e={}){let r=JSON.stringify([t,e]),n=pjt[r];return n||(n=new Intl.ListFormat(t,e),pjt[r]=n),n}var YAe={};function ZAe(t,e={}){let r=JSON.stringify([t,e]),n=YAe[r];return n||(n=new Intl.DateTimeFormat(t,e),YAe[r]=n),n}var XAe={};function gan(t,e={}){let r=JSON.stringify([t,e]),n=XAe[r];return n||(n=new Intl.NumberFormat(t,e),XAe[r]=n),n}var QAe={};function yan(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=QAe[o];return i||(i=new Intl.RelativeTimeFormat(t,e),QAe[o]=i),i}var j8=null;function ban(){return j8||(j8=new Intl.DateTimeFormat().resolvedOptions().locale,j8)}var mjt={};function _an(t){let e=mjt[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,mjt[t]=e}return e}function van(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let n,o;try{n=ZAe(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=ZAe(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function wan(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function San(t){let e=[];for(let r=1;r<=12;r++){let n=Dr.utc(2009,r,1);e.push(t(n))}return e}function xan(t){let e=[];for(let r=1;r<=7;r++){let n=Dr.utc(2016,11,13+r);e.push(t(n))}return e}function oie(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function Can(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var eIe=class{constructor(e,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:o,floor:i,...a}=n;if(!r||Object.keys(a).length>0){let s={useGrouping:!1,...n};n.padTo>0&&(s.minimumIntegerDigits=n.padTo),this.inf=gan(e,s)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):e$(e,3);return Sa(r,this.padTo)}}},tIe=class{constructor(e,r,n){this.opts=n,this.originalZone=void 0;let o;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let a=-1*(e.offset/60),s=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&_d.create(s).valid?(o=s,this.dt=e):(o="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,o=e.zone.name):(o="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||o,this.dtf=ZAe(r,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},rIe=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&iie()&&(this.rtf=yan(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):hjt(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},Oan={firstDay:1,minimalDays:4,weekend:[6,7]},To=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,o,i=!1){let a=e||Po.defaultLocale,s=a||(i?"en-US":ban()),u=r||Po.defaultNumberingSystem,l=n||Po.defaultOutputCalendar,c=D8(o)||Po.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){j8=null,YAe={},XAe={},QAe={}}static fromObject({locale:e,numberingSystem:r,outputCalendar:n,weekSettings:o}={}){return t.create(e,r,n,o)}constructor(e,r,n,o,i){let[a,s,u]=van(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=wan(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Can(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,D8(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,r=!1){return oie(this,e,nIe,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=San(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return oie(this,e,oIe,()=>{let n=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},o=r?"format":"standalone";return this.weekdaysCache[o][e]||(this.weekdaysCache[o][e]=xan(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return oie(this,void 0,()=>iIe,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Dr.utc(2016,11,13,9),Dr.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return oie(this,e,aIe,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[Dr.utc(-40,1,1),Dr.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[e]})}extract(e,r,n){let o=this.dtFormatter(e,r),i=o.formatToParts(),a=i.find(s=>s.type.toLowerCase()===n);return a?a.value:null}numberFormatter(e={}){return new eIe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new tIe(e,this.intl,r)}relFormatter(e={}){return new rIe(this.intl,this.isEnglish(),e)}listFormatter(e={}){return han(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:aie()?_an(this.locale):Oan}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}};var uIe=null,Bl=class t extends up{static get utcInstance(){return uIe===null&&(uIe=new t(0)),uIe}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(cj(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${nA(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${nA(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return nA(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}};var t$=class extends up{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function ty(t,e){let r;if(Ht(t)||t===null)return e;if(t instanceof up)return t;if(gjt(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?rA.instance:n==="utc"||n==="gmt"?Bl.utcInstance:Bl.parseSpecifier(n)||_d.create(t)}else return ry(t)?Bl.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new t$(t)}var lIe={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},yjt={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Ean=lIe.hanidec.replace(/[\[|\]]/g,"").split("");function bjt(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(t[r].search(lIe.hanidec)!==-1)e+=Ean.indexOf(t[r]);else for(let o in yjt){let[i,a]=yjt[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}var r$={};function _jt(){r$={}}function Ih({numberingSystem:t},e=""){let r=t||"latn";return r$[r]||(r$[r]={}),r$[r][e]||(r$[r][e]=new RegExp(`${lIe[r]}${e}`)),r$[r][e]}var vjt=()=>Date.now(),wjt="system",Sjt=null,xjt=null,Cjt=null,Ojt=60,Ejt,Pjt=null,Po=class{static get now(){return vjt}static set now(e){vjt=e}static set defaultZone(e){wjt=e}static get defaultZone(){return ty(wjt,rA.instance)}static get defaultLocale(){return Sjt}static set defaultLocale(e){Sjt=e}static get defaultNumberingSystem(){return xjt}static set defaultNumberingSystem(e){xjt=e}static get defaultOutputCalendar(){return Cjt}static set defaultOutputCalendar(e){Cjt=e}static get defaultWeekSettings(){return Pjt}static set defaultWeekSettings(e){Pjt=D8(e)}static get twoDigitCutoffYear(){return Ojt}static set twoDigitCutoffYear(e){Ojt=e%100}static get throwOnInvalid(){return Ejt}static set throwOnInvalid(e){Ejt=e}static resetCaches(){To.resetCache(),_d.resetCache(),Dr.resetCache(),_jt()}};var $l=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var Tjt=[0,31,59,90,120,151,181,212,243,273,304,334],Ajt=[0,31,60,91,121,152,182,213,244,274,305,335];function Mh(t,e){return new $l("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function sie(t,e,r){let n=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let o=n.getUTCDay();return o===0?7:o}function Ijt(t,e,r){return r+(fj(t)?Ajt:Tjt)[e-1]}function Mjt(t,e){let r=fj(t)?Ajt:Tjt,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function uie(t,e){return(t-e+7)%7+1}function N8(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=Ijt(n,o,i),s=uie(sie(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=dj(l,e,r)):u>dj(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...F8(t)}}function cIe(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=uie(sie(n,1,e),r),s=oA(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=oA(l)):u>s?(l=n+1,u-=oA(n)):l=n;let{month:c,day:d}=Mjt(l,u);return{year:l,month:c,day:d,...F8(t)}}function lie(t){let{year:e,month:r,day:n}=t,o=Ijt(e,r,n);return{year:e,ordinal:o,...F8(t)}}function dIe(t){let{year:e,ordinal:r}=t,{month:n,day:o}=Mjt(e,r);return{year:e,month:n,day:o,...F8(t)}}function fIe(t,e){if(!Ht(t.localWeekday)||!Ht(t.localWeekNumber)||!Ht(t.localWeekYear)){if(!Ht(t.weekday)||!Ht(t.weekNumber)||!Ht(t.weekYear))throw new Xg("Cannot mix locale-based week fields with ISO-based week fields");return Ht(t.localWeekday)||(t.weekday=t.localWeekday),Ht(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),Ht(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Rjt(t,e=4,r=1){let n=L8(t.weekYear),o=am(t.weekNumber,1,dj(t.weekYear,e,r)),i=am(t.weekday,1,7);return n?o?i?!1:Mh("weekday",t.weekday):Mh("week",t.weekNumber):Mh("weekYear",t.weekYear)}function jjt(t){let e=L8(t.year),r=am(t.ordinal,1,oA(t.year));return e?r?!1:Mh("ordinal",t.ordinal):Mh("year",t.year)}function pIe(t){let e=L8(t.year),r=am(t.month,1,12),n=am(t.day,1,n$(t.year,t.month));return e?r?n?!1:Mh("day",t.day):Mh("month",t.month):Mh("year",t.year)}function mIe(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=am(e,0,23)||e===24&&r===0&&n===0&&o===0,a=am(r,0,59),s=am(n,0,59),u=am(o,0,999);return i?a?s?u?!1:Mh("millisecond",o):Mh("second",n):Mh("minute",r):Mh("hour",e)}function Ht(t){return typeof t>"u"}function ry(t){return typeof t=="number"}function L8(t){return typeof t=="number"&&t%1===0}function gjt(t){return typeof t=="string"}function Njt(t){return Object.prototype.toString.call(t)==="[object Date]"}function iie(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function aie(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Ljt(t){return Array.isArray(t)?t:[t]}function hIe(t,e,r){if(t.length!==0)return t.reduce((n,o)=>{let i=[e(o),o];return n&&r(n[0],i[0])===n[0]?n:i},null)[1]}function Fjt(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function iA(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function D8(t){if(t==null)return null;if(typeof t!="object")throw new Ua("Week settings must be an object");if(!am(t.firstDay,1,7)||!am(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!am(e,1,7)))throw new Ua("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function am(t,e,r){return L8(t)&&t>=e&&t<=r}function Pan(t,e){return t-e*Math.floor(t/e)}function Sa(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function mO(t){if(!(Ht(t)||t===null||t===""))return parseInt(t,10)}function aA(t){if(!(Ht(t)||t===null||t===""))return parseFloat(t)}function k8(t){if(!(Ht(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function e$(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function fj(t){return t%4===0&&(t%100!==0||t%400===0)}function oA(t){return fj(t)?366:365}function n$(t,e){let r=Pan(e-1,12)+1,n=t+(e-r)/12;return r===2?fj(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function QB(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function Djt(t,e,r){return-uie(sie(t,1,e),r)+e-1}function dj(t,e=4,r=1){let n=Djt(t,e,r),o=Djt(t+1,e,r);return(oA(t)-n+o)/7}function B8(t){return t>99?t:t>Po.twoDigitCutoffYear?1900+t:2e3+t}function tie(t,e,r,n=null){let o=new Date(t),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);let a={timeZoneName:e,...i},s=new Intl.DateTimeFormat(r,a).formatToParts(o).find(u=>u.type.toLowerCase()==="timezonename");return s?s.value:null}function cj(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let n=parseInt(e,10)||0,o=r<0||Object.is(r,-0)?-n:n;return r*60+o}function gIe(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Ua(`Invalid unit value ${t}`);return e}function o$(t,e){let r={};for(let n in t)if(iA(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=gIe(o)}return r}function nA(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),o=t>=0?"+":"-";switch(e){case"short":return`${o}${Sa(r,2)}:${Sa(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${Sa(r,2)}${Sa(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function F8(t){return Fjt(t,["hour","minute","second","millisecond"])}var Tan=["January","February","March","April","May","June","July","August","September","October","November","December"],yIe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Aan=["J","F","M","A","M","J","J","A","S","O","N","D"];function nIe(t){switch(t){case"narrow":return[...Aan];case"short":return[...yIe];case"long":return[...Tan];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var bIe=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],_Ie=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ian=["M","T","W","T","F","S","S"];function oIe(t){switch(t){case"narrow":return[...Ian];case"short":return[..._Ie];case"long":return[...bIe];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var iIe=["AM","PM"],Man=["Before Christ","Anno Domini"],Ran=["BC","AD"],jan=["B","A"];function aIe(t){switch(t){case"narrow":return[...jan];case"short":return[...Ran];case"long":return[...Man];default:return null}}function kjt(t){return iIe[t.hour<12?0:1]}function Bjt(t,e){return oIe(e)[t.weekday-1]}function $jt(t,e){return nIe(e)[t.month-1]}function qjt(t,e){return aIe(e)[t.year<0?0:1]}function hjt(t,e,r="always",n=!1){let o={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&i){let d=t==="days";switch(e){case 1:return d?"tomorrow":`next ${o[t][0]}`;case-1:return d?"yesterday":`last ${o[t][0]}`;case 0:return d?"today":`this ${o[t][0]}`;default:}}let a=Object.is(e,-0)||e<0,s=Math.abs(e),u=s===1,l=o[t],c=n?u?l[1]:l[2]||l[1]:u?o[t][0]:t;return a?`${s} ${c} ago`:`in ${s} ${c}`}function Ujt(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var Dan={D:tA,DD:m8,DDD:h8,DDDD:g8,t:y8,tt:b8,ttt:_8,tttt:v8,T:w8,TT:S8,TTT:x8,TTTT:C8,f:O8,ff:P8,fff:A8,ffff:M8,F:E8,FF:T8,FFF:I8,FFFF:R8},ql=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,n="",o=!1,i=[];for(let a=0;a<e.length;a++){let s=e.charAt(a);s==="'"?(n.length>0&&i.push({literal:o||/^\s+$/.test(n),val:n}),r=null,n="",o=!o):o||s===r?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,r=s)}return n.length>0&&i.push({literal:o||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return Dan[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0){if(this.opts.forceSimple)return Sa(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",o=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(p,m)=>this.loc.extract(e,p,m),a=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",s=()=>n?kjt(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?$jt(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?Bjt(e,p):i(m?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),c=p=>{let m=t.macroTokenToFormatOpts(p);return m?this.formatWithSystemDefault(e,m):p},d=p=>n?qjt(e,p):i({era:p},"era"),f=p=>{switch(p){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return s();case"d":return o?i({day:"numeric"},"day"):this.num(e.day);case"dd":return o?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return o?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return o?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return o?i({month:"numeric"},"month"):this.num(e.month);case"MM":return o?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return o?i({year:"numeric"},"year"):this.num(e.year);case"yy":return o?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return o?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return o?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return c(p)}};return Ujt(t.parseFormat(r),f)}formatDurationFromString(e,r){let n=u=>{switch(u[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},o=u=>l=>{let c=n(l);return c?this.num(u.get(c),l.length):l},i=t.parseFormat(r),a=i.reduce((u,{literal:l,val:c})=>l?u:u.concat(c),[]),s=e.shiftTo(...a.map(n).filter(u=>u));return Ujt(i,o(s))}};var Hjt=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function a$(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function s$(...t){return e=>t.reduce(([r,n,o],i)=>{let[a,s,u]=i(e,o);return[{...r,...a},s||n,u]},[{},null,1]).slice(0,2)}function u$(t,...e){if(t==null)return[null,null];for(let[r,n]of e){let o=r.exec(t);if(o)return n(o)}return[null,null]}function Vjt(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=mO(e[r+o]);return[n,null,r+o]}}var Wjt=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Nan=`(?:${Wjt.source}?(?:\\[(${Hjt.source})\\])?)?`,vIe=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Kjt=RegExp(`${vIe.source}${Nan}`),wIe=RegExp(`(?:T${Kjt.source})?`),Lan=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Fan=/(\d{4})-?W(\d\d)(?:-?(\d))?/,kan=/(\d{4})-?(\d{3})/,Ban=Vjt("weekYear","weekNumber","weekDay"),$an=Vjt("year","ordinal"),qan=/(\d{4})-(\d\d)-(\d\d)/,Jjt=RegExp(`${vIe.source} ?(?:${Wjt.source}|(${Hjt.source}))?`),Uan=RegExp(`(?: ${Jjt.source})?`);function i$(t,e,r){let n=t[e];return Ht(n)?r:mO(n)}function zan(t,e){return[{year:i$(t,e),month:i$(t,e+1,1),day:i$(t,e+2,1)},null,e+3]}function l$(t,e){return[{hours:i$(t,e,0),minutes:i$(t,e+1,0),seconds:i$(t,e+2,0),milliseconds:k8(t[e+3])},null,e+4]}function $8(t,e){let r=!t[e]&&!t[e+1],n=cj(t[e+1],t[e+2]),o=r?null:Bl.instance(n);return[{},o,e+3]}function q8(t,e){let r=t[e]?_d.create(t[e]):null;return[{},r,e+1]}var Han=RegExp(`^T?${vIe.source}$`),Van=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Wan(t){let[e,r,n,o,i,a,s,u,l]=t,c=e[0]==="-",d=u&&u[0]==="-",f=(p,m=!1)=>p!==void 0&&(m||p&&c)?-p:p;return[{years:f(aA(r)),months:f(aA(n)),weeks:f(aA(o)),days:f(aA(i)),hours:f(aA(a)),minutes:f(aA(s)),seconds:f(aA(u),u==="-0"),milliseconds:f(k8(l),d)}]}var Kan={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function SIe(t,e,r,n,o,i,a){let s={year:e.length===2?B8(mO(e)):mO(e),month:yIe.indexOf(r)+1,day:mO(n),hour:mO(o),minute:mO(i)};return a&&(s.second=mO(a)),t&&(s.weekday=t.length>3?bIe.indexOf(t)+1:_Ie.indexOf(t)+1),s}var Jan=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Gan(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=SIe(e,o,n,r,i,a,s),p;return u?p=Kan[u]:l?p=0:p=cj(c,d),[f,new Bl(p)]}function Yan(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var Zan=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Xan=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Qan=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function zjt(t){let[,e,r,n,o,i,a,s]=t;return[SIe(e,o,n,r,i,a,s),Bl.utcInstance]}function esn(t){let[,e,r,n,o,i,a,s]=t;return[SIe(e,s,r,n,o,i,a),Bl.utcInstance]}var tsn=a$(Lan,wIe),rsn=a$(Fan,wIe),nsn=a$(kan,wIe),osn=a$(Kjt),Gjt=s$(zan,l$,$8,q8),isn=s$(Ban,l$,$8,q8),asn=s$($an,l$,$8,q8),ssn=s$(l$,$8,q8);function Yjt(t){return u$(t,[tsn,Gjt],[rsn,isn],[nsn,asn],[osn,ssn])}function Zjt(t){return u$(Yan(t),[Jan,Gan])}function Xjt(t){return u$(t,[Zan,zjt],[Xan,zjt],[Qan,esn])}function Qjt(t){return u$(t,[Van,Wan])}var usn=s$(l$);function eDt(t){return u$(t,[Han,usn])}var lsn=a$(qan,Uan),csn=a$(Jjt),dsn=s$(l$,$8,q8);function tDt(t){return u$(t,[lsn,Gjt],[csn,dsn])}var rDt="Invalid Duration",oDt={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},fsn={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...oDt},Rh=146097/400,c$=146097/4800,psn={years:{quarters:4,months:12,weeks:Rh/7,days:Rh,hours:Rh*24,minutes:Rh*24*60,seconds:Rh*24*60*60,milliseconds:Rh*24*60*60*1e3},quarters:{months:3,weeks:Rh/28,days:Rh/4,hours:Rh*24/4,minutes:Rh*24*60/4,seconds:Rh*24*60*60/4,milliseconds:Rh*24*60*60*1e3/4},months:{weeks:c$/7,days:c$,hours:c$*24,minutes:c$*24*60,seconds:c$*24*60*60,milliseconds:c$*24*60*60*1e3},...oDt},pj=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],msn=pj.slice(0).reverse();function sA(t,e,r=!1){let n={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new xa(n)}function iDt(t,e){let r=e.milliseconds??0;for(let n of msn.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function nDt(t,e){let r=iDt(t,e)<0?-1:1;pj.reduceRight((n,o)=>{if(Ht(e[o]))return n;if(n){let i=e[n]*r,a=t[o][n],s=Math.floor(i/a);e[o]+=s*r,e[n]-=s*a*r}return o},null),pj.reduce((n,o)=>{if(Ht(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function hsn(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var xa=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?psn:fsn;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||To.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new Ua(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:o$(e,t.normalizeUnit),loc:To.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(ry(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Ua(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=Qjt(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=eDt(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new Ua("need to specify a reason the Duration is invalid");let n=e instanceof $l?e:new $l(e,r);if(Po.throwOnInvalid)throw new Qoe(n);return new t({invalid:n})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new XB(e);return r}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?ql.create(this.loc,n).formatDurationFromString(this,e):rDt}toHuman(e={}){if(!this.isValid)return rDt;let r=pj.map(n=>{let o=this.values[n];return Ht(o)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(o)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=e$(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},Dr.fromMillis(r,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?iDt(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),n={};for(let o of pj)(iA(r.values,o)||iA(this.values,o))&&(n[o]=r.get(o)+this.get(o));return sA(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=gIe(e(this.values[n],n));return sA(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...o$(e,t.normalizeUnit)};return sA(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:n,matrix:o}={}){let a={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:o,conversionAccuracy:n};return sA(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return nDt(this.matrix,e),sA(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=hsn(this.normalize().shiftToAll().toObject());return sA(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>t.normalizeUnit(a));let r={},n={},o=this.toObject(),i;for(let a of pj)if(e.indexOf(a)>=0){i=a;let s=0;for(let l in n)s+=this.matrix[l][a]*n[l],n[l]=0;ry(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else ry(o[a])&&(n[a]=o[a]);for(let a in n)n[a]!==0&&(r[i]+=a===i?n[a]:n[a]/this.matrix[i][a]);return nDt(this.matrix,r),sA(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return sA(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function r(n,o){return n===void 0||n===0?o===void 0||o===0:n===o}for(let n of pj)if(!r(this.values[n],e.values[n]))return!1;return!0}};var d$="Invalid Interval";function gsn(t,e){return!t||!t.isValid?hO.invalid("missing or invalid start"):!e||!e.isValid?hO.invalid("missing or invalid end"):e<t?hO.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var hO=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new Ua("need to specify a reason the Interval is invalid");let n=e instanceof $l?e:new $l(e,r);if(Po.throwOnInvalid)throw new Xoe(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=f$(e),o=f$(r),i=gsn(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=xa.fromDurationLike(r),o=f$(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=xa.fromDurationLike(r),o=f$(e);return t.fromDateTimes(o.minus(n),o)}static fromISO(e,r){let[n,o]=(e||"").split("/",2);if(n&&o){let i,a;try{i=Dr.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=Dr.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=xa.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=xa.fromISO(n,r);if(l.isValid)return t.before(s,l)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(e,r),o;return r?.useLocaleWeeks?o=this.end.reconfigure({locale:n.locale}):o=this.end,o=o.startOf(e,r),Math.floor(o.diff(n,e).get(e))+(o.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(f$).filter(a=>this.contains(a)).sort((a,s)=>a.toMillis()-s.toMillis()),n=[],{s:o}=this,i=0;for(;o<this.e;){let a=r[i]||this.e,s=+a>+this.e?this.e:a;n.push(t.fromDateTimes(o,s)),o=s,i+=1}return n}splitBy(e){let r=xa.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,o=1,i,a=[];for(;n<this.e;){let s=this.start.plus(r.mapUnits(u=>u*o));i=+s>+this.e?this.e:s,a.push(t.fromDateTimes(n,i)),n=i,o+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((o,i)=>o.s-i.s).reduce(([o,i],a)=>i?i.overlaps(a)||i.abutsStart(a)?[o,i.union(a)]:[o.concat([i]),a]:[o,a],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,o=[],i=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),a=Array.prototype.concat(...i),s=a.sort((u,l)=>u.time-l.time);for(let u of s)n+=u.type==="s"?1:-1,n===1?r=u.time:(r&&+r!=+u.time&&o.push(t.fromDateTimes(r,u.time)),r=null);return t.merge(o)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:d$}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=tA,r={}){return this.isValid?ql.create(this.s.loc.clone(r),e).formatInterval(this):d$}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:d$}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:d$}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:d$}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:d$}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):xa.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var gO=class{static hasDST(e=Po.defaultZone){let r=Dr.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return _d.isValidZone(e)}static normalizeZone(e){return ty(e,Po.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||To.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||To.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||To.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||To.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||To.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||To.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||To.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return To.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return To.create(r,null,"gregory").eras(e)}static features(){return{relative:iie(),localeWeek:aie()}}};function aDt(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(xa.fromMillis(n).as("days"))}function ysn(t,e,r){let n=[["years",(u,l)=>l.year-u.year],["quarters",(u,l)=>l.quarter-u.quarter+(l.year-u.year)*4],["months",(u,l)=>l.month-u.month+(l.year-u.year)*12],["weeks",(u,l)=>{let c=aDt(u,l);return(c-c%7)/7}],["days",aDt]],o={},i=t,a,s;for(let[u,l]of n)r.indexOf(u)>=0&&(a=u,o[u]=l(t,e),s=i.plus(o),s>e?(o[u]--,t=i.plus(o),t>e&&(s=t,o[u]--,t=i.plus(o))):t=s);return[t,o,s,a]}function sDt(t,e,r,n){let[o,i,a,s]=ysn(t,e,r),u=e-o,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(a<e&&(a=o.plus({[s]:1})),a!==o&&(i[s]=(i[s]||0)+u/(a-o)));let c=xa.fromObject(i,n);return l.length>0?xa.fromMillis(u,n).shiftTo(...l).plus(c):c}var bsn="missing Intl.DateTimeFormat.formatToParts support";function ko(t,e=r=>r){return{regex:t,deser:([r])=>e(bjt(r))}}var _sn="\xA0",cDt=`[ ${_sn}]`,dDt=new RegExp(cDt,"g");function vsn(t){return t.replace(/\./g,"\\.?").replace(dDt,cDt)}function uDt(t){return t.replace(/\./g,"").replace(dDt," ").toLowerCase()}function ny(t,e){return t===null?null:{regex:RegExp(t.map(vsn).join("|")),deser:([r])=>t.findIndex(n=>uDt(r)===uDt(n))+e}}function lDt(t,e){return{regex:t,deser:([,r,n])=>cj(r,n),groups:e}}function cie(t){return{regex:t,deser:([e])=>e}}function wsn(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ssn(t,e){let r=Ih(e),n=Ih(e,"{2}"),o=Ih(e,"{3}"),i=Ih(e,"{4}"),a=Ih(e,"{6}"),s=Ih(e,"{1,2}"),u=Ih(e,"{1,3}"),l=Ih(e,"{1,6}"),c=Ih(e,"{1,9}"),d=Ih(e,"{2,4}"),f=Ih(e,"{4,6}"),p=v=>({regex:RegExp(wsn(v.val)),deser:([g])=>g,literal:!0}),h=(v=>{if(t.literal)return p(v);switch(v.val){case"G":return ny(e.eras("short"),0);case"GG":return ny(e.eras("long"),0);case"y":return ko(l);case"yy":return ko(d,B8);case"yyyy":return ko(i);case"yyyyy":return ko(f);case"yyyyyy":return ko(a);case"M":return ko(s);case"MM":return ko(n);case"MMM":return ny(e.months("short",!0),1);case"MMMM":return ny(e.months("long",!0),1);case"L":return ko(s);case"LL":return ko(n);case"LLL":return ny(e.months("short",!1),1);case"LLLL":return ny(e.months("long",!1),1);case"d":return ko(s);case"dd":return ko(n);case"o":return ko(u);case"ooo":return ko(o);case"HH":return ko(n);case"H":return ko(s);case"hh":return ko(n);case"h":return ko(s);case"mm":return ko(n);case"m":return ko(s);case"q":return ko(s);case"qq":return ko(n);case"s":return ko(s);case"ss":return ko(n);case"S":return ko(u);case"SSS":return ko(o);case"u":return cie(c);case"uu":return cie(s);case"uuu":return ko(r);case"a":return ny(e.meridiems(),0);case"kkkk":return ko(i);case"kk":return ko(d,B8);case"W":return ko(s);case"WW":return ko(n);case"E":case"c":return ko(r);case"EEE":return ny(e.weekdays("short",!1),1);case"EEEE":return ny(e.weekdays("long",!1),1);case"ccc":return ny(e.weekdays("short",!0),1);case"cccc":return ny(e.weekdays("long",!0),1);case"Z":case"ZZ":return lDt(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return lDt(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return cie(/[a-z_+-/]{1,256}?/i);case" ":return cie(/[^\S\n\r]/);default:return p(v)}})(t)||{invalidReason:bsn};return h.token=t,h}var xsn={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Csn(t,e,r){let{type:n,value:o}=t;if(n==="literal"){let u=/^\s+$/.test(o);return{literal:!u,val:u?" ":o}}let i=e[n],a=n;n==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=r.hour12?"hour12":"hour24");let s=xsn[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function Osn(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function Esn(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(iA(r,a)){let s=r[a],u=s.groups?s.groups+1:1;!s.literal&&s.token&&(o[s.token.val[0]]=s.deser(n.slice(i,i+u))),i+=u}return[n,o]}else return[n,{}]}function Psn(t){let e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return Ht(t.z)||(r=_d.create(t.z)),Ht(t.Z)||(r||(r=new Bl(t.Z)),n=t.Z),Ht(t.q)||(t.M=(t.q-1)*3+1),Ht(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),Ht(t.u)||(t.S=k8(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}var xIe=null;function Tsn(){return xIe||(xIe=Dr.fromMillis(1555555555555)),xIe}function Asn(t,e){if(t.literal)return t;let r=ql.macroTokenToFormatOpts(t.val),n=EIe(r,e);return n==null||n.includes(void 0)?t:n}function CIe(t,e){return Array.prototype.concat(...t.map(r=>Asn(r,e)))}var U8=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=CIe(ql.parseFormat(r),e),this.units=this.tokens.map(n=>Ssn(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=Osn(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=Esn(e,this.regex,this.handlers),[o,i,a]=n?Psn(n):[null,null,void 0];if(iA(n,"a")&&iA(n,"H"))throw new Xg("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:r,matches:n,result:o,zone:i,specificOffset:a}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function OIe(t,e,r){return new U8(t,r).explainFromTokens(e)}function fDt(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=OIe(t,e,r);return[n,o,i,a]}function EIe(t,e){if(!t)return null;let n=ql.create(e,t).dtFormatter(Tsn()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>Csn(a,t,i))}var PIe="Invalid DateTime",pDt=864e13;function z8(t){return new $l("unsupported zone",`the zone "${t.name}" is not supported`)}function TIe(t){return t.weekData===null&&(t.weekData=N8(t.c)),t.weekData}function AIe(t){return t.localWeekData===null&&(t.localWeekData=N8(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function mj(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Dr({...r,...e,old:r})}function vDt(t,e,r){let n=t-e*60*1e3,o=r.offset(n);if(e===o)return[n,e];n-=(o-e)*60*1e3;let i=r.offset(n);return o===i?[n,o]:[t-Math.min(o,i)*60*1e3,Math.max(o,i)]}function die(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function pie(t,e,r){return vDt(QB(t),e,r)}function mDt(t,e){let r=t.o,n=t.c.year+Math.trunc(e.years),o=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...t.c,year:n,month:o,day:Math.min(t.c.day,n$(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=xa.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),s=QB(i),[u,l]=vDt(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function p$(t,e,r,n,o,i){let{setZone:a,zone:s}=r;if(t&&Object.keys(t).length!==0||e){let u=e||s,l=Dr.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Dr.invalid(new $l("unparsable",`the input "${o}" can't be parsed as ${n}`))}function fie(t,e,r=!0){return t.isValid?ql.create(To.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function IIe(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=Sa(t.c.year,r?6:4),e?(n+="-",n+=Sa(t.c.month),n+="-",n+=Sa(t.c.day)):(n+=Sa(t.c.month),n+=Sa(t.c.day)),n}function hDt(t,e,r,n,o,i){let a=Sa(t.c.hour);return e?(a+=":",a+=Sa(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=Sa(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=Sa(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=Sa(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=Sa(Math.trunc(-t.o/60)),a+=":",a+=Sa(Math.trunc(-t.o%60))):(a+="+",a+=Sa(Math.trunc(t.o/60)),a+=":",a+=Sa(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}var wDt={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Isn={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Msn={ordinal:1,hour:0,minute:0,second:0,millisecond:0},SDt=["year","month","day","hour","minute","second","millisecond"],Rsn=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],jsn=["year","ordinal","hour","minute","second","millisecond"];function Dsn(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new XB(t);return e}function gDt(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Dsn(t)}}function Nsn(t){return hie[t]||(mie===void 0&&(mie=Po.now()),hie[t]=t.offset(mie)),hie[t]}function yDt(t,e){let r=ty(e.zone,Po.defaultZone);if(!r.isValid)return Dr.invalid(z8(r));let n=To.fromObject(e),o,i;if(Ht(t.year))o=Po.now();else{for(let u of SDt)Ht(t[u])&&(t[u]=wDt[u]);let a=pIe(t)||mIe(t);if(a)return Dr.invalid(a);let s=Nsn(r);[o,i]=pie(t,s,r)}return new Dr({ts:o,zone:r,loc:n,o:i})}function bDt(t,e,r){let n=Ht(r.round)?!0:r.round,o=(a,s)=>(a=e$(a,n||r.calendary?0:2,!0),e.loc.clone(r).relFormatter(r).format(a,s)),i=a=>r.calendary?e.hasSame(t,a)?0:e.startOf(a).diff(t.startOf(a),a).get(a):e.diff(t,a).get(a);if(r.unit)return o(i(r.unit),r.unit);for(let a of r.units){let s=i(a);if(Math.abs(s)>=1)return o(s,a)}return o(t>e?-0:0,r.units[r.units.length-1])}function _Dt(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var mie,hie={},Dr=class t{constructor(e){let r=e.zone||Po.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new $l("invalid input"):null)||(r.isValid?null:z8(r));this.ts=Ht(e.ts)?Po.now():e.ts;let o=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[o,i]=[e.old.c,e.old.o];else{let s=ry(e.o)&&!e.old?e.o:r.offset(this.ts);o=die(this.ts,s),n=Number.isNaN(o.year)?new $l("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||To.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=o,this.o=i,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=_Dt(arguments),[n,o,i,a,s,u,l]=r;return yDt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=_Dt(arguments),[n,o,i,a,s,u,l]=r;return e.zone=Bl.utcInstance,yDt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=Njt(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=ty(r.zone,Po.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:To.fromObject(r)}):t.invalid(z8(o))}static fromMillis(e,r={}){if(ry(e))return e<-pDt||e>pDt?t.invalid("Timestamp out of range"):new t({ts:e,zone:ty(r.zone,Po.defaultZone),loc:To.fromObject(r)});throw new Ua(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(ry(e))return new t({ts:e*1e3,zone:ty(r.zone,Po.defaultZone),loc:To.fromObject(r)});throw new Ua("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=ty(r.zone,Po.defaultZone);if(!n.isValid)return t.invalid(z8(n));let o=To.fromObject(r),i=o$(e,gDt),{minDaysInFirstWeek:a,startOfWeek:s}=fIe(i,o),u=Po.now(),l=Ht(r.specificOffset)?n.offset(u):r.specificOffset,c=!Ht(i.ordinal),d=!Ht(i.year),f=!Ht(i.month)||!Ht(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new Xg("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new Xg("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,v,g,_=die(u,l);h?(v=Rsn,g=Isn,_=N8(_,a,s)):c?(v=jsn,g=Msn,_=lie(_)):(v=SDt,g=wDt);let w=!1;for(let R of v){let N=i[R];Ht(N)?w?i[R]=g[R]:i[R]=_[R]:w=!0}let x=h?Rjt(i,a,s):c?jjt(i):pIe(i),C=x||mIe(i);if(C)return t.invalid(C);let P=h?cIe(i,a,s):c?dIe(i):i,[E,A]=pie(P,l,n),M=new t({ts:E,zone:n,o:A,loc:o});return i.weekday&&p&&e.weekday!==M.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${M.toISO()}`):M.isValid?M:t.invalid(M.invalid)}static fromISO(e,r={}){let[n,o]=Yjt(e);return p$(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=Zjt(e);return p$(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=Xjt(e);return p$(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(Ht(e)||Ht(r))throw new Ua("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=To.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=fDt(a,e,r);return c?t.invalid(c):p$(s,u,n,`format ${r}`,e,l)}static fromString(e,r,n={}){return t.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,o]=tDt(e);return p$(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Ua("need to specify a reason the DateTime is invalid");let n=e instanceof $l?e:new $l(e,r);if(Po.throwOnInvalid)throw new Zoe(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=EIe(e,To.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return CIe(ql.parseFormat(e),To.fromObject(r)).map(o=>o.val).join("")}static resetCache(){mie=void 0,hie={}}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?TIe(this).weekYear:NaN}get weekNumber(){return this.isValid?TIe(this).weekNumber:NaN}get weekday(){return this.isValid?TIe(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?AIe(this).weekday:NaN}get localWeekNumber(){return this.isValid?AIe(this).weekNumber:NaN}get localWeekYear(){return this.isValid?AIe(this).weekYear:NaN}get ordinal(){return this.isValid?lie(this.c).ordinal:NaN}get monthShort(){return this.isValid?gO.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?gO.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?gO.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?gO.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,r=6e4,n=QB(this.c),o=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-o*r),s=this.zone.offset(n-i*r);if(a===s)return[this];let u=n-a*r,l=n-s*r,c=die(u,a),d=die(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[mj(this,{ts:u}),mj(this,{ts:l})]:[this]}get isInLeapYear(){return fj(this.year)}get daysInMonth(){return n$(this.year,this.month)}get daysInYear(){return this.isValid?oA(this.year):NaN}get weeksInWeekYear(){return this.isValid?dj(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?dj(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=ql.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(Bl.instance(e),r)}toLocal(){return this.setZone(Po.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=ty(e,Po.defaultZone),e.equals(this.zone))return this;if(e.isValid){let o=this.ts;if(r||n){let i=e.offset(this.ts),a=this.toObject();[o]=pie(a,i,e)}return mj(this,{ts:o,zone:e})}else return t.invalid(z8(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return mj(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=o$(e,gDt),{minDaysInFirstWeek:n,startOfWeek:o}=fIe(r,this.loc),i=!Ht(r.weekYear)||!Ht(r.weekNumber)||!Ht(r.weekday),a=!Ht(r.ordinal),s=!Ht(r.year),u=!Ht(r.month)||!Ht(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new Xg("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new Xg("Can't mix ordinal dates with month/day");let d;i?d=cIe({...N8(this.c,n,o),...r},n,o):Ht(r.ordinal)?(d={...this.toObject(),...r},Ht(r.day)&&(d.day=Math.min(n$(d.year,d.month),d.day))):d=dIe({...lie(this.c),...r});let[f,p]=pie(d,this.o,this.zone);return mj(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=xa.fromDurationLike(e);return mj(this,mDt(this,r))}minus(e){if(!this.isValid)return this;let r=xa.fromDurationLike(e).negate();return mj(this,mDt(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=xa.normalizeUnit(e);switch(o){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break;case"milliseconds":break}if(o==="weeks")if(r){let i=this.loc.getStartOfWeek(),{weekday:a}=this;a<i&&(n.weekNumber=this.weekNumber-1),n.weekday=i}else n.weekday=1;if(o==="quarters"){let i=Math.ceil(this.month/3);n.month=(i-1)*3+1}return this.set(n)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?ql.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):PIe}toLocaleString(e=tA,r={}){return this.isValid?ql.create(this.loc.clone(r),e).formatDateTime(this):PIe}toLocaleParts(e={}){return this.isValid?ql.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:o=!0,extendedZone:i=!1}={}){if(!this.isValid)return null;let a=e==="extended",s=IIe(this,a);return s+="T",s+=hDt(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?IIe(this,e==="extended"):null}toISOWeekDate(){return fie(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:o=!1,extendedZone:i=!1,format:a="extended"}={}){return this.isValid?(o?"T":"")+hDt(this,a==="extended",r,e,n,i):null}toRFC2822(){return fie(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return fie(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?IIe(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let o="HH:mm:ss.SSS";return(r||e)&&(n&&(o+=" "),r?o+="z":e&&(o+="ZZ")),fie(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():PIe}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",n={}){if(!this.isValid||!e.isValid)return xa.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=Ljt(r).map(xa.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=sDt(s,u,i,o);return a?l.negate():l}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?hO.fromDateTimes(this,e):this}hasSame(e,r,n){if(!this.isValid)return!1;let o=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(r,n)<=o&&o<=i.endOf(r,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||t.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,o=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(o=e.unit,i=void 0),bDt(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?bDt(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Ua("min requires all arguments be DateTimes");return hIe(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Ua("max requires all arguments be DateTimes");return hIe(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=To.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return OIe(a,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static buildFormatParser(e,r={}){let{locale:n=null,numberingSystem:o=null}=r,i=To.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new U8(i,e)}static fromFormatParser(e,r,n={}){if(Ht(e)||Ht(r))throw new Ua("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=To.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new Ua(`fromFormatParser called with a locale of ${a}, but the format parser was created for ${r.locale}`);let{result:s,zone:u,specificOffset:l,invalidReason:c}=r.explainFromTokens(e);return c?t.invalid(c):p$(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return tA}static get DATE_MED(){return m8}static get DATE_MED_WITH_WEEKDAY(){return KAe}static get DATE_FULL(){return h8}static get DATE_HUGE(){return g8}static get TIME_SIMPLE(){return y8}static get TIME_WITH_SECONDS(){return b8}static get TIME_WITH_SHORT_OFFSET(){return _8}static get TIME_WITH_LONG_OFFSET(){return v8}static get TIME_24_SIMPLE(){return w8}static get TIME_24_WITH_SECONDS(){return S8}static get TIME_24_WITH_SHORT_OFFSET(){return x8}static get TIME_24_WITH_LONG_OFFSET(){return C8}static get DATETIME_SHORT(){return O8}static get DATETIME_SHORT_WITH_SECONDS(){return E8}static get DATETIME_MED(){return P8}static get DATETIME_MED_WITH_SECONDS(){return T8}static get DATETIME_MED_WITH_WEEKDAY(){return JAe}static get DATETIME_FULL(){return A8}static get DATETIME_FULL_WITH_SECONDS(){return I8}static get DATETIME_HUGE(){return M8}static get DATETIME_HUGE_WITH_SECONDS(){return R8}};function f$(t){if(Dr.isDateTime(t))return t;if(t&&t.valueOf&&ry(t.valueOf()))return Dr.fromJSDate(t);if(t&&typeof t=="object")return Dr.fromObject(t);throw new Ua(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var xDt=require("obsidian");Uc();async function Lsn(){let t=new Date,e=t.getTimezoneOffset(),r=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value||"Unknown";return{epoch:Math.floor(t.getTime()),isoString:t.toISOString(),userLocaleString:t.toLocaleString(),localDateString:t.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),timezoneOffset:-e,timezone:r}}var CDt=Xp(async()=>Lsn(),{name:"getCurrentTime",description:"Get the current time in various formats, including timezone information",schema:Pr.object({})}),ODt={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function Fsn(t,e){let r=t.match(/^(last|past|previous|prior)\s+(\d+)\s+(days?|weeks?|months?|years?)$/i);if(!r)return;let[,,n,o]=r,i=parseInt(n);if(i<=0)return;let a=o.replace(/s$/,""),s=e.startOf("day");return{start:s.minus({[a+"s"]:i}),end:s}}function ksn(t,e){switch(t){case"yesterday":return{start:e.minus({days:1}).startOf("day"),end:e.minus({days:1}).endOf("day")};case"last week":return{start:e.minus({weeks:1}).startOf("week"),end:e.minus({weeks:1}).endOf("week")};case"this week":return{start:e.startOf("week"),end:e.endOf("week")};case"next week":return{start:e.plus({weeks:1}).startOf("week"),end:e.plus({weeks:1}).endOf("week")};case"last month":return{start:e.minus({months:1}).startOf("month"),end:e.minus({months:1}).endOf("month")};case"this month":return{start:e.startOf("month"),end:e.endOf("month")};case"next month":return{start:e.plus({months:1}).startOf("month"),end:e.plus({months:1}).endOf("month")};case"last year":return{start:e.minus({years:1}).startOf("year"),end:e.minus({years:1}).endOf("year")};case"this year":return{start:e.startOf("year"),end:e.endOf("year")};case"next year":return{start:e.plus({years:1}).startOf("year"),end:e.plus({years:1}).endOf("year")};case"last quarter":return{start:e.minus({quarters:1}).startOf("quarter"),end:e.minus({quarters:1}).endOf("quarter")};case"this quarter":return{start:e.startOf("quarter"),end:e.endOf("quarter")};case"next quarter":return{start:e.plus({quarters:1}).startOf("quarter"),end:e.plus({quarters:1}).endOf("quarter")}}}function Bsn(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=WAe(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Dr.fromJSDate(o[0].start.date()).startOf("week"),a=i.endOf("week");return i>e&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function $sn(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|september|oct|october|nov|november|dec|december)$/i);if(!r)return;let n=ODt[r[1]],o=e.year;n>e.month&&o--;let i=Dr.fromObject({year:o,month:n,day:1}),a=i.endOf("month");return i>e&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function qsn(t,e){let r=t.match(/^(?:(?:the\s+)?(?:year|yr)(?:\s+(?:of|in))?\s+)?(\d{4})$/i);if(!r)return;let n=parseInt(r[1]),o=Dr.fromObject({year:n,month:1,day:1}),i=Dr.fromObject({year:n,month:12,day:31});return o>e&&(o=o.minus({years:1}),i=i.minus({years:1})),{start:o,end:i}}function Usn(t,e){let r=t.match(/^(?:(?:q|Q)(\d{1})\s+(\d{4})|(\d{4})\s+(?:q|Q)(\d{1}))$/),n=t.match(/^(?:q|Q)(\d{1})$/),o,i;if(r)o=parseInt(r[1]||r[4]),i=parseInt(r[2]||r[3]);else if(n){o=parseInt(n[1]),i=e.year;let l=Math.floor((e.month-1)/3)+1;o>l&&i--}else return;if(o<1||o>4)return;let a=(o-1)*3+1,s=Dr.fromObject({year:i,month:a,day:1}).startOf("day"),u=s.plus({months:3}).minus({days:1}).endOf("day");return s>e&&(s=s.minus({years:1}),u=u.minus({years:1})),{start:s,end:u}}function zsn(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|september|oct|october|nov|november|dec|december)\s+(\d{4})$/i);if(!r)return;let n=ODt[r[1].toLowerCase()],o=parseInt(r[2]),i=Dr.fromObject({year:o,month:n,day:1}).startOf("day"),a=i.endOf("month");return i>e&&(i=i.minus({years:1}),a=a.minus({years:1})),{start:i,end:a}}function Hsn(t){let e=Dr.now(),r=t.toLowerCase().replace("@vault","").trim(),n=Fsn(r,e)||ksn(r,e)||Bsn(r,e)||$sn(r,e)||zsn(r,e)||Usn(r,e)||qsn(r,e);if(n)return{startTime:H8(n.start),endTime:H8(n.end)};let o=WAe(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Dr.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Dr.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:H8(i),endTime:H8(a)}}console.warn(`Unable to parse time expression: ${t}`)}function H8(t){let e=t.toJSDate(),r=e.getTimezoneOffset(),n=new Intl.DateTimeFormat("en",{timeZoneName:"short"}).formatToParts(e).find(o=>o.type==="timeZoneName")?.value||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:e.toLocaleString(),localDateString:e.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),timezoneOffset:-r,timezone:n}}var EDt=Xp(async({timeExpression:t})=>Hsn(t),{name:"getTimeRangeMs",description:"Get a time range in milliseconds based on a natural language time expression",schema:Pr.object({timeExpression:Pr.string().describe("A natural language time expression (e.g., 'last week', 'from July 1 to July 15')")})});function Vsn(t){let e=t.toString().length===10?t*1e3:t,r=Dr.fromMillis(e);return H8(r)}var PDt=Xp(async({epoch:t})=>Vsn(t),{name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:Pr.object({epoch:Pr.number().describe("Unix timestamp in seconds or milliseconds")})});function Wsn(t){let e=t.match(/^(\d+)\s*(s|sec|seconds?|m|min|minutes?|h|hr|hours?)$/i);if(!e)throw new Error(`Invalid time interval format: ${t}`);let r=parseInt(e[1],10),n=e[2].toLowerCase();switch(n){case"s":case"sec":case"second":case"seconds":return r*1e3;case"m":case"min":case"minute":case"minutes":return r*60*1e3;case"h":case"hr":case"hour":case"hours":return r*60*60*1e3;default:throw new Error(`Unsupported time unit: ${n}`)}}async function Ksn(t="25min"){let e=Wsn(t);return new Promise(r=>{setTimeout(()=>{new xDt.Notice(`Pomodoro timer (${t}) completed! Take a break!`),r()},e)})}var MIe=Xp(async({interval:t="25min"})=>(Ksn(t),`Pomodoro timer started. It will end in ${t}.`),{name:"startPomodoro",description:"Start a Pomodoro timer with a customizable interval",schema:Pr.object({interval:Pr.string().optional().describe("Time interval (e.g., '25min', '5s', '1h'). Default is 25min.")})});Uc();function Jsn(t){return"children"in t&&"path"in t}function Gsn(t){return"path"in t&&!("children"in t)}function Ysn(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function RIe(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=p1();for(let u of t.children)if(Gsn(u)){if(hT(u,i,a)){e&&r.push(u.name);let l=Ysn(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(Jsn(u)){let l=RIe(u,e);if(Object.keys(l).length>0&&(o[u.name]=l[u.name],l[u.name].extensionCounts))for(let[c,d]of Object.entries(l[u.name].extensionCounts))n[c]=(n[c]||0)+d}let s={};return Object.keys(n).length>0&&(s.extensionCounts=n),e&&r.length>0&&(s.files=r),Object.keys(o).length>0&&(s.subFolders=o),Object.keys(s).length===0?{}:t.name?{[t.name]:s}:{vault:s}}var TDt=t=>Xp(async()=>{let e=RIe(t,!0),r=`A JSON represents the file tree as a nested structure:
* The root object has a key "vault" which contains a FileTreeNode object.
* Each FileTreeNode has these properties:
* files: An array of filenames in the current directory (if any files exist)
* subFolders: An object mapping folder names to their FileTreeNode objects (if any subfolders exist)
* extensionCounts: An object with counts of file extensions in this folder and all subfolders
`,n=JSON.stringify(e);if(n.length>5e5){let o=RIe(t,!1);return r+JSON.stringify(o)}return r+n},{name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:Pr.void()});Uc();var jIe=Xp(async({url:t})=>{try{let e=await Ss.getInstance().youtube4llm(t);return e.response.transcript?JSON.stringify({success:!0,transcript:e.response.transcript,elapsed_time_ms:e.elapsed_time_ms}):JSON.stringify({success:!1,message:"Transcript not available. Only English videos with the auto transcript option turned on are supported at the moment"})}catch(e){return console.error(`Error transcribing YouTube video ${t}:`,e),JSON.stringify({success:!1,message:"An error occurred while transcribing the YouTube video."})}},{name:"youtubeTranscription",description:"Get the transcript of a YouTube video",schema:Pr.object({url:Pr.string().describe("The YouTube video URL"),brevilabsClient:Pr.any().describe("The BrevilabsClient instance")})});var m$=class{},ADt=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},gie=(t,e)=>{let r=ADt(t,e);if(!r){let n=Object.keys(t);throw new Error(`input values have ${n.length} keys, you must specify an input key or pass only 1 key as input`)}return r},DIe=(t,e)=>{let r=ADt(t,e);if(!r&&r!==""){let n=Object.keys(t);throw new Error(`output values have ${n.length} keys, you must specify an output key or pass only 1 key as output`)}return r};xI();MI();var NIe=class extends bf{addUserMessage(e){return this.addMessage(new Ga(e))}addAIChatMessage(e){return this.addMessage(new en(e))}addAIMessage(e){return this.addMessage(new en(e))}async addMessages(e){for(let r of e)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},h$=class extends NIe{constructor(e){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain","stores","message","in_memory"]}),Object.defineProperty(this,"messages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.messages=e??[]}async getMessages(){return this.messages}async addMessage(e){this.messages.push(e)}async clear(){this.messages=[]}};var oy=class extends m${constructor(e){super(),Object.defineProperty(this,"chatHistory",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"returnMessages",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.chatHistory=e?.chatHistory??new h$,this.returnMessages=e?.returnMessages??this.returnMessages,this.inputKey=e?.inputKey??this.inputKey,this.outputKey=e?.outputKey??this.outputKey}async saveContext(e,r){await this.chatHistory.addUserMessage(gie(e,this.inputKey)),await this.chatHistory.addAIChatMessage(DIe(r,this.outputKey))}async clear(){await this.chatHistory.clear()}};var V8=class extends oy{constructor(e){super({chatHistory:e?.chatHistory,returnMessages:e?.returnMessages??!1,inputKey:e?.inputKey,outputKey:e?.outputKey}),Object.defineProperty(this,"humanPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"Human"}),Object.defineProperty(this,"aiPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"AI"}),Object.defineProperty(this,"memoryKey",{enumerable:!0,configurable:!0,writable:!0,value:"history"}),this.humanPrefix=e?.humanPrefix??this.humanPrefix,this.aiPrefix=e?.aiPrefix??this.aiPrefix,this.memoryKey=e?.memoryKey??this.memoryKey}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=await this.chatHistory.getMessages();return this.returnMessages?{[this.memoryKey]:r}:{[this.memoryKey]:Ld(r,this.humanPrefix,this.aiPrefix)}}};LIe();eE();var W8=class extends oy{constructor(e){super({returnMessages:e?.returnMessages??!1,chatHistory:e?.chatHistory,inputKey:e?.inputKey,outputKey:e?.outputKey}),Object.defineProperty(this,"humanPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"Human"}),Object.defineProperty(this,"aiPrefix",{enumerable:!0,configurable:!0,writable:!0,value:"AI"}),Object.defineProperty(this,"memoryKey",{enumerable:!0,configurable:!0,writable:!0,value:"history"}),Object.defineProperty(this,"k",{enumerable:!0,configurable:!0,writable:!0,value:5}),this.humanPrefix=e?.humanPrefix??this.humanPrefix,this.aiPrefix=e?.aiPrefix??this.aiPrefix,this.memoryKey=e?.memoryKey??this.memoryKey,this.k=e?.k??this.k}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=await this.chatHistory.getMessages();return this.returnMessages?{[this.memoryKey]:r.slice(-this.k*2)}:{[this.memoryKey]:Ld(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}};xI();LIe();var hj=class t{constructor(){this.initMemory(),bl(()=>this.initMemory())}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(){let e=de().contextTurns;this.memory=new W8({k:e*2,memoryKey:"history",inputKey:"input",returnMessages:!0}),this.debug&&console.log("Memory initialized with context turns:",e)}getMemory(){return this.memory}async clearChatMemory(){this.debug&&console.log("Clearing chat memory"),await this.memory.clear()}async loadMemoryVariables(){let e=await this.memory.loadMemoryVariables({});return this.debug&&console.log("Loaded memory variables:",e),e}async saveContext(e,r){this.debug&&console.log("Saving to memory - Input:",e,"Output:",r),await this.memory.saveContext(e,r)}};var K8=["@vault","@web","@youtube","@pomodoro"],gj=class{static initTools(e){this.tools.length===0&&(this.tools=[CDt,PDt,EDt,TAe,_1t,MIe,AAe,jIe,TDt(e.getRoot())])}static async analyzeIntent(e){try{let r=await Ss.getInstance().broca(e);if(!r?.response)throw new Error(r?.detail||"Broca API call failed");let n=r.response.tool_calls,o=r.response.salience_terms,i=[],a;for(let s of n){let u=this.tools.find(l=>l.name===s.tool);if(u){let l=s.args||{};u.name==="getTimeRangeMs"&&(a=await HB.callTool(u,l)),i.push({tool:u,args:l})}}return await this.processAtCommands(e,i,{timeRange:a,salientTerms:o}),i}catch(r){throw console.error("Error in intent analysis:",r),r}}static async processAtCommands(e,r,n){let o=e.toLowerCase(),{timeRange:i,salientTerms:a}=n;if(o.includes("@vault")&&(a.length>0||i)){let s=this.removeAtCommands(e);r.push({tool:TAe,args:{timeRange:i||void 0,query:s,salientTerms:a}})}if(o.includes("@web")){let s=this.removeAtCommands(e),l=await hj.getInstance().getMemory().loadMemoryVariables({}),c=zD(l);r.push({tool:AAe,args:{query:s,chatHistory:c}})}if(o.includes("@pomodoro")){let s=e.match(/@pomodoro\s+(\S+)/i),u=s?s[1]:"25min";r.push({tool:MIe,args:{interval:u}})}if(o.includes("@youtube")){let s=fU(e);s&&r.push({tool:jIe,args:{url:s}})}}static removeAtCommands(e){return e.split(" ").filter(r=>!K8.includes(r.toLowerCase())).join(" ").trim()}};gj.tools=[];var yie=class{constructor(e){this.updateCurrentAiMessage=e;this.hasOpenThinkBlock=!1;this.fullResponse=""}processChunk(e){this.fullResponse+=e.content,e.additional_kwargs?.reasoning_content?(this.hasOpenThinkBlock||(this.fullResponse+=`
<think>`,this.hasOpenThinkBlock=!0),this.fullResponse+=e.additional_kwargs.reasoning_content):this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),this.updateCurrentAiMessage(this.fullResponse)}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.updateCurrentAiMessage(this.fullResponse)),this.fullResponse}},J8=class{constructor(e){this.chainManager=e}async handleResponse(e,r,n,o,i,a,s){return e&&n.signal.reason!=="new-chat"&&(await this.chainManager.memoryManager.getMemory().saveContext({input:r.message},{output:e}),o({message:e,sender:Ry,isVisible:!0,timestamp:_l(new Date),sources:s})),i(""),a&&(console.log(`==== Chat Memory ====
`,this.chainManager.memoryManager.getMemory().chatHistory.messages.map(u=>u.content)),console.log(`==== Final AI Response ====
`,e)),e}async handleError(e,r,n,o){let i=Pi(e);r&&console.error("Error during LLM invocation:",i);let a=e?.response?.data?.error||i,s=a?.code||i,u="";if(e?.message?.includes("Invalid license key")?u="Invalid Copilot Plus license key. Please check your license key in settings.":s==="model_not_found"?u="You do not have access to this model or the model does not exist, please check with your API provider.":u=`${s}`,console.error(a),n&&o){o("");let l=u.search("Troubleshooting URL");u=l!==-1?u.slice(0,l):u,i.search(/401|invalid|not valid/gi)!==-1&&(u=`Something went wrong. Please check if you have set your API key.
Path: Settings > copilot plugin > Basic Tab > Set Keys.
Or check model config
Error Details: `+u),n({message:u,isErrorMessage:!0,sender:Ry,isVisible:!0,timestamp:_l(new Date)})}else new DDt.Notice(u),console.error(a)}},bie=class extends J8{async run(e,r,n,o,i){let{debug:a=!1}=i,s=new yie(n);try{let l=await yO.getChain().stream({input:e.message});for await(let c of l){if(r.signal.aborted)break;s.processChunk(c)}}catch(u){await this.handleError(u,a,o,n)}return this.handleResponse(s.close(),e,r,o,n,a)}},_ie=class extends J8{async run(e,r,n,o,i){let{debug:a=!1}=i,s="";try{if(await this.chainManager.vectorStoreManager.isIndexEmpty())return this.handleResponse(c9,e,r,o,n,a);let c=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),d=zD(c),f=await yO.getRetrievalChain().stream({question:e.message,chat_history:d});for await(let p of f){if(r.signal.aborted)break;s+=p.content,n(s)}s=this.addSourcestoResponse(s)}catch(u){await this.handleError(u,a,o,n)}return this.handleResponse(s,e,r,o,n,a)}addSourcestoResponse(e){let r=b$e(yO.retrievedDocuments);if(r.length>0){let n=r.map(o=>`- [[${o}]]`).join(`
`);e+=`
#### Sources:
`+n}return e}},vie=class extends J8{isYoutubeOnlyMessage(e){let r=e.trim(),n=r.includes("@youtube"),o=fU(r),i=r.split(/\s+/).filter(a=>a!=="@youtube"&&a.length>0);return n&&o!==null&&i.length===1}async processImageUrls(e){let r=[],n=await sj.processUrlBatch(e,r,this.chainManager.app.vault);return sj.showFailedImagesNotice(r),n}async processChatInputImages(e){let r=[],n=await sj.processChatImageBatch(e,r,this.chainManager.app.vault);return sj.showFailedImagesNotice(r),n}async extractEmbeddedImages(e){let r=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g;return[...e.matchAll(r)].map(i=>i[1])}async buildMessageContent(e,r){let n=[],o=[],i=de(),a=[],s=r.context?.urls;if(s&&s.length>0&&a.push({urls:s,type:"context"}),i.passMarkdownImages){let d=await this.extractEmbeddedImages(e);d.length>0&&a.push({urls:d,type:"embedded"})}for(let d of a){let f=await this.processImageUrls(d.urls);o.push(...f.successfulImages),n.push(...f.failureDescriptions)}let u=r.content;if(u&&u.length>0){let d=await this.processChatInputImages(u);o.push(...d.successfulImages),n.push(...d.failureDescriptions)}let l=e;n.length>0&&(l=`${e}
Note:
${n.join(`
`)}
`);let c=[{type:"text",text:l}];return o.length>0&&c.push(...o),c}hasCapability(e,r){let n=e.modelName||e.model||"";return this.chainManager.chatModelManager.findModelByName(n)?.capabilities?.includes(r)??!1}isMultimodalModel(e){return this.hasCapability(e,"vision")}async streamMultimodalResponse(e,r,n,o,i){let s=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),u=zD(s),l=[],c=BI();u.length>0&&(c+=`
The following is the relevant conversation history. Use this context to maintain consistency in your responses:`);let d=this.chainManager.chatModelManager.getChatModel();c&&l.push({role:S$e(d),content:`${c}
IMPORTANT: Maintain consistency with previous responses in the conversation. If you've provided information about a person or topic before, use that same information in follow-up questions.`});for(let[_,w]of u)l.push({role:"user",content:_}),l.push({role:"assistant",content:w});let f=this.chainManager.chatModelManager.getChatModel(),m=this.isMultimodalModel(f)?await this.buildMessageContent(e,r):e;l.push({role:"user",content:m});let h=m instanceof Array?m[0].text:m;ar("Enhanced user message: ",h),ar(`==== Final Request to AI ====
`,l);let v=new yie(o),g=await this.chainManager.chatModelManager.getChatModel().stream(l);for await(let _ of g){if(n.signal.aborted)break;v.processChunk(_)}return v.close()}async run(e,r,n,o,i){let{debug:a=!1,updateLoadingMessage:s}=i,u="",l=[];try{if(this.isYoutubeOnlyMessage(e.message)){let m=fU(e.message),h="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(m)try{let v=await Ss.getInstance().youtube4llm(m);return v.response.transcript?this.handleResponse(v.response.transcript,e,r,o,n,a):this.handleResponse(h,e,r,o,n,a)}catch(v){return console.error("Error processing YouTube video:",v),this.handleResponse(h,e,r,o,n,a)}}a&&console.log("==== Step 1: Analyzing intent ====");let c;try{let m=e.originalMessage||e.message;c=await gj.analyzeIntent(m)}catch(m){return this.handleResponse(p$e(m),e,r,o,n,a)}let d=e.message.split(" ").filter(m=>!K8.includes(m.toLowerCase())).join(" ").trim(),f=await this.executeToolCalls(c,a,s),p=f.find(m=>m.tool==="localSearch"&&m.output&&m.output.length>0);if(p){a&&console.log("==== Step 2: Processing local search results ====");let m=JSON.parse(p.output),v=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),g=zD(v);a&&console.log("==== Step 3: Condensing Question ====");let _=await qoe(d,g);a&&console.log("Condensed standalone question: ",_),a&&console.log("==== Step 4: Preparing context ====");let w=this.getTimeExpression(c),x=this.prepareLocalSearchResult(m,w),C=f.filter(A=>A.tool==="getCurrentTime"),P=this.prepareEnhancedUserMessage(_,C);a&&console.log(x),a&&console.log("==== Step 5: Invoking QA Chain ====");let E=await this.chainManager.promptManager.getQAPrompt({question:P,context:x,systemMessage:""});u=await this.streamMultimodalResponse(E,e,r,n,a),l=this.getSources(m)}else{let m=this.prepareEnhancedUserMessage(d,f);ar("No local search results. Using standard LLM Chain."),u=await this.streamMultimodalResponse(m,e,r,n,a)}}catch(c){s?.(ox.DEFAULT),await this.handleError(c,a,o,n)}return this.handleResponse(u,e,r,o,n,a,l)}getSources(e){return!e||!Array.isArray(e)?(console.warn("No valid documents provided to getSources"),[]):this.sortUniqueDocsByScore(e)}sortUniqueDocsByScore(e){let r=new Map;for(let n of e){if(!n.title||!n?.score&&!n?.rerank_score){console.warn("Invalid document structure:",n);continue}let o=r.get(n.title),i=n&&"rerank_score"in n,a=i?n.rerank_score:n.score;(!o||a>(o.score??0))&&r.set(n.title,{title:n.title,score:a,isReranked:i})}return Array.from(r.values()).sort((n,o)=>(o.score??0)-(n.score??0))}async executeToolCalls(e,r,n){let o=[];for(let i of e){r&&console.log(`==== Step 2: Calling tool: ${i.tool.name} ====`),i.tool.name==="localSearch"?n?.(ox.READING_FILES):i.tool.name==="webSearch"?n?.(ox.SEARCHING_WEB):i.tool.name==="getFileTree"&&n?.(ox.READING_FILE_TREE);let a=await HB.callTool(i.tool,i.args);o.push({tool:i.tool.name,output:a})}return o}prepareEnhancedUserMessage(e,r){let n="";if(r.length>0){let o=r.filter(i=>i.output!=null);o.length>0&&(n=`
# Additional context:
`+o.map(i=>`<${i.tool}>
${typeof i.output!="string"?JSON.stringify(i.output):i.output}
</${i.tool}>`).join(`
`))}return`${e}${n}`}getTimeExpression(e){let r=e.find(n=>n.tool.name==="getTimeRangeMs");return r?r.args.timeExpression:""}prepareLocalSearchResult(e,r){let n=e.filter(s=>s.includeInContext),o=n.reduce((s,u)=>s+u.content.length,0),i=n;if(o>Hce){let s=Hce/o;console.log("Truncating documents to fit context length. Truncation ratio:",s),i=n.map(u=>({...u,content:u.content.slice(0,Math.floor(u.content.length*s))}))}let a=i.map(s=>`Note in Vault: ${s.content}`).join(`
`);return r?`Local Search Result for ${r}:
${a}`:`Local Search Result:
${a}`}};eE();var NDt=require("obsidian");eE();var G8=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),bl(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=this.escapeTemplateString(BI());this.chatPrompt=Of.fromMessages([QO.fromTemplate(e),new Ay("history"),Iy.fromTemplate("{input}")])}initQAPrompt(){let e=`{system_message}
Answer the question with as detailed as possible based only on the following context:
{context}
Question: {question}
`;this.qaPrompt=Of.fromMessages([QO.fromTemplate(e)])}escapeTemplateString(e){return e.replace(/\{/g,"{{").replace(/\}/g,"}}")}getChatPrompt(){return this.chatPrompt}async getQAPrompt({question:e,context:r,systemMessage:n}){return await this.qaPrompt.format({question:e,context:r,system_message:n})}};var sm=class sm{constructor(e,r){this.app=e,this.vectorStoreManager=r,this.memoryManager=hj.getInstance(),this.chatModelManager=of.getInstance(),this.promptManager=G8.getInstance(),this.initialize(),Z$e(async()=>await this.createChainWithNewModel()),X$e(()=>this.setChain(ug(),{refreshIndex:de().indexVaultToVectorStore==="ON MODE SWITCH"&&(ug()==="vault_qa"||ug()==="copilot_plus")})),bl(async()=>await this.createChainWithNewModel())}async initialize(){await this.createChainWithNewModel()}static getChain(){return sm.chain}static getRetrievalChain(){return sm.retrievalChain}validateChainType(e){if(e==null)throw new Error("No chain type set")}validateChatModel(){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){let e="Chat model is not initialized properly, check your API key in Copilot setting and make sure you have API access.";throw new NDt.Notice(e),new Error(e)}}validateChainInitialization(){(!sm.chain||!h$e(sm.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",ug()),this.setChain(ug()))}static storeRetrieverDocuments(e){sm.retrievedDocuments=e}async createChainWithNewModel(){let e=w9();try{let r=i9(e,de().activeModels);r||(console.error("Resetting default model. No model configuration found for: ",e),r=nE[0],e=r.name+"|"+r.provider),await this.chatModelManager.setChatModel(r),this.setChain(ug()),ar(`Setting model to ${e}`)}catch(r){nt(`createChainWithNewModel failed: ${r}`),ar(`modelKey: ${e}`)}}async setChain(e,r={}){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){console.error("setChain failed: No chat model set.");return}this.validateChainType(e);let n=this.chatModelManager.getChatModel(),o=this.memoryManager.getMemory(),i=this.promptManager.getChatPrompt();switch(e){case"llm_chain":{sm.chain=l9.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),XD("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=new VT({minSimilarityScore:.01,maxK:de().maxSourceChunks,salientTerms:[]});sm.retrievalChain=l9.createConversationalRetrievalChain({llm:n,retriever:a,systemMessage:BI()},sm.storeRetrieverDocuments.bind(sm),de().debug),XD("vault_qa"),de().debug&&(console.log("New Vault QA chain with hybrid retriever created for entire vault"),console.log("Set chain:","vault_qa"));break}case"copilot_plus":{await this.initializeQAChain(r),sm.chain=l9.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),XD("copilot_plus");break}default:this.validateChainType(e);break}}getChainRunner(){let e=ug();switch(e){case"llm_chain":return new bie(this);case"vault_qa":return new _ie(this);case"copilot_plus":return new vie(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&await this.vectorStoreManager.indexVaultToVectorStore()}async runChain(e,r,n,o,i={}){let{debug:a=!1,ignoreSystemMessage:s=!1}=i;a&&console.log(`==== Step 0: Initial user message ====
`,e),this.validateChatModel(),this.validateChainInitialization();let u=this.chatModelManager.getChatModel();if(s||$I(u)){let c=Of.fromMessages([new Ay("history"),Iy.fromTemplate("{input}")]);$I(u)&&(c=Of.fromMessages([[ti,BI()||""],c])),this.setChain(ug(),{prompt:c})}return await this.getChainRunner().run(e,r,n,o,i)}async updateMemoryWithLoadedMessages(e){await this.memoryManager.clearChatMemory();for(let r=0;r<e.length;r+=2){let n=e[r],o=e[r+1];n&&o&&n.sender===ti&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}};sm.retrievedDocuments=[];var yO=sm;function LDt(t){let e=t.split(`
`),r=[],n="",o="",i="";for(let a of e)a.startsWith("**user**:")||a.startsWith("**ai**:")?(n&&o&&r.push({sender:n===ti?ti:Ry,message:o.trim(),isVisible:!0,timestamp:i?Fce(i):null}),n=a.startsWith("**user**:")?ti:Ry,o=a.substring(a.indexOf(":")+1).trim(),i=""):a.startsWith("[Timestamp:")?i=a.substring(11,a.length-1).trim():o+=`
`+a;return n&&o&&r.push({sender:n===ti?ti:Ry,message:o.trim(),isVisible:!0,timestamp:i?Fce(i):null}),r}async function Y8(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===ti){let o=t[r+1];o?.sender===Ry&&await e.getMemory().saveContext({input:n.message},{output:o.message})}}}var g$=require("obsidian"),bn=B(X()),FDt=B(km());var wie=B(X());var Yo=wie.forwardRef(({className:t,type:e,...r},n)=>wie.createElement("input",{type:e,className:Ce("!h-9 !min-w-[50px] !border border-border border-solid !rounded-md !bg-transparent !px-3 !py-1 md:!text-base !text-sm !transition-colors","focus-visible:!shadow-sm focus-visible:!outline-none focus-visible:!ring-1 focus-visible:!ring-ring","placeholder:text-sm","flex w-full shadow-sm placeholder:text-muted disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...r}));Yo.displayName="Input";var jh=B(X());var yj=jh.forwardRef(({className:t,value:e,...r},n)=>{let o=jh.useRef(null),i=jh.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);jh.useLayoutEffect(()=>{i()},[e,i]),jh.useEffect(()=>(i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)),[i]);let a=s=>{o.current=s,typeof n=="function"?n(s):n&&(n.current=s)};return jh.createElement("textarea",{className:Ce("border-solid resize-y min-w-fit overflow-auto","flex min-h-[60px] max-h-[300px] w-full rounded-md border border-primary-alt bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),value:e,ref:a,onChange:s=>{i(),r.onChange?.(s)},onInput:i,onCompositionEnd:i,onPaste:()=>{setTimeout(i,0)},...r})});yj.displayName="Textarea";var _S=B(X());function Sie(){return _S.default.createElement("ul",{className:"text-sm px-4 m-0"},_S.default.createElement("li",null,_S.default.createElement("span",{className:"font-medium text-accent"},"{}")," represents the selected text."),_S.default.createElement("li",null,_S.default.createElement("span",{className:"font-medium text-accent"},"{[[Note Title]]}")," represents a note."),_S.default.createElement("li",null,_S.default.createElement("span",{className:"font-medium text-accent"},"{activeNote}")," represents the active note."),_S.default.createElement("li",null,_S.default.createElement("span",{className:"font-medium text-accent"},"{#tag1, #tag2}")," represents ALL notes with ANY of the specified tags in their property (an OR operation)."))}function tun({initialTitle:t="",initialPrompt:e="",disabledTitle:r=!1,onSave:n,onCancel:o}){let[i,a]=(0,bn.useState)(t),[s,u]=(0,bn.useState)(e),[l,c]=(0,bn.useState)({title:!1,prompt:!1}),[d,f]=(0,bn.useState)(!1),m=i&&/[<>:"/\\|?*\x00-\x1F]/g.test(i),h=async()=>{if(m){new g$.Notice("Title contains invalid characters. Please remove them before saving.");return}if(i&&s)try{f(!0),await n(i,s)}catch(w){new g$.Notice(Pi(w))}finally{f(!1)}else c({title:!0,prompt:!0}),new g$.Notice("Please fill in both fields: Title and Prompt.")},v=l.title&&!i,g=l.prompt&&!s,_=i.trim()!==""&&s.trim()!==""&&!m;return bn.default.createElement("div",{className:"flex flex-col gap-4 p-4"},bn.default.createElement("div",{className:"text-xl font-bold text-normal mb-2"},"User Custom Prompt"),bn.default.createElement("div",{className:"flex flex-col"},bn.default.createElement("div",{className:"flex items-center gap-1"},bn.default.createElement("div",{className:"text-base font-medium text-normal"},"Title"),bn.default.createElement("span",{className:"text-error"},"*")),bn.default.createElement("div",{className:"flex flex-col gap-1"},bn.default.createElement("div",{className:"text-sm text-muted"},"The title of the prompt, must be unique."),bn.default.createElement("div",{className:"text-xs text-warning"},"Note: Title will be used as filename. Avoid using: ",'< > : " / \\ | ? *')),bn.default.createElement(Yo,{type:"text",value:i,onChange:w=>{a(w.target.value),l.title||c(x=>({...x,title:!0}))},onBlur:()=>c(w=>({...w,title:!0})),disabled:r,className:"w-full mt-1",required:!0}),v&&bn.default.createElement("div",{className:"text-error text-xs mt-1"},"Title is required"),m&&bn.default.createElement("div",{className:"text-error text-xs mt-1"},"Title contains invalid characters")),bn.default.createElement("div",{className:"flex flex-col gap-1"},bn.default.createElement("div",{className:"space-y-2"},bn.default.createElement("div",{className:"flex items-center gap-1"},bn.default.createElement("div",{className:"text-base font-medium text-normal"},"Prompt"),bn.default.createElement("span",{className:"text-error"},"*")),bn.default.createElement("div",{className:"text-sm text-muted -mt-1"},"Use the following syntax in your prompt:")),bn.default.createElement(Sie,null),bn.default.createElement(yj,{value:s,onChange:w=>{u(w.target.value),l.prompt||c(x=>({...x,prompt:!0}))},onBlur:()=>c(w=>({...w,prompt:!0})),className:"!min-h-[8rem] mt-1",required:!0}),g&&bn.default.createElement("div",{className:"text-error text-xs mt-1"},"Prompt is required"),bn.default.createElement("div",{className:"flex flex-col text-xs text-muted gap-2 mt-2"},bn.default.createElement("div",null,"Save the prompt to the local prompt library. You can then use it with the Copilot command: ",bn.default.createElement("strong",null,"Apply custom prompt to selection.")),bn.default.createElement("div",null,"Check out the"," ",bn.default.createElement("a",{href:"https://github.com/f/awesome-chatgpt-prompts",target:"_blank",className:"text-accent hover:text-accent-hover",rel:"noreferrer"},"awesome chatGPT prompts")," ","for inspiration."))),bn.default.createElement("div",{className:"flex items-center justify-end gap-2"},bn.default.createElement(ke,{variant:"secondary",onClick:o,disabled:d},"Cancel"),bn.default.createElement(ke,{onClick:h,disabled:!_||d},d?"Saving...":"Save")))}var Z8=class extends g$.Modal{constructor(r,n,o="",i="",a){super(r);this.onSave=n;this.initialTitle=o;this.initialPrompt=i;this.disabledTitle=a}onOpen(){let{contentEl:r}=this;this.root=(0,FDt.createRoot)(r);let n=async(i,a)=>{await this.onSave(i,a),this.close()},o=()=>{this.close()};this.root.render(bn.default.createElement(tun,{initialTitle:this.initialTitle,initialPrompt:this.initialPrompt,disabledTitle:this.disabledTitle,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};var kDt=require("obsidian"),xie=class extends kDt.Modal{constructor(r,n){super(r);this.placeholderText="Please enter your custom ad-hoc prompt here, press enter to send.";this.onSubmit=n}onOpen(){let{contentEl:r}=this,n=createFragment(i=>{i.createEl("strong",{text:"- {} represents the selected text (not required). "}),i.createEl("br"),i.createEl("strong",{text:"- {[[Note Title]]} represents a note. "}),i.createEl("br"),i.createEl("strong",{text:"- {activeNote} represents the active note. "}),i.createEl("br"),i.createEl("strong",{text:"- {FolderPath} represents a folder of notes. "}),i.createEl("br"),i.createEl("strong",{text:"- {#tag1, #tag2} represents ALL notes with ANY of the specified tags in their property (an OR operation). "}),i.createEl("br"),i.createEl("br"),i.appendText("Tip: turn on debug mode to show the processed prompt in the chat window."),i.createEl("br"),i.createEl("br")});r.appendChild(n);let o=r.createEl("textarea",{attr:{placeholder:this.placeholderText}});o.style.width="100%",o.style.height="100px",o.style.padding="10px",o.style.resize="vertical",o.addEventListener("input",i=>{this.result=i.target.value}),o.addEventListener("keydown",i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),this.close(),this.onSubmit(this.result))})}onClose(){let{contentEl:r}=this;r.empty()}};var uA=require("obsidian"),Cie=class extends uA.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Debug: Search OramaDB"});let r=e.createEl("p");r.innerHTML='Enter a JSON search params object. Example:<br><pre>{<br> "term": "#tag",<br> "mode": "hybrid",<br> "limit": 10,<br> "includeVectors": true<br>}</pre>',this.searchInput=e.createEl("textarea",{attr:{placeholder:"Enter search params JSON...",rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),e.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Search",cls:"mod-cta"}).addEventListener("click",async()=>{try{let i=JSON.parse(this.searchInput.value);i.vector?.value&&!Array.isArray(i.vector.value)&&(i.vector.value=Object.values(i.vector.value));let a=await this.plugin.vectorStoreManager.getDb();if(!a){new uA.Notice("Database not found");return}let s=await _c(a,i),u=["## Search Parameters","```json",JSON.stringify(i,null,2),"```","","## Results",`Total hits: ${s.hits.length}`,"","### Hits","```json",JSON.stringify(s.hits,null,2),"```"].join(`
`),l="OramaDB-Debug-Search.md",c=this.app.vault.getAbstractFileByPath(l);c instanceof uA.TFile?await this.app.vault.modify(c,u):await this.app.vault.create(l,u);let d=this.app.vault.getAbstractFileByPath(l);d instanceof uA.TFile&&(await this.app.workspace.getLeaf().openFile(d),this.close())}catch(i){console.error("Error in debug search:",i),new uA.Notice("Error executing search. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};var Oie=class{get usageData(){return de().promptUsageTimestamps}recordUsage(e){xt("promptUsageTimestamps",{...this.usageData,[e]:Date.now()})}updateUsage(e,r){let n={...this.usageData};n[r]=n[e],delete n[e],xt("promptUsageTimestamps",n)}removeUnusedPrompts(e){let r={...this.usageData};for(let n of Object.keys(r))e.includes(n)||delete r[n];xt("promptUsageTimestamps",r)}compare(e,r){return(this.usageData[e]||0)-(this.usageData[r]||0)}};var lA=require("obsidian"),run=/\{(?!copilot-selection\})([^}]+)\}/g;async function nun(t,e,r){let n=new Map,o=new Set,i;for(;(i=run.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]};if(a.toLowerCase()==="activenote")if(r){let u=await UD(r,e);u&&(s.content=`## ${o9(r)}
${u}`,s.files.push(r))}else new lA.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(d=>d.trim()),l=await m$e(e,u),c=[];for(let d of l){let f=await UD(d,e);f&&(c.push(`## ${o9(d)}
${f}`),s.files.push(d))}s.content=c.join(`
`)}else{let u=y$e(a),l=await Lce(e,u),c=[];for(let d of l){let f=await UD(d,e);f&&(c.push(`## ${o9(d)}
${f}`),s.files.push(d))}s.content=c.join(`
`)}s.content?(n.set(a,s.content),s.files.forEach(u=>o.add(u))):a.toLowerCase()!=="activenote"&&console.warn(`No notes found for variable: ${a}`)}return{variablesMap:n,includedFiles:o}}async function FIe(t,e,r,n){let o=de(),i=new Set;if(!o.enableCustomPromptTemplating)return t.includes("{}")&&!e&&n&&i.add(n),{processedPrompt:t+`
`,includedFiles:Array.from(i)};let{variablesMap:a,includedFiles:s}=await nun(t,r,n);s.forEach(f=>i.add(f));let u=t,l="",c=null;u.includes("{}")&&(u=u.replace(/\{\}/g,"{selectedText}"),e?l+=`selectedText:
${e}`:n?(c=await UD(n,r),l+=`selectedText (entire active note):
${c}`,i.add(n)):l+=`selectedText:
(No selected text or active note available)`);for(let[f,p]of a.entries())f.toLowerCase()==="activenote"&&c!==null||(l?l+=`
${f}:
${p}`:l+=`${f}:
${p}`);let d=rx(u,r);for(let f of d)if(!i.has(f)){let p=await UD(f,r);p&&(l?l+=`
Title: [[${f.basename}]]
Path: ${f.path}
${p}`:l+=`Title: [[${f.basename}]]
Path: ${f.path}
${p}`,i.add(f))}return{processedPrompt:l?`${u}
${l}`:`${u}
`,includedFiles:Array.from(i)}}var bO=class t{constructor(e){this.vault=e;this.usageStrategy=new Oie}get customPromptsFolder(){return de().customPromptsFolder}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}recordPromptUsage(e){this.usageStrategy.recordUsage(e)}async getAllPrompts(){let e=this.customPromptsFolder,r=this.vault.getFiles().filter(o=>o.path.startsWith(e)&&o.extension==="md"),n=[];for(let o of r){let i=await this.vault.read(o);n.push({title:o.basename,content:i})}return this.usageStrategy.removeUnusedPrompts(n.map(o=>o.title)),n.sort((o,i)=>this.usageStrategy.compare(i.title,o.title)||0)}async getPrompt(e){let r=`${this.customPromptsFolder}/${e}.md`,n=this.vault.getAbstractFileByPath(r);if(n instanceof lA.TFile){let o=await this.vault.read(n);return{title:e,content:o}}return null}async savePrompt(e,r){let n=(0,lA.normalizePath)(this.customPromptsFolder),o=`${n}/${e}.md`;await this.vault.adapter.exists(n)||await this.vault.createFolder(n),await this.vault.create(o,r)}async updatePrompt(e,r,n){let o=`${this.customPromptsFolder}/${e}.md`,i=this.vault.getAbstractFileByPath(o);if(i instanceof lA.TFile){if(e!==r){let a=`${this.customPromptsFolder}/${r}.md`;if(this.vault.getAbstractFileByPath(a))throw new hr("Error saving custom prompt. Please check if the title already exists.");this.usageStrategy.updateUsage(e,r),await this.vault.rename(i,a)}await this.vault.modify(i,n)}}async deletePrompt(e){let r=`${this.customPromptsFolder}/${e}.md`,n=this.vault.getAbstractFileByPath(r);n instanceof lA.TFile&&(this.usageStrategy.removeUnusedPrompts([e]),await this.vault.delete(n))}async processCustomPrompt(e,r,n){return FIe(e,r,this.vault,n)}};function y$(t){return encodeURIComponent(t.toLowerCase())}function BDt(t,e){if(!t)throw new Error("Command name is required");if(t.length>Hse)throw new Error(`Command name must be less than ${Hse} characters`);if(bj().some(n=>n.name.toLowerCase()===t.toLowerCase()&&n.name.toLowerCase()!==e?.toLowerCase()))throw new Error("A command with this name already exists")}function $Dt(t){return bj().find(r=>y$(r.name)===t)}function bj(){return de().inlineEditCommands??aD}function qDt(){return Bo().inlineEditCommands??aD}async function kIe(t,e,r=!1){let o=(await FIe(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes("{selectedText}")||r)return o;let i=o.indexOf(zse);return i===-1?o+`
`+e:o.slice(0,i)+e+o.slice(i+zse.length)}function UDt(){return bj()!==aD}var vS=B(X());var BIe=({capabilities:t=[],iconSize:e=16})=>vS.default.createElement(vS.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return vS.default.createElement(Sx,{key:n,className:"text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return vS.default.createElement(wx,{key:n,className:"text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return vS.default.createElement(cM,{key:n,className:"text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),$Ie=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return vS.default.createElement("div",{className:"flex items-center gap-1"},vS.default.createElement("span",null,r),t.capabilities&&t.capabilities.length>0&&vS.default.createElement("div",{className:"flex gap-0.5 items-center"},vS.default.createElement(BIe,{capabilities:t.capabilities,iconSize:e})))},Eie=t=>{let e=t.displayName||t.name,r=`(${Ef(t.provider)})`;return`${e} ${r}`},qIe=t=>{let e=t.displayName||t.name,r=`(${Ef(t.provider,t)})`,n=t.capabilities?.map(o=>{switch(o){case"reasoning":return"Reasoning";case"vision":return"Vision";case"websearch":return"Websearch";default:return""}}).join("|")||"";return`${e} ${r} ${n}`};var iy=require("obsidian"),ht=B(X()),zDt=B(km());eE();Cp();function oun(t){let[e]=(0,ht.useState)(new V8({returnMessages:!0,memoryKey:"history"})),[r,n]=(0,ht.useState)(null);return(0,ht.useEffect)(()=>{async function o(){let i=await of.getInstance().createModelInstance(t),a=Of.fromMessages([QO.fromTemplate("You are a helpful assistant. You'll help the user with their content editing needs."),new Ay("history"),Iy.fromTemplate("{input}")]),s=Wo.from([{input:u=>u.input,memory:()=>e.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},a,i]);n(s)}o()},[t,e]),{chatChain:r,chatMemory:e}}function iun({originalText:t,command:e,onInsert:r,onReplace:n}){let[o,i]=(0,ht.useState)(null),[a,s]=(0,ht.useState)(null),[u,l]=(0,ht.useState)(""),c=(0,ht.useRef)(null),d=(0,ht.useRef)(null),[f,p]=(0,ht.useState)(!0),[m]=ZD(),h=Bo(),v=(0,ht.useMemo)(()=>i9(e.modelKey||m,h.activeModels),[e.modelKey,m,h.activeModels]),{chatChain:g,chatMemory:_}=oun(v),w=e.name,x=(0,ht.useCallback)(async(R,N)=>{if(!g)return console.error("Chat chain not initialized"),new iy.Notice("Chat engine not ready. Please try again."),p(!1),null;try{i(null),s(null),p(!0);let L="",F=await g.bind({signal:N.signal}).stream({input:R});for await(let $ of F){if(N.signal.aborted)break;let U=typeof $.content=="string"?$.content:"";L+=U,i(L)}if(!N.signal.aborted){let $=L.trim();return s($),p(!1),await _.saveContext({input:R},{output:$}),$}return null}catch(L){return nt("Error generating response:",L),p(!1),null}},[g,_]);(0,ht.useEffect)(()=>{let R=new AbortController;C.current=R;async function N(){if(g)try{let L=await kIe(e.prompt,t);await x(L,R)}catch(L){nt("Error in initial response:",L),p(!1)}}return N(),()=>{R.abort()}},[e.prompt,t,g,x]);let C=(0,ht.useRef)(null),P=async()=>{if(!u.trim()||!g){g||new iy.Notice("Chat engine not ready. Please try again.");return}let R=new AbortController;C.current=R;let N=await kIe(u,t,!0);try{await x(N,R)&&l("")}finally{R.signal.aborted&&(p(!1),s(o??"")),C.current=null}},E=()=>{C.current&&(C.current.abort(),C.current=null,p(!1))},A=R=>{R.nativeEvent.isComposing||(!f&&a&&!M&&(R.key==="Enter"&&(iy.Platform.isMacOS?R.metaKey:R.ctrlKey)&&!R.shiftKey&&(R.preventDefault(),n(a)),R.key==="Enter"&&(iy.Platform.isMacOS?R.metaKey:R.ctrlKey)&&R.shiftKey&&(R.preventDefault(),r(a))),M&&R.key==="Enter"&&!R.shiftKey&&!R.metaKey&&!R.ctrlKey&&(R.preventDefault(),P()))};(0,ht.useEffect)(()=>{if(c.current&&o&&f){let R=c.current;R.scrollTop=R.scrollHeight}},[o,f]);let M=!f&&u.trim().length>0;return ht.default.createElement("div",{className:"flex flex-col gap-4",onKeyDown:A},ht.default.createElement("div",{className:"max-h-60 overflow-y-auto text-muted whitespace-pre-wrap"},t),ht.default.createElement("div",{className:"flex flex-col gap-2"},w&&ht.default.createElement("div",{className:"text-normal flex items-center gap-2 font-bold"},ht.default.createElement(NE,{className:"w-4 h-4"}),w)),ht.default.createElement("div",{className:"relative group"},ht.default.createElement("textarea",{ref:c,className:"w-full h-60 text-text peer",value:a??o??"loading...",disabled:a==null,onChange:R=>s(R.target.value)}),a&&ht.default.createElement("button",{className:"absolute top-2 right-2 opacity-0 peer-focus-visible:!opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{navigator.clipboard.writeText(a),new iy.Notice("Copied to clipboard")}},ht.default.createElement(vx,{className:"w-4 h-4 text-muted-foreground hover:text-accent"}))),!f&&a&&ht.default.createElement("div",{className:"flex flex-col gap-2"},ht.default.createElement("textarea",{autoFocus:!0,ref:d,className:"w-full h-20 text-text",placeholder:"Enter follow-up instructions...",value:u,onChange:R=>l(R.target.value)})),ht.default.createElement("div",{className:"flex justify-between gap-2"},ht.default.createElement("div",{className:"text-faint text-xs flex items-center gap-2 font-bold"},ht.default.createElement(aM,{className:"w-4 h-4"}),Eie(v)),ht.default.createElement("div",{className:"flex gap-2"},f?ht.default.createElement(ke,{variant:"secondary",onClick:E},"Stop"):M?ht.default.createElement(ke,{onClick:P,className:"flex items-center gap-1"},ht.default.createElement("span",null,"Submit"),ht.default.createElement(Rp,{className:"size-3"})):ht.default.createElement(ht.default.Fragment,null,ht.default.createElement(ke,{onClick:()=>r(a??""),className:"flex items-center gap-1"},ht.default.createElement("span",null,"Insert"),ht.default.createElement("div",{className:"flex items-center text-xs text-muted"},iy.Platform.isMacOS?ht.default.createElement(ht.default.Fragment,null,ht.default.createElement(zy,{className:"size-3"}),ht.default.createElement(bx,{className:"size-3"}),ht.default.createElement(Rp,{className:"size-3"})):ht.default.createElement(ht.default.Fragment,null,ht.default.createElement("span",{className:"text-xs"},"Ctrl"),ht.default.createElement(bx,{className:"size-3"}),ht.default.createElement(Rp,{className:"size-3"})))),ht.default.createElement(ke,{onClick:()=>n(a??""),className:"flex items-center gap-1"},ht.default.createElement("span",null,"Replace"),ht.default.createElement("div",{className:"flex items-center text-xs text-muted"},iy.Platform.isMacOS?ht.default.createElement(ht.default.Fragment,null,ht.default.createElement(zy,{className:"size-3"}),ht.default.createElement(Rp,{className:"size-3"})):ht.default.createElement(ht.default.Fragment,null,ht.default.createElement("span",{className:"text-xs"},"Ctrl"),ht.default.createElement(Rp,{className:"size-3"}))))))))}var Pie=class extends iy.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,zDt.createRoot)(r);let{selectedText:n,command:o}=this.configs,i=s=>{pU(s),this.close()},a=s=>{pU(s,!0),this.close()};this.root.render(ht.default.createElement(iun,{originalText:n,command:o,onInsert:i,onReplace:a}))}onClose(){this.root.unmount()}};var HDt=require("obsidian"),_O=class extends HDt.FuzzySuggestModal{constructor(e,r,n,o=[]){super(e),this.promptTitles=r,this.onChoosePromptTitle=n,this.descriptions=o}getItems(){return this.promptTitles}getItemText(e){let r=this.promptTitles.indexOf(e),n=this.descriptions[r];return n?`${e} (${n})`:e}onChooseItem(e,r){let n=this.promptTitles.findIndex(i=>e.startsWith(i+" (")||e===i),o=n>=0?this.promptTitles[n]:e;this.onChoosePromptTitle(o)}};var X8=require("obsidian"),Tie=class extends X8.Modal{constructor(e,r){super(e),this.plugin=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Inspect Copilot Index by Note Paths"}),this.searchInput=e.createEl("textarea",{attr:{placeholder:`Enter note paths as markdown list:
- [[Note 1]]
- [[Note 2]]`,rows:"10",style:"width: 100%; min-height: 200px; margin: 10px 0; padding: 10px; font-family: monospace;"}}),e.createEl("div",{cls:"search-button-container"}).createEl("button",{text:"Show Index Data",cls:"mod-cta"}).addEventListener("click",async()=>{let o=this.searchInput.value,i=rx(o,this.app.vault).map(a=>a.path);if(i.length===0){new X8.Notice("No valid note paths found. Use format: - [[Note Name]]");return}try{let s=await(await this.plugin.vectorStoreManager.getDbOps()).getDocsJsonByPaths(i),u="CopilotDB-Search-Results.md",l=["## Searched Paths",...i.map(f=>`- [[${f}]]`),"","## Index Data","```json",JSON.stringify(s,null,2),"```"].join(`
`),c=this.app.vault.getAbstractFileByPath(u);c?await this.app.vault.modify(c,l):await this.app.vault.create(u,l);let d=this.app.vault.getAbstractFileByPath(u);d&&await this.app.workspace.getLeaf().openFile(d),this.close()}catch(a){console.error("Error searching DB:",a),new X8.Notice("Error searching database. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};var Q8=require("obsidian"),Aie=class extends Q8.Modal{constructor(r,n){super(r);this.filePaths="";this.onSubmit=n}onOpen(){let{contentEl:r}=this;r.createEl("h2",{text:"Remove Files from Copilot Index"});let n=r.createDiv({cls:"remove-files-container"});new Q8.Setting(n).setName("File paths").setDesc("Paste the markdown list of file paths to remove from the index. You can get the list by running the command `List all indexed files`.").setClass("remove-files-setting").addTextArea(o=>o.setPlaceholder(`- [[path/to/file1.md]]
- [[path/to/file2.md]]`).setValue(this.filePaths).onChange(i=>{this.filePaths=i})),new Q8.Setting(n).addButton(o=>o.setButtonText("Remove").setCta().onClick(()=>{let i=this.filePaths.split(`
`).map(a=>{let s=a.match(/\[\[(.*?)\]\]/);return s?s[1].trim():""}).filter(a=>a.length>0);this.onSubmit(i),this.close()})),r.createEl("style",{text:`
.remove-files-container {
width: 100%;
margin-top: 12px;
}
.remove-files-setting {
display: block;
}
.remove-files-setting .setting-item-control {
padding: 0;
}
.remove-files-setting textarea {
width: 100%;
height: 300px;
margin-top: 12px;
}
.remove-files-setting textarea::placeholder {
opacity: 0.5;
}
`})}onClose(){let{contentEl:r}=this;r.empty()}};var Ao=require("obsidian");function vd(t,e,r){t.addCommand({id:e,name:d9[e],callback:r})}function aun(t,e,r){t.addCommand({id:e,name:d9[e],editorCallback:r})}function VDt(t,e,r){t.addCommand({id:e,name:d9[e],checkCallback:r})}async function sun(t,e){let r=t.getSelection().trim();if(!r)return;let n=$Dt(e);if(!n){nt(`Command not found for id ${e}`);return}new Pie(app,{selectedText:r,command:n}).open()}function uun(t,e,r){e.forEach(n=>{let o=y$(n.name);o&&t.removeCommand(o)}),r.forEach(n=>{let o=y$(n.name);t.addCommand({id:o,name:n.name,editorCallback:i=>{sun(i,o)}})})}function UIe(t,e,r){uun(t,e?.inlineEditCommands??[],r.inlineEditCommands??bj());let n=bO.getInstance(t.app.vault);aun(t,mr.COUNT_WORD_AND_TOKENS_SELECTION,async o=>{let i=await o.getSelection(),a=i.split(" ").length,s=await t.chainManager.chatModelManager.countTokens(i);new Ao.Notice(`Selected text contains ${a} words and ${s} tokens.`)}),vd(t,mr.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let o=await Vwt(t.app),i=await t.chainManager.chatModelManager.countTokens(o);new Ao.Notice(`Total tokens in your vault: ${i}`)}catch(o){console.error("Error counting tokens: ",o),new Ao.Notice("An error occurred while counting tokens.")}}),vd(t,mr.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),vd(t,mr.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),vd(t,mr.ADD_CUSTOM_PROMPT,()=>{new Z8(t.app,async(o,i)=>{try{await n.savePrompt(o,i),new Ao.Notice("Custom prompt saved successfully.")}catch(a){let s="An error occurred while saving the custom prompt: "+Pi(a);throw console.error(s),new Error(s)}}).open()}),vd(t,mr.APPLY_CUSTOM_PROMPT,async()=>{let i=(await n.getAllPrompts()).map(a=>a.title);new _O(t.app,i,async a=>{if(!a){new Ao.Notice("Please select a prompt title.");return}try{let s=await n.getPrompt(a);if(!s){new Ao.Notice(`No prompt found with the title "${a}".`);return}t.processCustomPrompt(mr.APPLY_CUSTOM_PROMPT,s.content)}catch(s){console.error(s),new Ao.Notice("An error occurred.")}}).open()}),vd(t,mr.APPLY_ADHOC_PROMPT,async()=>{new xie(t.app,async i=>{try{t.processCustomPrompt(mr.APPLY_ADHOC_PROMPT,i)}catch(a){console.error(a),new Ao.Notice("An error occurred.")}}).open()}),VDt(t,mr.DELETE_CUSTOM_PROMPT,o=>(o||n.getAllPrompts().then(i=>{let a=i.map(s=>s.title);new _O(t.app,a,async s=>{if(!s){new Ao.Notice("Please select a prompt title.");return}try{await n.deletePrompt(s),new Ao.Notice(`Prompt "${s}" has been deleted.`)}catch(u){console.error(u),new Ao.Notice("An error occurred while deleting the prompt.")}}).open()}),!0)),VDt(t,mr.EDIT_CUSTOM_PROMPT,o=>(o||n.getAllPrompts().then(i=>{let a=i.map(s=>s.title);new _O(t.app,a,async s=>{if(!s){new Ao.Notice("Please select a prompt title.");return}try{let u=await n.getPrompt(s);u?new Z8(t.app,async(l,c)=>{try{await n.updatePrompt(s,l,c),new Ao.Notice(`Prompt "${l}" has been updated.`)}catch(d){let f="An error occurred while updating the custom prompt: "+Pi(d);throw console.error(f),new Error(f)}},u.title,u.content,!1).open():new Ao.Notice(`No prompt found with the title "${s}".`)}catch(u){console.error(u),new Ao.Notice("An error occurred.")}}).open()}),!0)),vd(t,mr.CLEAR_LOCAL_COPILOT_INDEX,async()=>{await t.vectorStoreManager.clearIndex()}),vd(t,mr.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let o=await t.vectorStoreManager.garbageCollectVectorStore();new Ao.Notice(`${o} documents removed from Copilot index.`)}catch(o){console.error("Error garbage collecting the Copilot index:",o),new Ao.Notice("An error occurred while garbage collecting the Copilot index.")}}),vd(t,mr.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let o=await t.vectorStoreManager.indexVaultToVectorStore();new Ao.Notice(`${o} vault files indexed to Copilot index.`)}catch(o){console.error("Error indexing vault to Copilot index:",o),new Ao.Notice("An error occurred while indexing vault to Copilot index.")}}),vd(t,mr.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let o=await t.vectorStoreManager.indexVaultToVectorStore(!0);new Ao.Notice(`${o} vault files re-indexed to Copilot index.`)}catch(o){console.error("Error re-indexing vault to Copilot index:",o),new Ao.Notice("An error occurred while re-indexing vault to Copilot index.")}}),vd(t,mr.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),vd(t,mr.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,()=>{new Tie(t.app,t).open()}),vd(t,mr.SEARCH_ORAMA_DB,()=>{new Cie(t.app,t).open()}),vd(t,mr.LIST_INDEXED_FILES,async()=>{try{let o=await t.vectorStoreManager.getIndexedFiles(),i=new Set(o),a=t.app.vault.getMarkdownFiles(),s=new Set,u=new Set,l=new Set,c=await t.vectorStoreManager.getDbOps();for(let v of a){let g=await t.app.vault.cachedRead(v);!g||g.trim().length===0?s.add(v.path):i.has(v.path)?await c.hasEmbeddings(v.path)||l.add(v.path):u.add(v.path)}if(o.length===0&&s.size===0&&u.size===0){new Ao.Notice("No files found to list.");return}let d=["# Copilot Files Status",`- Indexed files: ${o.length}`,` - Files missing embeddings: ${l.size}`,`- Unindexed files: ${u.size}`,`- Empty files: ${s.size}`,"","## Indexed Files",...o.map(v=>{let g=l.has(v);return`- [[${v}]]${g?" *(embedding missing)*":""}`}),"","## Unindexed Files",...u.size>0?Array.from(u).sort().map(v=>`- [[${v}]]`):["No unindexed files found."],"","## Empty Files",...s.size>0?Array.from(s).sort().map(v=>`- [[${v}]]`):["No empty files found."]].join(`
`),p=`${`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`}`,m=t.app.vault.getAbstractFileByPath(p);m instanceof Ao.TFile?await t.app.vault.modify(m,d):await t.app.vault.create(p,d);let h=t.app.vault.getAbstractFileByPath(p);h instanceof Ao.TFile&&(await t.app.workspace.getLeaf().openFile(h),new Ao.Notice(`Listed ${o.length} indexed files`))}catch(o){console.error("Error listing indexed files:",o),new Ao.Notice("Failed to list indexed files.")}}),vd(t,mr.REMOVE_FILES_FROM_COPILOT_INDEX,async()=>{new Aie(t.app,async o=>{let i=await t.vectorStoreManager.getDbOps();try{for(let a of o)await i.removeDocs(a);await i.saveDB(),new Ao.Notice(`Successfully removed ${o.length} files from the index.`)}catch(a){console.error("Error removing files from index:",a),new Ao.Notice("An error occurred while removing files from the index.")}}).open()}),vd(t,mr.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),new Ao.Notice("Copilot cache cleared successfully")}catch(o){console.error("Error clearing Copilot cache:",o),new Ao.Notice("Failed to clear Copilot cache")}})}var xr=B(X());var dl=B(X(),1);function eV(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var lun=B(X(),1);function WDt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Iie(...t){return e=>{let r=!1,n=t.map(o=>{let i=WDt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():WDt(t[o],null)}}}}var Dh=B(X(),1),zIe=B(_t(),1);function KDt(t,e){let r=Dh.createContext(e),n=i=>{let{children:a,...s}=i,u=Dh.useMemo(()=>s,Object.values(s));return(0,zIe.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=Dh.useContext(r);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[n,o]}function Ho(t,e=[]){let r=[];function n(i,a){let s=Dh.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,v=Dh.useMemo(()=>m,Object.values(m));return(0,zIe.jsx)(h.Provider,{value:v,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=Dh.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>Dh.createContext(a));return function(s){let u=s?.[t]||i;return Dh.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,cun(o,...e)]}function cun(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return Dh.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var cA=B(X(),1);var b$=B(X(),1);function rr(t){let e=b$.useRef(t);return b$.useEffect(()=>{e.current=t}),b$.useMemo(()=>(...r)=>e.current?.(...r),[])}function cl({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=dun({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=rr(r),u=cA.useCallback(l=>{if(i){let d=typeof l=="function"?l(t):l;d!==t&&s(d)}else o(l)},[i,t,o,s]);return[a,u]}function dun({defaultProp:t,onChange:e}){let r=cA.useState(t),[n]=r,o=cA.useRef(n),i=rr(e);return cA.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var JDt=B(X(),1),gun=B(fs(),1);var Pc=B(X(),1);var _$=B(_t(),1),VIe=Pc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Pc.Children.toArray(r),i=o.find(pun);if(i){let a=i.props.children,s=o.map(u=>u===i?Pc.Children.count(a)>1?Pc.Children.only(null):Pc.isValidElement(a)?a.props.children:null:u);return(0,_$.jsx)(HIe,{...n,ref:e,children:Pc.isValidElement(a)?Pc.cloneElement(a,void 0,s):null})}return(0,_$.jsx)(HIe,{...n,ref:e,children:r})});VIe.displayName="Slot";var HIe=Pc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Pc.isValidElement(r)){let o=hun(r);return Pc.cloneElement(r,{...mun(n,r.props),ref:e?Iie(e,o):o})}return Pc.Children.count(r)>1?Pc.Children.only(null):null});HIe.displayName="SlotClone";var fun=({children:t})=>(0,_$.jsx)(_$.Fragment,{children:t});function pun(t){return Pc.isValidElement(t)&&t.type===fun}function mun(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function hun(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var GDt=B(_t(),1),yun=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],YDt=yun.reduce((t,e)=>{let r=JDt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?VIe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,GDt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var Mt=B(X(),1);function wi(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var fA=B(X(),1);var XDt=B(X(),1);function ZDt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function tV(...t){return e=>{let r=!1,n=t.map(o=>{let i=ZDt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():ZDt(t[o],null)}}}}function Tc(...t){return XDt.useCallback(tV(...t),t)}var Ac=B(X(),1);var v$=B(_t(),1),dA=Ac.forwardRef((t,e)=>{let{children:r,...n}=t,o=Ac.Children.toArray(r),i=o.find(_un);if(i){let a=i.props.children,s=o.map(u=>u===i?Ac.Children.count(a)>1?Ac.Children.only(null):Ac.isValidElement(a)?a.props.children:null:u);return(0,v$.jsx)(WIe,{...n,ref:e,children:Ac.isValidElement(a)?Ac.cloneElement(a,void 0,s):null})}return(0,v$.jsx)(WIe,{...n,ref:e,children:r})});dA.displayName="Slot";var WIe=Ac.forwardRef((t,e)=>{let{children:r,...n}=t;if(Ac.isValidElement(r)){let o=wun(r);return Ac.cloneElement(r,{...vun(n,r.props),ref:e?tV(e,o):o})}return Ac.Children.count(r)>1?Ac.Children.only(null):null});WIe.displayName="SlotClone";var bun=({children:t})=>(0,v$.jsx)(v$.Fragment,{children:t});function _un(t){return Ac.isValidElement(t)&&t.type===bun}function vun(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function wun(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Mie=B(_t(),1);function QDt(t){let e=t+"CollectionProvider",[r,n]=Ho(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,v=fA.default.useRef(null),g=fA.default.useRef(new Map).current;return(0,Mie.jsx)(o,{scope:m,itemMap:g,collectionRef:v,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=fA.default.forwardRef((p,m)=>{let{scope:h,children:v}=p,g=i(s,h),_=Tc(m,g.collectionRef);return(0,Mie.jsx)(dA,{ref:_,children:v})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=fA.default.forwardRef((p,m)=>{let{scope:h,children:v,...g}=p,_=fA.default.useRef(null),w=Tc(m,_),x=i(l,h);return fA.default.useEffect(()=>(x.itemMap.set(_,{ref:_,...g}),()=>void x.itemMap.delete(_))),(0,Mie.jsx)(dA,{[c]:"",ref:w,children:v})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return fA.default.useCallback(()=>{let v=m.collectionRef.current;if(!v)return[];let g=Array.from(v.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,C)=>g.indexOf(x.ref.current)-g.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Rie=B(X(),1),Sun=B(_t(),1),xun=Rie.createContext(void 0);function pA(t){let e=Rie.useContext(xun);return t||e||"ltr"}var Ca=B(X(),1);var eNt=B(X(),1),tNt=B(fs(),1);var rNt=B(_t(),1),Cun=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ul=Cun.reduce((t,e)=>{let r=eNt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?dA:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,rNt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function jie(t,e){t&&tNt.flushSync(()=>t.dispatchEvent(e))}var nNt=B(X(),1);function wS(t,e=globalThis?.document){let r=rr(t);nNt.useEffect(()=>{let n=o=>{o.key==="Escape"&&r(o)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var JIe=B(_t(),1),Oun="DismissableLayer",KIe="dismissableLayer.update",Eun="dismissableLayer.pointerDownOutside",Pun="dismissableLayer.focusOutside",oNt,aNt=Ca.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),GIe=Ca.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ca.useContext(aNt),[c,d]=Ca.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ca.useState({}),m=Tc(e,E=>d(E)),h=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(v),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,C=Iun(E=>{let A=E.target,M=[...l.branches].some(R=>R.contains(A));!x||M||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=Mun(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return wS(E=>{_===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Ca.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(oNt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),iNt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=oNt)}},[c,f,r,l]),Ca.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),iNt())},[c,l]),Ca.useEffect(()=>{let E=()=>p({});return document.addEventListener(KIe,E),()=>document.removeEventListener(KIe,E)},[]),(0,JIe.jsx)(Ul.div,{...u,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:wi(t.onFocusCapture,P.onFocusCapture),onBlurCapture:wi(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:wi(t.onPointerDownCapture,C.onPointerDownCapture)})});GIe.displayName=Oun;var Tun="DismissableLayerBranch",Aun=Ca.forwardRef((t,e)=>{let r=Ca.useContext(aNt),n=Ca.useRef(null),o=Tc(e,n);return Ca.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,JIe.jsx)(Ul.div,{...t,ref:o})});Aun.displayName=Tun;function Iun(t,e=globalThis?.document){let r=rr(t),n=Ca.useRef(!1),o=Ca.useRef(()=>{});return Ca.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){sNt(Eun,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function Mun(t,e=globalThis?.document){let r=rr(t),n=Ca.useRef(!1);return Ca.useEffect(()=>{let o=i=>{i.target&&!n.current&&sNt(Pun,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function iNt(){let t=new CustomEvent(KIe);document.dispatchEvent(t)}function sNt(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?jie(o,i):o.dispatchEvent(i)}var lNt=B(X(),1),YIe=0;function mA(){lNt.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??uNt()),document.body.insertAdjacentElement("beforeend",t[1]??uNt()),YIe++,()=>{YIe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),YIe--}},[])}function uNt(){let t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Nh=B(X(),1);var mNt=B(_t(),1),ZIe="focusScope.autoFocusOnMount",XIe="focusScope.autoFocusOnUnmount",cNt={bubbles:!1,cancelable:!0},Run="FocusScope",QIe=Nh.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Nh.useState(null),l=rr(o),c=rr(i),d=Nh.useRef(null),f=Tc(e,h=>u(h)),p=Nh.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Nh.useEffect(()=>{if(n){let _=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:hA(d.current,{select:!0})},w=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||hA(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&hA(s)};var h=_,v=w,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(x);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),Nh.useEffect(()=>{if(s){fNt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(ZIe,cNt);s.addEventListener(ZIe,l),s.dispatchEvent(g),g.defaultPrevented||(jun(kun(hNt(s)),{select:!0}),document.activeElement===h&&hA(s))}return()=>{s.removeEventListener(ZIe,l),setTimeout(()=>{let g=new CustomEvent(XIe,cNt);s.addEventListener(XIe,c),s.dispatchEvent(g),g.defaultPrevented||hA(h??document.body,{select:!0}),s.removeEventListener(XIe,c),fNt.remove(p)},0)}}},[s,l,c,p]);let m=Nh.useCallback(h=>{if(!r&&!n||p.paused)return;let v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(v&&g){let _=h.currentTarget,[w,x]=Dun(_);w&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&hA(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&hA(x,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,mNt.jsx)(Ul.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});QIe.displayName=Run;function jun(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(hA(n,{select:e}),document.activeElement!==r)return}function Dun(t){let e=hNt(t),r=dNt(e,t),n=dNt(e.reverse(),t);return[r,n]}function hNt(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function dNt(t,e){for(let r of t)if(!Nun(r,{upTo:e}))return r}function Nun(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Lun(t){return t instanceof HTMLInputElement&&"select"in t}function hA(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Lun(t)&&e&&t.select()}}var fNt=Fun();function Fun(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=pNt(t,e),t.unshift(e)},remove(e){t=pNt(t,e),t[0]?.resume()}}}function pNt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function kun(t){return t.filter(e=>e.tagName!=="A")}var Die=B(X(),1);var gNt=B(X(),1),Qr=globalThis?.document?gNt.useLayoutEffect:()=>{};var $un=Die.useId||(()=>{}),qun=0;function za(t){let[e,r]=Die.useState($un());return Qr(()=>{t||r(n=>n??String(qun++))},[t]),t||(e?`radix-${e}`:"")}var um=B(X(),1);var yNt=["top","right","bottom","left"];var SS=Math.min,af=Math.max,nV=Math.round,oV=Math.floor,ay=t=>({x:t,y:t}),Uun={left:"right",right:"left",bottom:"top",top:"bottom"},zun={start:"end",end:"start"};function Lie(t,e,r){return af(t,SS(e,r))}function xS(t,e){return typeof t=="function"?t(e):t}function CS(t){return t.split("-")[0]}function _j(t){return t.split("-")[1]}function Fie(t){return t==="x"?"y":"x"}function kie(t){return t==="y"?"height":"width"}function vO(t){return["top","bottom"].includes(CS(t))?"y":"x"}function Bie(t){return Fie(vO(t))}function bNt(t,e,r){r===void 0&&(r=!1);let n=_j(t),o=Bie(t),i=kie(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=rV(a)),[a,rV(a)]}function _Nt(t){let e=rV(t);return[Nie(t),e,Nie(e)]}function Nie(t){return t.replace(/start|end/g,e=>zun[e])}function Hun(t,e,r){let n=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return r?e?o:n:e?n:o;case"left":case"right":return e?i:a;default:return[]}}function vNt(t,e,r,n){let o=_j(t),i=Hun(CS(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(Nie)))),i}function rV(t){return t.replace(/left|right|bottom|top/g,e=>Uun[e])}function Vun(t){return{top:0,right:0,bottom:0,left:0,...t}}function eMe(t){return typeof t!="number"?Vun(t):{top:t,right:t,bottom:t,left:t}}function vj(t){let{x:e,y:r,width:n,height:o}=t;return{width:n,height:o,top:r,left:e,right:e+n,bottom:r+o,x:e,y:r}}function wNt(t,e,r){let{reference:n,floating:o}=t,i=vO(e),a=Bie(e),s=kie(a),u=CS(e),l=i==="y",c=n.x+n.width/2-o.width/2,d=n.y+n.height/2-o.height/2,f=n[s]/2-o[s]/2,p;switch(u){case"top":p={x:c,y:n.y-o.height};break;case"bottom":p={x:c,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:d};break;case"left":p={x:n.x-o.width,y:d};break;default:p={x:n.x,y:n.y}}switch(_j(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var CNt=async(t,e,r)=>{let{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:a}=r,s=i.filter(Boolean),u=await(a.isRTL==null?void 0:a.isRTL(e)),l=await a.getElementRects({reference:t,floating:e,strategy:o}),{x:c,y:d}=wNt(l,n,u),f=n,p={},m=0;for(let h=0;h<s.length;h++){let{name:v,fn:g}=s[h],{x:_,y:w,data:x,reset:C}=await g({x:c,y:d,initialPlacement:n,placement:f,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:t,floating:e}});c=_??c,d=w??d,p={...p,[v]:{...p[v],...x}},C&&m<=50&&(m++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(l=C.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:o}):C.rects),{x:c,y:d}=wNt(l,f,u)),h=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function w$(t,e){var r;e===void 0&&(e={});let{x:n,y:o,platform:i,rects:a,elements:s,strategy:u}=t,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=xS(e,t),m=eMe(p),v=s[f?d==="floating"?"reference":"floating":d],g=vj(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(v)))==null||r?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:c,strategy:u})),_=d==="floating"?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),x=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},C=vj(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:w,strategy:u}):_);return{top:(g.top-C.top+m.top)/x.y,bottom:(C.bottom-g.bottom+m.bottom)/x.y,left:(g.left-C.left+m.left)/x.x,right:(C.right-g.right+m.right)/x.x}}var ONt=t=>({name:"arrow",options:t,async fn(e){let{x:r,y:n,placement:o,rects:i,platform:a,elements:s,middlewareData:u}=e,{element:l,padding:c=0}=xS(t,e)||{};if(l==null)return{};let d=eMe(c),f={x:r,y:n},p=Bie(o),m=kie(p),h=await a.getDimensions(l),v=p==="y",g=v?"top":"left",_=v?"bottom":"right",w=v?"clientHeight":"clientWidth",x=i.reference[m]+i.reference[p]-f[p]-i.floating[m],C=f[p]-i.reference[p],P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),E=P?P[w]:0;(!E||!await(a.isElement==null?void 0:a.isElement(P)))&&(E=s.floating[w]||i.floating[m]);let A=x/2-C/2,M=E/2-h[m]/2-1,R=SS(d[g],M),N=SS(d[_],M),L=R,k=E-h[m]-N,F=E/2-h[m]/2+A,$=Lie(L,F,k),U=!u.arrow&&_j(o)!=null&&F!==$&&i.reference[m]/2-(F<L?R:N)-h[m]/2<0,J=U?F<L?F-L:F-k:0;return{[p]:f[p]+J,data:{[p]:$,centerOffset:F-$-J,...U&&{alignmentOffset:J}},reset:U}}});var ENt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;let{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:u,elements:l}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...v}=xS(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let g=CS(o),_=vO(s),w=CS(s)===s,x=await(u.isRTL==null?void 0:u.isRTL(l.floating)),C=f||(w||!h?[rV(s)]:_Nt(s)),P=m!=="none";!f&&P&&C.push(...vNt(s,h,m,x));let E=[s,...C],A=await w$(e,v),M=[],R=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&M.push(A[g]),d){let F=bNt(o,a,x);M.push(A[F[0]],A[F[1]])}if(R=[...R,{placement:o,overflows:M}],!M.every(F=>F<=0)){var N,L;let F=(((N=i.flip)==null?void 0:N.index)||0)+1,$=E[F];if($)return{data:{index:F,overflows:R},reset:{placement:$}};let U=(L=R.filter(J=>J.overflows[0]<=0).sort((J,V)=>J.overflows[1]-V.overflows[1])[0])==null?void 0:L.placement;if(!U)switch(p){case"bestFit":{var k;let J=(k=R.filter(V=>{if(P){let j=vO(V.placement);return j===_||j==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(j=>j>0).reduce((j,z)=>j+z,0)]).sort((V,j)=>V[1]-j[1])[0])==null?void 0:k[0];J&&(U=J);break}case"initialPlacement":U=s;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function SNt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function xNt(t){return yNt.some(e=>t[e]>=0)}var PNt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=xS(t,e);switch(n){case"referenceHidden":{let i=await w$(e,{...o,elementContext:"reference"}),a=SNt(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:xNt(a)}}}case"escaped":{let i=await w$(e,{...o,altBoundary:!0}),a=SNt(i,r.floating);return{data:{escapedOffsets:a,escaped:xNt(a)}}}default:return{}}}}};async function Wun(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=CS(r),s=_j(r),u=vO(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=xS(e,t),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m=="number"&&(p=s==="end"?m*-1:m),u?{x:p*c,y:f*l}:{x:f*l,y:p*c}}var TNt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;let{x:o,y:i,placement:a,middlewareData:s}=e,u=await Wun(e,t);return a===((r=s.offset)==null?void 0:r.placement)&&(n=s.arrow)!=null&&n.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:a}}}}},ANt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:r,y:n,placement:o}=e,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:v=>{let{x:g,y:_}=v;return{x:g,y:_}}},...u}=xS(t,e),l={x:r,y:n},c=await w$(e,u),d=vO(CS(o)),f=Fie(d),p=l[f],m=l[d];if(i){let v=f==="y"?"top":"left",g=f==="y"?"bottom":"right",_=p+c[v],w=p-c[g];p=Lie(_,p,w)}if(a){let v=d==="y"?"top":"left",g=d==="y"?"bottom":"right",_=m+c[v],w=m-c[g];m=Lie(_,m,w)}let h=s.fn({...e,[f]:p,[d]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:i,[d]:a}}}}}},INt=function(t){return t===void 0&&(t={}),{options:t,fn(e){let{x:r,y:n,placement:o,rects:i,middlewareData:a}=e,{offset:s=0,mainAxis:u=!0,crossAxis:l=!0}=xS(t,e),c={x:r,y:n},d=vO(o),f=Fie(d),p=c[f],m=c[d],h=xS(s,e),v=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){let w=f==="y"?"height":"width",x=i.reference[f]-i.floating[w]+v.mainAxis,C=i.reference[f]+i.reference[w]-v.mainAxis;p<x?p=x:p>C&&(p=C)}if(l){var g,_;let w=f==="y"?"width":"height",x=["top","left"].includes(CS(o)),C=i.reference[d]-i.floating[w]+(x&&((g=a.offset)==null?void 0:g[d])||0)+(x?0:v.crossAxis),P=i.reference[d]+i.reference[w]+(x?0:((_=a.offset)==null?void 0:_[d])||0)-(x?v.crossAxis:0);m<C?m=C:m>P&&(m=P)}return{[f]:p,[d]:m}}}},MNt=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var r,n;let{placement:o,rects:i,platform:a,elements:s}=e,{apply:u=()=>{},...l}=xS(t,e),c=await w$(e,l),d=CS(o),f=_j(o),p=vO(o)==="y",{width:m,height:h}=i.floating,v,g;d==="top"||d==="bottom"?(v=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,v=f==="end"?"top":"bottom");let _=h-c.top-c.bottom,w=m-c.left-c.right,x=SS(h-c[v],_),C=SS(m-c[g],w),P=!e.middlewareData.shift,E=x,A=C;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(A=w),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(E=_),P&&!f){let R=af(c.left,0),N=af(c.right,0),L=af(c.top,0),k=af(c.bottom,0);p?A=m-2*(R!==0||N!==0?R+N:af(c.left,c.right)):E=h-2*(L!==0||k!==0?L+k:af(c.top,c.bottom))}await u({...e,availableWidth:A,availableHeight:E});let M=await a.getDimensions(s.floating);return m!==M.width||h!==M.height?{reset:{rects:!0}}:{}}}};function $ie(){return typeof window<"u"}function Sj(t){return jNt(t)?(t.nodeName||"").toLowerCase():"#document"}function lp(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function sy(t){var e;return(e=(jNt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function jNt(t){return $ie()?t instanceof Node||t instanceof lp(t).Node:!1}function Lh(t){return $ie()?t instanceof Element||t instanceof lp(t).Element:!1}function uy(t){return $ie()?t instanceof HTMLElement||t instanceof lp(t).HTMLElement:!1}function RNt(t){return!$ie()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof lp(t).ShadowRoot}function S$(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=Fh(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(o)}function DNt(t){return["table","td","th"].includes(Sj(t))}function iV(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function qie(t){let e=Uie(),r=Lh(t)?Fh(t):t;return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function NNt(t){let e=wO(t);for(;uy(e)&&!xj(e);){if(qie(e))return e;if(iV(e))return null;e=wO(e)}return null}function Uie(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xj(t){return["html","body","#document"].includes(Sj(t))}function Fh(t){return lp(t).getComputedStyle(t)}function aV(t){return Lh(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function wO(t){if(Sj(t)==="html")return t;let e=t.assignedSlot||t.parentNode||RNt(t)&&t.host||sy(t);return RNt(e)?e.host:e}function LNt(t){let e=wO(t);return xj(e)?t.ownerDocument?t.ownerDocument.body:t.body:uy(e)&&S$(e)?e:LNt(e)}function wj(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=LNt(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=lp(o);if(i){let s=zie(a);return e.concat(a,a.visualViewport||[],S$(o)?o:[],s&&r?wj(s):[])}return e.concat(o,wj(o,[],r))}function zie(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function BNt(t){let e=Fh(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=uy(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=nV(r)!==i||nV(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function rMe(t){return Lh(t)?t:t.contextElement}function x$(t){let e=rMe(t);if(!uy(e))return ay(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=BNt(e),a=(i?nV(r.width):r.width)/n,s=(i?nV(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var Kun=ay(0);function $Nt(t){let e=lp(t);return!Uie()||!e.visualViewport?Kun:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Jun(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==lp(t)?!1:e}function Cj(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=rMe(t),a=ay(1);e&&(n?Lh(n)&&(a=x$(n)):a=x$(t));let s=Jun(i,r,n)?$Nt(i):ay(0),u=(o.left+s.x)/a.x,l=(o.top+s.y)/a.y,c=o.width/a.x,d=o.height/a.y;if(i){let f=lp(i),p=n&&Lh(n)?lp(n):n,m=f,h=zie(m);for(;h&&n&&p!==m;){let v=x$(h),g=h.getBoundingClientRect(),_=Fh(h),w=g.left+(h.clientLeft+parseFloat(_.paddingLeft))*v.x,x=g.top+(h.clientTop+parseFloat(_.paddingTop))*v.y;u*=v.x,l*=v.y,c*=v.x,d*=v.y,u+=w,l+=x,m=lp(h),h=zie(m)}}return vj({width:c,height:d,x:u,y:l})}function nMe(t,e){let r=aV(t).scrollLeft;return e?e.left+r:Cj(sy(t)).left+r}function qNt(t,e,r){r===void 0&&(r=!1);let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(r?0:nMe(t,n)),i=n.top+e.scrollTop;return{x:o,y:i}}function Gun(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=sy(n),s=e?iV(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=ay(1),c=ay(0),d=uy(n);if((d||!d&&!i)&&((Sj(n)!=="body"||S$(a))&&(u=aV(n)),uy(n))){let p=Cj(n);l=x$(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?qNt(a,u,!0):ay(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-u.scrollLeft*l.x+c.x+f.x,y:r.y*l.y-u.scrollTop*l.y+c.y+f.y}}function Yun(t){return Array.from(t.getClientRects())}function Zun(t){let e=sy(t),r=aV(t),n=t.ownerDocument.body,o=af(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=af(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+nMe(t),s=-r.scrollTop;return Fh(n).direction==="rtl"&&(a+=af(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function Xun(t,e){let r=lp(t),n=sy(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let l=Uie();(!l||l&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function Qun(t,e){let r=Cj(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=uy(t)?x$(t):ay(1),a=t.clientWidth*i.x,s=t.clientHeight*i.y,u=o*i.x,l=n*i.y;return{width:a,height:s,x:u,y:l}}function FNt(t,e,r){let n;if(e==="viewport")n=Xun(t,r);else if(e==="document")n=Zun(sy(t));else if(Lh(e))n=Qun(e,r);else{let o=$Nt(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return vj(n)}function UNt(t,e){let r=wO(t);return r===e||!Lh(r)||xj(r)?!1:Fh(r).position==="fixed"||UNt(r,e)}function eln(t,e){let r=e.get(t);if(r)return r;let n=wj(t,[],!1).filter(s=>Lh(s)&&Sj(s)!=="body"),o=null,i=Fh(t).position==="fixed",a=i?wO(t):t;for(;Lh(a)&&!xj(a);){let s=Fh(a),u=qie(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||S$(a)&&!u&&UNt(t,a))?n=n.filter(c=>c!==a):o=s,a=wO(a)}return e.set(t,n),n}function tln(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?iV(e)?[]:eln(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=FNt(e,c,o);return l.top=af(d.top,l.top),l.right=SS(d.right,l.right),l.bottom=SS(d.bottom,l.bottom),l.left=af(d.left,l.left),l},FNt(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function rln(t){let{width:e,height:r}=BNt(t);return{width:e,height:r}}function nln(t,e,r){let n=uy(e),o=sy(e),i=r==="fixed",a=Cj(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=ay(0);if(n||!n&&!i)if((Sj(e)!=="body"||S$(o))&&(s=aV(e)),n){let f=Cj(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=nMe(o));let l=o&&!n&&!i?qNt(o,s):ay(0),c=a.left+s.scrollLeft-u.x-l.x,d=a.top+s.scrollTop-u.y-l.y;return{x:c,y:d,width:a.width,height:a.height}}function tMe(t){return Fh(t).position==="static"}function kNt(t,e){if(!uy(t)||Fh(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return sy(t)===r&&(r=r.ownerDocument.body),r}function zNt(t,e){let r=lp(t);if(iV(t))return r;if(!uy(t)){let o=wO(t);for(;o&&!xj(o);){if(Lh(o)&&!tMe(o))return o;o=wO(o)}return r}let n=kNt(t,e);for(;n&&DNt(n)&&tMe(n);)n=kNt(n,e);return n&&xj(n)&&tMe(n)&&!qie(n)?r:n||NNt(t)||r}var oln=async function(t){let e=this.getOffsetParent||zNt,r=this.getDimensions,n=await r(t.floating);return{reference:nln(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function iln(t){return Fh(t).direction==="rtl"}var HNt={convertOffsetParentRelativeRectToViewportRelativeRect:Gun,getDocumentElement:sy,getClippingRect:tln,getOffsetParent:zNt,getElementRects:oln,getClientRects:Yun,getDimensions:rln,getScale:x$,isElement:Lh,isRTL:iln};function aln(t,e){let r=null,n,o=sy(t);function i(){var s;clearTimeout(n),(s=r)==null||s.disconnect(),r=null}function a(s,u){s===void 0&&(s=!1),u===void 0&&(u=1),i();let{left:l,top:c,width:d,height:f}=t.getBoundingClientRect();if(s||e(),!d||!f)return;let p=oV(c),m=oV(o.clientWidth-(l+d)),h=oV(o.clientHeight-(c+f)),v=oV(l),_={rootMargin:-p+"px "+-m+"px "+-h+"px "+-v+"px",threshold:af(0,SS(1,u))||1},w=!0;function x(C){let P=C[0].intersectionRatio;if(P!==u){if(!w)return a();P?a(!1,P):n=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{r=new IntersectionObserver(x,{..._,root:o.ownerDocument})}catch{r=new IntersectionObserver(x,_)}r.observe(t)}return a(!0),i}function SO(t,e,r,n){n===void 0&&(n={});let{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:u=!1}=n,l=rMe(t),c=o||i?[...l?wj(l):[],...wj(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?aln(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(g=>{let[_]=g;_&&_.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),r()}),l&&!u&&p.observe(l),p.observe(e));let m,h=u?Cj(t):null;u&&v();function v(){let g=Cj(t);h&&(g.x!==h.x||g.y!==h.y||g.width!==h.width||g.height!==h.height)&&r(),h=g,m=requestAnimationFrame(v)}return r(),()=>{var g;c.forEach(_=>{o&&_.removeEventListener("scroll",r),i&&_.removeEventListener("resize",r)}),d?.(),(g=p)==null||g.disconnect(),p=null,u&&cancelAnimationFrame(m)}}var VNt=TNt;var WNt=ANt,KNt=ENt,JNt=MNt,GNt=PNt,oMe=ONt;var YNt=INt,iMe=(t,e,r)=>{let n=new Map,o={platform:HNt,...r},i={...o.platform,_c:n};return CNt(t,e,{...o,platform:i})};var ku=B(X(),1),Wie=B(X(),1),XNt=B(fs(),1),Hie=typeof document<"u"?Wie.useLayoutEffect:Wie.useEffect;function Vie(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!Vie(t[n],e[n]))return!1;return!0}if(o=Object.keys(t),r=o.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,o[n]))return!1;for(n=r;n--!==0;){let i=o[n];if(!(i==="_owner"&&t.$$typeof)&&!Vie(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function QNt(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function ZNt(t,e){let r=QNt(t);return Math.round(e*r)/r}function aMe(t){let e=ku.useRef(t);return Hie(()=>{e.current=t}),e}function gA(t){t===void 0&&(t={});let{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:u,open:l}=t,[c,d]=ku.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=ku.useState(n);Vie(f,n)||p(n);let[m,h]=ku.useState(null),[v,g]=ku.useState(null),_=ku.useCallback(V=>{V!==P.current&&(P.current=V,h(V))},[]),w=ku.useCallback(V=>{V!==E.current&&(E.current=V,g(V))},[]),x=i||m,C=a||v,P=ku.useRef(null),E=ku.useRef(null),A=ku.useRef(c),M=u!=null,R=aMe(u),N=aMe(o),L=aMe(l),k=ku.useCallback(()=>{if(!P.current||!E.current)return;let V={placement:e,strategy:r,middleware:f};N.current&&(V.platform=N.current),iMe(P.current,E.current,V).then(j=>{let z={...j,isPositioned:L.current!==!1};F.current&&!Vie(A.current,z)&&(A.current=z,XNt.flushSync(()=>{d(z)}))})},[f,e,r,N,L]);Hie(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(V=>({...V,isPositioned:!1})))},[l]);let F=ku.useRef(!1);Hie(()=>(F.current=!0,()=>{F.current=!1}),[]),Hie(()=>{if(x&&(P.current=x),C&&(E.current=C),x&&C){if(R.current)return R.current(x,C,k);k()}},[x,C,k,R,M]);let $=ku.useMemo(()=>({reference:P,floating:E,setReference:_,setFloating:w}),[_,w]),U=ku.useMemo(()=>({reference:x,floating:C}),[x,C]),J=ku.useMemo(()=>{let V={position:r,left:0,top:0};if(!U.floating)return V;let j=ZNt(U.floating,c.x),z=ZNt(U.floating,c.y);return s?{...V,transform:"translate("+j+"px, "+z+"px)",...QNt(U.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:j,top:z}},[r,s,U.floating,c.x,c.y]);return ku.useMemo(()=>({...c,update:k,refs:$,elements:U,floatingStyles:J}),[c,k,$,U,J])}var sln=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){let{element:n,padding:o}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?oMe({element:n.current,padding:o}).fn(r):{}:n?oMe({element:n,padding:o}).fn(r):{}}}},yA=(t,e)=>({...VNt(t),options:[t,e]}),bA=(t,e)=>({...WNt(t),options:[t,e]}),_A=(t,e)=>({...YNt(t),options:[t,e]}),vA=(t,e)=>({...KNt(t),options:[t,e]}),wA=(t,e)=>({...JNt(t),options:[t,e]});var SA=(t,e)=>({...GNt(t),options:[t,e]});var xA=(t,e)=>({...sln(t),options:[t,e]});var eLt=B(X(),1);var sMe=B(_t(),1),uln="Arrow",tLt=eLt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,sMe.jsx)(Ul.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,sMe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});tLt.displayName=uln;var rLt=tLt;var nLt=B(X(),1);function kh(t){let[e,r]=nLt.useState(void 0);return Qr(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});let n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let i=o[0],a,s;if("borderBoxSize"in i){let u=i.borderBoxSize,l=Array.isArray(u)?u[0]:u;a=l.inlineSize,s=l.blockSize}else a=t.offsetWidth,s=t.offsetHeight;r({width:a,height:s})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}var CA=B(_t(),1);var uMe="Popper",[oLt,lMe]=Ho(uMe),[cln,iLt]=oLt(uMe),aLt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=um.useState(null);return(0,CA.jsx)(cln,{scope:e,anchor:n,onAnchorChange:o,children:r})};aLt.displayName=uMe;var sLt="PopperAnchor",uLt=um.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=iLt(sLt,r),a=um.useRef(null),s=Tc(e,a);return um.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,CA.jsx)(Ul.div,{...o,ref:s})});uLt.displayName=sLt;var cMe="PopperContent",[dln,fln]=oLt(cMe),lLt=um.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,v=iLt(cMe,r),[g,_]=um.useState(null),w=Tc(e,oe=>_(oe)),[x,C]=um.useState(null),P=kh(x),E=P?.width??0,A=P?.height??0,M=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],L=N.length>0,k={padding:R,boundary:N.filter(mln),altBoundary:L},{refs:F,floatingStyles:$,placement:U,isPositioned:J,middlewareData:V}=gA({strategy:"fixed",placement:M,whileElementsMounted:(...oe)=>SO(...oe,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[yA({mainAxis:o+A,alignmentAxis:a}),u&&bA({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?_A():void 0,...k}),u&&vA({...k}),wA({...k,apply:({elements:oe,rects:Te,availableWidth:bt,availableHeight:xe})=>{let{width:Z,height:te}=Te.reference,Ee=oe.floating.style;Ee.setProperty("--radix-popper-available-width",`${bt}px`),Ee.setProperty("--radix-popper-available-height",`${xe}px`),Ee.setProperty("--radix-popper-anchor-width",`${Z}px`),Ee.setProperty("--radix-popper-anchor-height",`${te}px`)}}),x&&xA({element:x,padding:s}),hln({arrowWidth:E,arrowHeight:A}),f&&SA({strategy:"referenceHidden",...k})]}),[j,z]=fLt(U),W=rr(m);Qr(()=>{J&&W?.()},[J,W]);let K=V.arrow?.x,re=V.arrow?.y,De=V.arrow?.centerOffset!==0,[Y,Q]=um.useState();return Qr(()=>{g&&Q(window.getComputedStyle(g).zIndex)},[g]),(0,CA.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:J?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,CA.jsx)(dln,{scope:r,placedSide:j,onArrowChange:C,arrowX:K,arrowY:re,shouldHideArrow:De,children:(0,CA.jsx)(Ul.div,{"data-side":j,"data-align":z,...h,ref:w,style:{...h.style,animation:J?void 0:"none"}})})})});lLt.displayName=cMe;var cLt="PopperArrow",pln={top:"bottom",right:"left",bottom:"top",left:"right"},dLt=um.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=fln(cLt,n),a=pln[i.placedSide];return(0,CA.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,CA.jsx)(rLt,{...o,ref:r,style:{...o.style,display:"block"}})})});dLt.displayName=cLt;function mln(t){return t!==null}var hln=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=fLt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function fLt(t){let[e,r="center"]=t.split("-");return[e,r]}var dMe=aLt,pLt=uLt,mLt=lLt,hLt=dLt;var Kie=B(X(),1),gLt=B(fs(),1);var yLt=B(_t(),1),yln="Portal",fMe=Kie.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Kie.useState(!1);Qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?gLt.default.createPortal((0,yLt.jsx)(Ul.div,{...n,ref:e}),a):null});fMe.displayName=yln;var cp=B(X(),1);var _Lt=B(X(),1);function bLt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function bln(...t){return e=>{let r=!1,n=t.map(o=>{let i=bLt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():bLt(t[o],null)}}}}function vLt(...t){return _Lt.useCallback(bln(...t),t)}var wLt=B(X(),1);function _ln(t,e){return wLt.useReducer((r,n)=>e[r][n]??r,t)}var Bu=t=>{let{present:e,children:r}=t,n=vln(e),o=typeof r=="function"?r({present:n.isPresent}):cp.Children.only(r),i=vLt(n.ref,wln(o));return typeof r=="function"||n.isPresent?cp.cloneElement(o,{ref:i}):null};Bu.displayName="Presence";function vln(t){let[e,r]=cp.useState(),n=cp.useRef({}),o=cp.useRef(t),i=cp.useRef("none"),a=t?"mounted":"unmounted",[s,u]=_ln(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return cp.useEffect(()=>{let l=Jie(n.current);i.current=s==="mounted"?l:"none"},[s]),Qr(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Jie(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),Qr(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Jie(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let v=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=p=>{p.target===e&&(i.current=Jie(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(l),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:cp.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Jie(t){return t?.animationName||"none"}function wln(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var zl=B(X(),1);function Oj(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var OA=B(X(),1);var xLt=B(X(),1);function SLt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function pMe(...t){return e=>{let r=!1,n=t.map(o=>{let i=SLt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():SLt(t[o],null)}}}}function sV(...t){return xLt.useCallback(pMe(...t),t)}var Ic=B(X(),1);var C$=B(_t(),1),O$=Ic.forwardRef((t,e)=>{let{children:r,...n}=t,o=Ic.Children.toArray(r),i=o.find(xln);if(i){let a=i.props.children,s=o.map(u=>u===i?Ic.Children.count(a)>1?Ic.Children.only(null):Ic.isValidElement(a)?a.props.children:null:u);return(0,C$.jsx)(mMe,{...n,ref:e,children:Ic.isValidElement(a)?Ic.cloneElement(a,void 0,s):null})}return(0,C$.jsx)(mMe,{...n,ref:e,children:r})});O$.displayName="Slot";var mMe=Ic.forwardRef((t,e)=>{let{children:r,...n}=t;if(Ic.isValidElement(r)){let o=Oln(r);return Ic.cloneElement(r,{...Cln(n,r.props),ref:e?pMe(e,o):o})}return Ic.Children.count(r)>1?Ic.Children.only(null):null});mMe.displayName="SlotClone";var Sln=({children:t})=>(0,C$.jsx)(C$.Fragment,{children:t});function xln(t){return Ic.isValidElement(t)&&t.type===Sln}function Cln(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Oln(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Gie=B(_t(),1);function CLt(t){let e=t+"CollectionProvider",[r,n]=Ho(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,v=OA.default.useRef(null),g=OA.default.useRef(new Map).current;return(0,Gie.jsx)(o,{scope:m,itemMap:g,collectionRef:v,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=OA.default.forwardRef((p,m)=>{let{scope:h,children:v}=p,g=i(s,h),_=sV(m,g.collectionRef);return(0,Gie.jsx)(O$,{ref:_,children:v})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=OA.default.forwardRef((p,m)=>{let{scope:h,children:v,...g}=p,_=OA.default.useRef(null),w=sV(m,_),x=i(l,h);return OA.default.useEffect(()=>(x.itemMap.set(_,{ref:_,...g}),()=>void x.itemMap.delete(_))),(0,Gie.jsx)(O$,{[c]:"",ref:w,children:v})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return OA.default.useCallback(()=>{let v=m.collectionRef.current;if(!v)return[];let g=Array.from(v.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,C)=>g.indexOf(x.ref.current)-g.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var OLt=B(X(),1),Eln=B(fs(),1);var ELt=B(_t(),1),Pln=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],hMe=Pln.reduce((t,e)=>{let r=OLt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?O$:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,ELt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var EA=B(_t(),1),gMe="rovingFocusGroup.onEntryFocus",Tln={bubbles:!1,cancelable:!0},Yie="RovingFocusGroup",[yMe,PLt,Aln]=CLt(Yie),[Iln,bMe]=Ho(Yie,[Aln]),[Mln,Rln]=Iln(Yie),TLt=zl.forwardRef((t,e)=>(0,EA.jsx)(yMe.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,EA.jsx)(yMe.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,EA.jsx)(jln,{...t,ref:e})})}));TLt.displayName=Yie;var jln=zl.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:u,onEntryFocus:l,preventScrollOnEntryFocus:c=!1,...d}=t,f=zl.useRef(null),p=sV(e,f),m=pA(i),[h=null,v]=cl({prop:a,defaultProp:s,onChange:u}),[g,_]=zl.useState(!1),w=rr(l),x=PLt(r),C=zl.useRef(!1),[P,E]=zl.useState(0);return zl.useEffect(()=>{let A=f.current;if(A)return A.addEventListener(gMe,w),()=>A.removeEventListener(gMe,w)},[w]),(0,EA.jsx)(Mln,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:zl.useCallback(A=>v(A),[v]),onItemShiftTab:zl.useCallback(()=>_(!0),[]),onFocusableItemAdd:zl.useCallback(()=>E(A=>A+1),[]),onFocusableItemRemove:zl.useCallback(()=>E(A=>A-1),[]),children:(0,EA.jsx)(hMe.div,{tabIndex:g||P===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:Oj(t.onMouseDown,()=>{C.current=!0}),onFocus:Oj(t.onFocus,A=>{let M=!C.current;if(A.target===A.currentTarget&&M&&!g){let R=new CustomEvent(gMe,Tln);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){let N=x().filter(U=>U.focusable),L=N.find(U=>U.active),k=N.find(U=>U.id===h),$=[L,k,...N].filter(Boolean).map(U=>U.ref.current);MLt($,c)}}C.current=!1}),onBlur:Oj(t.onBlur,()=>_(!1))})})}),ALt="RovingFocusGroupItem",ILt=zl.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=t,s=za(),u=i||s,l=Rln(ALt,r),c=l.currentTabStopId===u,d=PLt(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return zl.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,EA.jsx)(yMe.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,EA.jsx)(hMe.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:e,onMouseDown:Oj(t.onMouseDown,m=>{n?l.onItemFocus(u):m.preventDefault()}),onFocus:Oj(t.onFocus,()=>l.onItemFocus(u)),onKeyDown:Oj(t.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){l.onItemShiftTab();return}if(m.target!==m.currentTarget)return;let h=Lln(m,l.orientation,l.dir);if(h!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let g=d().filter(_=>_.focusable).map(_=>_.ref.current);if(h==="last")g.reverse();else if(h==="prev"||h==="next"){h==="prev"&&g.reverse();let _=g.indexOf(m.currentTarget);g=l.loop?Fln(g,_+1):g.slice(_+1)}setTimeout(()=>MLt(g))}})})})});ILt.displayName=ALt;var Dln={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Nln(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Lln(t,e,r){let n=Nln(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Dln[n]}function MLt(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function Fln(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var RLt=TLt,jLt=ILt;var Bln=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},E$=new WeakMap,Zie=new WeakMap,Xie={},_Me=0,DLt=function(t){return t&&(t.host||DLt(t.parentNode))},$ln=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=DLt(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},qln=function(t,e,r,n){var o=$ln(e,Array.isArray(t)?t:[t]);Xie[r]||(Xie[r]=new WeakMap);var i=Xie[r],a=[],s=new Set,u=new Set(o),l=function(d){!d||s.has(d)||(s.add(d),l(d.parentNode))};o.forEach(l);var c=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))c(f);else try{var p=f.getAttribute(n),m=p!==null&&p!=="false",h=(E$.get(f)||0)+1,v=(i.get(f)||0)+1;E$.set(f,h),i.set(f,v),a.push(f),h===1&&m&&Zie.set(f,!0),v===1&&f.setAttribute(r,"true"),m||f.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(e),s.clear(),_Me++,function(){a.forEach(function(d){var f=E$.get(d)-1,p=i.get(d)-1;E$.set(d,f),i.set(d,p),f||(Zie.has(d)||d.removeAttribute(n),Zie.delete(d)),p||d.removeAttribute(r)}),_Me--,_Me||(E$=new WeakMap,E$=new WeakMap,Zie=new WeakMap,Xie={})}},PA=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||Bln(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),qln(n,o,r,"aria-hidden")):function(){return null}};var Vo=function(){return Vo=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Vo.apply(this,arguments)};function TA(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function P$(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}var nae=B(X());var wd=B(X());var ly="right-scroll-bar-position",cy="width-before-scroll-bar",vMe="with-scroll-bars-hidden",wMe="--removed-body-scroll-bar-size";function Qie(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var NLt=B(X());function LLt(t,e){var r=(0,NLt.useState)(function(){return{value:t,callback:e,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=e,r.facade}var eae=B(X());var Uln=typeof window<"u"?eae.useLayoutEffect:eae.useEffect,FLt=new WeakMap;function Ej(t,e){var r=LLt(e||null,function(n){return t.forEach(function(o){return Qie(o,n)})});return Uln(function(){var n=FLt.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||Qie(s,null)}),i.forEach(function(s){o.has(s)||Qie(s,a)})}FLt.set(r,t)},[t]),r}function zln(t){return t}function Hln(t,e){e===void 0&&(e=zln);var r=[],n=!1,o={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:t},useMedium:function(i){var a=e(i,n);return r.push(a),function(){r=r.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(n=!0;r.length;){var a=r;r=[],a.forEach(i)}r={push:function(s){return i(s)},filter:function(){return r}}},assignMedium:function(i){n=!0;var a=[];if(r.length){var s=r;r=[],s.forEach(i),a=r}var u=function(){var c=a;a=[],c.forEach(i)},l=function(){return Promise.resolve().then(u)};l(),r={push:function(c){a.push(c),l()},filter:function(c){return a=a.filter(c),r}}}};return o}function Pj(t){t===void 0&&(t={});var e=Hln(null);return e.options=Vo({async:!0,ssr:!1},t),e}var kLt=B(X()),BLt=function(t){var e=t.sideCar,r=TA(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return kLt.createElement(n,Vo({},r))};BLt.isSideCarExport=!0;function Tj(t,e){return t.useMedium(e),BLt}var tae=Pj();var SMe=function(){},uV=wd.forwardRef(function(t,e){var r=wd.useRef(null),n=wd.useState({onScrollCapture:SMe,onWheelCapture:SMe,onTouchMoveCapture:SMe}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,v=t.as,g=v===void 0?"div":v,_=t.gapMode,w=TA(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,C=Ej([r,e]),P=Vo(Vo({},w),o);return wd.createElement(wd.Fragment,null,c&&wd.createElement(x,{sideCar:tae,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:_}),a?wd.cloneElement(wd.Children.only(s),Vo(Vo({},P),{ref:C})):wd.createElement(g,Vo({},P,{className:u,ref:C}),s))});uV.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};uV.classNames={fullWidth:cy,zeroRight:ly};var Bi=B(X());var A$=B(X());var ULt=B(X());var $Lt;var qLt=function(){if($Lt)return $Lt;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Vln(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=qLt();return e&&t.setAttribute("nonce",e),t}function Wln(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Kln(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var xMe=function(){var t=0,e=null;return{add:function(r){t==0&&(e=Vln())&&(Wln(e,r),Kln(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var CMe=function(){var t=xMe();return function(e,r){ULt.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var xO=function(){var t=CMe(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var Jln={left:0,top:0,right:0,gap:0},OMe=function(t){return parseInt(t||"",10)||0},Gln=function(t){var e=window.getComputedStyle(document.body),r=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[OMe(r),OMe(n),OMe(o)]},EMe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Jln;var e=Gln(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}};var Yln=xO(),T$="data-scroll-locked",Zln=function(t,e,r,n){var o=t.left,i=t.top,a=t.right,s=t.gap;return r===void 0&&(r="margin"),`
.`.concat(vMe,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(s,"px ").concat(n,`;
}
body[`).concat(T$,`] {
overflow: hidden `).concat(n,`;
overscroll-behavior: contain;
`).concat([e&&"position: relative ".concat(n,";"),r==="margin"&&`
padding-left: `.concat(o,`px;
padding-top: `).concat(i,`px;
padding-right: `).concat(a,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(s,"px ").concat(n,`;
`),r==="padding"&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),`
}
.`).concat(ly,` {
right: `).concat(s,"px ").concat(n,`;
}
.`).concat(cy,` {
margin-right: `).concat(s,"px ").concat(n,`;
}
.`).concat(ly," .").concat(ly,` {
right: 0 `).concat(n,`;
}
.`).concat(cy," .").concat(cy,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(T$,`] {
`).concat(wMe,": ").concat(s,`px;
}
`)},zLt=function(){var t=parseInt(document.body.getAttribute(T$)||"0",10);return isFinite(t)?t:0},Xln=function(){A$.useEffect(function(){return document.body.setAttribute(T$,(zLt()+1).toString()),function(){var t=zLt()-1;t<=0?document.body.removeAttribute(T$):document.body.setAttribute(T$,t.toString())}},[])},Aj=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;Xln();var i=A$.useMemo(function(){return EMe(o)},[o]);return A$.createElement(Yln,{styles:Zln(i,!e,o,r?"":"!important")})};var PMe=!1;if(typeof window<"u")try{lV=Object.defineProperty({},"passive",{get:function(){return PMe=!0,!0}}),window.addEventListener("test",lV,lV),window.removeEventListener("test",lV,lV)}catch{PMe=!1}var lV,Ij=PMe?{passive:!1}:!1;var Qln=function(t){return t.tagName==="TEXTAREA"},HLt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Qln(t)&&r[e]==="visible")},ecn=function(t){return HLt(t,"overflowY")},tcn=function(t){return HLt(t,"overflowX")},TMe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=VLt(t,n);if(o){var i=WLt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},rcn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},ncn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},VLt=function(t,e){return t==="v"?ecn(e):tcn(e)},WLt=function(t,e){return t==="v"?rcn(e):ncn(e)},ocn=function(t,e){return t==="h"&&e==="rtl"?-1:1},KLt=function(t,e,r,n,o){var i=ocn(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=WLt(t,s),m=p[0],h=p[1],v=p[2],g=h-v-i*m;(m||g)&&VLt(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var rae=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},JLt=function(t){return[t.deltaX,t.deltaY]},GLt=function(t){return t&&"current"in t?t.current:t},icn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},acn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},scn=0,I$=[];function YLt(t){var e=Bi.useRef([]),r=Bi.useRef([0,0]),n=Bi.useRef(),o=Bi.useState(scn++)[0],i=Bi.useState(xO)[0],a=Bi.useRef(t);Bi.useEffect(function(){a.current=t},[t]),Bi.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=P$([t.lockRef.current],(t.shards||[]).map(GLt),!0).filter(Boolean);return h.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Bi.useCallback(function(h,v){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=rae(h),_=r.current,w="deltaX"in h?h.deltaX:_[0]-g[0],x="deltaY"in h?h.deltaY:_[1]-g[1],C,P=h.target,E=Math.abs(w)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=TMe(E,P);if(!A)return!0;if(A?C=E:(C=E==="v"?"h":"v",A=TMe(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(w||x)&&(n.current=C),!C)return!0;var M=n.current||C;return KLt(M,v,h,M==="h"?w:x,!0)},[]),u=Bi.useCallback(function(h){var v=h;if(!(!I$.length||I$[I$.length-1]!==i)){var g="deltaY"in v?JLt(v):rae(v),_=e.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&icn(C.delta,g)})[0];if(_&&_.should){v.cancelable&&v.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(GLt).filter(Boolean).filter(function(C){return C.contains(v.target)}),x=w.length>0?s(v,w[0]):!a.current.noIsolation;x&&v.cancelable&&v.preventDefault()}}},[]),l=Bi.useCallback(function(h,v,g,_){var w={name:h,delta:v,target:g,should:_,shadowParent:ucn(g)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(x){return x!==w})},1)},[]),c=Bi.useCallback(function(h){r.current=rae(h),n.current=void 0},[]),d=Bi.useCallback(function(h){l(h.type,JLt(h),h.target,s(h,t.lockRef.current))},[]),f=Bi.useCallback(function(h){l(h.type,rae(h),h.target,s(h,t.lockRef.current))},[]);Bi.useEffect(function(){return I$.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,Ij),document.addEventListener("touchmove",u,Ij),document.addEventListener("touchstart",c,Ij),function(){I$=I$.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,Ij),document.removeEventListener("touchmove",u,Ij),document.removeEventListener("touchstart",c,Ij)}},[]);var p=t.removeScrollBar,m=t.inert;return Bi.createElement(Bi.Fragment,null,m?Bi.createElement(i,{styles:acn(o)}):null,p?Bi.createElement(Aj,{gapMode:t.gapMode}):null)}function ucn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var ZLt=Tj(tae,YLt);var XLt=nae.forwardRef(function(t,e){return nae.createElement(uV,Vo({},t,{ref:e,sideCar:ZLt}))});XLt.classNames=uV.classNames;var AMe=XLt;var pr=B(_t(),1),IMe=["Enter"," "],lcn=["ArrowDown","PageUp","Home"],eFt=["ArrowUp","PageDown","End"],ccn=[...lcn,...eFt],dcn={ltr:[...IMe,"ArrowRight"],rtl:[...IMe,"ArrowLeft"]},fcn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},pV="Menu",[dV,pcn,mcn]=QDt(pV),[Mj,MMe]=Ho(pV,[mcn,lMe,bMe]),mV=lMe(),tFt=bMe(),[rFt,AA]=Mj(pV),[hcn,hV]=Mj(pV),nFt=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=mV(e),[u,l]=Mt.useState(null),c=Mt.useRef(!1),d=rr(i),f=pA(o);return Mt.useEffect(()=>{let p=()=>{c.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>c.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),(0,pr.jsx)(dMe,{...s,children:(0,pr.jsx)(rFt,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,pr.jsx)(hcn,{scope:e,onClose:Mt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};nFt.displayName=pV;var gcn="MenuAnchor",RMe=Mt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=mV(r);return(0,pr.jsx)(pLt,{...o,...n,ref:e})});RMe.displayName=gcn;var jMe="MenuPortal",[ycn,oFt]=Mj(jMe,{forceMount:void 0}),iFt=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=AA(jMe,e);return(0,pr.jsx)(ycn,{scope:e,forceMount:r,children:(0,pr.jsx)(Bu,{present:r||i.open,children:(0,pr.jsx)(fMe,{asChild:!0,container:o,children:n})})})};iFt.displayName=jMe;var Bh="MenuContent",[bcn,DMe]=Mj(Bh),aFt=Mt.forwardRef((t,e)=>{let r=oFt(Bh,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=AA(Bh,t.__scopeMenu),a=hV(Bh,t.__scopeMenu);return(0,pr.jsx)(dV.Provider,{scope:t.__scopeMenu,children:(0,pr.jsx)(Bu,{present:n||i.open,children:(0,pr.jsx)(dV.Slot,{scope:t.__scopeMenu,children:a.modal?(0,pr.jsx)(_cn,{...o,ref:e}):(0,pr.jsx)(vcn,{...o,ref:e})})})})}),_cn=Mt.forwardRef((t,e)=>{let r=AA(Bh,t.__scopeMenu),n=Mt.useRef(null),o=Tc(e,n);return Mt.useEffect(()=>{let i=n.current;if(i)return PA(i)},[]),(0,pr.jsx)(NMe,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:wi(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),vcn=Mt.forwardRef((t,e)=>{let r=AA(Bh,t.__scopeMenu);return(0,pr.jsx)(NMe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),NMe=Mt.forwardRef((t,e)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=t,v=AA(Bh,r),g=hV(Bh,r),_=mV(r),w=tFt(r),x=pcn(r),[C,P]=Mt.useState(null),E=Mt.useRef(null),A=Tc(e,E,v.onContentChange),M=Mt.useRef(0),R=Mt.useRef(""),N=Mt.useRef(0),L=Mt.useRef(null),k=Mt.useRef("right"),F=Mt.useRef(0),$=m?AMe:Mt.Fragment,U=m?{as:dA,allowPinchZoom:!0}:void 0,J=j=>{let z=R.current+j,W=x().filter(oe=>!oe.disabled),K=document.activeElement,re=W.find(oe=>oe.ref.current===K)?.textValue,De=W.map(oe=>oe.textValue),Y=jcn(De,z,re),Q=W.find(oe=>oe.textValue===Y)?.ref.current;(function oe(Te){R.current=Te,window.clearTimeout(M.current),Te!==""&&(M.current=window.setTimeout(()=>oe(""),1e3))})(z),Q&&setTimeout(()=>Q.focus())};Mt.useEffect(()=>()=>window.clearTimeout(M.current),[]),mA();let V=Mt.useCallback(j=>k.current===L.current?.side&&Ncn(j,L.current?.area),[]);return(0,pr.jsx)(bcn,{scope:r,searchRef:R,onItemEnter:Mt.useCallback(j=>{V(j)&&j.preventDefault()},[V]),onItemLeave:Mt.useCallback(j=>{V(j)||(E.current?.focus(),P(null))},[V]),onTriggerLeave:Mt.useCallback(j=>{V(j)&&j.preventDefault()},[V]),pointerGraceTimerRef:N,onPointerGraceIntentChange:Mt.useCallback(j=>{L.current=j},[]),children:(0,pr.jsx)($,{...U,children:(0,pr.jsx)(QIe,{asChild:!0,trapped:o,onMountAutoFocus:wi(i,j=>{j.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,pr.jsx)(GIe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,pr.jsx)(RLt,{asChild:!0,...w,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:C,onCurrentTabStopIdChange:P,onEntryFocus:wi(u,j=>{g.isUsingKeyboardRef.current||j.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,pr.jsx)(mLt,{role:"menu","aria-orientation":"vertical","data-state":SFt(v.open),"data-radix-menu-content":"",dir:g.dir,..._,...h,ref:A,style:{outline:"none",...h.style},onKeyDown:wi(h.onKeyDown,j=>{let W=j.target.closest("[data-radix-menu-content]")===j.currentTarget,K=j.ctrlKey||j.altKey||j.metaKey,re=j.key.length===1;W&&(j.key==="Tab"&&j.preventDefault(),!K&&re&&J(j.key));let De=E.current;if(j.target!==De||!ccn.includes(j.key))return;j.preventDefault();let Q=x().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);eFt.includes(j.key)&&Q.reverse(),Mcn(Q)}),onBlur:wi(t.onBlur,j=>{j.currentTarget.contains(j.target)||(window.clearTimeout(M.current),R.current="")}),onPointerMove:wi(t.onPointerMove,fV(j=>{let z=j.target,W=F.current!==j.clientX;if(j.currentTarget.contains(z)&&W){let K=j.clientX>F.current?"right":"left";k.current=K,F.current=j.clientX}}))})})})})})})});aFt.displayName=Bh;var wcn="MenuGroup",LMe=Mt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,pr.jsx)(Ul.div,{role:"group",...n,ref:e})});LMe.displayName=wcn;var Scn="MenuLabel",sFt=Mt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,pr.jsx)(Ul.div,{...n,ref:e})});sFt.displayName=Scn;var oae="MenuItem",QLt="menu.itemSelect",aae=Mt.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=Mt.useRef(null),a=hV(oae,t.__scopeMenu),s=DMe(oae,t.__scopeMenu),u=Tc(e,i),l=Mt.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(QLt,{bubbles:!0,cancelable:!0});d.addEventListener(QLt,p=>n?.(p),{once:!0}),jie(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,pr.jsx)(uFt,{...o,ref:u,disabled:r,onClick:wi(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:wi(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:wi(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||IMe.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});aae.displayName=oae;var uFt=Mt.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=DMe(oae,r),s=tFt(r),u=Mt.useRef(null),l=Tc(e,u),[c,d]=Mt.useState(!1),[f,p]=Mt.useState("");return Mt.useEffect(()=>{let m=u.current;m&&p((m.textContent??"").trim())},[i.children]),(0,pr.jsx)(dV.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,pr.jsx)(jLt,{asChild:!0,...s,focusable:!n,children:(0,pr.jsx)(Ul.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:wi(t.onPointerMove,fV(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:wi(t.onPointerLeave,fV(m=>a.onItemLeave(m))),onFocus:wi(t.onFocus,()=>d(!0)),onBlur:wi(t.onBlur,()=>d(!1))})})})}),xcn="MenuCheckboxItem",lFt=Mt.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,pr.jsx)(mFt,{scope:t.__scopeMenu,checked:r,children:(0,pr.jsx)(aae,{role:"menuitemcheckbox","aria-checked":iae(r)?"mixed":r,...o,ref:e,"data-state":BMe(r),onSelect:wi(o.onSelect,()=>n?.(iae(r)?!0:!r),{checkForDefaultPrevented:!1})})})});lFt.displayName=xcn;var cFt="MenuRadioGroup",[Ccn,Ocn]=Mj(cFt,{value:void 0,onValueChange:()=>{}}),dFt=Mt.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=rr(n);return(0,pr.jsx)(Ccn,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,pr.jsx)(LMe,{...o,ref:e})})});dFt.displayName=cFt;var fFt="MenuRadioItem",pFt=Mt.forwardRef((t,e)=>{let{value:r,...n}=t,o=Ocn(fFt,t.__scopeMenu),i=r===o.value;return(0,pr.jsx)(mFt,{scope:t.__scopeMenu,checked:i,children:(0,pr.jsx)(aae,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":BMe(i),onSelect:wi(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});pFt.displayName=fFt;var FMe="MenuItemIndicator",[mFt,Ecn]=Mj(FMe,{checked:!1}),hFt=Mt.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=Ecn(FMe,r);return(0,pr.jsx)(Bu,{present:n||iae(i.checked)||i.checked===!0,children:(0,pr.jsx)(Ul.span,{...o,ref:e,"data-state":BMe(i.checked)})})});hFt.displayName=FMe;var Pcn="MenuSeparator",gFt=Mt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,pr.jsx)(Ul.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});gFt.displayName=Pcn;var Tcn="MenuArrow",yFt=Mt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=mV(r);return(0,pr.jsx)(hLt,{...o,...n,ref:e})});yFt.displayName=Tcn;var kMe="MenuSub",[Acn,bFt]=Mj(kMe),Icn=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=AA(kMe,e),a=mV(e),[s,u]=Mt.useState(null),[l,c]=Mt.useState(null),d=rr(o);return Mt.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,pr.jsx)(dMe,{...a,children:(0,pr.jsx)(rFt,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,pr.jsx)(Acn,{scope:e,contentId:za(),triggerId:za(),trigger:s,onTriggerChange:u,children:r})})})};Icn.displayName=kMe;var cV="MenuSubTrigger",_Ft=Mt.forwardRef((t,e)=>{let r=AA(cV,t.__scopeMenu),n=hV(cV,t.__scopeMenu),o=bFt(cV,t.__scopeMenu),i=DMe(cV,t.__scopeMenu),a=Mt.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=Mt.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return Mt.useEffect(()=>c,[c]),Mt.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,pr.jsx)(RMe,{asChild:!0,...l,children:(0,pr.jsx)(uFt,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":SFt(r.open),...t,ref:tV(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:wi(t.onPointerMove,fV(d=>{i.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!r.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),c()},100))})),onPointerLeave:wi(t.onPointerLeave,fV(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,m=p==="right",h=m?-5:5,v=f[m?"left":"right"],g=f[m?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:v,y:f.top},{x:g,y:f.top},{x:g,y:f.bottom},{x:v,y:f.bottom}],side:p}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:wi(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||dcn[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});_Ft.displayName=cV;var vFt="MenuSubContent",wFt=Mt.forwardRef((t,e)=>{let r=oFt(Bh,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=AA(Bh,t.__scopeMenu),a=hV(Bh,t.__scopeMenu),s=bFt(vFt,t.__scopeMenu),u=Mt.useRef(null),l=Tc(e,u);return(0,pr.jsx)(dV.Provider,{scope:t.__scopeMenu,children:(0,pr.jsx)(Bu,{present:n||i.open,children:(0,pr.jsx)(dV.Slot,{scope:t.__scopeMenu,children:(0,pr.jsx)(NMe,{id:s.contentId,"aria-labelledby":s.triggerId,...o,ref:l,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{a.isUsingKeyboardRef.current&&u.current?.focus(),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:wi(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:wi(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:wi(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=fcn[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});wFt.displayName=vFt;function SFt(t){return t?"open":"closed"}function iae(t){return t==="indeterminate"}function BMe(t){return iae(t)?"indeterminate":t?"checked":"unchecked"}function Mcn(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function Rcn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function jcn(t,e,r){let o=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=r?t.indexOf(r):-1,a=Rcn(t,Math.max(i,0));o.length===1&&(a=a.filter(l=>l!==r));let u=a.find(l=>l.toLowerCase().startsWith(o.toLowerCase()));return u!==r?u:void 0}function Dcn(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let s=e[i].x,u=e[i].y,l=e[a].x,c=e[a].y;u>n!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(o=!o)}return o}function Ncn(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return Dcn(r,e)}function fV(t){return e=>e.pointerType==="mouse"?t(e):void 0}var xFt=nFt,CFt=RMe,OFt=iFt,EFt=aFt,PFt=LMe,TFt=sFt,AFt=aae,IFt=lFt,MFt=dFt,RFt=pFt,jFt=hFt,DFt=gFt,NFt=yFt;var LFt=_Ft,FFt=wFt;var Hl=B(_t(),1),$Me="DropdownMenu",[Fcn,A5o]=Ho($Me,[MMe]),sf=MMe(),[kcn,kFt]=Fcn($Me),gV=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=sf(e),l=dl.useRef(null),[c=!1,d]=cl({prop:o,defaultProp:i,onChange:a});return(0,Hl.jsx)(kcn,{scope:e,triggerId:za(),triggerRef:l,contentId:za(),open:c,onOpenChange:d,onOpenToggle:dl.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,Hl.jsx)(xFt,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};gV.displayName=$Me;var BFt="DropdownMenuTrigger",yV=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=kFt(BFt,r),a=sf(r);return(0,Hl.jsx)(CFt,{asChild:!0,...a,children:(0,Hl.jsx)(YDt.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...o,ref:Iie(e,i.triggerRef),onPointerDown:eV(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:eV(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});yV.displayName=BFt;var Bcn="DropdownMenuPortal",$Ft=t=>{let{__scopeDropdownMenu:e,...r}=t,n=sf(e);return(0,Hl.jsx)(OFt,{...n,...r})};$Ft.displayName=Bcn;var qFt="DropdownMenuContent",UFt=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=kFt(qFt,r),i=sf(r),a=dl.useRef(!1);return(0,Hl.jsx)(EFt,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:eV(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:eV(t.onInteractOutside,s=>{let u=s.detail.originalEvent,l=u.button===0&&u.ctrlKey===!0,c=u.button===2||l;(!o.modal||c)&&(a.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});UFt.displayName=qFt;var $cn="DropdownMenuGroup",qcn=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(PFt,{...o,...n,ref:e})});qcn.displayName=$cn;var Ucn="DropdownMenuLabel",zFt=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(TFt,{...o,...n,ref:e})});zFt.displayName=Ucn;var zcn="DropdownMenuItem",HFt=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(AFt,{...o,...n,ref:e})});HFt.displayName=zcn;var Hcn="DropdownMenuCheckboxItem",VFt=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(IFt,{...o,...n,ref:e})});VFt.displayName=Hcn;var Vcn="DropdownMenuRadioGroup",Wcn=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(MFt,{...o,...n,ref:e})});Wcn.displayName=Vcn;var Kcn="DropdownMenuRadioItem",WFt=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(RFt,{...o,...n,ref:e})});WFt.displayName=Kcn;var Jcn="DropdownMenuItemIndicator",KFt=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(jFt,{...o,...n,ref:e})});KFt.displayName=Jcn;var Gcn="DropdownMenuSeparator",JFt=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(DFt,{...o,...n,ref:e})});JFt.displayName=Gcn;var Ycn="DropdownMenuArrow",Zcn=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(NFt,{...o,...n,ref:e})});Zcn.displayName=Ycn;var Xcn="DropdownMenuSubTrigger",GFt=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(LFt,{...o,...n,ref:e})});GFt.displayName=Xcn;var Qcn="DropdownMenuSubContent",YFt=dl.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=sf(r);return(0,Hl.jsx)(FFt,{...o,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});YFt.displayName=Qcn;var ZFt=gV,XFt=yV,QFt=$Ft,qMe=UFt;var UMe=zFt,zMe=HFt,HMe=VFt;var VMe=WFt,WMe=KFt,KMe=JFt;var JMe=GFt,GMe=YFt;var mi=B(X());var M$=ZFt,R$=XFt;var tdn=mi.forwardRef(({className:t,inset:e,children:r,...n},o)=>mi.createElement(JMe,{ref:o,className:Ce("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-dropdown-hover data-[state=open]:bg-dropdown-hover [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",t),...n},r,mi.createElement(_x,{className:"ml-auto"})));tdn.displayName=JMe.displayName;var rdn=mi.forwardRef(({className:t,...e},r)=>mi.createElement(GMe,{ref:r,className:Ce("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-primary p-1 text-normal shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));rdn.displayName=GMe.displayName;var OS=mi.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>mi.createElement(QFt,{container:r??activeDocument.body},mi.createElement(qMe,{ref:o,sideOffset:e,className:Ce("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border border-solid bg-primary p-1 text-normal shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})));OS.displayName=qMe.displayName;var os=mi.forwardRef(({className:t,inset:e,...r},n)=>mi.createElement(zMe,{ref:n,className:Ce("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-dropdown-hover focus:text-normal data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",e&&"pl-8",t),...r}));os.displayName=zMe.displayName;var ndn=mi.forwardRef(({className:t,children:e,checked:r,...n},o)=>mi.createElement(HMe,{ref:o,className:Ce("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-dropdown-hover focus:text-normal data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...n},mi.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},mi.createElement(WMe,null,mi.createElement(yg,{className:"h-4 w-4"}))),e));ndn.displayName=HMe.displayName;var odn=mi.forwardRef(({className:t,children:e,...r},n)=>mi.createElement(VMe,{ref:n,className:Ce("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-dropdown-hover focus:text-normal data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r},mi.createElement("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},mi.createElement(WMe,null,mi.createElement(fz,{className:"h-2 w-2 fill-current"}))),e));odn.displayName=VMe.displayName;var idn=mi.forwardRef(({className:t,inset:e,...r},n)=>mi.createElement(UMe,{ref:n,className:Ce("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...r}));idn.displayName=UMe.displayName;var adn=mi.forwardRef(({className:t,...e},r)=>mi.createElement(KMe,{ref:r,className:Ce("-mx-1 my-1 h-px bg-muted",t),...e}));adn.displayName=KMe.displayName;var sdn=({className:t,...e})=>mi.createElement("span",{className:Ce("ml-auto text-xs tracking-widest opacity-60",t),...e});sdn.displayName="DropdownMenuShortcut";var bV=B(X());var j$=bV.forwardRef(({checked:t=!1,onCheckedChange:e,disabled:r=!1,className:n,...o},i)=>{let a=()=>{r||e?.(!t)},s=u=>{r||(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),e?.(!t))};return bV.createElement("div",{role:"switch","aria-checked":t,"aria-disabled":r,"data-state":t?"checked":"unchecked","data-disabled":r?"":void 0,ref:i,tabIndex:r?-1:0,className:Ce("relative inline-flex h-5.5 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t?"bg-interactive-accent":"bg-[--background-modifier-border-hover]",r&&"cursor-not-allowed opacity-50",n),onClick:a,onKeyDown:s,...o},bV.createElement("div",{className:Ce("pointer-events-none block h-4 w-4 rounded-full bg-toggle-thumb shadow-lg ring-0 transition-transform",t?"translate-x-5.5":"translate-x-0.5")}))});j$.displayName="SettingSwitch";var vV=B(X());var Nr=B(X(),1);function dy(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var tkt=B(X(),1);function ekt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function YMe(...t){return e=>{let r=!1,n=t.map(o=>{let i=ekt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():ekt(t[o],null)}}}}function CO(...t){return tkt.useCallback(YMe(...t),t)}var Oa=B(X(),1);var rkt=B(X(),1),nkt=B(fs(),1);var Mc=B(X(),1);var D$=B(_t(),1),XMe=Mc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Mc.Children.toArray(r),i=o.find(udn);if(i){let a=i.props.children,s=o.map(u=>u===i?Mc.Children.count(a)>1?Mc.Children.only(null):Mc.isValidElement(a)?a.props.children:null:u);return(0,D$.jsx)(ZMe,{...n,ref:e,children:Mc.isValidElement(a)?Mc.cloneElement(a,void 0,s):null})}return(0,D$.jsx)(ZMe,{...n,ref:e,children:r})});XMe.displayName="Slot";var ZMe=Mc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Mc.isValidElement(r)){let o=cdn(r);return Mc.cloneElement(r,{...ldn(n,r.props),ref:e?YMe(e,o):o})}return Mc.Children.count(r)>1?Mc.Children.only(null):null});ZMe.displayName="SlotClone";var QMe=({children:t})=>(0,D$.jsx)(D$.Fragment,{children:t});function udn(t){return Mc.isValidElement(t)&&t.type===QMe}function ldn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function cdn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var okt=B(_t(),1),ddn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],$h=ddn.reduce((t,e)=>{let r=rkt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?XMe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,okt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function ikt(t,e){t&&nkt.flushSync(()=>t.dispatchEvent(e))}var tRe=B(_t(),1),fdn="DismissableLayer",eRe="dismissableLayer.update",pdn="dismissableLayer.pointerDownOutside",mdn="dismissableLayer.focusOutside",akt,ukt=Oa.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),rRe=Oa.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Oa.useContext(ukt),[c,d]=Oa.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Oa.useState({}),m=CO(e,E=>d(E)),h=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(v),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,C=ydn(E=>{let A=E.target,M=[...l.branches].some(R=>R.contains(A));!x||M||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=bdn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return wS(E=>{_===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Oa.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(akt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),skt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=akt)}},[c,f,r,l]),Oa.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),skt())},[c,l]),Oa.useEffect(()=>{let E=()=>p({});return document.addEventListener(eRe,E),()=>document.removeEventListener(eRe,E)},[]),(0,tRe.jsx)($h.div,{...u,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:dy(t.onFocusCapture,P.onFocusCapture),onBlurCapture:dy(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:dy(t.onPointerDownCapture,C.onPointerDownCapture)})});rRe.displayName=fdn;var hdn="DismissableLayerBranch",gdn=Oa.forwardRef((t,e)=>{let r=Oa.useContext(ukt),n=Oa.useRef(null),o=CO(e,n);return Oa.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,tRe.jsx)($h.div,{...t,ref:o})});gdn.displayName=hdn;function ydn(t,e=globalThis?.document){let r=rr(t),n=Oa.useRef(!1),o=Oa.useRef(()=>{});return Oa.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){lkt(pdn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function bdn(t,e=globalThis?.document){let r=rr(t),n=Oa.useRef(!1);return Oa.useEffect(()=>{let o=i=>{i.target&&!n.current&&lkt(mdn,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function skt(){let t=new CustomEvent(eRe);document.dispatchEvent(t)}function lkt(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?ikt(o,i):o.dispatchEvent(i)}var lm=B(X(),1);var ckt=B(X(),1);var nRe=B(_t(),1),_dn="Arrow",dkt=ckt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,nRe.jsx)($h.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,nRe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});dkt.displayName=_dn;var fkt=dkt;var IA=B(_t(),1);var oRe="Popper",[pkt,iRe]=Ho(oRe),[wdn,mkt]=pkt(oRe),hkt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=lm.useState(null);return(0,IA.jsx)(wdn,{scope:e,anchor:n,onAnchorChange:o,children:r})};hkt.displayName=oRe;var gkt="PopperAnchor",ykt=lm.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=mkt(gkt,r),a=lm.useRef(null),s=CO(e,a);return lm.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,IA.jsx)($h.div,{...o,ref:s})});ykt.displayName=gkt;var aRe="PopperContent",[Sdn,xdn]=pkt(aRe),bkt=lm.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,v=mkt(aRe,r),[g,_]=lm.useState(null),w=CO(e,oe=>_(oe)),[x,C]=lm.useState(null),P=kh(x),E=P?.width??0,A=P?.height??0,M=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],L=N.length>0,k={padding:R,boundary:N.filter(Odn),altBoundary:L},{refs:F,floatingStyles:$,placement:U,isPositioned:J,middlewareData:V}=gA({strategy:"fixed",placement:M,whileElementsMounted:(...oe)=>SO(...oe,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[yA({mainAxis:o+A,alignmentAxis:a}),u&&bA({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?_A():void 0,...k}),u&&vA({...k}),wA({...k,apply:({elements:oe,rects:Te,availableWidth:bt,availableHeight:xe})=>{let{width:Z,height:te}=Te.reference,Ee=oe.floating.style;Ee.setProperty("--radix-popper-available-width",`${bt}px`),Ee.setProperty("--radix-popper-available-height",`${xe}px`),Ee.setProperty("--radix-popper-anchor-width",`${Z}px`),Ee.setProperty("--radix-popper-anchor-height",`${te}px`)}}),x&&xA({element:x,padding:s}),Edn({arrowWidth:E,arrowHeight:A}),f&&SA({strategy:"referenceHidden",...k})]}),[j,z]=wkt(U),W=rr(m);Qr(()=>{J&&W?.()},[J,W]);let K=V.arrow?.x,re=V.arrow?.y,De=V.arrow?.centerOffset!==0,[Y,Q]=lm.useState();return Qr(()=>{g&&Q(window.getComputedStyle(g).zIndex)},[g]),(0,IA.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:J?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,IA.jsx)(Sdn,{scope:r,placedSide:j,onArrowChange:C,arrowX:K,arrowY:re,shouldHideArrow:De,children:(0,IA.jsx)($h.div,{"data-side":j,"data-align":z,...h,ref:w,style:{...h.style,animation:J?void 0:"none"}})})})});bkt.displayName=aRe;var _kt="PopperArrow",Cdn={top:"bottom",right:"left",bottom:"top",left:"right"},vkt=lm.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=xdn(_kt,n),a=Cdn[i.placedSide];return(0,IA.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,IA.jsx)(fkt,{...o,ref:r,style:{...o.style,display:"block"}})})});vkt.displayName=_kt;function Odn(t){return t!==null}var Edn=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=wkt(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function wkt(t){let[e,r="center"]=t.split("-");return[e,r]}var Skt=hkt,xkt=ykt,Ckt=bkt,Okt=vkt;var sae=B(X(),1),Ekt=B(fs(),1);var Pkt=B(_t(),1),Tdn="Portal",sRe=sae.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=sae.useState(!1);Qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Ekt.default.createPortal((0,Pkt.jsx)($h.div,{...n,ref:e}),a):null});sRe.displayName=Tdn;var jkt=B(X(),1);var Ikt=B(X(),1),Ddn=B(fs(),1);var Rc=B(X(),1);var Adn=B(X(),1);function Tkt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Akt(...t){return e=>{let r=!1,n=t.map(o=>{let i=Tkt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Tkt(t[o],null)}}}}var N$=B(_t(),1),lRe=Rc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Rc.Children.toArray(r),i=o.find(Mdn);if(i){let a=i.props.children,s=o.map(u=>u===i?Rc.Children.count(a)>1?Rc.Children.only(null):Rc.isValidElement(a)?a.props.children:null:u);return(0,N$.jsx)(uRe,{...n,ref:e,children:Rc.isValidElement(a)?Rc.cloneElement(a,void 0,s):null})}return(0,N$.jsx)(uRe,{...n,ref:e,children:r})});lRe.displayName="Slot";var uRe=Rc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Rc.isValidElement(r)){let o=jdn(r);return Rc.cloneElement(r,{...Rdn(n,r.props),ref:e?Akt(e,o):o})}return Rc.Children.count(r)>1?Rc.Children.only(null):null});uRe.displayName="SlotClone";var Idn=({children:t})=>(0,N$.jsx)(N$.Fragment,{children:t});function Mdn(t){return Rc.isValidElement(t)&&t.type===Idn}function Rdn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function jdn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Mkt=B(_t(),1),Ndn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Rkt=Ndn.reduce((t,e)=>{let r=Ikt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?lRe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Mkt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var Dkt=B(_t(),1),Ldn="VisuallyHidden",Nkt=jkt.forwardRef((t,e)=>(0,Dkt.jsx)(Rkt.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));Nkt.displayName=Ldn;var Lkt=Nkt;var $u=B(_t(),1),[uae,C9o]=Ho("Tooltip",[iRe]),lae=iRe(),Fkt="TooltipProvider",kdn=700,cRe="tooltip.open",[Bdn,fRe]=uae(Fkt),kkt=t=>{let{__scopeTooltip:e,delayDuration:r=kdn,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,[a,s]=Nr.useState(!0),u=Nr.useRef(!1),l=Nr.useRef(0);return Nr.useEffect(()=>{let c=l.current;return()=>window.clearTimeout(c)},[]),(0,$u.jsx)(Bdn,{scope:e,isOpenDelayed:a,delayDuration:r,onOpen:Nr.useCallback(()=>{window.clearTimeout(l.current),s(!1)},[]),onClose:Nr.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s(!0),n)},[n]),isPointerInTransitRef:u,onPointerInTransitChange:Nr.useCallback(c=>{u.current=c},[]),disableHoverableContent:o,children:i})};kkt.displayName=Fkt;var cae="Tooltip",[$dn,_V]=uae(cae),Bkt=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=fRe(cae,t.__scopeTooltip),l=lae(e),[c,d]=Nr.useState(null),f=za(),p=Nr.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,v=Nr.useRef(!1),[g=!1,_]=cl({prop:n,defaultProp:o,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent(cRe))):u.onClose(),i?.(E)}}),w=Nr.useMemo(()=>g?v.current?"delayed-open":"instant-open":"closed",[g]),x=Nr.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,_(!0)},[_]),C=Nr.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),P=Nr.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,_(!0),p.current=0},h)},[h,_]);return Nr.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,$u.jsx)(Skt,{...l,children:(0,$u.jsx)($dn,{scope:e,contentId:f,open:g,stateAttribute:w,trigger:c,onTriggerChange:d,onTriggerEnter:Nr.useCallback(()=>{u.isOpenDelayed?P():x()},[u.isOpenDelayed,P,x]),onTriggerLeave:Nr.useCallback(()=>{m?C():(window.clearTimeout(p.current),p.current=0)},[C,m]),onOpen:x,onClose:C,disableHoverableContent:m,children:r})})};Bkt.displayName=cae;var dRe="TooltipTrigger",$kt=Nr.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=_V(dRe,r),i=fRe(dRe,r),a=lae(r),s=Nr.useRef(null),u=CO(e,s,o.onTriggerChange),l=Nr.useRef(!1),c=Nr.useRef(!1),d=Nr.useCallback(()=>l.current=!1,[]);return Nr.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,$u.jsx)(xkt,{asChild:!0,...a,children:(0,$u.jsx)($h.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:dy(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:dy(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:dy(t.onPointerDown,()=>{l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:dy(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:dy(t.onBlur,o.onClose),onClick:dy(t.onClick,o.onClose)})})});$kt.displayName=dRe;var pRe="TooltipPortal",[qdn,Udn]=uae(pRe,{forceMount:void 0}),qkt=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=_V(pRe,e);return(0,$u.jsx)(qdn,{scope:e,forceMount:r,children:(0,$u.jsx)(Bu,{present:r||i.open,children:(0,$u.jsx)(sRe,{asChild:!0,container:o,children:n})})})};qkt.displayName=pRe;var L$="TooltipContent",Ukt=Nr.forwardRef((t,e)=>{let r=Udn(L$,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=_V(L$,t.__scopeTooltip);return(0,$u.jsx)(Bu,{present:n||a.open,children:a.disableHoverableContent?(0,$u.jsx)(zkt,{side:o,...i,ref:e}):(0,$u.jsx)(zdn,{side:o,...i,ref:e})})}),zdn=Nr.forwardRef((t,e)=>{let r=_V(L$,t.__scopeTooltip),n=fRe(L$,t.__scopeTooltip),o=Nr.useRef(null),i=CO(e,o),[a,s]=Nr.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=Nr.useCallback(()=>{s(null),d(!1)},[d]),p=Nr.useCallback((m,h)=>{let v=m.currentTarget,g={x:m.clientX,y:m.clientY},_=Kdn(g,v.getBoundingClientRect()),w=Jdn(g,_),x=Gdn(h.getBoundingClientRect()),C=Zdn([...w,...x]);s(C),d(!0)},[d]);return Nr.useEffect(()=>()=>f(),[f]),Nr.useEffect(()=>{if(u&&c){let m=v=>p(v,c),h=v=>p(v,u);return u.addEventListener("pointerleave",m),c.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",h)}}},[u,c,p,f]),Nr.useEffect(()=>{if(a){let m=h=>{let v=h.target,g={x:h.clientX,y:h.clientY},_=u?.contains(v)||c?.contains(v),w=!Ydn(g,a);_?f():w&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,$u.jsx)(zkt,{...t,ref:i})}),[Hdn,Vdn]=uae(cae,{isInside:!1}),zkt=Nr.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=_V(L$,r),l=lae(r),{onClose:c}=u;return Nr.useEffect(()=>(document.addEventListener(cRe,c),()=>document.removeEventListener(cRe,c)),[c]),Nr.useEffect(()=>{if(u.trigger){let d=f=>{f.target?.contains(u.trigger)&&c()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[u.trigger,c]),(0,$u.jsx)(rRe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,$u.jsxs)(Ckt,{"data-state":u.stateAttribute,...l,...s,ref:e,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,$u.jsx)(QMe,{children:n}),(0,$u.jsx)(Hdn,{scope:r,isInside:!0,children:(0,$u.jsx)(Lkt,{id:u.contentId,role:"tooltip",children:o||n})})]})})});Ukt.displayName=L$;var Hkt="TooltipArrow",Wdn=Nr.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=lae(r);return Vdn(Hkt,r).isInside?null:(0,$u.jsx)(Okt,{...o,...n,ref:e})});Wdn.displayName=Hkt;function Kdn(t,e){let r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(r,n,o,i)){case i:return"left";case o:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Jdn(t,e,r=5){let n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function Gdn(t){let{top:e,right:r,bottom:n,left:o}=t;return[{x:o,y:e},{x:r,y:e},{x:r,y:n},{x:o,y:n}]}function Ydn(t,e){let{x:r,y:n}=t,o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let s=e[i].x,u=e[i].y,l=e[a].x,c=e[a].y;u>n!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(o=!o)}return o}function Zdn(t){let e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),Xdn(e)}function Xdn(t){if(t.length<=1)return t.slice();let e=[];for(let n=0;n<t.length;n++){let o=t[n];for(;e.length>=2;){let i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))e.pop();else break}e.push(o)}e.pop();let r=[];for(let n=t.length-1;n>=0;n--){let o=t[n];for(;r.length>=2;){let i=r[r.length-1],a=r[r.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))r.pop();else break}r.push(o)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var dae=kkt,Vkt=Bkt,Wkt=$kt,Kkt=qkt,mRe=Ukt;var qu=dae,qr=Vkt,Ur=Wkt,Lr=vV.forwardRef(({className:t,sideOffset:e=4,...r},n)=>vV.createElement(Kkt,{container:activeDocument.body},vV.createElement(mRe,{ref:n,sideOffset:e,className:Ce("z-50 overflow-hidden rounded-md bg-secondary border-border border border-solid px-3 py-1.5 text-xs text-normal animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})));Lr.displayName=mRe.displayName;var hRe=require("obsidian");async function Qdn(){try{await va.getInstance().indexVaultToVectorStore(),new hRe.Notice("Vault index refreshed.")}catch(t){console.error("Error refreshing vault index:",t),new hRe.Notice("Failed to refresh vault index. Check console for details.")}}function Gkt({onNewChat:t,onSaveAsNote:e}){let r=Bo(),[n,o]=Ny(),i=zee();return xr.default.createElement("div",{className:"w-full py-1 flex justify-between items-center px-1"},xr.default.createElement("div",{className:"flex-1"},xr.default.createElement(gV,null,xr.default.createElement(yV,{asChild:!0},xr.default.createElement(ke,{variant:"ghost2",size:"fit",className:"ml-1"},n==="llm_chain"&&"chat",n==="vault_qa"&&"vault QA",n==="copilot_plus"&&xr.default.createElement("div",{className:"flex items-center gap-1"},xr.default.createElement(Hy,{className:"size-4"}),"copilot plus (beta)"),xr.default.createElement(ps,{className:"size-5 mt-0.5"}))),xr.default.createElement(OS,{align:"start"},xr.default.createElement(os,{onSelect:()=>o("llm_chain")},"chat"),xr.default.createElement(os,{onSelect:()=>o("vault_qa")},"vault QA"),i?xr.default.createElement(os,{onSelect:()=>o("copilot_plus")},xr.default.createElement("div",{className:"flex items-center gap-1"},xr.default.createElement(Hy,{className:"size-4"}),"copilot plus (beta)")):xr.default.createElement(os,{onSelect:()=>{DN(iE.CHAT_MODE_SELECT)}},"copilot plus (beta)",xr.default.createElement(LE,{className:"size-3"}))))),xr.default.createElement("div",null,xr.default.createElement(qr,null,xr.default.createElement(Ur,{asChild:!0},xr.default.createElement(ke,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},xr.default.createElement(Ez,{className:"size-4"}))),xr.default.createElement(Lr,null,"New Chat")),xr.default.createElement(qr,null,xr.default.createElement(Ur,{asChild:!0},xr.default.createElement(ke,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},xr.default.createElement(gz,{className:"size-4"}))),xr.default.createElement(Lr,null,"Save Chat as Note")),xr.default.createElement(gV,null,xr.default.createElement(yV,{asChild:!0},xr.default.createElement(ke,{variant:"ghost2",size:"icon",title:"Advanced Settings"},xr.default.createElement(jE,{className:"size-4"}))),xr.default.createElement(OS,{align:"end",className:"w-64"},xr.default.createElement(os,{className:"flex justify-between",onSelect:a=>{a.preventDefault(),xt("showSuggestedPrompts",!r.showSuggestedPrompts)}},xr.default.createElement("div",{className:"flex items-center gap-2"},xr.default.createElement(Hy,{className:"size-4"}),"Suggested Prompt"),xr.default.createElement(j$,{checked:r.showSuggestedPrompts})),xr.default.createElement(os,{className:"flex justify-between",onSelect:a=>{a.preventDefault(),xt("showRelevantNotes",!r.showRelevantNotes)}},xr.default.createElement("div",{className:"flex items-center gap-2"},xr.default.createElement(lM,{className:"size-4"}),"Relevant Note"),xr.default.createElement(j$,{checked:r.showRelevantNotes})),xr.default.createElement(os,{className:"flex items-center gap-2",onSelect:()=>Qdn()},xr.default.createElement(Tz,{className:"size-4"}),"Refresh Vault Index")))))}var Ykt=require("obsidian");var pae=require("obsidian"),fae=class extends pae.FuzzySuggestModal{constructor(e){super(e),this.activeNote=e.workspace.getActiveFile()}getOrderedNotes(e=[]){let r=this.app.workspace.getLastOpenFiles().map(i=>this.app.vault.getAbstractFileByPath(i)).filter(i=>i instanceof pae.TFile&&(i.extension==="md"||i.extension==="pdf"||i.extension==="canvas")&&!e.includes(i.path)&&i.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(i=>i.extension==="md"||i.extension==="pdf"||i.extension==="canvas").filter(i=>!r.some(a=>a.path===i.path)&&!e.includes(i.path)&&i.path!==this.activeNote?.path);return[...this.activeNote?[this.activeNote]:[],...r,...o]}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n==="pdf"?o+=" (PDF)":n==="canvas"&&(o+=" (Canvas)"),o}};var MA=class extends fae{constructor({app:e,onNoteSelect:r,excludeNotePaths:n,titleOnly:o=!1}){super(e),this.onNoteSelect=r,this.availableNotes=this.getOrderedNotes(n),this.titleOnly=o}getItems(){if(this.titleOnly){let e=new Map;return this.availableNotes.forEach(r=>{e.set(r.basename,r)}),Array.from(e.values())}return this.availableNotes}getItemText(e){let r=e.path===this.activeNote?.path;return this.formatNoteTitle(e.basename,r,e.extension)}onChooseItem(e,r){this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof Ykt.TFile){let o=n.createDiv(),i=e.item;o.setText(this.formatNoteTitle(i.basename,i===this.activeNote,i.extension)),this.titleOnly||n.createDiv({cls:"mt-1 text-muted text-xs"}).setText(i.path)}}};var mae=class{constructor(e,r){this.app=e,this.onImagesSelected=r}open(){let e=document.createElement("input");e.type="file",e.accept="image/*",e.multiple=!0,e.style.display="none",e.addEventListener("change",()=>{let r=Array.from(e.files||[]);this.onImagesSelected(r),document.body.removeChild(e)}),document.body.appendChild(e),e.click()}};var Zkt=require("obsidian"),F$=class t{constructor(){}static getInstance(){return t.instance||(t.instance=new t),t.instance}async processEmbeddedPDFs(e,r,n){let o=/!\[\[(.*?\.pdf)\]\]/g,i=[...e.matchAll(o)];for(let a of i){let s=a[1],u=r.getAbstractFileByPath(s);if(u instanceof Zkt.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`
Embedded PDF (${s}):
${l}
`)}catch(l){console.error(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`
Embedded PDF (${s}): [Error: Could not process PDF]
`)}}return e}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async c=>{try{if(e.has(c.path)){console.log(`Skipping note ${c.path} as it was included via custom prompt.`);return}if(console.log(`Processing note: ${c.path}, extension: ${c.extension}, chain: ${s}`),!r.supportsExtension(c.extension)){console.warn(`Unsupported file type: ${c.extension}`);return}if(s!=="copilot_plus"&&c.extension!=="md"&&c.extension!=="canvas"){console.warn(`File type ${c.extension} requires Copilot Plus mode for context processing.`);return}let d=await r.parseFile(c,n);c.extension==="md"&&s==="copilot_plus"&&(d=await this.processEmbeddedPDFs(d,n,r)),u+=`
Title: [[${c.basename}]]
Path: ${c.path}
${d}`}catch(d){console.error(`Error processing file ${c.path}:`,d),u+=`
Title: [[${c.basename}]]
Path: ${c.path}
[Error: Could not process file]`}};i&&a&&await l(a);for(let c of o)await l(c);return u}async hasEmbeddedPDFs(e){return/!\[\[(.*?\.pdf)\]\]/g.test(e)}async addNoteToContext(e,r,n,o,i,a){if(n.some(l=>l.path===e.path))return;let s=await r.read(e),u=await this.hasEmbeddedPDFs(s);o&&e.path===o.path&&a(!0),i(l=>[...l,Object.assign(e,{wasAddedViaReference:!0,hasEmbeddedPDFs:u})])}};var Dj=require("obsidian"),rt=B(X());var rn=B(X()),si=B(iBt());function RA(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}var rfn=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function Rj(t,e,r){let n=nfn(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&aBt(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),aBt(n,"relativePath",i),n}function nfn(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=rfn.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function aBt(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var ofn=[".DS_Store","Thumbs.db"];function yRe(t){return RA(this,void 0,void 0,function*(){return hae(t)&&ifn(t.dataTransfer)?lfn(t.dataTransfer,t.type):afn(t)?sfn(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?ufn(t):[]})}function ifn(t){return hae(t)}function afn(t){return hae(t)&&hae(t.target)}function hae(t){return typeof t=="object"&&t!==null}function sfn(t){return gRe(t.target.files).map(e=>Rj(e))}function ufn(t){return RA(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>Rj(r))})}function lfn(t,e){return RA(this,void 0,void 0,function*(){if(t.items){let r=gRe(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(cfn));return sBt(lBt(n))}return sBt(gRe(t.files).map(r=>Rj(r)))})}function sBt(t){return t.filter(e=>ofn.indexOf(e.name)===-1)}function gRe(t){if(t===null)return[];let e=[];for(let r=0;r<t.length;r++){let n=t[r];e.push(n)}return e}function cfn(t){if(typeof t.webkitGetAsEntry!="function")return uBt(t);let e=t.webkitGetAsEntry();return e&&e.isDirectory?cBt(e):uBt(t,e)}function lBt(t){return t.reduce((e,r)=>[...e,...Array.isArray(r)?lBt(r):[r]],[])}function uBt(t,e){return RA(this,void 0,void 0,function*(){var r;if(globalThis.isSecureContext&&typeof t.getAsFileSystemHandle=="function"){let i=yield t.getAsFileSystemHandle();if(i===null)throw new Error(`${t} is not a File`);if(i!==void 0){let a=yield i.getFile();return a.handle=i,Rj(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return Rj(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function dfn(t){return RA(this,void 0,void 0,function*(){return t.isDirectory?cBt(t):ffn(t)})}function cBt(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>RA(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(dfn));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function ffn(t){return RA(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=Rj(n,t.fullPath);e(o)},n=>{r(n)})})})}var gae=B(dBt());function fBt(t){return hfn(t)||mfn(t)||bBt(t)||pfn()}function pfn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mfn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function hfn(t){if(Array.isArray(t))return _Re(t)}function pBt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function mBt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?pBt(Object(r),!0).forEach(function(n){yBt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pBt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function yBt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wV(t,e){return bfn(t)||yfn(t,e)||bBt(t,e)||gfn()}function gfn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bBt(t,e){if(t){if(typeof t=="string")return _Re(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _Re(t,e)}}function _Re(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function yfn(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,s;try{for(r=r.call(t);!(o=(a=r.next()).done)&&(n.push(a.value),!(e&&n.length===e));o=!0);}catch(u){i=!0,s=u}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function bfn(t){if(Array.isArray(t))return t}var _fn=typeof gae.default=="function"?gae.default:gae.default.default,vfn="file-invalid-type",wfn="file-too-large",Sfn="file-too-small",xfn="too-many-files";var Cfn=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=e.split(","),n=r.length>1?"one of ".concat(r.join(", ")):r[0];return{code:vfn,message:"File type must be ".concat(n)}},hBt=function(e){return{code:wfn,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},gBt=function(e){return{code:Sfn,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},_Bt={code:xfn,message:"Too many files"};function vRe(t,e){var r=t.type==="application/x-moz-file"||_fn(t,e);return[r,r?null:Cfn(e)]}function wRe(t,e,r){if(jj(t.size))if(jj(e)&&jj(r)){if(t.size>r)return[!1,hBt(r)];if(t.size<e)return[!1,gBt(e)]}else{if(jj(e)&&t.size<e)return[!1,gBt(e)];if(jj(r)&&t.size>r)return[!1,hBt(r)]}return[!0,null]}function jj(t){return t!=null}function vBt(t){var e=t.files,r=t.accept,n=t.minSize,o=t.maxSize,i=t.multiple,a=t.maxFiles,s=t.validator;return!i&&e.length>1||i&&a>=1&&e.length>a?!1:e.every(function(u){var l=vRe(u,r),c=wV(l,1),d=c[0],f=wRe(u,n,o),p=wV(f,1),m=p[0],h=s?s(u):null;return d&&m&&!h})}function SV(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function xV(t){return t.dataTransfer?Array.prototype.some.call(t.dataTransfer.types,function(e){return e==="Files"||e==="application/x-moz-file"}):!!t.target&&!!t.target.files}function SRe(t){t.preventDefault()}function Ofn(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function Efn(t){return t.indexOf("Edge/")!==-1}function wBt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Ofn(t)||Efn(t)}function fy(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return e.some(function(s){return!SV(n)&&s&&s.apply(void 0,[n].concat(i)),SV(n)})}}function SBt(){return"showOpenFilePicker"in window}function xBt(t){if(jj(t)){var e=Object.entries(t).filter(function(r){var n=wV(r,2),o=n[0],i=n[1],a=!0;return PBt(o)||(console.warn('Skipped "'.concat(o,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),a=!1),(!Array.isArray(i)||!i.every(TBt))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(r,n){var o=wV(n,2),i=o[0],a=o[1];return mBt(mBt({},r),{},yBt({},i,a))},{});return[{description:"Files",accept:e}]}return t}function CBt(t){if(jj(t))return Object.entries(t).reduce(function(e,r){var n=wV(r,2),o=n[0],i=n[1];return[].concat(fBt(e),[o],fBt(i))},[]).filter(function(e){return PBt(e)||TBt(e)}).join(",")}function OBt(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function EBt(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function PBt(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function TBt(t){return/^.*\.[\w]+$/.test(t)}var Pfn=["children"],Tfn=["open"],Afn=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Ifn=["refKey","onChange","onClick"];function Mfn(t){return Dfn(t)||jfn(t)||MBt(t)||Rfn()}function Rfn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jfn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Dfn(t){if(Array.isArray(t))return CRe(t)}function xRe(t,e){return Ffn(t)||Lfn(t,e)||MBt(t,e)||Nfn()}function Nfn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MBt(t,e){if(t){if(typeof t=="string")return CRe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return CRe(t,e)}}function CRe(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Lfn(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,s;try{for(r=r.call(t);!(o=(a=r.next()).done)&&(n.push(a.value),!(e&&n.length===e));o=!0);}catch(u){i=!0,s=u}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function Ffn(t){if(Array.isArray(t))return t}function ABt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function Ea(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ABt(Object(r),!0).forEach(function(n){ORe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ABt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ORe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yae(t,e){if(t==null)return{};var r=kfn(t,e),n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)n=i[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function kfn(t,e){if(t==null)return{};var r={},n=Object.keys(t),o,i;for(i=0;i<n.length;i++)o=n[i],!(e.indexOf(o)>=0)&&(r[o]=t[o]);return r}var PRe=(0,rn.forwardRef)(function(t,e){var r=t.children,n=yae(t,Pfn),o=TRe(n),i=o.open,a=yae(o,Tfn);return(0,rn.useImperativeHandle)(e,function(){return{open:i}},[i]),rn.default.createElement(rn.Fragment,null,r(Ea(Ea({},a),{},{open:i})))});PRe.displayName="Dropzone";var RBt={disabled:!1,getFilesFromEvent:yRe,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};PRe.defaultProps=RBt;PRe.propTypes={children:si.default.func,accept:si.default.objectOf(si.default.arrayOf(si.default.string)),multiple:si.default.bool,preventDropOnDocument:si.default.bool,noClick:si.default.bool,noKeyboard:si.default.bool,noDrag:si.default.bool,noDragEventsBubbling:si.default.bool,minSize:si.default.number,maxSize:si.default.number,maxFiles:si.default.number,disabled:si.default.bool,getFilesFromEvent:si.default.func,onFileDialogCancel:si.default.func,onFileDialogOpen:si.default.func,useFsAccessApi:si.default.bool,autoFocus:si.default.bool,onDragEnter:si.default.func,onDragLeave:si.default.func,onDragOver:si.default.func,onDrop:si.default.func,onDropAccepted:si.default.func,onDropRejected:si.default.func,onError:si.default.func,validator:si.default.func};var ERe={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function TRe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Ea(Ea({},RBt),t),r=e.accept,n=e.disabled,o=e.getFilesFromEvent,i=e.maxSize,a=e.minSize,s=e.multiple,u=e.maxFiles,l=e.onDragEnter,c=e.onDragLeave,d=e.onDragOver,f=e.onDrop,p=e.onDropAccepted,m=e.onDropRejected,h=e.onFileDialogCancel,v=e.onFileDialogOpen,g=e.useFsAccessApi,_=e.autoFocus,w=e.preventDropOnDocument,x=e.noClick,C=e.noKeyboard,P=e.noDrag,E=e.noDragEventsBubbling,A=e.onError,M=e.validator,R=(0,rn.useMemo)(function(){return CBt(r)},[r]),N=(0,rn.useMemo)(function(){return xBt(r)},[r]),L=(0,rn.useMemo)(function(){return typeof v=="function"?v:IBt},[v]),k=(0,rn.useMemo)(function(){return typeof h=="function"?h:IBt},[h]),F=(0,rn.useRef)(null),$=(0,rn.useRef)(null),U=(0,rn.useReducer)(Bfn,ERe),J=xRe(U,2),V=J[0],j=J[1],z=V.isFocused,W=V.isFileDialogActive,K=(0,rn.useRef)(typeof window<"u"&&window.isSecureContext&&g&&SBt()),re=function(){!K.current&&W&&setTimeout(function(){if($.current){var ce=$.current.files;ce.length||(j({type:"closeDialog"}),k())}},300)};(0,rn.useEffect)(function(){return window.addEventListener("focus",re,!1),function(){window.removeEventListener("focus",re,!1)}},[$,W,k,K]);var De=(0,rn.useRef)([]),Y=function(ce){F.current&&F.current.contains(ce.target)||(ce.preventDefault(),De.current=[])};(0,rn.useEffect)(function(){return w&&(document.addEventListener("dragover",SRe,!1),document.addEventListener("drop",Y,!1)),function(){w&&(document.removeEventListener("dragover",SRe),document.removeEventListener("drop",Y))}},[F,w]),(0,rn.useEffect)(function(){return!n&&_&&F.current&&F.current.focus(),function(){}},[F,_,n]);var Q=(0,rn.useCallback)(function(ie){A?A(ie):console.error(ie)},[A]),oe=(0,rn.useCallback)(function(ie){ie.preventDefault(),ie.persist(),ve(ie),De.current=[].concat(Mfn(De.current),[ie.target]),xV(ie)&&Promise.resolve(o(ie)).then(function(ce){if(!(SV(ie)&&!E)){var _e=ce.length,be=_e>0&&vBt({files:ce,accept:R,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:M}),Ue=_e>0&&!be;j({isDragAccept:be,isDragReject:Ue,isDragActive:!0,type:"setDraggedFiles"}),l&&l(ie)}}).catch(function(ce){return Q(ce)})},[o,l,Q,E,R,a,i,s,u,M]),Te=(0,rn.useCallback)(function(ie){ie.preventDefault(),ie.persist(),ve(ie);var ce=xV(ie);if(ce&&ie.dataTransfer)try{ie.dataTransfer.dropEffect="copy"}catch{}return ce&&d&&d(ie),!1},[d,E]),bt=(0,rn.useCallback)(function(ie){ie.preventDefault(),ie.persist(),ve(ie);var ce=De.current.filter(function(be){return F.current&&F.current.contains(be)}),_e=ce.indexOf(ie.target);_e!==-1&&ce.splice(_e,1),De.current=ce,!(ce.length>0)&&(j({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),xV(ie)&&c&&c(ie))},[F,c,E]),xe=(0,rn.useCallback)(function(ie,ce){var _e=[],be=[];ie.forEach(function(Ue){var zr=vRe(Ue,R),ia=xRe(zr,2),Hu=ia[0],Jh=ia[1],Gh=wRe(Ue,a,i),Ia=xRe(Gh,2),gm=Ia[0],hp=Ia[1],ym=M?M(Ue):null;if(Hu&&gm&&!ym)_e.push(Ue);else{var wn=[Jh,hp];ym&&(wn=wn.concat(ym)),be.push({file:Ue,errors:wn.filter(function(DO){return DO})})}}),(!s&&_e.length>1||s&&u>=1&&_e.length>u)&&(_e.forEach(function(Ue){be.push({file:Ue,errors:[_Bt]})}),_e.splice(0)),j({acceptedFiles:_e,fileRejections:be,isDragReject:be.length>0,type:"setFiles"}),f&&f(_e,be,ce),be.length>0&&m&&m(be,ce),_e.length>0&&p&&p(_e,ce)},[j,s,R,a,i,u,f,p,m,M]),Z=(0,rn.useCallback)(function(ie){ie.preventDefault(),ie.persist(),ve(ie),De.current=[],xV(ie)&&Promise.resolve(o(ie)).then(function(ce){SV(ie)&&!E||xe(ce,ie)}).catch(function(ce){return Q(ce)}),j({type:"reset"})},[o,xe,Q,E]),te=(0,rn.useCallback)(function(){if(K.current){j({type:"openDialog"}),L();var ie={multiple:s,types:N};window.showOpenFilePicker(ie).then(function(ce){return o(ce)}).then(function(ce){xe(ce,null),j({type:"closeDialog"})}).catch(function(ce){OBt(ce)?(k(ce),j({type:"closeDialog"})):EBt(ce)?(K.current=!1,$.current?($.current.value=null,$.current.click()):Q(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):Q(ce)});return}$.current&&(j({type:"openDialog"}),L(),$.current.value=null,$.current.click())},[j,L,k,g,xe,Q,N,s]),Ee=(0,rn.useCallback)(function(ie){!F.current||!F.current.isEqualNode(ie.target)||(ie.key===" "||ie.key==="Enter"||ie.keyCode===32||ie.keyCode===13)&&(ie.preventDefault(),te())},[F,te]),Le=(0,rn.useCallback)(function(){j({type:"focus"})},[]),Ze=(0,rn.useCallback)(function(){j({type:"blur"})},[]),Ot=(0,rn.useCallback)(function(){x||(wBt()?setTimeout(te,0):te())},[x,te]),Yt=function(ce){return n?null:ce},Wn=function(ce){return C?null:Yt(ce)},nr=function(ce){return P?null:Yt(ce)},ve=function(ce){E&&ce.stopPropagation()},vn=(0,rn.useMemo)(function(){return function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ce=ie.refKey,_e=ce===void 0?"ref":ce,be=ie.role,Ue=ie.onKeyDown,zr=ie.onFocus,ia=ie.onBlur,Hu=ie.onClick,Jh=ie.onDragEnter,Gh=ie.onDragOver,Ia=ie.onDragLeave,gm=ie.onDrop,hp=yae(ie,Afn);return Ea(Ea(ORe({onKeyDown:Wn(fy(Ue,Ee)),onFocus:Wn(fy(zr,Le)),onBlur:Wn(fy(ia,Ze)),onClick:Yt(fy(Hu,Ot)),onDragEnter:nr(fy(Jh,oe)),onDragOver:nr(fy(Gh,Te)),onDragLeave:nr(fy(Ia,bt)),onDrop:nr(fy(gm,Z)),role:typeof be=="string"&&be!==""?be:"presentation"},_e,F),!n&&!C?{tabIndex:0}:{}),hp)}},[F,Ee,Le,Ze,Ot,oe,Te,bt,Z,C,P,n]),lt=(0,rn.useCallback)(function(ie){ie.stopPropagation()},[]),qe=(0,rn.useMemo)(function(){return function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ce=ie.refKey,_e=ce===void 0?"ref":ce,be=ie.onChange,Ue=ie.onClick,zr=yae(ie,Ifn),ia=ORe({accept:R,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:Yt(fy(be,Z)),onClick:Yt(fy(Ue,lt)),tabIndex:-1},_e,$);return Ea(Ea({},ia),zr)}},[$,r,s,Z,n]);return Ea(Ea({},V),{},{isFocused:z&&!n,getRootProps:vn,getInputProps:qe,rootRef:F,inputRef:$,open:Yt(te)})}function Bfn(t,e){switch(e.type){case"focus":return Ea(Ea({},t),{},{isFocused:!0});case"blur":return Ea(Ea({},t),{},{isFocused:!1});case"openDialog":return Ea(Ea({},ERe),{},{isFileDialogActive:!0});case"closeDialog":return Ea(Ea({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return Ea(Ea({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return Ea(Ea({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return Ea({},ERe);default:return t}}function IBt(){}var NBt=B(X());var $i=B(X());var bae=B(X());var $fn=AN("inline-flex items-center rounded-md px-2.5 py-0.5 text-normal text-ui-smaller transition-colors focus:outline-none",{variants:{variant:{default:"bg-primary-alt shadow",secondary:"bg-secondary-alt",destructive:"bg-modifier-error shadow",outline:"border border-border border-solid"}},defaultVariants:{variant:"default"}}),py=bae.forwardRef(({className:t,variant:e,...r},n)=>bae.createElement("div",{ref:n,className:Ce($fn({variant:e}),t),...r}));py.displayName="Badge";function jBt({note:t,isActive:e=!1,onRemoveContext:r}){return $i.default.createElement(py,{className:"text-xs pl-2 pr-0.5 py-0 items-center"},$i.default.createElement("div",{className:"flex items-center gap-1"},$i.default.createElement("span",{className:"max-w-40 truncate"},t.basename),e&&$i.default.createElement("span",{className:"text-xs text-faint"},"Current"),t.extension==="pdf"&&$i.default.createElement("span",{className:"text-xs text-faint"},"pdf")),$i.default.createElement(ke,{variant:"ghost2",size:"fit",onClick:()=>r(t.path),"aria-label":"Remove from context"},$i.default.createElement(Nf,{className:"size-4"})))}function qfn({url:t,onRemoveUrl:e}){return $i.default.createElement(py,{className:"text-xs pl-2 pr-0.5 py-0 items-center"},$i.default.createElement("div",{className:"flex items-center gap-1"},$i.default.createElement("span",{className:"max-w-40 truncate"},t),$i.default.createElement("span",{className:"text-xs text-faint"},"Link")),$i.default.createElement(ke,{variant:"ghost2",size:"fit",onClick:()=>e(t),"aria-label":"Remove from context"},$i.default.createElement(Nf,{className:"size-4"})))}var DBt=({activeNote:t,contextNotes:e,contextUrls:r,onAddContext:n,onRemoveContext:o,onRemoveUrl:i})=>{let a=$i.default.useMemo(()=>{let l=new Map(e.map(c=>[c.path,c]));return Array.from(l.values()).filter(c=>c.wasAddedManually?!0:!(t&&c.path===t.path))},[e,t]),s=$i.default.useMemo(()=>Array.from(new Set(r)),[r]),u=a.length>0||s.length>0||!!t;return $i.default.createElement("div",{className:"flex items-center w-full gap-1"},$i.default.createElement("div",{className:"flex items-start h-full"},$i.default.createElement(ke,{onClick:n,variant:"ghost2",size:"fit",className:"border border-border border-solid rounded-sm ml-1"},$i.default.createElement(xx,{className:"size-4"}),!u&&$i.default.createElement("span",{className:"text-xs leading-4 pr-1"},"Add context"))),$i.default.createElement("div",{className:"flex gap-1 flex-wrap flex-1"},t&&$i.default.createElement(jBt,{key:t.path,note:t,isActive:!0,onRemoveContext:o}),a.map(l=>$i.default.createElement(jBt,{key:l.path,note:l,isActive:!1,onRemoveContext:o})),s.map(l=>$i.default.createElement(qfn,{key:l,url:l,onRemoveUrl:i}))))};var Ufn=({app:t,excludeNotePaths:e,contextNotes:r,setContextNotes:n,includeActiveNote:o,setIncludeActiveNote:i,activeNote:a,contextUrls:s,onRemoveUrl:u})=>{let[l]=Ny(),c=()=>{new MA({app:t,onNoteSelect:f=>{a&&f.path===a.path?(i(!0),n(p=>p.filter(m=>m.path!==f.path))):n(p=>[...p,Object.assign(f,{wasAddedManually:!0})])},excludeNotePaths:e}).open()},d=f=>{let p=r.find(h=>h.path===f);p&&p.wasAddedManually?n(h=>h.filter(v=>v.path!==f)):(i(!1),n(h=>h.filter(v=>v.path!==f)))};return l!=="copilot_plus"?null:NBt.default.createElement(DBt,{activeNote:o?a:null,contextNotes:r,onAddContext:c,onRemoveContext:d,contextUrls:s,onRemoveUrl:u})},LBt=Ufn;var FBt=(0,rt.forwardRef)(({inputMessage:t,setInputMessage:e,handleSendMessage:r,isGenerating:n,onStopGenerating:o,app:i,navigateHistory:a,contextNotes:s,setContextNotes:u,includeActiveNote:l,setIncludeActiveNote:c,mention:d,selectedImages:f,onAddImage:p,setSelectedImages:m},h)=>{let[v,g]=(0,rt.useState)(-1),[_,w]=(0,rt.useState)(""),[x,C]=(0,rt.useState)(!1),[P,E]=(0,rt.useState)([]),A=(0,rt.useRef)(null),M=(0,rt.useRef)(null),[R,N]=ZD(),[L,k]=(0,rt.useState)(null),[F]=Ny(),[$,U]=(0,rt.useState)(i.workspace.getActiveFile()),J=Bo(),V=F==="copilot_plus";(0,rt.useImperativeHandle)(h,()=>({focus:()=>{A.current?.focus()}}));let j=Z=>{if(!V){r();return}r({toolCalls:Z?["@vault"]:[],contextNotes:s,urls:P})},z=async Z=>{let te=Z.target.value,Ee=Z.target.selectionStart;e(te),W();let Ze=d.extractAllUrls(te).filter(Ot=>!P.includes(Ot));Ze.length>0&&E(Ot=>Array.from(new Set([...Ot,...Ze]))),Ee>=2&&te.slice(Ee-2,Ee)==="[["?K(Ee):te==="/"?re():te.slice(-1)==="@"&&V&&De()},W=()=>{A.current&&(A.current.style.height="auto",A.current.style.height=`${A.current.scrollHeight}px`)};(0,rt.useEffect)(()=>{W()},[t]);let K=Z=>{(async()=>{let Ee=F$.getInstance();new MA({app:i,onNoteSelect:async Le=>{let Ze=t.slice(0,Z-2),Ot=t.slice(Z-1),Wn=kce(Le.basename,i.vault)?Le.basename:Le.path,nr=`${Ze}[[${Wn}]]${Ot}`;e(nr);let ve=i.workspace.getActiveFile();Le&&await Ee.addNoteToContext(Le,i.vault,s,ve,u,c),setTimeout(()=>{if(A.current){let vn=Z+Wn.length+2;A.current.setSelectionRange(vn,vn)}},0)},excludeNotePaths:xe}).open()})()},re=async()=>{let Z=bO.getInstance(i.vault),te=await Z.getAllPrompts(),Ee=te.map(Le=>Le.title);new _O(i,Ee,async Le=>{let Ze=te.find(Ot=>Ot.title===Le);Ze&&(Z.recordPromptUsage(Ze.title),e(Ze.content))}).open()},De=()=>{let Z=K8.map(te=>({title:te,description:b1t(te)}));new _O(i,Z.map(te=>te.title),te=>{e(t+te+" ")},Z.map(te=>te.description)).open()},Y=Z=>{if(Z.nativeEvent.isComposing)return;let te=A.current;if(!te)return;let{selectionStart:Ee,value:Le}=te,Ze=Le.split(`
`),Ot=Le.substring(0,Ee).split(`
`).length-1;if(Z.key==="Enter"&&Z.shiftKey&&(Dj.Platform.isMacOS?Z.metaKey:Z.ctrlKey)){Z.preventDefault(),Z.stopPropagation(),j(!0),g(-1),w("");return}if(Z.key==="Enter"&&!Z.shiftKey)Dj.Platform.isMobile||(Z.preventDefault(),j(!1),g(-1),w(""));else if(Z.key==="ArrowUp"){if(Ot>0||Ee>0)return;Z.preventDefault(),v===-1&&Le.trim()!==""&&w(Le);let Yt=a("up");Yt!==t&&(g(v+1),e(Yt),setTimeout(()=>{te&&(te.selectionStart=te.selectionEnd=0)},0))}else if(Z.key==="ArrowDown"){if(Ot<Ze.length-1||Ee<Le.length)return;if(Z.preventDefault(),v>-1){let Yt=a("down");g(v-1),e(v===0?_:Yt),setTimeout(()=>{te&&(te.selectionStart=te.selectionEnd=0)},0)}}},Q=(0,rt.useCallback)(async Z=>{let te=Z.clipboardData?.items;if(!te||!V)return;let Ee=Array.from(te).filter(Le=>Le.type.indexOf("image")!==-1);if(Ee.length>0){Z.preventDefault();let Ze=(await Promise.all(Ee.map(Ot=>{let Yt=Ot.getAsFile();return Yt||null}))).filter(Ot=>Ot!==null);Ze.length>0&&p(Ze)}},[p,V]);(0,rt.useEffect)(()=>{let Z=new Set(rx(t,i.vault)),te=d.extractAllUrls(t);u(Ee=>Ee.filter(Le=>{if(Le.wasAddedManually===!0)return!0;let Ot=Le.wasAddedViaReference===!0;return Le.path===$?.path?Ot?Z.has(Le):l:Ot?Z.has(Le):!0})),E(Ee=>Ee.filter(Le=>te.includes(Le)))},[t,l,$,d,u,i.vault]),(0,rt.useEffect)(()=>{let Z,te=()=>{clearTimeout(Z),Z=setTimeout(()=>{let Le=i.workspace.getActiveFile();U(Le)},100)},Ee=i.workspace.on("active-leaf-change",te);return()=>{clearTimeout(Z),i.workspace.offref(Ee)}},[i.workspace]);let{getRootProps:oe,getInputProps:Te,isDragActive:bt}=TRe({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:Z=>{p(Z)},noClick:!0,noDragEventsBubbling:!0}),xe=(0,rt.useMemo)(()=>[...s.map(Z=>Z.path),...l&&$?[$.path]:[]].filter(Z=>Z!=null),[s,l,$]);return rt.default.createElement("div",{className:"flex flex-col gap-0.5 w-full border border-border border-solid rounded-md pt-2 pb-1 px-1 @container/chat-input",ref:M},rt.default.createElement(LBt,{app:i,excludeNotePaths:xe,contextNotes:s,setContextNotes:u,includeActiveNote:l,setIncludeActiveNote:c,activeNote:$,contextUrls:P,onRemoveUrl:Z=>E(te=>te.filter(Ee=>Ee!==Z))}),f.length>0&&rt.default.createElement("div",{className:"selected-images"},f.map((Z,te)=>rt.default.createElement("div",{key:te,className:"image-preview-container"},rt.default.createElement("img",{src:URL.createObjectURL(Z),alt:Z.name,className:"selected-image-preview"}),rt.default.createElement("button",{className:"remove-image-button",onClick:()=>m(Ee=>Ee.filter((Le,Ze)=>Ze!==te)),title:"Remove image"},rt.default.createElement(Nf,{className:"size-4"}))))),rt.default.createElement("div",{className:"relative",...V?oe():{}},rt.default.createElement("textarea",{ref:A,className:"w-full bg-transparent focus-visible:ring-0 border-none min-h-[60px] max-h-40 overflow-y-auto resize-none px-2 rounded-md text-sm text-normal",placeholder:"Ask anything. [[ for notes. / for custom prompts. "+(V?"@ for tools.":""),value:t,onChange:z,onKeyDown:Y,onPaste:Q}),V&&rt.default.createElement(rt.default.Fragment,null,rt.default.createElement("input",{...Te()}),bt&&rt.default.createElement("div",{className:"absolute inset-0 bg-primary border border-dashed border-primary rounded-md flex items-center justify-center"},rt.default.createElement("span",{className:"text-primary"},"Drop images here...")))),rt.default.createElement("div",{className:"flex gap-1 justify-between px-1 h-6"},n?rt.default.createElement("div",{className:"flex items-center gap-1 px-1 text-faint text-sm"},rt.default.createElement(td,{className:"size-3 animate-spin"}),rt.default.createElement("span",null,"Generating...")):rt.default.createElement(M$,{open:x,onOpenChange:C},rt.default.createElement(R$,{asChild:!0},rt.default.createElement(ke,{variant:"ghost2",size:"fit"},L?rt.default.createElement("span",{className:"text-error"},"Model Load Failed"):J.activeModels.find(Z=>Z.enabled&&Kr(Z)===R)?rt.default.createElement($Ie,{model:J.activeModels.find(Z=>Z.enabled&&Kr(Z)===R),iconSize:8}):"Select Model",rt.default.createElement(ps,{className:"size-5 mt-0.5"}))),rt.default.createElement(OS,{align:"start"},J.activeModels.filter(Z=>Z.enabled).map(Z=>{let{hasApiKey:te,errorNotice:Ee}=u9(Z,J);return rt.default.createElement(os,{key:Kr(Z),onSelect:async Le=>{if(!te&&Ee){Le.preventDefault(),new Dj.Notice(Ee);return}try{k(null),N(Kr(Z))}catch(Ze){let Ot="Model switch failed: "+Pi(Ze);k(Ot),new Dj.Notice(Ot);let Yt=J.activeModels.find(Wn=>Wn.enabled&&Kr(Wn)===R);Yt&&N(Kr(Yt))}},className:te?"":"opacity-50 cursor-not-allowed"},rt.default.createElement($Ie,{model:Z,iconSize:12}))}))),rt.default.createElement("div",{className:"flex items-center gap-1"},n?rt.default.createElement(ke,{variant:"ghost2",size:"fit",className:"text-muted",onClick:()=>o()},rt.default.createElement(ME,{className:"size-4"}),"Stop"):rt.default.createElement(rt.default.Fragment,null,V&&rt.default.createElement(ke,{variant:"ghost2",size:"fit",onClick:()=>{new mae(i,p).open()}},rt.default.createElement(Sz,{className:"w-4 h-4"})),rt.default.createElement(ke,{variant:"ghost2",size:"fit",className:"text-muted",onClick:()=>j(!1)},rt.default.createElement(Rp,{className:"!size-3"}),rt.default.createElement("span",null,"chat")),F==="copilot_plus"&&rt.default.createElement(ke,{variant:"ghost2",size:"fit",className:"text-muted @xs/chat-input:inline-flex hidden",onClick:()=>j(!0)},rt.default.createElement("div",{className:"flex items-center gap-1"},Dj.Platform.isMacOS?rt.default.createElement("div",{className:"flex items-center"},rt.default.createElement(zy,{className:"!size-3"}),rt.default.createElement(bx,{className:"!size-3"}),rt.default.createElement(Rp,{className:"!size-3"})):rt.default.createElement("div",{className:"flex items-center"},rt.default.createElement("span",null,"Ctrl"),rt.default.createElement(bx,{className:"size-4"}),rt.default.createElement(Rp,{className:"!size-3"})),rt.default.createElement("span",null,"vault")))))))});FBt.displayName="ChatInput";var kBt=FBt;var BBt=require("obsidian"),Fr=B(X()),$Bt=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>Fr.default.createElement("div",{className:Ce("flex gap-1",{"group-hover:opacity-100 opacity-0":!BBt.Platform.isMobile})},t.sender===ti?Fr.default.createElement(Fr.default.Fragment,null,Fr.default.createElement(qr,null,Fr.default.createElement(Ur,{asChild:!0},Fr.default.createElement(ke,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},Fr.default.createElement(Df,{className:"size-4"}))),Fr.default.createElement(Lr,null,"Edit")),Fr.default.createElement(qr,null,Fr.default.createElement(Ur,{asChild:!0},Fr.default.createElement(ke,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Fr.default.createElement(_g,{className:"size-4"}))),Fr.default.createElement(Lr,null,"Delete"))):Fr.default.createElement(Fr.default.Fragment,null,u&&Fr.default.createElement(qr,null,Fr.default.createElement(Ur,{asChild:!0},Fr.default.createElement(ke,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},Fr.default.createElement(Oz,{className:"size-4"}))),Fr.default.createElement(Lr,null,"Show Sources")),Fr.default.createElement(qr,null,Fr.default.createElement(Ur,{asChild:!0},Fr.default.createElement(ke,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},Fr.default.createElement(Mz,{className:"size-4"}))),Fr.default.createElement(Lr,null,"Insert / Replace at cursor")),Fr.default.createElement(qr,null,Fr.default.createElement(Ur,{asChild:!0},Fr.default.createElement(ke,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Fr.default.createElement(yg,{className:"size-4"}):Fr.default.createElement(vx,{className:"size-4"}))),Fr.default.createElement(Lr,null,"Copy")),Fr.default.createElement(qr,null,Fr.default.createElement(Ur,{asChild:!0},Fr.default.createElement(ke,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},Fr.default.createElement(Az,{className:"size-4"}))),Fr.default.createElement(Lr,null,"Regenerate")),Fr.default.createElement(qr,null,Fr.default.createElement(Ur,{asChild:!0},Fr.default.createElement(ke,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Fr.default.createElement(_g,{className:"size-4"}))),Fr.default.createElement(Lr,null,"Delete"))));var qBt=require("obsidian"),_ae=class extends qBt.Modal{constructor(e,r){super(e),this.sources=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Sources"});let r=this.sources.filter(o=>o.score>=Uce),n=this.sources.filter(o=>o.score<Uce);r.length>0&&(e.createEl("h3",{text:"High Relevance Sources"}),this.createSourceList(e,r)),n.length>0&&(e.createEl("h3",{text:"Lower Relevance Sources"}),this.createSourceList(e,n))}createSourceList(e,r){let n=e.createEl("ul");n.style.listStyleType="none",n.style.padding="0",r.forEach(o=>{let i=n.createEl("li");i.style.marginBottom="1em",i.createEl("a",{href:`obsidian://open?vault=${encodeURIComponent(this.app.vault.getName())}&file=${encodeURIComponent(o.title)}`,text:o.title}).addEventListener("click",s=>{s.preventDefault(),this.app.workspace.openLinkText(o.title,"")}),o.score&&o.score<=1&&i.appendChild(document.createTextNode(` - Relevance score: ${o.score.toFixed(3)}`))})}onClose(){let{contentEl:e}=this;e.empty()}};var Nj=require("obsidian"),ir=B(X());function zfn({context:t}){return!t||t.notes.length===0&&t.urls.length===0?null:ir.default.createElement("div",{className:"flex gap-2 flex-wrap"},t.notes.map(e=>ir.default.createElement(qr,{key:e.path},ir.default.createElement(Ur,{asChild:!0},ir.default.createElement(py,{variant:"secondary"},ir.default.createElement("span",{className:"max-w-40 truncate"},e.basename))),ir.default.createElement(Lr,null,e.path))),t.urls.map(e=>ir.default.createElement(qr,{key:e},ir.default.createElement(Ur,{asChild:!0},ir.default.createElement(py,{variant:"secondary"},ir.default.createElement("span",{className:"max-w-40 truncate"},e))),ir.default.createElement(Lr,null,e))))}var Hfn=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i})=>{let[a,s]=(0,ir.useState)(!1),[u,l]=(0,ir.useState)(!1),[c,d]=(0,ir.useState)(t.message),f=(0,ir.useRef)(null),p=(0,ir.useRef)(null),m=(0,ir.useRef)(null),h=()=>{!navigator.clipboard||!navigator.clipboard.writeText||navigator.clipboard.writeText(t.message).then(()=>{s(!0),setTimeout(()=>{s(!1)},2e3)})},v=(0,ir.useCallback)(R=>{let N=e.workspace.getActiveFile(),L=N?N.path:"",k=z=>{let W="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",K="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",re="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)";if(r&&z.includes("<think>"))return z=z.replace(/<think>([\s\S]*?)<\/think>/g,(Y,Q)=>`<details style="${W}">
<summary style="${K}">Thought for a second</summary>
<div class="text-muted" style="${re}">${Q.trim()}</div>
</details>
`),z=z.replace(/<think>([\s\S]*)$/,(Y,Q)=>`<div style="${W}">
<div style="${K}">Thinking...</div>
<div class="text-muted" style="${re}">${Q.trim()}</div>
</div>`),z;let De=/<think>([\s\S]*?)<\/think>/g;return z.replace(De,(Y,Q)=>`<details style="${W}">
<summary style="${K}">Thought for a second</summary>
<div class="text-muted" style="${re}">${Q.trim()}</div>
</details>
`)},F=(z,W,K)=>z.split(/(```[\s\S]*?```|`[^`]*`)/g).map((De,Y)=>Y%2===0?De.replace(W,(Q,oe)=>{let Te=e.metadataCache.getFirstLinkpathDest(oe,L);return Te?K(Te):Q}):De).join(""),$=R.replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),U=F($,/!\[\[(.*?)]]/g,z=>`![](${e.vault.getResourcePath(z)})`),J=k(U),V=g(J);return F(V,/(?<!!)\[\[([^\]]+)]]/g,z=>`<a href="obsidian://open?file=${encodeURIComponent(z.path)}">${z.basename}</a>`)},[e,r]),g=R=>{let N=R.split(`
#### Sources:
`);if(N.length!==2)return R;let[L,k]=N,F=k.split(`
`).map($=>{let U=$.match(/- \[\[(.*?)\]\]/);return U?`<li>[[${U[1]}]]</li>`:$}).join(`
`);return L+`
<br/>
<details><summary>Sources</summary>
<ul>
`+F+`
</ul>
</details>`};(0,ir.useEffect)(()=>{if(f.current&&t.sender!==ti){f.current.innerHTML="",p.current||(p.current=new Nj.Component);let R=v(t.message);Nj.MarkdownRenderer.renderMarkdown(R,f.current,"",p.current)}return()=>{p.current&&(p.current.unload(),p.current=null)}},[t,e,p,r,v]),(0,ir.useEffect)(()=>{u&&m.current&&_(m.current)},[u]),(0,ir.useEffect)(()=>{d(t.message)},[t.message]);let _=R=>{R.style.height="auto",R.style.height=`${R.scrollHeight}px`},w=R=>{d(R.target.value),_(R.target)},x=R=>{R.nativeEvent.isComposing||R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),P())},C=()=>{l(!0)},P=()=>{l(!1),o&&o(c)},E=()=>{t.sources&&t.sources.length>0&&new _ae(e,t.sources).open()},A=()=>{let R=e.workspace.getMostRecentLeaf();if((!R||!(R.view instanceof Nj.MarkdownView))&&(R=e.workspace.getLeaf(!1),!R||!(R.view instanceof Nj.MarkdownView)))return;let L=R.view.editor.getSelection().length>0;pU(t.message,L)},M=()=>t.content?ir.default.createElement("div",{className:"message-content-items"},t.content.map((R,N)=>R.type==="text"?ir.default.createElement("div",{key:N,className:"message-text-content"},t.sender===ti&&u?ir.default.createElement("textarea",{ref:m,value:c,onChange:w,onKeyDown:x,onBlur:P,autoFocus:!0,className:"edit-textarea"}):t.sender===ti?ir.default.createElement("div",{className:"whitespace-pre-wrap break-words font-normal text-[calc(var(--font-text-size)_-_2px)]"},t.message):ir.default.createElement("div",{ref:f,className:t.isErrorMessage?"text-error":""})):R.type==="image_url"?ir.default.createElement("div",{key:N,className:"message-image-content"},ir.default.createElement("img",{src:R.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===ti&&u?ir.default.createElement("textarea",{ref:m,value:c,onChange:w,onKeyDown:x,onBlur:P,autoFocus:!0,className:"edit-textarea"}):t.sender===ti?ir.default.createElement("div",{className:"whitespace-pre-wrap break-words font-normal text-[calc(var(--font-text-size)_-_2px)]"},t.message):ir.default.createElement("div",{ref:f,className:t.isErrorMessage?"text-error":""});return ir.default.createElement("div",{className:"flex flex-col w-full my-1"},ir.default.createElement("div",{className:Ce("flex rounded-md p-2 mx-2 gap-2 group",t.sender===ti&&"border border-border border-solid")},ir.default.createElement("div",{className:"w-6 shrink-0"},t.sender===ti?ir.default.createElement(Rz,null):ir.default.createElement(aM,null)),ir.default.createElement("div",{className:"flex flex-col flex-grow max-w-full gap-2"},!u&&ir.default.createElement(zfn,{context:t.context}),ir.default.createElement("div",{className:"message-content"},M()),!r&&ir.default.createElement("div",{className:"flex justify-between items-center"},ir.default.createElement("div",{className:"text-faint text-xs"},t.timestamp?.display),ir.default.createElement($Bt,{message:t,onCopy:h,isCopied:a,onInsertIntoEditor:A,onRegenerate:n,onEdit:C,onDelete:i,onShowSources:E,hasSources:!!(t.sources&&t.sources.length>0)})))))},ARe=Hfn;var Dc=B(X(),1);function UBt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var HBt=B(X(),1);function zBt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function IRe(...t){return e=>{let r=!1,n=t.map(o=>{let i=zBt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():zBt(t[o],null)}}}}function VBt(...t){return HBt.useCallback(IRe(...t),t)}var WBt=B(X(),1),Gfn=B(fs(),1);var jc=B(X(),1);var k$=B(_t(),1),RRe=jc.forwardRef((t,e)=>{let{children:r,...n}=t,o=jc.Children.toArray(r),i=o.find(Wfn);if(i){let a=i.props.children,s=o.map(u=>u===i?jc.Children.count(a)>1?jc.Children.only(null):jc.isValidElement(a)?a.props.children:null:u);return(0,k$.jsx)(MRe,{...n,ref:e,children:jc.isValidElement(a)?jc.cloneElement(a,void 0,s):null})}return(0,k$.jsx)(MRe,{...n,ref:e,children:r})});RRe.displayName="Slot";var MRe=jc.forwardRef((t,e)=>{let{children:r,...n}=t;if(jc.isValidElement(r)){let o=Jfn(r);return jc.cloneElement(r,{...Kfn(n,r.props),ref:e?IRe(e,o):o})}return jc.Children.count(r)>1?jc.Children.only(null):null});MRe.displayName="SlotClone";var Vfn=({children:t})=>(0,k$.jsx)(k$.Fragment,{children:t});function Wfn(t){return jc.isValidElement(t)&&t.type===Vfn}function Kfn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function Jfn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var KBt=B(_t(),1),Yfn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],vae=Yfn.reduce((t,e)=>{let r=WBt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?RRe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,KBt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var Lj=B(_t(),1),jRe="Collapsible",[Zfn,OKo]=Ho(jRe),[Xfn,DRe]=Zfn(jRe),JBt=Dc.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=cl({prop:n,defaultProp:o,onChange:a});return(0,Lj.jsx)(Xfn,{scope:r,disabled:i,contentId:za(),open:u,onOpenToggle:Dc.useCallback(()=>l(c=>!c),[l]),children:(0,Lj.jsx)(vae.div,{"data-state":kRe(u),"data-disabled":i?"":void 0,...s,ref:e})})});JBt.displayName=jRe;var GBt="CollapsibleTrigger",NRe=Dc.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=DRe(GBt,r);return(0,Lj.jsx)(vae.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":kRe(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:UBt(t.onClick,o.onOpenToggle)})});NRe.displayName=GBt;var LRe="CollapsibleContent",FRe=Dc.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=DRe(LRe,t.__scopeCollapsible);return(0,Lj.jsx)(Bu,{present:r||o.open,children:({present:i})=>(0,Lj.jsx)(Qfn,{...n,ref:e,present:i})})});FRe.displayName=LRe;var Qfn=Dc.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=DRe(LRe,r),[s,u]=Dc.useState(n),l=Dc.useRef(null),c=VBt(e,l),d=Dc.useRef(0),f=d.current,p=Dc.useRef(0),m=p.current,h=a.open||s,v=Dc.useRef(h),g=Dc.useRef(void 0);return Dc.useEffect(()=>{let _=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(_)},[]),Qr(()=>{let _=l.current;if(_){g.current=g.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";let w=_.getBoundingClientRect();d.current=w.height,p.current=w.width,v.current||(_.style.transitionDuration=g.current.transitionDuration,_.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,Lj.jsx)(vae.div,{"data-state":kRe(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!h,...i,ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:h&&o})});function kRe(t){return t?"open":"closed"}var YBt=JBt;var CV=YBt,OV=NRe,EV=FRe;var MV=B(X());var na=B(X(),1);function ES(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var XBt=B(X(),1);function ZBt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function BRe(...t){return e=>{let r=!1,n=t.map(o=>{let i=ZBt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():ZBt(t[o],null)}}}}function my(...t){return XBt.useCallback(BRe(...t),t)}var Pa=B(X(),1);var QBt=B(X(),1),e$t=B(fs(),1);var Nc=B(X(),1);var B$=B(_t(),1),PV=Nc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Nc.Children.toArray(r),i=o.find(rpn);if(i){let a=i.props.children,s=o.map(u=>u===i?Nc.Children.count(a)>1?Nc.Children.only(null):Nc.isValidElement(a)?a.props.children:null:u);return(0,B$.jsx)($Re,{...n,ref:e,children:Nc.isValidElement(a)?Nc.cloneElement(a,void 0,s):null})}return(0,B$.jsx)($Re,{...n,ref:e,children:r})});PV.displayName="Slot";var $Re=Nc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Nc.isValidElement(r)){let o=opn(r);return Nc.cloneElement(r,{...npn(n,r.props),ref:e?BRe(e,o):o})}return Nc.Children.count(r)>1?Nc.Children.only(null):null});$Re.displayName="SlotClone";var tpn=({children:t})=>(0,B$.jsx)(B$.Fragment,{children:t});function rpn(t){return Nc.isValidElement(t)&&t.type===tpn}function npn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function opn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var t$t=B(_t(),1),ipn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],uf=ipn.reduce((t,e)=>{let r=QBt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?PV:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,t$t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function r$t(t,e){t&&e$t.flushSync(()=>t.dispatchEvent(e))}var URe=B(_t(),1),apn="DismissableLayer",qRe="dismissableLayer.update",spn="dismissableLayer.pointerDownOutside",upn="dismissableLayer.focusOutside",n$t,i$t=Pa.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zRe=Pa.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Pa.useContext(i$t),[c,d]=Pa.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Pa.useState({}),m=my(e,E=>d(E)),h=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(v),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,C=dpn(E=>{let A=E.target,M=[...l.branches].some(R=>R.contains(A));!x||M||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=fpn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return wS(E=>{_===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Pa.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(n$t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),o$t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=n$t)}},[c,f,r,l]),Pa.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),o$t())},[c,l]),Pa.useEffect(()=>{let E=()=>p({});return document.addEventListener(qRe,E),()=>document.removeEventListener(qRe,E)},[]),(0,URe.jsx)(uf.div,{...u,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:ES(t.onFocusCapture,P.onFocusCapture),onBlurCapture:ES(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:ES(t.onPointerDownCapture,C.onPointerDownCapture)})});zRe.displayName=apn;var lpn="DismissableLayerBranch",cpn=Pa.forwardRef((t,e)=>{let r=Pa.useContext(i$t),n=Pa.useRef(null),o=my(e,n);return Pa.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,URe.jsx)(uf.div,{...t,ref:o})});cpn.displayName=lpn;function dpn(t,e=globalThis?.document){let r=rr(t),n=Pa.useRef(!1),o=Pa.useRef(()=>{});return Pa.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){a$t(spn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function fpn(t,e=globalThis?.document){let r=rr(t),n=Pa.useRef(!1);return Pa.useEffect(()=>{let o=i=>{i.target&&!n.current&&a$t(upn,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function o$t(){let t=new CustomEvent(qRe);document.dispatchEvent(t)}function a$t(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?r$t(o,i):o.dispatchEvent(i)}var qh=B(X(),1);var d$t=B(_t(),1),HRe="focusScope.autoFocusOnMount",VRe="focusScope.autoFocusOnUnmount",s$t={bubbles:!1,cancelable:!0},ppn="FocusScope",WRe=qh.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=qh.useState(null),l=rr(o),c=rr(i),d=qh.useRef(null),f=my(e,h=>u(h)),p=qh.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;qh.useEffect(()=>{if(n){let _=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:jA(d.current,{select:!0})},w=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||jA(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&jA(s)};var h=_,v=w,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(x);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),qh.useEffect(()=>{if(s){l$t.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(HRe,s$t);s.addEventListener(HRe,l),s.dispatchEvent(g),g.defaultPrevented||(mpn(_pn(f$t(s)),{select:!0}),document.activeElement===h&&jA(s))}return()=>{s.removeEventListener(HRe,l),setTimeout(()=>{let g=new CustomEvent(VRe,s$t);s.addEventListener(VRe,c),s.dispatchEvent(g),g.defaultPrevented||jA(h??document.body,{select:!0}),s.removeEventListener(VRe,c),l$t.remove(p)},0)}}},[s,l,c,p]);let m=qh.useCallback(h=>{if(!r&&!n||p.paused)return;let v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(v&&g){let _=h.currentTarget,[w,x]=hpn(_);w&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&jA(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&jA(x,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,d$t.jsx)(uf.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});WRe.displayName=ppn;function mpn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(jA(n,{select:e}),document.activeElement!==r)return}function hpn(t){let e=f$t(t),r=u$t(e,t),n=u$t(e.reverse(),t);return[r,n]}function f$t(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function u$t(t,e){for(let r of t)if(!gpn(r,{upTo:e}))return r}function gpn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function ypn(t){return t instanceof HTMLInputElement&&"select"in t}function jA(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&ypn(t)&&e&&t.select()}}var l$t=bpn();function bpn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=c$t(t,e),t.unshift(e)},remove(e){t=c$t(t,e),t[0]?.resume()}}}function c$t(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function _pn(t){return t.filter(e=>e.tagName!=="A")}var cm=B(X(),1);var p$t=B(X(),1);var KRe=B(_t(),1),vpn="Arrow",m$t=p$t.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,KRe.jsx)(uf.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,KRe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});m$t.displayName=vpn;var h$t=m$t;var DA=B(_t(),1);var JRe="Popper",[g$t,GRe]=Ho(JRe),[Spn,y$t]=g$t(JRe),b$t=t=>{let{__scopePopper:e,children:r}=t,[n,o]=cm.useState(null);return(0,DA.jsx)(Spn,{scope:e,anchor:n,onAnchorChange:o,children:r})};b$t.displayName=JRe;var _$t="PopperAnchor",v$t=cm.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=y$t(_$t,r),a=cm.useRef(null),s=my(e,a);return cm.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,DA.jsx)(uf.div,{...o,ref:s})});v$t.displayName=_$t;var YRe="PopperContent",[xpn,Cpn]=g$t(YRe),w$t=cm.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,v=y$t(YRe,r),[g,_]=cm.useState(null),w=my(e,oe=>_(oe)),[x,C]=cm.useState(null),P=kh(x),E=P?.width??0,A=P?.height??0,M=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],L=N.length>0,k={padding:R,boundary:N.filter(Epn),altBoundary:L},{refs:F,floatingStyles:$,placement:U,isPositioned:J,middlewareData:V}=gA({strategy:"fixed",placement:M,whileElementsMounted:(...oe)=>SO(...oe,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[yA({mainAxis:o+A,alignmentAxis:a}),u&&bA({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?_A():void 0,...k}),u&&vA({...k}),wA({...k,apply:({elements:oe,rects:Te,availableWidth:bt,availableHeight:xe})=>{let{width:Z,height:te}=Te.reference,Ee=oe.floating.style;Ee.setProperty("--radix-popper-available-width",`${bt}px`),Ee.setProperty("--radix-popper-available-height",`${xe}px`),Ee.setProperty("--radix-popper-anchor-width",`${Z}px`),Ee.setProperty("--radix-popper-anchor-height",`${te}px`)}}),x&&xA({element:x,padding:s}),Ppn({arrowWidth:E,arrowHeight:A}),f&&SA({strategy:"referenceHidden",...k})]}),[j,z]=C$t(U),W=rr(m);Qr(()=>{J&&W?.()},[J,W]);let K=V.arrow?.x,re=V.arrow?.y,De=V.arrow?.centerOffset!==0,[Y,Q]=cm.useState();return Qr(()=>{g&&Q(window.getComputedStyle(g).zIndex)},[g]),(0,DA.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:J?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,DA.jsx)(xpn,{scope:r,placedSide:j,onArrowChange:C,arrowX:K,arrowY:re,shouldHideArrow:De,children:(0,DA.jsx)(uf.div,{"data-side":j,"data-align":z,...h,ref:w,style:{...h.style,animation:J?void 0:"none"}})})})});w$t.displayName=YRe;var S$t="PopperArrow",Opn={top:"bottom",right:"left",bottom:"top",left:"right"},x$t=cm.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Cpn(S$t,n),a=Opn[i.placedSide];return(0,DA.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,DA.jsx)(h$t,{...o,ref:r,style:{...o.style,display:"block"}})})});x$t.displayName=S$t;function Epn(t){return t!==null}var Ppn=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=C$t(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function C$t(t){let[e,r="center"]=t.split("-");return[e,r]}var O$t=b$t,ZRe=v$t,E$t=w$t,P$t=x$t;var wae=B(X(),1),T$t=B(fs(),1);var A$t=B(_t(),1),Apn="Portal",XRe=wae.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=wae.useState(!1);Qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?T$t.default.createPortal((0,A$t.jsx)(uf.div,{...n,ref:e}),a):null});XRe.displayName=Apn;var Cae=B(X());var Sd=B(X());var Sae=Pj();var QRe=function(){},TV=Sd.forwardRef(function(t,e){var r=Sd.useRef(null),n=Sd.useState({onScrollCapture:QRe,onWheelCapture:QRe,onTouchMoveCapture:QRe}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,v=t.as,g=v===void 0?"div":v,_=t.gapMode,w=TA(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,C=Ej([r,e]),P=Vo(Vo({},w),o);return Sd.createElement(Sd.Fragment,null,c&&Sd.createElement(x,{sideCar:Sae,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:_}),a?Sd.cloneElement(Sd.Children.only(s),Vo(Vo({},P),{ref:C})):Sd.createElement(g,Vo({},P,{className:u,ref:C}),s))});TV.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};TV.classNames={fullWidth:cy,zeroRight:ly};var qi=B(X());var e1e=!1;if(typeof window<"u")try{AV=Object.defineProperty({},"passive",{get:function(){return e1e=!0,!0}}),window.addEventListener("test",AV,AV),window.removeEventListener("test",AV,AV)}catch{e1e=!1}var AV,Fj=e1e?{passive:!1}:!1;var Ipn=function(t){return t.tagName==="TEXTAREA"},I$t=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Ipn(t)&&r[e]==="visible")},Mpn=function(t){return I$t(t,"overflowY")},Rpn=function(t){return I$t(t,"overflowX")},t1e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=M$t(t,n);if(o){var i=R$t(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},jpn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Dpn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},M$t=function(t,e){return t==="v"?Mpn(e):Rpn(e)},R$t=function(t,e){return t==="v"?jpn(e):Dpn(e)},Npn=function(t,e){return t==="h"&&e==="rtl"?-1:1},j$t=function(t,e,r,n,o){var i=Npn(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=R$t(t,s),m=p[0],h=p[1],v=p[2],g=h-v-i*m;(m||g)&&M$t(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var xae=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},D$t=function(t){return[t.deltaX,t.deltaY]},N$t=function(t){return t&&"current"in t?t.current:t},Lpn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Fpn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},kpn=0,$$=[];function L$t(t){var e=qi.useRef([]),r=qi.useRef([0,0]),n=qi.useRef(),o=qi.useState(kpn++)[0],i=qi.useState(xO)[0],a=qi.useRef(t);qi.useEffect(function(){a.current=t},[t]),qi.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=P$([t.lockRef.current],(t.shards||[]).map(N$t),!0).filter(Boolean);return h.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=qi.useCallback(function(h,v){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=xae(h),_=r.current,w="deltaX"in h?h.deltaX:_[0]-g[0],x="deltaY"in h?h.deltaY:_[1]-g[1],C,P=h.target,E=Math.abs(w)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=t1e(E,P);if(!A)return!0;if(A?C=E:(C=E==="v"?"h":"v",A=t1e(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(w||x)&&(n.current=C),!C)return!0;var M=n.current||C;return j$t(M,v,h,M==="h"?w:x,!0)},[]),u=qi.useCallback(function(h){var v=h;if(!(!$$.length||$$[$$.length-1]!==i)){var g="deltaY"in v?D$t(v):xae(v),_=e.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&Lpn(C.delta,g)})[0];if(_&&_.should){v.cancelable&&v.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(N$t).filter(Boolean).filter(function(C){return C.contains(v.target)}),x=w.length>0?s(v,w[0]):!a.current.noIsolation;x&&v.cancelable&&v.preventDefault()}}},[]),l=qi.useCallback(function(h,v,g,_){var w={name:h,delta:v,target:g,should:_,shadowParent:Bpn(g)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(x){return x!==w})},1)},[]),c=qi.useCallback(function(h){r.current=xae(h),n.current=void 0},[]),d=qi.useCallback(function(h){l(h.type,D$t(h),h.target,s(h,t.lockRef.current))},[]),f=qi.useCallback(function(h){l(h.type,xae(h),h.target,s(h,t.lockRef.current))},[]);qi.useEffect(function(){return $$.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,Fj),document.addEventListener("touchmove",u,Fj),document.addEventListener("touchstart",c,Fj),function(){$$=$$.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,Fj),document.removeEventListener("touchmove",u,Fj),document.removeEventListener("touchstart",c,Fj)}},[]);var p=t.removeScrollBar,m=t.inert;return qi.createElement(qi.Fragment,null,m?qi.createElement(i,{styles:Fpn(o)}):null,p?qi.createElement(Aj,{gapMode:t.gapMode}):null)}function Bpn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var F$t=Tj(Sae,L$t);var k$t=Cae.forwardRef(function(t,e){return Cae.createElement(TV,Vo({},t,{ref:e,sideCar:F$t}))});k$t.classNames=TV.classNames;var r1e=k$t;var Uu=B(_t(),1),n1e="Popover",[B$t,$Jo]=Ho(n1e,[GRe]),IV=GRe(),[$pn,NA]=B$t(n1e),$$t=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=IV(e),u=na.useRef(null),[l,c]=na.useState(!1),[d=!1,f]=cl({prop:n,defaultProp:o,onChange:i});return(0,Uu.jsx)(O$t,{...s,children:(0,Uu.jsx)($pn,{scope:e,contentId:za(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:na.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:na.useCallback(()=>c(!0),[]),onCustomAnchorRemove:na.useCallback(()=>c(!1),[]),modal:a,children:r})})};$$t.displayName=n1e;var q$t="PopoverAnchor",qpn=na.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=NA(q$t,r),i=IV(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return na.useEffect(()=>(a(),()=>s()),[a,s]),(0,Uu.jsx)(ZRe,{...i,...n,ref:e})});qpn.displayName=q$t;var U$t="PopoverTrigger",z$t=na.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=NA(U$t,r),i=IV(r),a=my(e,o.triggerRef),s=(0,Uu.jsx)(uf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":J$t(o.open),...n,ref:a,onClick:ES(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,Uu.jsx)(ZRe,{asChild:!0,...i,children:s})});z$t.displayName=U$t;var o1e="PopoverPortal",[Upn,zpn]=B$t(o1e,{forceMount:void 0}),H$t=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=NA(o1e,e);return(0,Uu.jsx)(Upn,{scope:e,forceMount:r,children:(0,Uu.jsx)(Bu,{present:r||i.open,children:(0,Uu.jsx)(XRe,{asChild:!0,container:o,children:n})})})};H$t.displayName=o1e;var q$="PopoverContent",V$t=na.forwardRef((t,e)=>{let r=zpn(q$,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=NA(q$,t.__scopePopover);return(0,Uu.jsx)(Bu,{present:n||i.open,children:i.modal?(0,Uu.jsx)(Hpn,{...o,ref:e}):(0,Uu.jsx)(Vpn,{...o,ref:e})})});V$t.displayName=q$;var Hpn=na.forwardRef((t,e)=>{let r=NA(q$,t.__scopePopover),n=na.useRef(null),o=my(e,n),i=na.useRef(!1);return na.useEffect(()=>{let a=n.current;if(a)return PA(a)},[]),(0,Uu.jsx)(r1e,{as:PV,allowPinchZoom:!0,children:(0,Uu.jsx)(W$t,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ES(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:ES(t.onPointerDownOutside,a=>{let s=a.detail.originalEvent,u=s.button===0&&s.ctrlKey===!0,l=s.button===2||u;i.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:ES(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Vpn=na.forwardRef((t,e)=>{let r=NA(q$,t.__scopePopover),n=na.useRef(!1),o=na.useRef(!1);return(0,Uu.jsx)(W$t,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));let a=i.target;r.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),W$t=na.forwardRef((t,e)=>{let{__scopePopover:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onInteractOutside:c,...d}=t,f=NA(q$,r),p=IV(r);return mA(),(0,Uu.jsx)(WRe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Uu.jsx)(zRe,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,Uu.jsx)(E$t,{"data-state":J$t(f.open),role:"dialog",id:f.contentId,...p,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),K$t="PopoverClose",Wpn=na.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=NA(K$t,r);return(0,Uu.jsx)(uf.button,{type:"button",...n,ref:e,onClick:ES(t.onClick,()=>o.onOpenChange(!1))})});Wpn.displayName=K$t;var Kpn="PopoverArrow",Jpn=na.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=IV(r);return(0,Uu.jsx)(P$t,{...o,...n,ref:e})});Jpn.displayName=Kpn;function J$t(t){return t?"open":"closed"}var G$t=$$t;var Y$t=z$t,Z$t=H$t,i1e=V$t;var X$t=G$t,Q$t=Y$t;var a1e=MV.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>MV.createElement(Z$t,{container:n??activeDocument.body},MV.createElement(i1e,{ref:i,align:e,sideOffset:r,className:Ce("z-popover w-72 rounded-md border border-border bg-primary p-4 text-normal shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...o})));a1e.displayName=i1e.displayName;var s1e=B(X()),Oae=s1e.createContext(void 0),U$=s1e.createContext(void 0);var z$=B(X());function u1e(){let[t,e]=(0,z$.useState)(null),r=(0,z$.useContext)(U$);return(0,z$.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(ix.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(ix.ACTIVE_LEAF_CHANGE,n)}},[r]),t}var eqt=require("obsidian");function tqt(t,e=20){let r=app.metadataCache.getFileCache(t),n=[];if(r?.links)for(let o of r.links){let i=app.metadataCache.getFirstLinkpathDest(o.link,t.path);if(i&&(n.push(i),n.length>=e))break}if(r?.embeds&&n.length<e)for(let o of r.embeds){let i=app.metadataCache.getFirstLinkpathDest(o.link,t.path);if(i&&(n.push(i),n.length>=e))break}return[...new Set(n)]}function rqt(t,e=20){let r=[],n=app.metadataCache.getBacklinksForFile(t);if(n?.data)for(let[o]of n.data){let i=app.vault.getAbstractFileByPath(o);if(i instanceof eqt.TFile&&(r.push(i),r.length>=e))break}return r}var l1e=require("obsidian"),Ypn=.4,Zpn=20,nqt=.7,Eae=.3;async function Xpn(t,e){let r=de().debug,n=await _C.getDocsByPath(e,t);if(!n)return r&&console.log("No hits found for note:",t),[];let o=[];for(let i of n){if(!i?.document?.embedding){r&&console.log("No embedding found for note:",t);continue}o.push(i.document.embedding)}return o}function Qpn(t){if(t.length===0)return[];let e=t[0].length,r=Array(e).fill(0);return t.forEach(n=>{n.forEach((o,i)=>{r[i]+=o/e})}),r}function emn(t,e){let r=new Map;for(let n of t){let o=r.get(n.document.path);o?n.score>o&&r.set(n.document.path,n.score):r.set(n.document.path,n.score)}return r.delete(e),r}async function tmn({db:t,filePath:e}){let r=de().debug,n=await Xpn(e,t),o=Qpn(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await _C.getDocsByEmbedding(t,o,{limit:Zpn,similarity:Ypn});return emn(i,e)}function rmn(t){let e=new Map,n=tqt(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=rqt(t).map(a=>a.path);for(let a of i)e.has(a)?e.set(a,{links:!0,backlinks:!0}):e.set(a,{links:!1,backlinks:!0});return e}function nmn(t,e){let r=new Map,n=nqt+Eae;for(let[o,i]of t)r.set(o,i*nqt/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=Eae:(i.links||i.backlinks)&&(a=Eae*.8),r.set(o,(r.get(o)??0)+a)}return r}async function oqt({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof l1e.TFile))return[];let n=await tmn({db:t,filePath:e}),o=rmn(r),i=nmn(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=Pae(n.get(l)??0),f=Pae(n.get(c)??0);return d!==f?f-d:u[1]-s[1]}).map(([s,u])=>{let l=app.vault.getAbstractFileByPath(s);return l instanceof l1e.TFile?{document:{path:s,title:l.basename},metadata:{score:u,similarityScore:n.get(s),hasOutgoingLinks:o.get(s)?.links??!1,hasBacklinks:o.get(s)?.backlinks??!1}}:null}).filter(s=>s!==null)}function Pae(t){return t>.7?3:t>.55?2:1}var RV=require("obsidian"),$e=B(X());function omn(t){let[e,r]=(0,$e.useState)([]),n=u1e();return(0,$e.useEffect)(()=>{async function o(){if(!n?.path)return;let i=await va.getInstance().getDb(),a=await oqt({db:i,filePath:n.path});r(a)}o()},[n?.path,t]),e}function imn(t,e){let[r,n]=(0,$e.useState)(!0);return(0,$e.useEffect)(()=>{if(!t)return;async function o(){let i=await va.getInstance().hasIndex(t);n(i)}o()},[t,e]),r}function amn({score:t}){let e=Pae(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),$e.default.createElement("span",{className:"text-sm"},r)}function smn({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,$e.useState)(!1),[i,a]=(0,$e.useState)(null),s=(0,$e.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof RV.TFile){let l=await app.vault.cachedRead(u),c=l;if(l.startsWith("---")){let d=l.indexOf("---",3);d!==-1&&(c=l.slice(d+3).trim())}a(c.slice(0,1e3)+(c.length>1e3?"...":""))}},[i,t.document.path]);return(0,$e.useEffect)(()=>{n&&s()},[n,s]),$e.default.createElement(CV,{open:n,onOpenChange:o,className:"rounded-md border border-border border-solid"},$e.default.createElement("div",{className:Ce("flex gap-2 p-2 justify-between items-center")},$e.default.createElement(ke,{variant:"ghost2",size:"icon",className:"shrink-0",asChild:!0},$e.default.createElement(OV,null,$e.default.createElement(_x,{className:Ce("size-4 transition-transform duration-200",{"transform rotate-90":n})}))),$e.default.createElement("div",{className:"flex items-center gap-2 shrink-0"},$e.default.createElement(amn,{score:t.metadata.similarityScore??0})),$e.default.createElement("div",{className:"flex-1 overflow-hidden"},$e.default.createElement("a",{onClick:u=>{u.preventDefault();let l=u.metaKey||u.ctrlKey;r(l)},onAuxClick:u=>{u.button===1&&(u.preventDefault(),r(!0))},className:"text-sm text-normal font-bold text-ellipsis overflow-hidden whitespace-nowrap w-full block"},t.document.title)),$e.default.createElement(qr,null,$e.default.createElement(Ur,{asChild:!0},$e.default.createElement(ke,{variant:"ghost2",size:"icon",onClick:e,className:"shrink-0"},$e.default.createElement(bg,{className:"size-4"}))),$e.default.createElement(Lr,null,"Add to Chat"))),$e.default.createElement(EV,null,$e.default.createElement("div",{className:"px-4 py-2 border-[0px] border-t border-border border-solid"},$e.default.createElement("div",{className:"text-xs text-muted text-wrap opacity-75 break-all whitespace-pre-wrap"},t.document.path),i&&$e.default.createElement("div",{className:"text-xs text-normal whitespace-pre-wrap pt-2 pb-4 border-t border-border overflow-hidden"},i)),$e.default.createElement("div",{className:"flex item-center gap-4 px-4 py-2 border-[0px] border-t border-solid border-border text-xs text-muted"},t.metadata.similarityScore!=null&&$e.default.createElement("div",{className:"flex items-center gap-1"},$e.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&$e.default.createElement("div",{className:"flex items-center gap-1"},$e.default.createElement(_z,{className:"size-4"}),$e.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&$e.default.createElement("div",{className:"flex items-center gap-1"},$e.default.createElement(bz,{className:"size-4"}),$e.default.createElement("span",null,"Backlinks")))))}function umn({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return $e.default.createElement(X$t,{key:t.document.path},$e.default.createElement(Q$t,{asChild:!0},n),$e.default.createElement(a1e,{className:"flex flex-col gap-2 overflow-hidden w-fit min-w-72 max-w-96"},$e.default.createElement("span",{className:"text-sm text-normal"},t.document.title),$e.default.createElement("span",{className:"text-xs text-muted"},t.document.path),$e.default.createElement("div",{className:"flex gap-2"},$e.default.createElement("button",{onClick:e,className:"!bg-transparent inline-flex items-center gap-2 border border-border border-solid !shadow-none hover:!bg-interactive-hover"},"Add to Chat ",$e.default.createElement(bg,{className:"size-4"})),$e.default.createElement("button",{onClick:o=>{let i=o.metaKey||o.ctrlKey;r(i)},className:"!bg-transparent inline-flex items-center gap-2 border border-border border-solid !shadow-none hover:!bg-interactive-hover"},"Navigate to Note ",$e.default.createElement(dz,{className:"size-4"})))))}var Tae=(0,$e.memo)(({className:t,onInsertToChat:e,defaultOpen:r=!1})=>{let[n,o]=(0,$e.useState)(0),[i,a]=(0,$e.useState)(r),s=omn(n),u=u1e(),l=imn(u?.path??"",n),c=(p,m=!1)=>{let h=app.vault.getAbstractFileByPath(p);h instanceof RV.TFile&&app.workspace.getLeaf(m).openFile(h)},d=p=>{e(`[[${p}]]`)},f=async()=>{u&&(await va.getInstance().reindexFile(u),new RV.Notice(`Reindexed ${u.name}`),o(n+1))};return $e.default.createElement("div",{className:Ce("w-full border border-transparent border-b-border border-solid pb-2",t)},$e.default.createElement(CV,{open:i,onOpenChange:a},$e.default.createElement("div",{className:"flex justify-between items-center pl-1 pb-2"},$e.default.createElement("div",{className:"flex gap-2 items-center flex-1"},$e.default.createElement("span",{className:"font-semibold text-normal"},"Relevant Notes"),$e.default.createElement(qr,null,$e.default.createElement(Ur,{asChild:!0},$e.default.createElement(xz,{className:"size-4 text-muted"})),$e.default.createElement(Lr,{side:"bottom",className:"w-64"},"Relevance is a combination of semantic similarity and links.")),!l&&$e.default.createElement(qr,null,$e.default.createElement(Ur,{asChild:!0},$e.default.createElement(Bm,{className:"size-4 text-warning"})),$e.default.createElement(Lr,{side:"bottom"},"Note has not been indexed"))),$e.default.createElement("div",{className:"flex items-center"},$e.default.createElement(qr,null,$e.default.createElement(Ur,{asChild:!0},$e.default.createElement(ke,{variant:"ghost2",size:"icon",onClick:f},$e.default.createElement(Pz,{className:"size-4"}))),$e.default.createElement(Lr,{side:"bottom"},"Reindex Current Note")),s.length>0&&$e.default.createElement(OV,{asChild:!0},$e.default.createElement(ke,{variant:"ghost2",size:"icon"},i?$e.default.createElement(sM,{className:"size-5"}):$e.default.createElement(ps,{className:"size-5"}))))),s.length===0&&$e.default.createElement("div",{className:"flex flex-wrap gap-x-2 gap-y-1 max-h-12 overflow-y-hidden px-1"},$e.default.createElement("span",{className:"text-xs text-muted"},"No relevant notes found")),!i&&s.length>0&&$e.default.createElement("div",{className:"flex flex-wrap gap-x-2 gap-y-1 max-h-6 overflow-y-hidden px-1"},s.map(p=>$e.default.createElement(umn,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)},$e.default.createElement(py,{variant:"outline",key:p.document.path,className:"text-xs max-w-40 text-muted hover:cursor-pointer hover:bg-interactive-hover"},$e.default.createElement("span",{className:"text-ellipsis overflow-hidden whitespace-nowrap"},p.document.title))))),$e.default.createElement(EV,null,$e.default.createElement("div",{className:"px-1 py-2 max-h-screen overflow-y-auto flex flex-col gap-2"},s.map(p=>$e.default.createElement(smn,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)}))))))});Tae.displayName="RelevantNotes";var dp=B(X());var jV=dp.forwardRef(({className:t,...e},r)=>dp.createElement("div",{ref:r,className:Ce("rounded-xl border border-border bg-primary text-normal shadow",t),...e}));jV.displayName="Card";var DV=dp.forwardRef(({className:t,...e},r)=>dp.createElement("div",{ref:r,className:Ce("flex flex-col space-y-1.5 p-6",t),...e}));DV.displayName="CardHeader";var c1e=dp.forwardRef(({className:t,...e},r)=>dp.createElement("div",{ref:r,className:Ce("font-semibold leading-none tracking-tight",t),...e}));c1e.displayName="CardTitle";var lmn=dp.forwardRef(({className:t,...e},r)=>dp.createElement("div",{ref:r,className:Ce("text-sm text-muted",t),...e}));lmn.displayName="CardDescription";var NV=dp.forwardRef(({className:t,...e},r)=>dp.createElement("div",{ref:r,className:Ce("p-6 pt-0",t),...e}));NV.displayName="CardContent";var cmn=dp.forwardRef(({className:t,...e},r)=>dp.createElement("div",{ref:r,className:Ce("flex items-center p-6 pt-0",t),...e}));cmn.displayName="CardFooter";var Si=B(X()),d1e={activeNote:{title:"Active Note Insights",prompts:["Provide three follow-up questions worded as if I'm asking you based on {activeNote}?","What key questions does {activeNote} answer?","Give me a quick recap of {activeNote} in two sentences."]},quoteNote:{title:"Note Link Chat",prompts:["Based on [[<note>]], what improvements should we focus on next?","Summarize the key points from [[<note>]].","Summarize the recent updates from [[<note>]].","Roast my writing in [[<note>]] and give concrete actionable feedback"]},fun:{title:"Test LLM",prompts:["9.11 and 9.8, which is bigger?","What's the longest river in the world?","If a lead ball and a feather are dropped simultaneously from the same height, which will reach the ground first?"]},qaVault:{title:"Vault Q&A",prompts:["What insights can I gather about <topic> from my notes?","Explain <concept> based on my stored notes.","Highlight important details on <topic> from my notes.","Based on my notes on <topic>, what is the question that I should be asking, but am not?"]},copilotPlus:{title:"Copilot Plus",prompts:["Give me a recap of last week @vault","What are the key takeaways from my notes on <topic> @vault","Summarize <url> in under 10 bullet points","@youtube <video_url>","@web what are most recent updates in the AI industry","What are the key insights from this paper <arxiv_url>","What new methods are proposed in this paper [[<note_with_embedded_pdf>]]"]}},iqt={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"]};function dmn(t="llm_chain"){let e=iqt[t]||iqt.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...d1e[n].prompts].sort(()=>Math.random()-.5)),{title:d1e[n].title,text:r[n].pop()||d1e[n].prompts[0]}))}var aqt=({onClick:t})=>{let[e]=Ny(),r=(0,Si.useMemo)(()=>dmn(e),[e]),o=Bo().indexVaultToVectorStore;return Si.default.createElement("div",{className:"flex flex-col gap-4"},Si.default.createElement(jV,{className:"w-full bg-transparent"},Si.default.createElement(DV,{className:"px-2"},Si.default.createElement(c1e,null,"Suggested Prompts")),Si.default.createElement(NV,{className:"p-2 pt-0"},Si.default.createElement("div",{className:"flex flex-col gap-2"},r.map((i,a)=>Si.default.createElement("div",{key:a,className:"flex gap-2 p-2 justify-between text-sm rounded-md border border-border border-solid"},Si.default.createElement("div",{className:"flex flex-col gap-1"},Si.default.createElement("div",{className:"text-muted"},i.title),Si.default.createElement("div",null,i.text)),Si.default.createElement("div",{className:"flex items-start h-full"},Si.default.createElement(qr,null,Si.default.createElement(Ur,{asChild:!0},Si.default.createElement(ke,{variant:"ghost2",size:"fit",className:"text-muted",onClick:()=>t(i.text)},Si.default.createElement(bg,{className:"size-4"}))),Si.default.createElement(Lr,null,"Add to Chat")))))))),e==="vault_qa"&&Si.default.createElement("div",{className:"text-sm border border-border border-solid p-2 rounded-md"},"Please note that this is a retrieval-based QA. Questions should contain keywords and concepts that exist literally in your vault"),e==="vault_qa"&&o==="NEVER"&&Si.default.createElement("div",{className:"text-sm border border-border border-solid p-2 rounded-md"},Si.default.createElement("div",null,Si.default.createElement(Bm,{className:"size-4"})," Your auto-index strategy is set to ",Si.default.createElement("b",null,"NEVER"),". Before proceeding, click the ",Si.default.createElement("span",{className:"text-accent"},"Refresh Index")," button below or run the"," ",Si.default.createElement("span",{className:"text-accent"},"Copilot command: Index (refresh) vault for QA")," to update the index.")))};var xd=B(X()),sqt=(0,xd.memo)(({chatHistory:t,currentAiMessage:e,loading:r,loadingMessage:n,app:o,onRegenerate:i,onEdit:a,onDelete:s,onInsertToChat:u,onReplaceChat:l})=>{let[c,d]=(0,xd.useState)(""),f=Bo(),p=()=>{let h=document.querySelector("[data-testid='chat-messages']");h&&(h.scrollTop=h.scrollHeight)};if((0,xd.useEffect)(()=>{r||p()},[r]),(0,xd.useEffect)(()=>{let h;return r?h=setInterval(()=>{d(v=>v.length<6?v+".":"")},200):d(""),()=>clearInterval(h)},[r]),!t.filter(h=>h.isVisible).length&&!e)return xd.default.createElement("div",{className:"flex flex-col gap-2 overflow-y-auto w-full h-full"},f.showRelevantNotes&&xd.default.createElement(Tae,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),f.showSuggestedPrompts&&xd.default.createElement(aqt,{onClick:l}));let m=()=>n?`${n} ${c}`:c;return xd.default.createElement("div",{className:"flex flex-col flex-1 h-full overflow-hidden"},f.showRelevantNotes&&xd.default.createElement(Tae,{className:"mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),xd.default.createElement("div",{"data-testid":"chat-messages",className:"flex flex-col items-start justify-start flex-1 overflow-y-auto w-full break-words text-[calc(var(--font-text-size)_-_2px)] box-border scroll-smooth mt-auto select-text"},t.map((h,v)=>h.isVisible&&xd.default.createElement(ARe,{key:v,message:h,app:o,isStreaming:!1,onRegenerate:()=>i(v),onEdit:g=>a(v,g),onDelete:()=>s(v)})),(e||r)&&xd.default.createElement(ARe,{key:`ai_message_${e}`,message:{sender:"AI",message:e||m(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{}})))});sqt.displayName="ChatMessages";var uqt=sqt;var Aae=B(X());function Iae(t){let[e,r]=(0,Aae.useState)(null);(0,Aae.useEffect)(()=>{(async()=>{let i=await w$e();i.version&&r(i.version)})()},[]);let n=e!==null&&s9(e,t);return{latestVersion:e,hasUpdate:n}}var Uh=B(X());function lqt({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=Iae(t),n=Bo().lastDismissedVersion,[o,i]=(0,Uh.useState)(!0),a=r&&e&&s9(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{xt("lastDismissedVersion",e)},300))};return a?Uh.default.createElement("div",{className:Ce("min-h-14 overflow-hidden",o?"animate-in slide-in-from-top duration-300":"animate-out slide-out-to-top duration-300")},Uh.default.createElement("div",{className:"flex items-center justify-between gap-2 p-2 pl-3 mb-1 text-xs border border-border border-solid rounded-md"},Uh.default.createElement("div",{className:"flex items-center gap-2"},Uh.default.createElement("span",{className:"font-medium"},"Update available:"),"(",Uh.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"text-normal"},"v",e)),Uh.default.createElement("div",{className:"flex items-center gap-2"},Uh.default.createElement(ke,{size:"fit",variant:"ghost2",className:"text-accent hover:text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),Uh.default.createElement(ke,{variant:"ghost2",size:"icon",onClick:s},Uh.default.createElement(Nf,{className:"size-4"}))))):null}var f1e=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){nt("Model request failed:",s);let u="Model request failed: "+Pi(s);r({sender:Ry,isErrorMessage:!0,message:`Error: ${u}`,isVisible:!0,timestamp:_l(new Date)})}};var Mae=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Ss.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}extractAllUrls(e){let r=/https?:\/\/[^\s"'<>]+/g;return(e.match(r)||[]).map(n=>n.replace(/,+$/,"")).filter((n,o,i)=>i.indexOf(n)===o)}extractUrls(e){let r=/https?:\/\/[^\s"'<>]+/g;return(e.match(r)||[]).map(n=>n.replace(/,+$/,"")).filter((n,o,i)=>i.indexOf(n)===o).filter(n=>!v$e(n))}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){return console.error(`Error processing URL ${e}:`,r),{response:e,elapsed_time_ms:0}}}async processUrls(e){let r=this.extractUrls(e),n="",o=[];if(r.length===0)return{urlContext:"",imageUrls:[]};let i=r.map(async s=>{if(await bS.isImageUrl(s,app.vault))return o.push(s),null;if(!this.mentions.has(s)){let u=await this.processUrl(s);this.mentions.set(s,{type:"url",original:s,processed:u.response})}return this.mentions.get(s)});return(await Promise.all(i)).forEach(s=>{s?.processed&&(n+=`
Content from ${s.original}:
${s.processed}`)}),{urlContext:n,imageUrls:o}}getMentions(){return this.mentions}clearMentions(){this.mentions.clear()}};var kj=B(X()),p1e=class{constructor(){this.chatHistory=[]}addMessage(e){this.chatHistory.push(e)}getMessages(){return this.chatHistory}clearChatHistory(){this.chatHistory=[]}};function cqt(t){let[e,r]=(0,kj.useState)(t.getMessages());(0,kj.useEffect)(()=>{r(t.getMessages())},[t]);let n=(0,kj.useCallback)(i=>{t.addMessage(i),r([...t.getMessages()])},[t]),o=(0,kj.useCallback)(()=>{t.clearChatHistory(),r([])},[t]);return[e,n,o]}var dqt=p1e;var fqt=B(Tf()),PS=require("obsidian"),An=B(X()),fmn=({sharedState:t,chainManager:e,onSaveChat:r,updateUserMessageHistory:n,fileParserManager:o,plugin:i})=>{let a=Bo(),s=(0,An.useContext)(U$),[u,l,c]=cqt(t),[d]=ZD(),[f]=Ny(),[p,m]=(0,An.useState)(""),[h,v]=(0,An.useState)(""),[g,_]=(0,An.useState)(null),[w,x]=(0,An.useState)(!1),[C,P]=(0,An.useState)(ox.DEFAULT),[E,A]=(0,An.useState)(-1),[M,R]=(0,An.useState)([]),[N,L]=(0,An.useState)(!1),[k,F]=(0,An.useState)([]),$=Mae.getInstance(),U=F$.getInstance(),J=(0,An.useRef)(null);(0,An.useEffect)(()=>{let Z=()=>{J.current&&J.current.focus()};return s?.addEventListener(ix.CHAT_IS_VISIBLE,Z),()=>{s?.removeEventListener(ix.CHAT_IS_VISIBLE,Z)}},[s]);let V=(0,An.useContext)(Oae),j=i.app||V,z=async({toolCalls:Z,urls:te,contextNotes:Ee}={})=>{if(!h&&k.length===0)return;let Le=_l(new Date),Ze=[];h&&Ze.push({type:"text",text:h});for(let Ue of k){let zr=await Ue.arrayBuffer(),ia=fqt.Buffer.from(zr).toString("base64");Ze.push({type:"image_url",image_url:{url:`data:${Ue.type};base64,${ia}`}})}let Ot=[...Ee||[]],Yt=j.workspace.getActiveFile();N&&Yt&&!Ot.some(Ue=>Ue.path===Yt.path)&&Ot.push(Yt);let Wn={message:h||"Image message",originalMessage:h,sender:ti,isVisible:!0,timestamp:Le,content:Ze,context:{notes:Ot,urls:te||[]}};v(""),F([]),l(Wn),x(!0),P(ox.DEFAULT);let nr=bO.getInstance(j.vault),{processedPrompt:ve,includedFiles:vn}=await nr.processCustomPrompt(h||"","",j.workspace.getActiveFile()),lt=f==="copilot_plus"?await $.processUrls(h||""):{urlContext:"",imageUrls:[]},qe=new Set(vn.map(Ue=>Ue.path)),ie=await U.processContextNotes(qe,o,j.vault,Ot,N,Yt,f),ce=ve+lt.urlContext+ie,_e=h;Z&&(_e+=" "+Z.join(`
`));let be={message:ce,originalMessage:_e,sender:ti,isVisible:!1,timestamp:Le,content:Ze,context:{notes:Ot,urls:f==="copilot_plus"?[...te||[],...lt.imageUrls]:te||[]}};l(be),h&&(n(h),A(-1)),await f1e(be,e,l,m,_,{debug:a.debug,updateLoadingMessage:P}),x(!1),P(ox.DEFAULT)},W=Z=>{let te=i.userMessageHistory;return Z==="up"&&E<te.length-1?(A(E+1),te[te.length-1-E-1]):Z==="down"&&E>-1?(A(E-1),E===0?"":te[te.length-1-E+1]):h},K=(0,An.useCallback)(async(Z=!1)=>{if(!j){console.error("App instance is not available.");return}let te=u.filter(Ze=>Ze.isVisible);if(te.length===0){new PS.Notice("No messages to save.");return}let Ee=te[0].timestamp?.epoch||Date.now(),Le=te.map(Ze=>`**${Ze.sender}**: ${Ze.message}
[Timestamp: ${Ze.timestamp?.display}]`).join(`
`);try{j.vault.getAbstractFileByPath(a.defaultSaveFolder)||await j.vault.createFolder(a.defaultSaveFolder);let{fileName:Ot}=_l(new Date(Ee)),Yt=te.find(ie=>ie.sender===ti),Wn=Yt?Yt.message.split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|]/g,"").trim():"Untitled Chat",nr=a.defaultConversationNoteName||"{$date}_{$time}__{$topic}";nr=nr.replace("{$topic}",Wn.slice(0,100).replace(/\s+/g,"_")).replace("{$date}",Ot.split("_")[0]).replace("{$time}",Ot.split("_")[1]);let ve=nr.replace(/[\\/:*?"<>|]/g,"_"),vn=`${a.defaultSaveFolder}/${ve}.md`,lt=`---
epoch: ${Ee}
modelKey: ${d}
tags:
- ${a.defaultConversationTag}
---
${Le}`,qe=j.vault.getAbstractFileByPath(vn);if(qe instanceof PS.TFile?(await j.vault.modify(qe,lt),new PS.Notice(`Chat updated in existing note: ${vn}`)):(await j.vault.create(vn,lt),new PS.Notice(`Chat saved as new note: ${vn}`)),Z){let ie=j.vault.getAbstractFileByPath(vn);ie instanceof PS.TFile&&j.workspace.getLeaf().openFile(ie)}}catch(Ze){console.error("Error saving chat as note:",Pi(Ze)),new PS.Notice("Failed to save chat as note. Check console for details.")}},[j,u,d,a.defaultConversationTag,a.defaultSaveFolder,a.defaultConversationNoteName]),re=(0,An.useCallback)(Z=>{g&&(a.debug&&console.log(`stopping generation..., reason: ${Z}`),g.abort(Z),x(!1))},[g,a.debug]),De=(0,An.useCallback)(async Z=>{let te=Z-1;if(te<0||u[te].sender!==ti){new PS.Notice("Cannot regenerate the first message or a user message.");return}let Ee=u[te],Le=u.slice(0,Z);c(),Le.forEach(l),e.memoryManager.clearChatMemory();for(let Ze=0;Ze<Le.length;Ze+=2){let Ot=Le[Ze],Yt=Le[Ze+1];Ot&&Yt&&await e.memoryManager.getMemory().saveContext({input:Ot.message},{output:Yt.message})}x(!0);try{await e.runChain(Ee,new AbortController,m,l,{debug:a.debug})&&a.debug&&console.log("Message regenerated successfully")}catch(Ze){console.error("Error regenerating message:",Ze),new PS.Notice("Failed to regenerate message. Please try again.")}finally{x(!1)}},[l,e,u,c,a.debug]),Y=(0,An.useCallback)(async(Z,te)=>{let Ee=u[Z].message;if(Ee===te)return;let Le=[...u];for(let Ze=Z;Ze<Le.length;Ze++)Le[Ze].originalMessage===Ee&&(Le[Ze].message=te,Le[Ze].originalMessage=te,Le[Ze].context={notes:[],urls:[]});c(),Le.forEach(l),await Y8(Le,e.memoryManager),Le[Z].sender===ti&&Z<Le.length-1&&De(Z+1)},[l,e.memoryManager,u,c,De]),Q=(Z,te)=>()=>{let Ee=de().debug,Le=async Ze=>{let Yt={message:await te(Ze.detail.selectedText,Ze.detail.eventSubtype),sender:ti,isVisible:Ee,timestamp:_l(new Date)};Ee&&l(Yt),x(!0),await f1e(Yt,e,l,m,_,{debug:Ee,ignoreSystemMessage:!0}),x(!1)};return s?.addEventListener(Z,Le),()=>{s?.removeEventListener(Z,Le)}},oe=bO.getInstance(j.vault);(0,An.useEffect)(Q(mr.APPLY_CUSTOM_PROMPT,async(Z,te)=>te?(await oe.processCustomPrompt(te,Z,j.workspace.getActiveFile()??void 0)).processedPrompt:Z),[]),(0,An.useEffect)(Q(mr.APPLY_ADHOC_PROMPT,async(Z,te)=>te?(await oe.processCustomPrompt(te,Z,j.workspace.getActiveFile())).processedPrompt:Z),[]),(0,An.useEffect)(()=>{r&&r(K)},[r,K]);let Te=(0,An.useCallback)(async Z=>{let te=[...u];te.splice(Z,1),c(),te.forEach(l),await Y8(te,e.memoryManager)},[l,e.memoryManager,u,c]),bt=(0,An.useCallback)(Z=>{v(te=>`${te} ${Z} `)},[]),xe=(0,An.useCallback)(async()=>{re("new-chat"),a.autosaveChat&&u.length>0&&await K(!0),c(),e.memoryManager.clearChatMemory(),m(""),R([]),L(!1)},[re,a.autosaveChat,u.length,c,e.memoryManager,K]);return An.default.createElement("div",{className:"flex flex-col size-full overflow-hidden"},An.default.createElement(lqt,{currentVersion:i.manifest.version}),An.default.createElement(uqt,{chatHistory:u,currentAiMessage:p,loading:w,loadingMessage:C,app:j,onRegenerate:De,onEdit:Y,onDelete:Te,onInsertToChat:bt,onReplaceChat:v}),An.default.createElement("div",{className:"bottom-container"},An.default.createElement(Gkt,{onNewChat:xe,onSaveAsNote:()=>K(!0)}),An.default.createElement(kBt,{ref:J,inputMessage:h,setInputMessage:v,handleSendMessage:z,isGenerating:w,onStopGenerating:()=>re("user-stopped"),app:j,navigateHistory:W,contextNotes:M,setContextNotes:R,includeActiveNote:N,setIncludeActiveNote:L,mention:$,selectedImages:k,onAddImage:Z=>F(te=>[...te,...Z]),setSelectedImages:F})))},pqt=fmn;var mqt=require("obsidian"),LA=B(X()),hqt=B(km()),FA=class extends mqt.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=null;this.sharedState=n.sharedState,this.app=n.app,this.chainManager=n.chainManager,this.fileParserManager=n.fileParserManager,this.eventTarget=new EventTarget,this.plugin=n}getViewType(){return wl}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){let r=(0,hqt.createRoot)(this.containerEl.children[1]),n=i=>{this.handleSaveAsNote=i},o=i=>{this.plugin.updateUserMessageHistory(i)};r.render(LA.createElement(Oae.Provider,{value:this.app},LA.createElement(U$.Provider,{value:this.eventTarget},LA.createElement(LA.StrictMode,null,LA.createElement(dae,{delayDuration:0},LA.createElement(pqt,{sharedState:this.sharedState,chainManager:this.chainManager,updateUserMessageHistory:o,fileParserManager:this.fileParserManager,plugin:this.plugin,onSaveChat:n}))))))}async saveChat(){this.handleSaveAsNote&&await this.handleSaveAsNote()}async onClose(){this.root&&this.root.unmount()}updateView(){this.onOpen()}};var gqt=require("obsidian"),Rae=class extends gqt.FuzzySuggestModal{constructor(r,n,o){super(r);this.chatFiles=n;this.onChooseFile=o}getItems(){return this.chatFiles.sort((r,n)=>{let o=s=>{let u=this.app.metadataCache.getFileCache(s)?.frontmatter;return u&&u.epoch?u.epoch:s.stat.ctime},i=o(r);return o(n)-i})}getItemText(r){let n=r.basename.replace(/\{\$date}|\d{8}/g,"").replace(/\{\$time}|\d{6}/g,"").replace(/[@_]/g," ").replace(/\s+/g," ").trim(),o,i=this.app.metadataCache.getFileCache(r)?.frontmatter;return i&&i.epoch?o=_l(new Date(i.epoch)):o=_l(new Date(r.stat.ctime)),`${n} - ${o.display}`}onChooseItem(r,n){this.onChooseFile(r)}};function yqt(t,e,r){bj().filter(o=>o.showInContextMenu).forEach(o=>{t.addItem(i=>{i.setTitle(`Copilot: ${o.name}`).onClick(async a=>{r.app.commands.executeCommandById(`copilot:${y$(o.name)}`)})})})}var s6=require("obsidian"),Fje=B(X()),D4t=B(km());var bqt=require("obsidian"),Bj=B(X()),_qt=B(km());function pmn({content:t,onConfirm:e,onCancel:r}){return Bj.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"20px"}},Bj.default.createElement("div",null,t),Bj.default.createElement("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"}},Bj.default.createElement("button",{onClick:r},"Cancel"),Bj.default.createElement("button",{style:{backgroundColor:"var(--interactive-accent)",color:"var(--text-on-accent)",cursor:"pointer"},onClick:e},"Continue")))}var H$=class extends bqt.Modal{constructor(r,n,o,i){super(r);this.onConfirm=n;this.content=o;this.setTitle(i)}onOpen(){let{contentEl:r}=this;this.root=(0,_qt.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(Bj.default.createElement(pmn,{content:this.content,onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var jae=class extends H${constructor(e,r){super(e,r,"Resetting settings will clear all settings and restore the default values. You will lose any custom settings you have made including the API keys. Are you sure you want to continue?","Reset Settings")}};var LV=B(X());var vqt=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>LV.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:Ce("flex flex-row items-center","h-8","px-2 py-1","gap-1.5","cursor-pointer","overflow-hidden","whitespace-nowrap","text-sm","border border-border border-solid","rounded-t-md rounded-b-[2px]","bg-primary","transition-all duration-300 ease-in-out","hover:border-interactive-accent hover:border-b-0",e&&["!bg-interactive-accent","text-on-accent","!px-3","!max-w-full","border-b-0","transition-all duration-300 ease-in-out","delay-200"],"lg:max-w-32","md:max-w-32")},LV.default.createElement("div",{className:Ce("flex items-center justify-center","w-4 h-4","transition-transform duration-200 ease-in-out",e?"opacity-100 max-w-[16px] translate-x-0":"opacity-0 max-w-0 -translate-x-4")},t.icon),LV.default.createElement("span",{className:Ce("text-sm","font-medium","transition-all duration-200 ease-in-out","overflow-hidden whitespace-nowrap","opacity-100 max-w-[100px] translate-x-0")},t.label)),wqt=({id:t,children:e,isSelected:r})=>r?LV.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:Ce("pt-4","transition-all duration-200 ease-in-out",r?"opacity-100 translate-y-0":"opacity-0 translate-y-2")},e):null;var dm=B(X()),Sqt=(0,dm.createContext)(void 0),xqt=({children:t})=>{let[e,r]=(0,dm.useState)("basic"),[n,o]=(0,dm.useState)(null),i=(0,dm.useRef)(!1);return(0,dm.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),dm.default.createElement(Sqt.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},TS=()=>{let t=(0,dm.useContext)(Sqt);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};var br=B(X());var qqt=require("obsidian");var Dae=B(X());var Tqt=B(X(),1);var Cqt=B(X(),1),Oqt=B(fs(),1);var Eqt=B(_t(),1),mmn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Hn=mmn.reduce((t,e)=>{let r=Cqt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Uy:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Eqt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Pqt(t,e){t&&Oqt.flushSync(()=>t.dispatchEvent(e))}var Aqt=B(_t(),1),hmn="Label",Iqt=Tqt.forwardRef((t,e)=>(0,Aqt.jsx)(Hn.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Iqt.displayName=hmn;var m1e=Iqt;var ymn=AN("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),fp=Dae.forwardRef(({className:t,...e},r)=>Dae.createElement(m1e,{ref:r,className:Ce(ymn(),t),...e}));fp.displayName=m1e.displayName;var K$=B(X());var fm=B(X(),1);var Rqt=B(X(),1);function Mqt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function h1e(...t){return e=>{let r=!1,n=t.map(o=>{let i=Mqt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Mqt(t[o],null)}}}}function jqt(...t){return Rqt.useCallback(h1e(...t),t)}function g1e(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Nae=B(X(),1);function V$(t){let e=Nae.useRef({value:t,previous:t});return Nae.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Dqt=B(X(),1),Smn=B(fs(),1);var Lc=B(X(),1);var W$=B(_t(),1),b1e=Lc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Lc.Children.toArray(r),i=o.find(_mn);if(i){let a=i.props.children,s=o.map(u=>u===i?Lc.Children.count(a)>1?Lc.Children.only(null):Lc.isValidElement(a)?a.props.children:null:u);return(0,W$.jsx)(y1e,{...n,ref:e,children:Lc.isValidElement(a)?Lc.cloneElement(a,void 0,s):null})}return(0,W$.jsx)(y1e,{...n,ref:e,children:r})});b1e.displayName="Slot";var y1e=Lc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Lc.isValidElement(r)){let o=wmn(r);return Lc.cloneElement(r,{...vmn(n,r.props),ref:e?h1e(e,o):o})}return Lc.Children.count(r)>1?Lc.Children.only(null):null});y1e.displayName="SlotClone";var bmn=({children:t})=>(0,W$.jsx)(W$.Fragment,{children:t});function _mn(t){return Lc.isValidElement(t)&&t.type===bmn}function vmn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function wmn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var Nqt=B(_t(),1),xmn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_1e=xmn.reduce((t,e)=>{let r=Dqt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?b1e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Nqt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var BA=B(_t(),1),v1e="Checkbox",[Cmn,Q7o]=Ho(v1e),[Omn,Emn]=Cmn(v1e),Lqt=fm.forwardRef((t,e)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:u="on",onCheckedChange:l,form:c,...d}=t,[f,p]=fm.useState(null),m=jqt(e,x=>p(x)),h=fm.useRef(!1),v=f?c||!!f.closest("form"):!0,[g=!1,_]=cl({prop:o,defaultProp:i,onChange:l}),w=fm.useRef(g);return fm.useEffect(()=>{let x=f?.form;if(x){let C=()=>_(w.current);return x.addEventListener("reset",C),()=>x.removeEventListener("reset",C)}},[f,_]),(0,BA.jsxs)(Omn,{scope:r,state:g,disabled:s,children:[(0,BA.jsx)(_1e.button,{type:"button",role:"checkbox","aria-checked":kA(g)?"mixed":g,"aria-required":a,"data-state":Bqt(g),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:m,onKeyDown:g1e(t.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:g1e(t.onClick,x=>{_(C=>kA(C)?!0:!C),v&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})}),v&&(0,BA.jsx)(Pmn,{control:f,bubbles:!h.current,name:n,value:u,checked:g,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:kA(i)?!1:i})]})});Lqt.displayName=v1e;var Fqt="CheckboxIndicator",kqt=fm.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=Emn(Fqt,r);return(0,BA.jsx)(Bu,{present:n||kA(i.state)||i.state===!0,children:(0,BA.jsx)(_1e.span,{"data-state":Bqt(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});kqt.displayName=Fqt;var Pmn=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=fm.useRef(null),s=V$(r),u=kh(e);fm.useEffect(()=>{let c=a.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==r&&p){let m=new Event("click",{bubbles:n});c.indeterminate=kA(r),p.call(c,kA(r)?!1:r),c.dispatchEvent(m)}},[s,r,n]);let l=fm.useRef(kA(r)?!1:r);return(0,BA.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??l.current,...i,tabIndex:-1,ref:a,style:{...t.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function kA(t){return t==="indeterminate"}function Bqt(t){return kA(t)?"indeterminate":t?"checked":"unchecked"}var w1e=Lqt,$qt=kqt;var lf=K$.forwardRef(({className:t,...e},r)=>K$.createElement(w1e,{ref:r,className:Ce("p-0 border-solid !bg-transparent !shadow transition-colors","hover:!bg-interactive-accent hover:!text-on-accent data-[state=checked]:!bg-interactive-accent data-[state=checked]:!text-on-accent","peer h-4 w-4 shrink-0 rounded-sm border border-interactive-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-interactive-accent data-[state=checked]:text-on-accent",t),...e},K$.createElement($qt,{className:Ce("flex items-center justify-center text-current")},K$.createElement(yg,{className:"h-4 w-4"}))));lf.displayName=w1e.displayName;var Zo=B(X()),Uqt=B(km());function Amn({command:t,onConfirm:e,onCancel:r,onRemove:n}){let i=Bo().activeModels.filter(f=>f.enabled).map(f=>({label:Eie(f),value:Kr(f)})),[a,s]=(0,Zo.useState)(t),[u,l]=(0,Zo.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={};try{BDt(a.name,t.name)}catch(p){f.name=p.message}if(a.prompt.trim()||(f.prompt="Prompt is required"),Object.keys(f).length>0){l(f);return}e(a)};return Zo.default.createElement("div",{className:"flex flex-col gap-4 p-4"},Zo.default.createElement("div",{className:"flex flex-col gap-2"},Zo.default.createElement(fp,{htmlFor:"name"},"Name"),Zo.default.createElement(Yo,{id:"name",value:a.name,onChange:f=>c("name",f.target.value),placeholder:"Enter command name"}),u.name&&Zo.default.createElement("div",{className:"text-error text-sm"},u.name)),Zo.default.createElement("div",{className:"flex flex-col gap-2"},Zo.default.createElement(fp,{htmlFor:"prompt"},"Prompt"),Zo.default.createElement(Sie,null),Zo.default.createElement(yj,{id:"prompt",value:a.prompt,onChange:f=>c("prompt",f.target.value),placeholder:"Enter command prompt",className:"min-h-[200px]"}),u.prompt&&Zo.default.createElement("div",{className:"text-error text-sm"},u.prompt)),Zo.default.createElement("div",{className:"flex flex-col gap-2"},Zo.default.createElement(fp,{htmlFor:"modelKey"},"Model (Optional)"),Zo.default.createElement("div",{className:"relative w-full group"},Zo.default.createElement("select",{value:a.modelKey,onChange:f=>{let p=f.target.value;if(!p){c("modelKey","");return}if(!i.find(h=>h.value===p)){nt(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:Ce("w-full appearance-none","flex h-9 rounded-md border border-solid border-border bg-dropdown px-3 py-1 pr-8","text-sm !shadow transition-colors","focus:outline-none focus:ring-1 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-interactive-hover hover:text-normal")},Zo.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>Zo.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),Zo.default.createElement("div",{className:Ce("pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2","transition-colors group-hover:[&>svg]:text-normal")},Zo.default.createElement(ps,{className:"h-4 w-4"})))),Zo.default.createElement("div",{className:"flex items-center gap-2"},Zo.default.createElement(lf,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),Zo.default.createElement(fp,{htmlFor:"showInContextMenu"},"Show in context menu")),Zo.default.createElement("div",{className:"flex justify-end gap-2"},Zo.default.createElement(ke,{variant:"secondary",onClick:r},"Cancel"),Zo.default.createElement(ke,{variant:"default",onClick:d},"Save")))}var J$=class extends qqt.Modal{constructor(r,n,o,i){super(r);this.command=n;this.onUpdate=o;this.onRemove=i;this.setTitle("Edit Command")}onOpen(){let{contentEl:r}=this;this.root=(0,Uqt.createRoot)(r);let n=i=>{this.onUpdate(i),this.close()},o=()=>{this.onRemove?.(),this.close()};this.root.render(Zo.default.createElement(Amn,{command:this.command,onConfirm:n,onCancel:()=>this.close(),onRemove:this.onRemove?o:void 0}))}onClose(){this.root.unmount()}};var fl=B(X());var FV=fl.forwardRef(({className:t,...e},r)=>fl.createElement("div",{className:"relative w-full overflow-auto"},fl.createElement("table",{ref:r,className:Ce("w-full caption-bottom text-sm border-collapse",t),...e})));FV.displayName="Table";var kV=fl.forwardRef(({className:t,...e},r)=>fl.createElement("thead",{ref:r,className:Ce("[&_tr]:border-b",t),...e}));kV.displayName="TableHeader";var BV=fl.forwardRef(({className:t,...e},r)=>fl.createElement("tbody",{ref:r,className:Ce("[&_tr:last-child]:border-0",t),...e}));BV.displayName="TableBody";var Imn=fl.forwardRef(({className:t,...e},r)=>fl.createElement("tfoot",{ref:r,className:Ce("border-t bg-primary-alt/50 font-medium [&>tr]:last:border-b-0",t),...e}));Imn.displayName="TableFooter";var $j=fl.forwardRef(({className:t,...e},r)=>fl.createElement("tr",{ref:r,className:Ce("border-b transition-colors hover:bg-primary-alt/50 data-[state=selected]:bg-primary-alt",t),...e}));$j.displayName="TableRow";var pp=fl.forwardRef(({className:t,...e},r)=>fl.createElement("th",{ref:r,className:Ce("h-10 px-2 text-left align-middle font-medium text-muted [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));pp.displayName="TableHead";var mp=fl.forwardRef(({className:t,...e},r)=>fl.createElement("td",{ref:r,className:Ce("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));mp.displayName="TableCell";var Mmn=fl.forwardRef(({className:t,...e},r)=>fl.createElement("caption",{ref:r,className:Ce("mt-4 text-sm text-muted",t),...e}));Mmn.displayName="TableCaption";var we=B(X()),Kj=B(fs());var is=B(X());function Hqt(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,is.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var $V=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qj(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Lae(t){return"nodeType"in t}function cf(t){var e,r;return t?qj(t)?t:Lae(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function Fae(t){let{Document:e}=cf(t);return t instanceof e}function G$(t){return qj(t)?!1:t instanceof cf(t).HTMLElement}function x1e(t){return t instanceof cf(t).SVGElement}function Uj(t){return t?qj(t)?t.document:Lae(t)?Fae(t)?t:G$(t)||x1e(t)?t.ownerDocument:document:document:document}var zh=$V?is.useLayoutEffect:is.useEffect;function kae(t){let e=(0,is.useRef)(t);return zh(()=>{e.current=t}),(0,is.useCallback)(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return e.current==null?void 0:e.current(...n)},[])}function Vqt(){let t=(0,is.useRef)(null),e=(0,is.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,is.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function Y$(t,e){e===void 0&&(e=[t]);let r=(0,is.useRef)(t);return zh(()=>{r.current!==t&&(r.current=t)},e),r}function Z$(t,e){let r=(0,is.useRef)();return(0,is.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function qV(t){let e=kae(t),r=(0,is.useRef)(null),n=(0,is.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function Bae(t){let e=(0,is.useRef)();return(0,is.useEffect)(()=>{e.current=t},[t]),e.current}var S1e={};function zj(t,e){return(0,is.useMemo)(()=>{if(e)return e;let r=S1e[t]==null?0:S1e[t]+1;return S1e[t]=r,t+"-"+r},[t,e])}function Wqt(t){return function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((i,a)=>{let s=Object.entries(a);for(let[u,l]of s){let c=i[u];c!=null&&(i[u]=c+t*l)}return i},{...e})}}var Hj=Wqt(1),Vj=Wqt(-1);function Rmn(t){return"clientX"in t&&"clientY"in t}function UV(t){if(!t)return!1;let{KeyboardEvent:e}=cf(t.target);return e&&t instanceof e}function jmn(t){if(!t)return!1;let{TouchEvent:e}=cf(t.target);return e&&t instanceof e}function $ae(t){if(jmn(t)){if(t.touches&&t.touches.length){let{clientX:e,clientY:r}=t.touches[0];return{x:e,y:r}}else if(t.changedTouches&&t.changedTouches.length){let{clientX:e,clientY:r}=t.changedTouches[0];return{x:e,y:r}}}return Rmn(t)?{x:t.clientX,y:t.clientY}:null}var hy=Object.freeze({Translate:{toString(t){if(!t)return;let{x:e,y:r}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;let{scaleX:e,scaleY:r}=t;return"scaleX("+e+") scaleY("+r+")"}},Transform:{toString(t){if(t)return[hy.Translate.toString(t),hy.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),zqt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Kqt(t){return t.matches(zqt)?t:t.querySelector(zqt)}var Wj=B(X()),Dmn={display:"none"};function Jqt(t){let{id:e,value:r}=t;return Wj.default.createElement("div",{id:e,style:Dmn},r)}function Gqt(t){let{id:e,announcement:r,ariaLiveType:n="assertive"}=t,o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Wj.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Yqt(){let[t,e]=(0,Wj.useState)("");return{announce:(0,Wj.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var lUt=(0,we.createContext)(null);function Nmn(t){let e=(0,we.useContext)(lUt);(0,we.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Lmn(){let[t]=(0,we.useState)(()=>new Set),e=(0,we.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,we.useCallback)(n=>{let{type:o,event:i}=n;t.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[t]),e]}var Fmn={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},kmn={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:r}=t;return r?"Draggable item "+e.id+" was moved over droppable area "+r.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:r}=t;return r?"Draggable item "+e.id+" was dropped over droppable area "+r.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function Bmn(t){let{announcements:e=kmn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Fmn}=t,{announce:i,announcement:a}=Yqt(),s=zj("DndLiveRegion"),[u,l]=(0,we.useState)(!1);if((0,we.useEffect)(()=>{l(!0)},[]),Nmn((0,we.useMemo)(()=>({onDragStart(d){let{active:f}=d;i(e.onDragStart({active:f}))},onDragMove(d){let{active:f,over:p}=d;e.onDragMove&&i(e.onDragMove({active:f,over:p}))},onDragOver(d){let{active:f,over:p}=d;i(e.onDragOver({active:f,over:p}))},onDragEnd(d){let{active:f,over:p}=d;i(e.onDragEnd({active:f,over:p}))},onDragCancel(d){let{active:f,over:p}=d;i(e.onDragCancel({active:f,over:p}))}}),[i,e])),!u)return null;let c=we.default.createElement(we.default.Fragment,null,we.default.createElement(Jqt,{id:n,value:o.draggable}),we.default.createElement(Gqt,{id:s,announcement:a}));return r?(0,Kj.createPortal)(c,r):c}var pl;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(pl||(pl={}));function Uae(){}function X$(t,e){return(0,we.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function Hae(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,we.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var gy=Object.freeze({x:0,y:0});function cUt(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function dUt(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function $mn(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function Zqt(t){let{left:e,top:r,height:n,width:o}=t;return[{x:e,y:r},{x:e+o,y:r},{x:e,y:r+n},{x:e+o,y:r+n}]}function R1e(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function Xqt(t,e,r){return e===void 0&&(e=t.left),r===void 0&&(r=t.top),{x:e+t.width*.5,y:r+t.height*.5}}var KV=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=Xqt(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=cUt(Xqt(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(dUt)},fUt=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=Zqt(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=Zqt(u),c=o.reduce((f,p,m)=>f+cUt(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(dUt)};function qmn(t,e){let r=Math.max(e.top,t.top),n=Math.max(e.left,t.left),o=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),a=o-n,s=i-r;if(n<o&&r<i){let u=e.width*e.height,l=t.width*t.height,c=a*s,d=c/(u+l-c);return Number(d.toFixed(4))}return 0}var Umn=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=[];for(let i of n){let{id:a}=i,s=r.get(a);if(s){let u=qmn(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort($mn)};function zmn(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function pUt(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:gy}function Hmn(t){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return o.reduce((a,s)=>({...a,top:a.top+t*s.y,bottom:a.bottom+t*s.y,left:a.left+t*s.x,right:a.right+t*s.x}),{...r})}}var Vmn=Hmn(1);function Wmn(t){if(t.startsWith("matrix3d(")){let e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){let e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function Kmn(t,e,r){let n=Wmn(e);if(!n)return t;let{scaleX:o,scaleY:i,x:a,y:s}=n,u=t.left-a-(1-o)*parseFloat(r),l=t.top-s-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),c=o?t.width/o:t.width,d=i?t.height/i:t.height;return{width:c,height:d,top:l,right:u+c,bottom:l+d,left:u}}var Jmn={ignoreTransform:!1};function Yj(t,e){e===void 0&&(e=Jmn);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=cf(t).getComputedStyle(t);l&&(r=Kmn(r,l,c))}let{top:n,left:o,width:i,height:a,bottom:s,right:u}=r;return{top:n,left:o,width:i,height:a,bottom:s,right:u}}function Qqt(t){return Yj(t,{ignoreTransform:!0})}function Gmn(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function Ymn(t,e){return e===void 0&&(e=cf(t).getComputedStyle(t)),e.position==="fixed"}function Zmn(t,e){e===void 0&&(e=cf(t).getComputedStyle(t));let r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{let i=e[o];return typeof i=="string"?r.test(i):!1})}function JV(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(Fae(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!G$(o)||x1e(o)||r.includes(o))return r;let i=cf(t).getComputedStyle(o);return o!==t&&Zmn(o,i)&&r.push(o),Ymn(o,i)?r:n(o.parentNode)}return t?n(t):r}function mUt(t){let[e]=JV(t,1);return e??null}function C1e(t){return!$V||!t?null:qj(t)?t:Lae(t)?Fae(t)||t===Uj(t).scrollingElement?window:G$(t)?t:null:null}function hUt(t){return qj(t)?t.scrollX:t.scrollLeft}function gUt(t){return qj(t)?t.scrollY:t.scrollTop}function P1e(t){return{x:hUt(t),y:gUt(t)}}var Vl;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Vl||(Vl={}));function yUt(t){return!$V||!t?!1:t===document.scrollingElement}function bUt(t){let e={x:0,y:0},r=yUt(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},n={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},o=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,a=t.scrollTop>=n.y,s=t.scrollLeft>=n.x;return{isTop:o,isLeft:i,isBottom:a,isRight:s,maxScroll:n,minScroll:e}}var Xmn={x:.2,y:.2};function Qmn(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=Xmn);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=bUt(t),p={x:0,y:0},m={x:0,y:0},h={height:e.height*o.y,width:e.width*o.x};return!l&&i<=e.top+h.height?(p.y=Vl.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=Vl.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=Vl.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=Vl.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function ehn(t){if(t===document.scrollingElement){let{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}let{top:e,left:r,right:n,bottom:o}=t.getBoundingClientRect();return{top:e,left:r,right:n,bottom:o,width:t.clientWidth,height:t.clientHeight}}function _Ut(t){return t.reduce((e,r)=>Hj(e,P1e(r)),gy)}function thn(t){return t.reduce((e,r)=>e+hUt(r),0)}function rhn(t){return t.reduce((e,r)=>e+gUt(r),0)}function nhn(t,e){if(e===void 0&&(e=Yj),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);mUt(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var ohn=[["x",["left","right"],thn],["y",["top","bottom"],rhn]],HV=class{constructor(e,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=JV(r),o=_Ut(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of ohn)for(let u of a)Object.defineProperty(this,u,{get:()=>{let l=s(n),c=o[i]-l;return this.rect[u]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Jj=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=e}add(e,r,n){var o;(o=this.target)==null||o.addEventListener(e,r,n),this.listeners.push([e,r,n])}};function ihn(t){let{EventTarget:e}=cf(t);return t instanceof e?t:Uj(t)}function O1e(t,e){let r=Math.abs(t.x),n=Math.abs(t.y);return typeof e=="number"?Math.sqrt(r**2+n**2)>e:"x"in e&&"y"in e?r>e.x&&n>e.y:"x"in e?r>e.x:"y"in e?n>e.y:!1}var Hh;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Hh||(Hh={}));function eUt(t){t.preventDefault()}function ahn(t){t.stopPropagation()}var _n;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(_n||(_n={}));var vUt={start:[_n.Space,_n.Enter],cancel:[_n.Esc],end:[_n.Space,_n.Enter,_n.Tab]},shn=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case _n.Right:return{...r,x:r.x+25};case _n.Left:return{...r,x:r.x-25};case _n.Down:return{...r,y:r.y+25};case _n.Up:return{...r,y:r.y-25}}},qA=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:r}}=e;this.props=e,this.listeners=new Jj(Uj(r)),this.windowListeners=new Jj(cf(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Hh.Resize,this.handleCancel),this.windowListeners.add(Hh.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Hh.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&nhn(n),r(gy)}handleKeyDown(e){if(UV(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=vUt,coordinateGetter:a=shn,scrollBehavior:s="smooth"}=o,{code:u}=e;if(i.end.includes(u)){this.handleEnd(e);return}if(i.cancel.includes(u)){this.handleCancel(e);return}let{collisionRect:l}=n.current,c=l?{x:l.left,y:l.top}:gy;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=Vj(d,c),p={x:0,y:0},{scrollableAncestors:m}=n.current;for(let h of m){let v=e.code,{isTop:g,isRight:_,isLeft:w,isBottom:x,maxScroll:C,minScroll:P}=bUt(h),E=ehn(h),A={x:Math.min(v===_n.Right?E.right-E.width/2:E.right,Math.max(v===_n.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(v===_n.Down?E.bottom-E.height/2:E.bottom,Math.max(v===_n.Down?E.top:E.top+E.height/2,d.y))},M=v===_n.Right&&!_||v===_n.Left&&!w,R=v===_n.Down&&!x||v===_n.Up&&!g;if(M&&A.x!==d.x){let N=h.scrollLeft+f.x,L=v===_n.Right&&N<=C.x||v===_n.Left&&N>=P.x;if(L&&!f.y){h.scrollTo({left:N,behavior:s});return}L?p.x=h.scrollLeft-N:p.x=v===_n.Right?h.scrollLeft-C.x:h.scrollLeft-P.x,p.x&&h.scrollBy({left:-p.x,behavior:s});break}else if(R&&A.y!==d.y){let N=h.scrollTop+f.y,L=v===_n.Down&&N<=C.y||v===_n.Up&&N>=P.y;if(L&&!f.x){h.scrollTo({top:N,behavior:s});return}L?p.y=h.scrollTop-N:p.y=v===_n.Down?h.scrollTop-C.y:h.scrollTop-P.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,Hj(Vj(d,this.referenceCoordinates),p))}}}handleMove(e,r){let{onMove:n}=this.props;e.preventDefault(),n(r)}handleEnd(e){let{onEnd:r}=this.props;e.preventDefault(),this.detach(),r()}handleCancel(e){let{onCancel:r}=this.props;e.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};qA.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=vUt,onActivation:o}=e,{active:i}=r,{code:a}=t.nativeEvent;if(n.start.includes(a)){let s=i.activatorNode.current;return s&&t.target!==s?!1:(t.preventDefault(),o?.({event:t.nativeEvent}),!0)}return!1}}];function tUt(t){return!!(t&&"distance"in t)}function rUt(t){return!!(t&&"delay"in t)}var VV=class{constructor(e,r,n){var o;n===void 0&&(n=ihn(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=r;let{event:i}=e,{target:a}=i;this.props=e,this.events=r,this.document=Uj(a),this.documentListeners=new Jj(this.document),this.listeners=new Jj(n),this.windowListeners=new Jj(cf(a)),this.initialCoordinates=(o=$ae(i))!=null?o:gy,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Hh.Resize,this.handleCancel),this.windowListeners.add(Hh.DragStart,eUt),this.windowListeners.add(Hh.VisibilityChange,this.handleCancel),this.windowListeners.add(Hh.ContextMenu,eUt),this.documentListeners.add(Hh.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rUt(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(tUt(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,r){let{active:n,onPending:o}=this.props;o(n,e,this.initialCoordinates,r)}handleStart(){let{initialCoordinates:e}=this,{onStart:r}=this.props;e&&(this.activated=!0,this.documentListeners.add(Hh.Click,ahn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Hh.SelectionChange,this.removeTextSelection),r(e))}handleMove(e){var r;let{activated:n,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!o)return;let u=(r=$ae(e))!=null?r:gy,l=Vj(o,u);if(!n&&s){if(tUt(s)){if(s.tolerance!=null&&O1e(l,s.tolerance))return this.handleCancel();if(O1e(l,s.distance))return this.handleStart()}if(rUt(s)&&O1e(l,s.tolerance))return this.handleCancel();this.handlePending(s,l);return}e.cancelable&&e.preventDefault(),a(u)}handleEnd(){let{onAbort:e,onEnd:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleCancel(){let{onAbort:e,onCancel:r}=this.props;this.detach(),this.activated||e(this.props.active),r()}handleKeydown(e){e.code===_n.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},uhn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},UA=class extends VV{constructor(e){let{event:r}=e,n=Uj(r.target);super(e,uhn,n)}};UA.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];var lhn={move:{name:"mousemove"},end:{name:"mouseup"}},T1e;(function(t){t[t.RightClick=2]="RightClick"})(T1e||(T1e={}));var A1e=class extends VV{constructor(e){super(e,lhn,Uj(e.event.target))}};A1e.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===T1e.RightClick?!1:(n?.({event:r}),!0)}}];var E1e={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},I1e=class extends VV{constructor(e){super(e,E1e)}static setup(){return window.addEventListener(E1e.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(E1e.move.name,e)};function e(){}}};I1e.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e,{touches:o}=r;return o.length>1?!1:(n?.({event:r}),!0)}}];var zV;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(zV||(zV={}));var zae;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(zae||(zae={}));function chn(t){let{acceleration:e,activator:r=zV.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=zae.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=fhn({delta:d,disabled:!i}),[m,h]=Vqt(),v=(0,we.useRef)({x:0,y:0}),g=(0,we.useRef)({x:0,y:0}),_=(0,we.useMemo)(()=>{switch(r){case zV.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case zV.DraggableRect:return o}},[r,o,u]),w=(0,we.useRef)(null),x=(0,we.useCallback)(()=>{let P=w.current;if(!P)return;let E=v.current.x*g.current.x,A=v.current.y*g.current.y;P.scrollBy(E,A)},[]),C=(0,we.useMemo)(()=>s===zae.TreeOrder?[...l].reverse():l,[s,l]);(0,we.useEffect)(()=>{if(!i||!l.length||!_){h();return}for(let P of C){if(n?.(P)===!1)continue;let E=l.indexOf(P),A=c[E];if(!A)continue;let{direction:M,speed:R}=Qmn(P,A,_,e,f);for(let N of["x","y"])p[N][M[N]]||(R[N]=0,M[N]=0);if(R.x>0||R.y>0){h(),w.current=P,m(x,a),v.current=R,g.current=M;return}}v.current={x:0,y:0},g.current={x:0,y:0},h()},[e,x,n,h,i,a,JSON.stringify(_),JSON.stringify(p),m,l,C,c,JSON.stringify(f)])}var dhn={x:{[Vl.Backward]:!1,[Vl.Forward]:!1},y:{[Vl.Backward]:!1,[Vl.Forward]:!1}};function fhn(t){let{delta:e,disabled:r}=t,n=Bae(e);return Z$(o=>{if(r||!n||!o)return dhn;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[Vl.Backward]:o.x[Vl.Backward]||i.x===-1,[Vl.Forward]:o.x[Vl.Forward]||i.x===1},y:{[Vl.Backward]:o.y[Vl.Backward]||i.y===-1,[Vl.Forward]:o.y[Vl.Forward]||i.y===1}}},[r,e,n])}function phn(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return Z$(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function mhn(t,e){return(0,we.useMemo)(()=>t.reduce((r,n)=>{let{sensor:o}=n,i=o.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,n)}));return[...r,...i]},[]),[t,e])}var WV;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(WV||(WV={}));var M1e;(function(t){t.Optimized="optimized"})(M1e||(M1e={}));var nUt=new Map;function hhn(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,we.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,we.useRef)(t),d=v(),f=Y$(d),p=(0,we.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(_=>_===null?g:_.concat(g.filter(w=>!_.includes(w))))},[f]),m=(0,we.useRef)(null),h=Z$(g=>{if(d&&!r)return nUt;if(!g||g===nUt||c.current!==t||i!=null){let _=new Map;for(let w of t){if(!w)continue;if(i&&i.length>0&&!i.includes(w.id)&&w.rect.current){_.set(w.id,w.rect.current);continue}let x=w.node.current,C=x?new HV(u(x),x):null;w.rect.current=C,C&&_.set(w.id,C)}return _}return g},[t,i,r,d,u]);return(0,we.useEffect)(()=>{c.current=t},[t]),(0,we.useEffect)(()=>{d||p()},[r,d]),(0,we.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,we.useEffect)(()=>{d||typeof s!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...n]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:i!=null};function v(){switch(l){case WV.Always:return!1;case WV.BeforeDragging:return r;default:return!r}}}function wUt(t,e){return Z$(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function ghn(t,e){return wUt(t,e)}function yhn(t){let{callback:e,disabled:r}=t,n=kae(e),o=(0,we.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,we.useEffect)(()=>()=>o?.disconnect(),[o]),o}function Vae(t){let{callback:e,disabled:r}=t,n=kae(e),o=(0,we.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,we.useEffect)(()=>()=>o?.disconnect(),[o]),o}function bhn(t){return new HV(Yj(t),t)}function oUt(t,e,r){e===void 0&&(e=bhn);let[n,o]=(0,we.useState)(null);function i(){o(u=>{if(!t)return null;if(t.isConnected===!1){var l;return(l=u??r)!=null?l:null}let c=e(t);return JSON.stringify(u)===JSON.stringify(c)?u:c})}let a=yhn({callback(u){if(t)for(let l of u){let{type:c,target:d}=l;if(c==="childList"&&d instanceof HTMLElement&&d.contains(t)){i();break}}}}),s=Vae({callback:i});return zh(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function _hn(t){let e=wUt(t);return pUt(t,e)}var iUt=[];function vhn(t){let e=(0,we.useRef)(t),r=Z$(n=>t?n&&n!==iUt&&t&&e.current&&t.parentNode===e.current.parentNode?n:JV(t):iUt,[t]);return(0,we.useEffect)(()=>{e.current=t},[t]),r}function whn(t){let[e,r]=(0,we.useState)(null),n=(0,we.useRef)(t),o=(0,we.useCallback)(i=>{let a=C1e(i.target);a&&r(s=>s?(s.set(a,P1e(a)),new Map(s)):null)},[]);return(0,we.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=C1e(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,P1e(l)]):null}).filter(u=>u!=null);r(s.length?new Map(s):null),n.current=t}return()=>{a(t),a(i)};function a(s){s.forEach(u=>{let l=C1e(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,we.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>Hj(i,a),gy):_Ut(t):gy,[t,e])}function aUt(t,e){e===void 0&&(e=[]);let r=(0,we.useRef)(null);return(0,we.useEffect)(()=>{r.current=null},e),(0,we.useEffect)(()=>{let n=t!==gy;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?Vj(t,r.current):gy}function Shn(t){(0,we.useEffect)(()=>{if(!$V)return;let e=t.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(let r of e)r?.()}},t.map(e=>{let{sensor:r}=e;return r}))}function xhn(t,e){return(0,we.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function SUt(t){return(0,we.useMemo)(()=>t?Gmn(t):null,[t])}var sUt=[];function Chn(t,e){e===void 0&&(e=Yj);let[r]=t,n=SUt(r?cf(r):null),[o,i]=(0,we.useState)(sUt);function a(){i(()=>t.length?t.map(u=>yUt(u)?n:new HV(e(u),u)):sUt)}let s=Vae({callback:a});return zh(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function Ohn(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return G$(e)?e:t}function Ehn(t){let{measure:e}=t,[r,n]=(0,we.useState)(null),o=(0,we.useCallback)(l=>{for(let{target:c}of l)if(G$(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=Vae({callback:o}),a=(0,we.useCallback)(l=>{let c=Ohn(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=qV(a);return(0,we.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var Phn=[{sensor:UA,options:{}},{sensor:qA,options:{}}],Thn={current:{}},qae={draggable:{measure:Qqt},droppable:{measure:Qqt,strategy:WV.WhileDragging,frequency:M1e.Optimized},dragOverlay:{measure:Yj}},Gj=class extends Map{get(e){var r;return e!=null&&(r=super.get(e))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:r}=e;return!r})}getNodeFor(e){var r,n;return(r=(n=this.get(e))==null?void 0:n.node.current)!=null?r:void 0}},Ahn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Gj,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Uae},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qae,measureDroppableContainers:Uae,windowRect:null,measuringScheduled:!1},Ihn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Uae,draggableNodes:new Map,over:null,measureDroppableContainers:Uae},Wae=(0,we.createContext)(Ihn),xUt=(0,we.createContext)(Ahn);function Mhn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Gj}}}function Rhn(t,e){switch(e.type){case pl.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case pl.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case pl.DragEnd:case pl.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case pl.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new Gj(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case pl.SetDroppableDisabled:{let{id:r,key:n,disabled:o}=e,i=t.droppable.containers.get(r);if(!i||n!==i.key)return t;let a=new Gj(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case pl.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new Gj(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function jhn(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,we.useContext)(Wae),i=Bae(n),a=Bae(r?.id);return(0,we.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!UV(i)||document.activeElement===i.target)return;let s=o.get(a);if(!s)return;let{activatorNode:u,node:l}=s;if(!u.current&&!l.current)return;requestAnimationFrame(()=>{for(let c of[u.current,l.current]){if(!c)continue;let d=Kqt(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function Dhn(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function Nhn(t){return(0,we.useMemo)(()=>({draggable:{...qae.draggable,...t?.draggable},droppable:{...qae.droppable,...t?.droppable},dragOverlay:{...qae.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function Lhn(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,we.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;zh(()=>{if(!a&&!s||!e){i.current=!1;return}if(i.current||!n)return;let l=e?.node.current;if(!l||l.isConnected===!1)return;let c=r(l),d=pUt(c,n);if(a||(d.x=0),s||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){let f=mUt(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var CUt=(0,we.createContext)({...gy,scaleX:1,scaleY:1}),$A;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})($A||($A={}));var GV=(0,we.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=Phn,collisionDetection:d=Umn,measuring:f,modifiers:p,...m}=e,h=(0,we.useReducer)(Rhn,void 0,Mhn),[v,g]=h,[_,w]=Lmn(),[x,C]=(0,we.useState)($A.Uninitialized),P=x===$A.Initialized,{draggable:{active:E,nodes:A,translate:M},droppable:{containers:R}}=v,N=E!=null?A.get(E):null,L=(0,we.useRef)({initial:null,translated:null}),k=(0,we.useMemo)(()=>{var Ma;return E!=null?{id:E,data:(Ma=N?.data)!=null?Ma:Thn,rect:L}:null},[E,N]),F=(0,we.useRef)(null),[$,U]=(0,we.useState)(null),[J,V]=(0,we.useState)(null),j=Y$(m,Object.values(m)),z=zj("DndDescribedBy",a),W=(0,we.useMemo)(()=>R.getEnabled(),[R]),K=Nhn(f),{droppableRects:re,measureDroppableContainers:De,measuringScheduled:Y}=hhn(W,{dragging:P,dependencies:[M.x,M.y],config:K.droppable}),Q=phn(A,E),oe=(0,we.useMemo)(()=>J?$ae(J):null,[J]),Te=NO(),bt=ghn(Q,K.draggable.measure);Lhn({activeNode:E!=null?A.get(E):null,config:Te.layoutShiftCompensation,initialRect:bt,measure:K.draggable.measure});let xe=oUt(Q,K.draggable.measure,bt),Z=oUt(Q?Q.parentElement:null),te=(0,we.useRef)({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ee=R.getNodeFor((r=te.current.over)==null?void 0:r.id),Le=Ehn({measure:K.dragOverlay.measure}),Ze=(n=Le.nodeRef.current)!=null?n:Q,Ot=P?(o=Le.rect)!=null?o:xe:null,Yt=!!(Le.nodeRef.current&&Le.rect),Wn=_hn(Yt?null:xe),nr=SUt(Ze?cf(Ze):null),ve=vhn(P?Ee??Q:null),vn=Chn(ve),lt=Dhn(p,{transform:{x:M.x-Wn.x,y:M.y-Wn.y,scaleX:1,scaleY:1},activatorEvent:J,active:k,activeNodeRect:xe,containerNodeRect:Z,draggingNodeRect:Ot,over:te.current.over,overlayNodeRect:Le.rect,scrollableAncestors:ve,scrollableAncestorRects:vn,windowRect:nr}),qe=oe?Hj(oe,M):null,ie=whn(ve),ce=aUt(ie),_e=aUt(ie,[xe]),be=Hj(lt,ce),Ue=Ot?Vmn(Ot,lt):null,zr=k&&Ue?d({active:k,collisionRect:Ue,droppableRects:re,droppableContainers:W,pointerCoordinates:qe}):null,ia=R1e(zr,"id"),[Hu,Jh]=(0,we.useState)(null),Gh=Yt?lt:Hj(lt,_e),Ia=zmn(Gh,(i=Hu?.rect)!=null?i:null,xe),gm=(0,we.useRef)(null),hp=(0,we.useCallback)((Ma,us)=>{let{sensor:aa,options:Od}=us;if(F.current==null)return;let Bc=A.get(F.current);if(!Bc)return;let Va=Ma.nativeEvent,df=new aa({active:F.current,activeNode:Bc,event:Va,options:Od,context:te,onAbort(un){if(!A.get(un))return;let{onDragAbort:Pd}=j.current,gp={id:un};Pd?.(gp),_({type:"onDragAbort",event:gp})},onPending(un,ze,Pd,gp){if(!A.get(un))return;let{onDragPending:MS}=j.current,an={id:un,constraint:ze,initialCoordinates:Pd,offset:gp};MS?.(an),_({type:"onDragPending",event:an})},onStart(un){let ze=F.current;if(ze==null)return;let Pd=A.get(ze);if(!Pd)return;let{onDragStart:gp}=j.current,Vu={activatorEvent:Va,active:{id:ze,data:Pd.data,rect:L}};(0,Kj.unstable_batchedUpdates)(()=>{gp?.(Vu),C($A.Initializing),g({type:pl.DragStart,initialCoordinates:un,active:ze}),_({type:"onDragStart",event:Vu}),U(gm.current),V(Va)})},onMove(un){g({type:pl.DragMove,coordinates:un})},onEnd:Ed(pl.DragEnd),onCancel:Ed(pl.DragCancel)});gm.current=df;function Ed(un){return async function(){let{active:Pd,collisions:gp,over:Vu,scrollAdjustedTranslate:MS}=te.current,an=null;if(Pd&&MS){let{cancelDrop:Yh}=j.current;an={activatorEvent:Va,active:Pd,collisions:gp,delta:MS,over:Vu},un===pl.DragEnd&&typeof Yh=="function"&&await Promise.resolve(Yh(an))&&(un=pl.DragCancel)}F.current=null,(0,Kj.unstable_batchedUpdates)(()=>{g({type:un}),C($A.Uninitialized),Jh(null),U(null),V(null),gm.current=null;let Yh=un===pl.DragEnd?"onDragEnd":"onDragCancel";if(an){let lq=j.current[Yh];lq?.(an),_({type:Yh,event:an})}})}}},[A]),ym=(0,we.useCallback)((Ma,us)=>(aa,Od)=>{let Bc=aa.nativeEvent,Va=A.get(Od);if(F.current!==null||!Va||Bc.dndKit||Bc.defaultPrevented)return;let df={active:Va};Ma(aa,us.options,df)===!0&&(Bc.dndKit={capturedBy:us.sensor},F.current=Od,hp(aa,us))},[A,hp]),wn=mhn(c,ym);Shn(c),zh(()=>{xe&&x===$A.Initializing&&C($A.Initialized)},[xe,x]),(0,we.useEffect)(()=>{let{onDragMove:Ma}=j.current,{active:us,activatorEvent:aa,collisions:Od,over:Bc}=te.current;if(!us||!aa)return;let Va={active:us,activatorEvent:aa,collisions:Od,delta:{x:be.x,y:be.y},over:Bc};(0,Kj.unstable_batchedUpdates)(()=>{Ma?.(Va),_({type:"onDragMove",event:Va})})},[be.x,be.y]),(0,we.useEffect)(()=>{let{active:Ma,activatorEvent:us,collisions:aa,droppableContainers:Od,scrollAdjustedTranslate:Bc}=te.current;if(!Ma||F.current==null||!us||!Bc)return;let{onDragOver:Va}=j.current,df=Od.get(ia),Ed=df&&df.rect.current?{id:df.id,rect:df.rect.current,data:df.data,disabled:df.disabled}:null,un={active:Ma,activatorEvent:us,collisions:aa,delta:{x:Bc.x,y:Bc.y},over:Ed};(0,Kj.unstable_batchedUpdates)(()=>{Jh(Ed),Va?.(un),_({type:"onDragOver",event:un})})},[ia]),zh(()=>{te.current={activatorEvent:J,active:k,activeNode:Q,collisionRect:Ue,collisions:zr,droppableRects:re,draggableNodes:A,draggingNode:Ze,draggingNodeRect:Ot,droppableContainers:R,over:Hu,scrollableAncestors:ve,scrollAdjustedTranslate:be},L.current={initial:Ot,translated:Ue}},[k,Q,zr,Ue,A,Ze,Ot,re,R,Hu,ve,be]),chn({...Te,delta:M,draggingRect:Ue,pointerCoordinates:qe,scrollableAncestors:ve,scrollableAncestorRects:vn});let DO=(0,we.useMemo)(()=>({active:k,activeNode:Q,activeNodeRect:xe,activatorEvent:J,collisions:zr,containerNodeRect:Z,dragOverlay:Le,draggableNodes:A,droppableContainers:R,droppableRects:re,over:Hu,measureDroppableContainers:De,scrollableAncestors:ve,scrollableAncestorRects:vn,measuringConfiguration:K,measuringScheduled:Y,windowRect:nr}),[k,Q,xe,J,zr,Z,Le,A,R,re,Hu,De,ve,vn,K,Y,nr]),ZA=(0,we.useMemo)(()=>({activatorEvent:J,activators:wn,active:k,activeNodeRect:xe,ariaDescribedById:{draggable:z},dispatch:g,draggableNodes:A,over:Hu,measureDroppableContainers:De}),[J,wn,k,xe,g,z,A,Hu,De]);return we.default.createElement(lUt.Provider,{value:w},we.default.createElement(Wae.Provider,{value:ZA},we.default.createElement(xUt.Provider,{value:DO},we.default.createElement(CUt.Provider,{value:Ia},l)),we.default.createElement(jhn,{disabled:s?.restoreFocus===!1})),we.default.createElement(Bmn,{...s,hiddenTextDescribedById:z}));function NO(){let Ma=$?.autoScrollEnabled===!1,us=typeof u=="object"?u.enabled===!1:u===!1,aa=P&&!Ma&&!us;return typeof u=="object"?{...u,enabled:aa}:{enabled:aa}}}),Fhn=(0,we.createContext)(null),uUt="button",khn="Draggable";function OUt(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=zj(khn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,we.useContext)(Wae),{role:p=uUt,roleDescription:m="draggable",tabIndex:h=0}=o??{},v=u?.id===e,g=(0,we.useContext)(v?CUt:Fhn),[_,w]=qV(),[x,C]=qV(),P=xhn(a,e),E=Y$(r);zh(()=>(d.set(e,{id:e,key:i,node:_,activatorNode:x,data:E}),()=>{let M=d.get(e);M&&M.key===i&&d.delete(e)}),[d,e]);let A=(0,we.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":v&&p===uUt?!0:void 0,"aria-roledescription":m,"aria-describedby":c.draggable}),[n,p,h,v,m,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:A,isDragging:v,listeners:n?void 0:P,node:_,over:f,setNodeRef:w,setActivatorNodeRef:C,transform:g}}function EUt(){return(0,we.useContext)(xUt)}var Bhn="Droppable",$hn={timeout:25};function PUt(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=zj(Bhn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,we.useContext)(Wae),c=(0,we.useRef)({disabled:r}),d=(0,we.useRef)(!1),f=(0,we.useRef)(null),p=(0,we.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:v}={...$hn,...o},g=Y$(h??n),_=(0,we.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(g.current)?g.current:[g.current]),p.current=null},v)},[v]),w=Vae({callback:_,disabled:m||!a}),x=(0,we.useCallback)((A,M)=>{w&&(M&&(w.unobserve(M),d.current=!1),A&&w.observe(A))},[w]),[C,P]=qV(x),E=Y$(e);return(0,we.useEffect)(()=>{!w||!C.current||(w.disconnect(),d.current=!1,w.observe(C.current))},[C,w]),(0,we.useEffect)(()=>(s({type:pl.RegisterDroppable,element:{id:n,key:i,disabled:r,node:C,rect:f,data:E}}),()=>s({type:pl.UnregisterDroppable,key:i,id:n})),[n]),(0,we.useEffect)(()=>{r!==c.current.disabled&&(s({type:pl.SetDroppableDisabled,id:n,key:i,disabled:r}),c.current.disabled=r)},[n,i,r,s]),{active:a,rect:f,isOver:u?.id===n,node:C,over:u,setNodeRef:P}}var as=B(X());function Q$(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function qhn(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function Kae(t){return t!==null&&t>=0}function Uhn(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function zhn(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var TUt=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=Q$(e,n,r),a=e[o],s=i[o];return!s||!a?null:{x:s.left-a.left,y:s.top-a.top,scaleX:s.width/a.width,scaleY:s.height/a.height}};var Jae={scaleX:1,scaleY:1},YV=t=>{var e;let{activeIndex:r,activeNodeRect:n,index:o,rects:i,overIndex:a}=t,s=(e=i[r])!=null?e:n;if(!s)return null;if(o===r){let l=i[a];return l?{x:0,y:r<a?l.top+l.height-(s.top+s.height):l.top-s.top,...Jae}:null}let u=Hhn(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...Jae}:o<r&&o>=a?{x:0,y:s.height+u,...Jae}:{x:0,y:0,...Jae}};function Hhn(t,e,r){let n=t[e],o=t[e-1],i=t[e+1];return n?r<e?o?n.top-(o.top+o.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):o?n.top-(o.top+o.height):0:0}var AUt="Sortable",IUt=as.default.createContext({activeIndex:-1,containerId:AUt,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:TUt,disabled:{draggable:!1,droppable:!1}});function ZV(t){let{children:e,id:r,items:n,strategy:o=TUt,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=EUt(),d=zj(AUt,r),f=s.rect!==null,p=(0,as.useMemo)(()=>n.map(P=>typeof P=="object"&&"id"in P?P.id:P),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,v=l?p.indexOf(l.id):-1,g=(0,as.useRef)(p),_=!Uhn(p,g.current),w=v!==-1&&h===-1||_,x=zhn(i);zh(()=>{_&&m&&c(p)},[_,p,m,c]),(0,as.useEffect)(()=>{g.current=p},[p]);let C=(0,as.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:w,items:p,overIndex:v,useDragOverlay:f,sortedRects:qhn(p,u),strategy:o}),[h,d,x.draggable,x.droppable,w,p,v,u,f,o]);return as.default.createElement(IUt.Provider,{value:C},e)}var Vhn=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return Q$(r,n,o).indexOf(e)},Whn=t=>{let{containerId:e,isSorting:r,wasDragging:n,index:o,items:i,newIndex:a,previousItems:s,previousContainerId:u,transition:l}=t;return!l||!n||s!==i&&o===a?!1:r?!0:a!==o&&e===u},Khn={duration:200,easing:"ease"},MUt="transform",Jhn=hy.Transition.toString({property:MUt,duration:0,easing:"linear"}),Ghn={roleDescription:"sortable"};function Yhn(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,as.useState)(null),s=(0,as.useRef)(r);return zh(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=Yj(n.current,{ignoreTransform:!0}),c={x:u.left-l.left,y:u.top-l.top,scaleX:u.width/l.width,scaleY:u.height/l.height};(c.x||c.y)&&a(c)}}r!==s.current&&(s.current=r)},[e,r,n,o]),(0,as.useEffect)(()=>{i&&a(null)},[i]),i}function XV(t){let{animateLayoutChanges:e=Whn,attributes:r,disabled:n,data:o,getNewIndex:i=Vhn,id:a,strategy:s,resizeObserverConfig:u,transition:l=Khn}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:v,useDragOverlay:g,strategy:_}=(0,as.useContext)(IUt),w=Zhn(n,p),x=c.indexOf(a),C=(0,as.useMemo)(()=>({sortable:{containerId:d,index:x,items:c},...o}),[d,o,x,c]),P=(0,as.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:E,node:A,isOver:M,setNodeRef:R}=PUt({id:a,data:C,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...u}}),{active:N,activatorEvent:L,activeNodeRect:k,attributes:F,setNodeRef:$,listeners:U,isDragging:J,over:V,setActivatorNodeRef:j,transform:z}=OUt({id:a,data:C,attributes:{...Ghn,...r},disabled:w.draggable}),W=Hqt(R,$),K=!!N,re=K&&!m&&Kae(f)&&Kae(v),De=!g&&J,Y=De&&re?z:null,oe=re?Y??(s??_)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:v,index:x}):null,Te=Kae(f)&&Kae(v)?i({id:a,items:c,activeIndex:f,overIndex:v}):x,bt=N?.id,xe=(0,as.useRef)({activeId:bt,items:c,newIndex:Te,containerId:d}),Z=c!==xe.current.items,te=e({active:N,containerId:d,isDragging:J,isSorting:K,id:a,index:x,items:c,newIndex:xe.current.newIndex,previousItems:xe.current.items,previousContainerId:xe.current.containerId,transition:l,wasDragging:xe.current.activeId!=null}),Ee=Yhn({disabled:!te,index:x,node:A,rect:E});return(0,as.useEffect)(()=>{K&&xe.current.newIndex!==Te&&(xe.current.newIndex=Te),d!==xe.current.containerId&&(xe.current.containerId=d),c!==xe.current.items&&(xe.current.items=c)},[K,Te,d,c]),(0,as.useEffect)(()=>{if(bt===xe.current.activeId)return;if(bt!=null&&xe.current.activeId==null){xe.current.activeId=bt;return}let Ze=setTimeout(()=>{xe.current.activeId=bt},50);return()=>clearTimeout(Ze)},[bt]),{active:N,activeIndex:f,attributes:F,data:C,rect:E,index:x,newIndex:Te,items:c,isOver:M,isSorting:K,isDragging:J,listeners:U,node:A,overIndex:v,over:V,setNodeRef:W,setActivatorNodeRef:j,setDroppableNodeRef:R,setDraggableNodeRef:$,transform:Ee??oe,transition:Le()};function Le(){if(Ee||Z&&xe.current.newIndex===x)return Jhn;if(!(De&&!UV(L)||!l)&&(K||te))return hy.Transition.toString({...l,property:MUt})}}function Zhn(t,e){var r,n;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t?.draggable)!=null?r:e.draggable,droppable:(n=t?.droppable)!=null?n:e.droppable}}function Gae(t){if(!t)return!1;let e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}var Xhn=[_n.Down,_n.Right,_n.Up,_n.Left],Yae=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(Xhn.includes(t.code)){if(t.preventDefault(),!r||!n)return;let u=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;let f=o.get(d.id);if(f)switch(t.code){case _n.Down:n.top<f.top&&u.push(d);break;case _n.Up:n.top>f.top&&u.push(d);break;case _n.Left:n.left>f.left&&u.push(d);break;case _n.Right:n.left<f.left&&u.push(d);break}});let l=fUt({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=R1e(l,"id");if(c===a?.id&&l.length>1&&(c=l[1].id),c!=null){let d=i.get(r.id),f=i.get(c),p=f?o.get(f.id):null,m=f?.node.current;if(m&&p&&d&&f){let v=JV(m).some((P,E)=>s[E]!==P),g=RUt(d,f),_=Qhn(d,f),w=v||!g?{x:0,y:0}:{x:_?n.width-p.width:0,y:_?n.height-p.height:0},x={x:p.left,y:p.top};return w.x&&w.y?x:Vj(x,w)}}}};function RUt(t,e){return!Gae(t)||!Gae(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Qhn(t,e){return!Gae(t)||!Gae(e)||!RUt(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}var Zae=B(X()),j1e=(0,Zae.createContext)(null),jUt=()=>(0,Zae.useContext)(j1e);var egn=({command:t,onUpdate:e,onRemove:r,onDuplicate:n})=>{let{attributes:o,listeners:i,setNodeRef:a,transform:s,transition:u,isDragging:l}=XV({id:t.name}),c={transform:hy.Transform.toString(s),transition:u},d=jUt();return br.default.createElement($j,{ref:a,style:c,className:Ce("transition-colors",l&&"shadow-lg bg-background/90 backdrop-blur-sm relative z-[100] cursor-grabbing border-2 border-accent/50")},br.default.createElement(mp,{className:"w-10"},br.default.createElement("div",{...o,...i,className:"flex items-center justify-center cursor-grab"},br.default.createElement(DE,{className:"h-4 w-4 text-muted-foreground"}))),br.default.createElement(mp,null,t.name),br.default.createElement(mp,{className:"text-center"},br.default.createElement(lf,{checked:t.showInContextMenu,onCheckedChange:f=>e(t,{...t,showInContextMenu:f===!0}),className:"mx-auto"})),br.default.createElement(mp,{className:"text-center"},br.default.createElement("div",{className:"flex justify-center space-x-1"},br.default.createElement(ke,{variant:"ghost",size:"icon",onClick:()=>new J$(app,t,f=>e(t,f),()=>r(t)).open()},br.default.createElement(RN,{className:"h-4 w-4"})),br.default.createElement(M$,null,br.default.createElement(R$,{asChild:!0},br.default.createElement(ke,{variant:"ghost",size:"icon"},br.default.createElement(RE,{className:"h-4 w-4"}))),br.default.createElement(OS,{align:"end",container:d},br.default.createElement(os,{onClick:()=>new J$(app,t,f=>e(t,f),()=>r(t)).open()},br.default.createElement(RN,{className:"h-4 w-4 mr-2"}),"Edit"),br.default.createElement(os,{onClick:()=>n(t)},br.default.createElement(vx,{className:"h-4 w-4 mr-2"}),"Copy"),br.default.createElement(os,{onClick:()=>r(t),className:"text-error"},br.default.createElement(_g,{className:"h-4 w-4 mr-2"}),"Delete"))))))},DUt=()=>{let t=qDt(),e=Hae(X$(UA,{activationConstraint:{distance:8}}),X$(qA,{coordinateGetter:Yae})),r=(a,s)=>{let u=t.findIndex(l=>l===a);u===-1?xt("inlineEditCommands",[...t,s]):xt("inlineEditCommands",[...t.slice(0,u),s,...t.slice(u+1)])},n=a=>{let s={...a,name:`${a.name} (copy)`},u=t.findIndex(l=>l===a);u!==-1&&xt("inlineEditCommands",[...t.slice(0,u+1),s,...t.slice(u+1)])},o=a=>{xt("inlineEditCommands",t.filter(s=>s!==a))},i=a=>{let{active:s,over:u}=a;if(u&&s.id!==u.id){let l=t.findIndex(d=>d.name===s.id),c=t.findIndex(d=>d.name===u.id);if(l!==-1&&c!==-1){let d=Q$(t,l,c);xt("inlineEditCommands",d)}}};return br.default.createElement("div",{className:"space-y-4"},br.default.createElement("section",null,br.default.createElement("div",{className:"flex flex-col mb-4 gap-2"},br.default.createElement("div",{className:"text-xl font-bold"},"Custom Commands"),br.default.createElement("div",{className:"text-sm text-muted"},"To trigger a custom command, highlight text in the editor and select it from the command palette, or right-click and choose it from the context menu if configured.")),!UDt()&&br.default.createElement("div",{className:"border border-border border-solid p-4 rounded-md text-muted flex items-start gap-2"},br.default.createElement(Sx,{className:"size-5"})," Take control of your inline edit commands! You can now create your own or edit built-in ones to tailor functionality to your needs."),br.default.createElement("div",{className:"flex flex-col gap-4"},br.default.createElement(GV,{sensors:e,collisionDetection:KV,onDragEnd:i},br.default.createElement(FV,null,br.default.createElement(kV,null,br.default.createElement($j,null,br.default.createElement(pp,{className:"w-10"}),br.default.createElement(pp,null,"Name"),br.default.createElement(pp,{className:"text-center w-20"},"In Menu"),br.default.createElement(pp,{className:"w-10"}))),br.default.createElement(ZV,{items:t.map(a=>a.name),strategy:YV},br.default.createElement(BV,null,t.map(a=>br.default.createElement(egn,{key:a.name,command:a,onUpdate:r,onRemove:o,onDuplicate:n})))))),br.default.createElement("div",{className:"flex w-full justify-end"},br.default.createElement(ke,{variant:"secondary",onClick:()=>new J$(app,{name:"",prompt:"",showInContextMenu:!1},a=>r(a,a)).open()},br.default.createElement(xx,{className:"h-4 w-4"})," Add Command")))))};var Vn=B(X());var zi=B(X());var pm=B(X());function AS({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,pm.useState)(!1),s=(0,pm.useRef)(null),u=(0,pm.useRef)(!0);return(0,pm.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await Io(t)}catch(c){nt("Failed to decrypt value:"+Pi(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),pm.default.createElement("div",{className:Ce("relative",o)},pm.default.createElement(Yo,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:Ce("![padding-right:1.75rem] w-full")}),pm.default.createElement("div",{onClick:()=>!n&&a(!i),className:Ce("absolute right-2 top-0 bottom-0 flex items-center justify-center","cursor-pointer",n&&"opacity-50 cursor-not-allowed"),role:"button","aria-label":i?"Hide password":"Show password"},i?pm.default.createElement(yz,{className:Ce("h-3.5 w-3.5","text-muted/60 hover:text-accent","transition-colors duration-200")}):pm.default.createElement(wx,{className:Ce("h-3.5 w-3.5","text-muted/60 hover:text-accent","transition-colors duration-200")})))}var kc=B(X());var xi=B(X(),1);function IS(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var LUt=B(X(),1);function NUt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function D1e(...t){return e=>{let r=!1,n=t.map(o=>{let i=NUt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():NUt(t[o],null)}}}}function OO(...t){return LUt.useCallback(D1e(...t),t)}var Ta=B(X(),1);var FUt=B(X(),1),kUt=B(fs(),1);var Fc=B(X(),1);var eq=B(_t(),1),QV=Fc.forwardRef((t,e)=>{let{children:r,...n}=t,o=Fc.Children.toArray(r),i=o.find(rgn);if(i){let a=i.props.children,s=o.map(u=>u===i?Fc.Children.count(a)>1?Fc.Children.only(null):Fc.isValidElement(a)?a.props.children:null:u);return(0,eq.jsx)(N1e,{...n,ref:e,children:Fc.isValidElement(a)?Fc.cloneElement(a,void 0,s):null})}return(0,eq.jsx)(N1e,{...n,ref:e,children:r})});QV.displayName="Slot";var N1e=Fc.forwardRef((t,e)=>{let{children:r,...n}=t;if(Fc.isValidElement(r)){let o=ogn(r);return Fc.cloneElement(r,{...ngn(n,r.props),ref:e?D1e(e,o):o})}return Fc.Children.count(r)>1?Fc.Children.only(null):null});N1e.displayName="SlotClone";var tgn=({children:t})=>(0,eq.jsx)(eq.Fragment,{children:t});function rgn(t){return Fc.isValidElement(t)&&t.type===tgn}function ngn(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{i(...s),o(...s)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...t,...r}}function ogn(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var BUt=B(_t(),1),ign=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],mm=ign.reduce((t,e)=>{let r=FUt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?QV:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,BUt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function $Ut(t,e){t&&kUt.flushSync(()=>t.dispatchEvent(e))}var F1e=B(_t(),1),agn="DismissableLayer",L1e="dismissableLayer.update",sgn="dismissableLayer.pointerDownOutside",ugn="dismissableLayer.focusOutside",qUt,zUt=Ta.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),k1e=Ta.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ta.useContext(zUt),[c,d]=Ta.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ta.useState({}),m=OO(e,E=>d(E)),h=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(v),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,C=dgn(E=>{let A=E.target,M=[...l.branches].some(R=>R.contains(A));!x||M||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=fgn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return wS(E=>{_===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Ta.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(qUt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),UUt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=qUt)}},[c,f,r,l]),Ta.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),UUt())},[c,l]),Ta.useEffect(()=>{let E=()=>p({});return document.addEventListener(L1e,E),()=>document.removeEventListener(L1e,E)},[]),(0,F1e.jsx)(mm.div,{...u,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:IS(t.onFocusCapture,P.onFocusCapture),onBlurCapture:IS(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:IS(t.onPointerDownCapture,C.onPointerDownCapture)})});k1e.displayName=agn;var lgn="DismissableLayerBranch",cgn=Ta.forwardRef((t,e)=>{let r=Ta.useContext(zUt),n=Ta.useRef(null),o=OO(e,n);return Ta.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,F1e.jsx)(mm.div,{...t,ref:o})});cgn.displayName=lgn;function dgn(t,e=globalThis?.document){let r=rr(t),n=Ta.useRef(!1),o=Ta.useRef(()=>{});return Ta.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){HUt(sgn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function fgn(t,e=globalThis?.document){let r=rr(t),n=Ta.useRef(!1);return Ta.useEffect(()=>{let o=i=>{i.target&&!n.current&&HUt(ugn,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function UUt(){let t=new CustomEvent(L1e);document.dispatchEvent(t)}function HUt(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?$Ut(o,i):o.dispatchEvent(i)}var Vh=B(X(),1);var GUt=B(_t(),1),B1e="focusScope.autoFocusOnMount",$1e="focusScope.autoFocusOnUnmount",VUt={bubbles:!1,cancelable:!0},pgn="FocusScope",q1e=Vh.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Vh.useState(null),l=rr(o),c=rr(i),d=Vh.useRef(null),f=OO(e,h=>u(h)),p=Vh.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Vh.useEffect(()=>{if(n){let _=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:zA(d.current,{select:!0})},w=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||zA(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&zA(s)};var h=_,v=w,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(x);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),Vh.useEffect(()=>{if(s){KUt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(B1e,VUt);s.addEventListener(B1e,l),s.dispatchEvent(g),g.defaultPrevented||(mgn(_gn(YUt(s)),{select:!0}),document.activeElement===h&&zA(s))}return()=>{s.removeEventListener(B1e,l),setTimeout(()=>{let g=new CustomEvent($1e,VUt);s.addEventListener($1e,c),s.dispatchEvent(g),g.defaultPrevented||zA(h??document.body,{select:!0}),s.removeEventListener($1e,c),KUt.remove(p)},0)}}},[s,l,c,p]);let m=Vh.useCallback(h=>{if(!r&&!n||p.paused)return;let v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(v&&g){let _=h.currentTarget,[w,x]=hgn(_);w&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&zA(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&zA(x,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,GUt.jsx)(mm.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});q1e.displayName=pgn;function mgn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(zA(n,{select:e}),document.activeElement!==r)return}function hgn(t){let e=YUt(t),r=WUt(e,t),n=WUt(e.reverse(),t);return[r,n]}function YUt(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function WUt(t,e){for(let r of t)if(!ggn(r,{upTo:e}))return r}function ggn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function ygn(t){return t instanceof HTMLInputElement&&"select"in t}function zA(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&ygn(t)&&e&&t.select()}}var KUt=bgn();function bgn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=JUt(t,e),t.unshift(e)},remove(e){t=JUt(t,e),t[0]?.resume()}}}function JUt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function _gn(t){return t.filter(e=>e.tagName!=="A")}var Xae=B(X(),1),ZUt=B(fs(),1);var XUt=B(_t(),1),vgn="Portal",U1e=Xae.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Xae.useState(!1);Qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?ZUt.default.createPortal((0,XUt.jsx)(mm.div,{...n,ref:e}),a):null});U1e.displayName=vgn;var tse=B(X());var Cd=B(X());var Qae=Pj();var z1e=function(){},e6=Cd.forwardRef(function(t,e){var r=Cd.useRef(null),n=Cd.useState({onScrollCapture:z1e,onWheelCapture:z1e,onTouchMoveCapture:z1e}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,v=t.as,g=v===void 0?"div":v,_=t.gapMode,w=TA(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,C=Ej([r,e]),P=Vo(Vo({},w),o);return Cd.createElement(Cd.Fragment,null,c&&Cd.createElement(x,{sideCar:Qae,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:_}),a?Cd.cloneElement(Cd.Children.only(s),Vo(Vo({},P),{ref:C})):Cd.createElement(g,Vo({},P,{className:u,ref:C}),s))});e6.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};e6.classNames={fullWidth:cy,zeroRight:ly};var Ui=B(X());var H1e=!1;if(typeof window<"u")try{t6=Object.defineProperty({},"passive",{get:function(){return H1e=!0,!0}}),window.addEventListener("test",t6,t6),window.removeEventListener("test",t6,t6)}catch{H1e=!1}var t6,Zj=H1e?{passive:!1}:!1;var wgn=function(t){return t.tagName==="TEXTAREA"},QUt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!wgn(t)&&r[e]==="visible")},Sgn=function(t){return QUt(t,"overflowY")},xgn=function(t){return QUt(t,"overflowX")},V1e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=ezt(t,n);if(o){var i=tzt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Cgn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Ogn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},ezt=function(t,e){return t==="v"?Sgn(e):xgn(e)},tzt=function(t,e){return t==="v"?Cgn(e):Ogn(e)},Egn=function(t,e){return t==="h"&&e==="rtl"?-1:1},rzt=function(t,e,r,n,o){var i=Egn(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=tzt(t,s),m=p[0],h=p[1],v=p[2],g=h-v-i*m;(m||g)&&ezt(t,s)&&(d+=g,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var ese=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},nzt=function(t){return[t.deltaX,t.deltaY]},ozt=function(t){return t&&"current"in t?t.current:t},Pgn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Tgn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Agn=0,tq=[];function izt(t){var e=Ui.useRef([]),r=Ui.useRef([0,0]),n=Ui.useRef(),o=Ui.useState(Agn++)[0],i=Ui.useState(xO)[0],a=Ui.useRef(t);Ui.useEffect(function(){a.current=t},[t]),Ui.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=P$([t.lockRef.current],(t.shards||[]).map(ozt),!0).filter(Boolean);return h.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Ui.useCallback(function(h,v){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=ese(h),_=r.current,w="deltaX"in h?h.deltaX:_[0]-g[0],x="deltaY"in h?h.deltaY:_[1]-g[1],C,P=h.target,E=Math.abs(w)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=V1e(E,P);if(!A)return!0;if(A?C=E:(C=E==="v"?"h":"v",A=V1e(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(w||x)&&(n.current=C),!C)return!0;var M=n.current||C;return rzt(M,v,h,M==="h"?w:x,!0)},[]),u=Ui.useCallback(function(h){var v=h;if(!(!tq.length||tq[tq.length-1]!==i)){var g="deltaY"in v?nzt(v):ese(v),_=e.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&Pgn(C.delta,g)})[0];if(_&&_.should){v.cancelable&&v.preventDefault();return}if(!_){var w=(a.current.shards||[]).map(ozt).filter(Boolean).filter(function(C){return C.contains(v.target)}),x=w.length>0?s(v,w[0]):!a.current.noIsolation;x&&v.cancelable&&v.preventDefault()}}},[]),l=Ui.useCallback(function(h,v,g,_){var w={name:h,delta:v,target:g,should:_,shadowParent:Ign(g)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(x){return x!==w})},1)},[]),c=Ui.useCallback(function(h){r.current=ese(h),n.current=void 0},[]),d=Ui.useCallback(function(h){l(h.type,nzt(h),h.target,s(h,t.lockRef.current))},[]),f=Ui.useCallback(function(h){l(h.type,ese(h),h.target,s(h,t.lockRef.current))},[]);Ui.useEffect(function(){return tq.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,Zj),document.addEventListener("touchmove",u,Zj),document.addEventListener("touchstart",c,Zj),function(){tq=tq.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,Zj),document.removeEventListener("touchmove",u,Zj),document.removeEventListener("touchstart",c,Zj)}},[]);var p=t.removeScrollBar,m=t.inert;return Ui.createElement(Ui.Fragment,null,m?Ui.createElement(i,{styles:Tgn(o)}):null,p?Ui.createElement(Aj,{gapMode:t.gapMode}):null)}function Ign(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var azt=Tj(Qae,izt);var szt=tse.forwardRef(function(t,e){return tse.createElement(e6,Vo({},t,{ref:e,sideCar:azt}))});szt.classNames=e6.classNames;var r6=szt;var ui=B(_t(),1),W1e="Dialog",[uzt,nXo]=Ho(W1e),[Mgn,yy]=uzt(W1e),lzt=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=xi.useRef(null),u=xi.useRef(null),[l=!1,c]=cl({prop:n,defaultProp:o,onChange:i});return(0,ui.jsx)(Mgn,{scope:e,triggerRef:s,contentRef:u,contentId:za(),titleId:za(),descriptionId:za(),open:l,onOpenChange:c,onOpenToggle:xi.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};lzt.displayName=W1e;var czt="DialogTrigger",dzt=xi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=yy(czt,r),i=OO(e,o.triggerRef);return(0,ui.jsx)(mm.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":G1e(o.open),...n,ref:i,onClick:IS(t.onClick,o.onOpenToggle)})});dzt.displayName=czt;var K1e="DialogPortal",[Rgn,fzt]=uzt(K1e,{forceMount:void 0}),pzt=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=yy(K1e,e);return(0,ui.jsx)(Rgn,{scope:e,forceMount:r,children:xi.Children.map(n,a=>(0,ui.jsx)(Bu,{present:r||i.open,children:(0,ui.jsx)(U1e,{asChild:!0,container:o,children:a})}))})};pzt.displayName=K1e;var rse="DialogOverlay",mzt=xi.forwardRef((t,e)=>{let r=fzt(rse,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=yy(rse,t.__scopeDialog);return i.modal?(0,ui.jsx)(Bu,{present:n||i.open,children:(0,ui.jsx)(jgn,{...o,ref:e})}):null});mzt.displayName=rse;var jgn=xi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=yy(rse,r);return(0,ui.jsx)(r6,{as:QV,allowPinchZoom:!0,shards:[o.contentRef],children:(0,ui.jsx)(mm.div,{"data-state":G1e(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),Xj="DialogContent",hzt=xi.forwardRef((t,e)=>{let r=fzt(Xj,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=yy(Xj,t.__scopeDialog);return(0,ui.jsx)(Bu,{present:n||i.open,children:i.modal?(0,ui.jsx)(Dgn,{...o,ref:e}):(0,ui.jsx)(Ngn,{...o,ref:e})})});hzt.displayName=Xj;var Dgn=xi.forwardRef((t,e)=>{let r=yy(Xj,t.__scopeDialog),n=xi.useRef(null),o=OO(e,r.contentRef,n);return xi.useEffect(()=>{let i=n.current;if(i)return PA(i)},[]),(0,ui.jsx)(gzt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:IS(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:IS(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:IS(t.onFocusOutside,i=>i.preventDefault())})}),Ngn=xi.forwardRef((t,e)=>{let r=yy(Xj,t.__scopeDialog),n=xi.useRef(!1),o=xi.useRef(!1);return(0,ui.jsx)(gzt,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(n.current||r.triggerRef.current?.focus(),i.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));let a=i.target;r.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),gzt=xi.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=yy(Xj,r),u=xi.useRef(null),l=OO(e,u);return mA(),(0,ui.jsxs)(ui.Fragment,{children:[(0,ui.jsx)(q1e,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,ui.jsx)(k1e,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":G1e(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,ui.jsxs)(ui.Fragment,{children:[(0,ui.jsx)(Lgn,{titleId:s.titleId}),(0,ui.jsx)(kgn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),J1e="DialogTitle",yzt=xi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=yy(J1e,r);return(0,ui.jsx)(mm.h2,{id:o.titleId,...n,ref:e})});yzt.displayName=J1e;var bzt="DialogDescription",_zt=xi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=yy(bzt,r);return(0,ui.jsx)(mm.p,{id:o.descriptionId,...n,ref:e})});_zt.displayName=bzt;var vzt="DialogClose",wzt=xi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=yy(vzt,r);return(0,ui.jsx)(mm.button,{type:"button",...n,ref:e,onClick:IS(t.onClick,()=>o.onOpenChange(!1))})});wzt.displayName=vzt;function G1e(t){return t?"open":"closed"}var Szt="DialogTitleWarning",[oXo,xzt]=KDt(Szt,{contentName:Xj,titleName:J1e,docsSlug:"dialog"}),Lgn=({titleId:t})=>{let e=xzt(Szt),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return xi.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},Fgn="DialogDescriptionWarning",kgn=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xzt(Fgn).contentName}}.`;return xi.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},Czt=lzt,Ozt=dzt,Ezt=pzt,Y1e=mzt,Z1e=hzt,X1e=yzt,Q1e=_zt,Pzt=wzt;var HA=Czt,Tzt=Ozt,$gn=Ezt;var Azt=kc.forwardRef(({className:t,...e},r)=>kc.createElement(Y1e,{ref:r,className:Ce("fixed inset-0 z-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","bg-overlay/50",t),...e}));Azt.displayName=Y1e.displayName;var EO=kc.forwardRef(({className:t,children:e,container:r,...n},o)=>kc.createElement($gn,{container:r},kc.createElement(Azt,null),kc.createElement(Z1e,{ref:o,className:Ce("fixed left-[50%] top-[50%] z-modal grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-primary p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n},e,kc.createElement(Pzt,{className:"absolute border-none right-4 top-4 text-faint clickable-icon bg-transparent hover:bg-opacity-100 hover:text-normal hover:bg-transparent outline-none focus-visible:outline-none focus-visible:text-normal focus-visible:ring-0"},kc.createElement(Nf,{className:"h-4 w-4"}),kc.createElement("span",{className:"sr-only"},"Close")))));EO.displayName=Z1e.displayName;var PO=({className:t,...e})=>kc.createElement("div",{className:Ce("flex flex-col space-y-0.5 text-center sm:text-left",t),...e});PO.displayName="DialogHeader";var qgn=({className:t,...e})=>kc.createElement("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});qgn.displayName="DialogFooter";var TO=kc.forwardRef(({className:t,...e},r)=>kc.createElement(X1e,{ref:r,className:Ce("text-lg font-semibold leading-none tracking-tight mt-0",t),...e}));TO.displayName=X1e.displayName;var AO=kc.forwardRef(({className:t,...e},r)=>kc.createElement(Q1e,{ref:r,className:Ce("text-sm text-muted",t),...e}));AO.displayName=Q1e.displayName;var WA=B(X());var Qj=B(X());var hi=B(X(),1);function rq(t,[e,r]){return Math.min(r,Math.max(e,t))}function Xo(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var VA=B(X(),1);var IO=B(X(),1),Izt=B(_t(),1);function Mzt(t,e=[]){let r=[];function n(i,a){let s=IO.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,v=IO.useMemo(()=>m,Object.values(m));return(0,Izt.jsx)(h.Provider,{value:v,children:p})}function c(d,f){let p=f?.[t][u]||s,m=IO.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>IO.createContext(a));return function(s){let u=s?.[t]||i;return IO.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Ugn(o,...e)]}function Ugn(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return IO.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var nse=B(_t(),1);function ose(t){let e=t+"CollectionProvider",[r,n]=Mzt(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,v=VA.default.useRef(null),g=VA.default.useRef(new Map).current;return(0,nse.jsx)(o,{scope:m,itemMap:g,collectionRef:v,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=VA.default.forwardRef((p,m)=>{let{scope:h,children:v}=p,g=i(s,h),_=ri(m,g.collectionRef);return(0,nse.jsx)(Uy,{ref:_,children:v})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=VA.default.forwardRef((p,m)=>{let{scope:h,children:v,...g}=p,_=VA.default.useRef(null),w=ri(m,_),x=i(l,h);return VA.default.useEffect(()=>(x.itemMap.set(_,{ref:_,...g}),()=>void x.itemMap.delete(_))),(0,nse.jsx)(Uy,{[c]:"",ref:w,children:v})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return VA.default.useCallback(()=>{let v=m.collectionRef.current;if(!v)return[];let g=Array.from(v.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,C)=>g.indexOf(x.ref.current)-g.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var ml=B(_t(),1),Rzt=["PageUp","PageDown"],jzt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Dzt={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},nq="Slider",[eje,zgn,Hgn]=ose(nq),[Nzt,OXo]=Ho(nq,[Hgn]),[Vgn,ise]=Nzt(nq),Lzt=hi.forwardRef((t,e)=>{let{name:r,min:n=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:u=0,defaultValue:l=[n],value:c,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...h}=t,v=hi.useRef(new Set),g=hi.useRef(0),w=a==="horizontal"?Wgn:Kgn,[x=[],C]=cl({prop:c,defaultProp:l,onChange:N=>{[...v.current][g.current]?.focus(),d(N)}}),P=hi.useRef(x);function E(N){let L=Xgn(x,N);R(N,L)}function A(N){R(N,g.current)}function M(){let N=P.current[g.current];x[g.current]!==N&&f(x)}function R(N,L,{commit:k}={commit:!1}){let F=ryn(i),$=nyn(Math.round((N-n)/i)*i+n,F),U=rq($,[n,o]);C((J=[])=>{let V=Ygn(J,U,L);if(tyn(V,u*i)){g.current=V.indexOf(U);let j=String(V)!==String(J);return j&&k&&f(V),j?V:J}else return J})}return(0,ml.jsx)(Vgn,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:v.current,values:x,orientation:a,form:m,children:(0,ml.jsx)(eje.Provider,{scope:t.__scopeSlider,children:(0,ml.jsx)(eje.Slot,{scope:t.__scopeSlider,children:(0,ml.jsx)(w,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:Xo(h.onPointerDown,()=>{s||(P.current=x)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:E,onSlideMove:s?void 0:A,onSlideEnd:s?void 0:M,onHomeKeyDown:()=>!s&&R(n,0,{commit:!0}),onEndKeyDown:()=>!s&&R(o,x.length-1,{commit:!0}),onStepKeyDown:({event:N,direction:L})=>{if(!s){let $=Rzt.includes(N.key)||N.shiftKey&&jzt.includes(N.key)?10:1,U=g.current,J=x[U],V=i*$*L;R(J+V,U,{commit:!0})}}})})})})});Lzt.displayName=nq;var[Fzt,kzt]=Nzt(nq,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Wgn=hi.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=hi.useState(null),p=ri(e,w=>f(w)),m=hi.useRef(),h=pA(o),v=h==="ltr",g=v&&!i||!v&&i;function _(w){let x=m.current||d.getBoundingClientRect(),C=[0,x.width],E=nje(C,g?[r,n]:[n,r]);return m.current=x,E(w-x.left)}return(0,ml.jsx)(Fzt,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,ml.jsx)(Bzt,{dir:h,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{let x=_(w.clientX);a?.(x)},onSlideMove:w=>{let x=_(w.clientX);s?.(x)},onSlideEnd:()=>{m.current=void 0,u?.()},onStepKeyDown:w=>{let C=Dzt[g?"from-left":"from-right"].includes(w.key);l?.({event:w,direction:C?-1:1})}})})}),Kgn=hi.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=hi.useRef(null),d=ri(e,c),f=hi.useRef(),p=!o;function m(h){let v=f.current||c.current.getBoundingClientRect(),g=[0,v.height],w=nje(g,p?[n,r]:[r,n]);return f.current=v,w(h-v.top)}return(0,ml.jsx)(Fzt,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,ml.jsx)(Bzt,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{let v=m(h.clientY);i?.(v)},onSlideMove:h=>{let v=m(h.clientY);a?.(v)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:h=>{let g=Dzt[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:g?-1:1})}})})}),Bzt=hi.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=ise(nq,r);return(0,ml.jsx)(Hn.span,{...l,ref:e,onKeyDown:Xo(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):Rzt.concat(jzt).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:Xo(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:Xo(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:Xo(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),$zt="SliderTrack",qzt=hi.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=ise($zt,r);return(0,ml.jsx)(Hn.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});qzt.displayName=$zt;var tje="SliderRange",Uzt=hi.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=ise(tje,r),i=kzt(tje,r),a=hi.useRef(null),s=ri(e,a),u=o.values.length,l=o.values.map(f=>Hzt(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,ml.jsx)(Hn.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});Uzt.displayName=tje;var rje="SliderThumb",zzt=hi.forwardRef((t,e)=>{let r=zgn(t.__scopeSlider),[n,o]=hi.useState(null),i=ri(e,s=>o(s)),a=hi.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,ml.jsx)(Jgn,{...t,ref:i,index:a})}),Jgn=hi.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=ise(rje,r),s=kzt(rje,r),[u,l]=hi.useState(null),c=ri(e,_=>l(_)),d=u?a.form||!!u.closest("form"):!0,f=kh(u),p=a.values[n],m=p===void 0?0:Hzt(p,a.min,a.max),h=Zgn(n,a.values.length),v=f?.[s.size],g=v?Qgn(v,m,s.direction):0;return hi.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,ml.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${g}px)`},children:[(0,ml.jsx)(eje.ItemSlot,{scope:t.__scopeSlider,children:(0,ml.jsx)(Hn.span,{role:"slider","aria-label":t["aria-label"]||h,"aria-valuemin":a.min,"aria-valuenow":p,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:c,style:p===void 0?{display:"none"}:t.style,onFocus:Xo(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,ml.jsx)(Ggn,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});zzt.displayName=rje;var Ggn=t=>{let{value:e,...r}=t,n=hi.useRef(null),o=V$(e);return hi.useEffect(()=>{let i=n.current,a=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(a,"value").set;if(o!==e&&u){let l=new Event("input",{bubbles:!0});u.call(i,e),i.dispatchEvent(l)}},[o,e]),(0,ml.jsx)("input",{style:{display:"none"},...r,ref:n,defaultValue:e})};function Ygn(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function Hzt(t,e,r){let i=100/(r-e)*(t-e);return rq(i,[0,100])}function Zgn(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Xgn(t,e){if(t.length===1)return 0;let r=t.map(o=>Math.abs(o-e)),n=Math.min(...r);return r.indexOf(n)}function Qgn(t,e,r){let n=t/2,i=nje([0,50],[0,n]);return(n-i(e)*r)*r}function eyn(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function tyn(t,e){if(e>0){let r=eyn(t);return Math.min(...r)>=e}return!0}function nje(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];let n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function ryn(t){return(String(t).split(".")[1]||"").length}function nyn(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var oje=Lzt,Vzt=qzt,Wzt=Uzt,Kzt=zzt;var ije=Qj.forwardRef(({className:t,...e},r)=>Qj.createElement(oje,{ref:r,className:Ce("relative flex w-full touch-none select-none items-center",t),...e},Qj.createElement(Vzt,{className:"relative h-1.5 w-full grow overflow-hidden border border-solid border-interactive-accent/30 rounded-full bg-interactive-accent/20"},Qj.createElement(Wzt,{className:"absolute h-full bg-interactive-accent"})),Qj.createElement(Kzt,{className:"block h-4 w-4 rounded-full border bg-toggle-thumb shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})));ije.displayName=oje.displayName;function Jzt({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a}){let[s,u]=(0,WA.useState)(t);return(0,WA.useEffect)(()=>{u(t)},[t]),WA.default.createElement("div",{className:Ce("flex items-center gap-4",a)},WA.default.createElement(ije,{value:[s],onValueChange:([l])=>u(l),onValueCommit:([l])=>e?.(l),min:r,max:n,step:o,disabled:i,className:"flex-1"}),WA.default.createElement("div",{className:"min-w-[40px] text-sm text-right"},s))}function Yn(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=TS(),a="onChange"in t?t.onChange:void 0,s=(0,zi.useMemo)(()=>{if(a)return a9(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return zi.default.createElement(Yo,{type:t.type,defaultValue:t.value,onChange:l=>{s?.(l.target.value)},placeholder:t.placeholder,disabled:o,className:"w-full sm:w-[200px]"});case"password":return zi.default.createElement(AS,{value:t.value!==void 0?String(t.value):void 0,onChange:l=>{s?.(l)},placeholder:t.placeholder,disabled:o,className:"w-full sm:w-[200px]"});case"textarea":return zi.default.createElement(yj,{defaultValue:t.value,onChange:l=>{s?.(l.target.value)},placeholder:t.placeholder,rows:t.rows||3,disabled:o,className:"w-full sm:w-[300px] min-h-[80px]"});case"switch":return zi.default.createElement(j$,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return zi.default.createElement("div",{className:"relative w-full sm:w-[200px] group"},zi.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:Ce("w-full appearance-none","flex h-9 rounded-md border border-solid border-border bg-dropdown px-3 py-1 pr-8","text-sm !shadow transition-colors","focus:outline-none focus:ring-1 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-interactive-hover hover:text-normal")},t.placeholder&&zi.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>zi.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),zi.default.createElement("div",{className:Ce("pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2","transition-colors group-hover:[&>svg]:text-normal",o&&"opacity-50")},zi.default.createElement(ps,{className:"h-4 w-4"})));case"slider":return zi.default.createElement(Jzt,{value:t.value||0,onChange:t.onChange,min:t.min,max:t.max,step:t.step,disabled:o,className:"w-full sm:w-[300px]"});case"dialog":return zi.default.createElement(HA,null,zi.default.createElement(Tzt,{asChild:!0},t.trigger),zi.default.createElement(EO,{container:i},(t.dialogTitle||t.dialogDescription)&&zi.default.createElement(PO,null,t.dialogTitle&&zi.default.createElement(TO,null,t.dialogTitle),t.dialogDescription&&zi.default.createElement(AO,null,t.dialogDescription)),t.children));case"custom":return t.children}};return zi.default.createElement("div",{className:Ce("flex flex-col sm:flex-row items-start sm:items-center justify-between py-4 gap-4","w-full",n)},zi.default.createElement("div",{className:"space-y-1.5 w-full sm:w-[300px]"},zi.default.createElement("div",{className:"text-sm font-medium leading-none"},e),r&&zi.default.createElement("div",{className:"text-xs text-muted"},r)),zi.default.createElement("div",{className:"flex-1 w-full sm:flex sm:justify-end"},u()))}var MO=B(X()),Gzt=()=>{let t=Bo();return MO.default.createElement("div",{className:"space-y-4"},MO.default.createElement("section",null,MO.default.createElement(Yn,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>xt("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),MO.default.createElement("div",{className:"space-y-4"},MO.default.createElement(Yn,{type:"switch",title:"Custom Prompt Templating",description:"Enable templating to process variables like {activenote}, {foldername} or {#tag} in prompts. Disable to use raw prompts without any processing.",checked:t.enableCustomPromptTemplating,onCheckedChange:e=>{xt("enableCustomPromptTemplating",e)}}),MO.default.createElement(Yn,{type:"switch",title:"Images in Markdown (Plus)",description:"Pass embedded images in markdown to the AI along with the text. Only works with multimodal models (plus only).",checked:t.passMarkdownImages,onCheckedChange:e=>{xt("passMarkdownImages",e)}}),MO.default.createElement(Yn,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{xt("enableEncryption",e)}}),MO.default.createElement(Yn,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{xt("debug",e)}}))))};var oq=class extends H${constructor(e,r){super(e,r,"Changing this setting means you have to rebuild the index for your entire vault, do you wish to proceed?","Rebuild Index")}};var iq=require("obsidian"),Fe=B(X());var ase=require("obsidian"),Ha=B(X()),iyn=({open:t,onOpenChange:e,settings:r,updateSetting:n,modalContainer:o})=>{let[i,a]=(0,Ha.useState)(new Set),[s,u]=(0,Ha.useState)(new Set),l=m=>{m?u(new Set):s.forEach(h=>{let v=My[h];n(v,"")}),e(m)},c=m=>{let h=My[m];return r[h]??""},d=$ce().map(m=>{let h=m,v=c(h);return{provider:h,apiKey:v,isVerified:!!v&&!s.has(h)}}),f=(m,h)=>{c(m)!==h&&(n(My[m],h),u(g=>new Set(g).add(m)))},p=async(m,h)=>{a(v=>new Set(v).add(m));try{r.debug&&console.log(`Verifying ${m} API key:`,h);let v=nx(m).testModel;if(!v){new ase.Notice("API key verification failed: No default test model found for the selected provider.",1e4);return}let g={name:v,provider:m,apiKey:h,enabled:!0};await of.getInstance().ping(g),new ase.Notice("API key verified successfully!"),u(_=>{let w=new Set(_);return w.delete(m),w})}catch(v){console.error("API key verification failed:",v),new ase.Notice("API key verification failed: "+Pi(v),1e4)}finally{a(v=>{let g=new Set(v);return g.delete(m),g})}};return Ha.default.createElement(HA,{open:t,onOpenChange:l},Ha.default.createElement(EO,{container:o,className:"sm:max-w-[480px]"},Ha.default.createElement(PO,null,Ha.default.createElement(TO,null,"AI Provider Settings"),Ha.default.createElement(AO,null,"Configure your AI providers by adding their API keys.")),Ha.default.createElement("div",{className:"space-y-6 py-4"},Ha.default.createElement("div",{className:"space-y-4"},d.map(m=>Ha.default.createElement("div",{key:m.provider,className:"flex items-center gap-2"},Ha.default.createElement("div",{className:"w-[120px] font-medium"},Ha.default.createElement("div",{className:"truncate"},Ef(m.provider)),nx(m.provider).keyManagementURL&&Ha.default.createElement("a",{href:nx(m.provider).keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-accent hover:text-accent-hover"},"Get ",Ef(m.provider)," Key")),Ha.default.createElement("div",{className:"flex-1 flex items-center gap-2"},Ha.default.createElement("div",{className:"flex-1 pr-2"},Ha.default.createElement(AS,{className:"w-full",value:m.apiKey,onChange:h=>f(m.provider,h),disabled:i.has(m.provider)})),Ha.default.createElement("div",{className:"w-[72px]"},m.isVerified?Ha.default.createElement("span",{className:"text-success text-sm flex items-center justify-center h-9"},"Verified"):Ha.default.createElement(ke,{onClick:()=>p(m.provider,m.apiKey),disabled:!m.apiKey||i.size>0,variant:"secondary",size:"sm",className:"w-full whitespace-nowrap"},i.has(m.provider)?Ha.default.createElement(td,{className:"mr-2 h-4 w-4 animate-spin"}):"Verify")))))))))},Yzt=iyn;var zu=B(X()),Zzt=require("obsidian"),Xzt=B(km());function ayn({onConfirm:t,onCancel:e}){let r=de();return zu.default.createElement("div",{className:"flex flex-col gap-4"},zu.default.createElement("div",null,zu.default.createElement("p",null,"Thanks for purchasing ",zu.default.createElement("b",null,"Copilot Plus"),"! You have unlocked the full power of Copilot, featuring chat context, PDF and image support, exclusive chat and embedding models, and much more!"),zu.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),zu.default.createElement("ul",{className:"pl-4"},zu.default.createElement("li",null,"Default mode: ",zu.default.createElement("b",{className:"text-accent"},"Copilot Plus")),zu.default.createElement("li",null,"Chat model: ",zu.default.createElement("b",{className:"text-accent"},$Oe)),zu.default.createElement("li",null,zu.default.createElement("div",null,"Embedding model: ",zu.default.createElement("b",{className:"text-accent"},qOe)),r.embeddingModelKey!==UOe&&zu.default.createElement("div",{className:"text-sm text-warning flex items-center gap-1"},zu.default.createElement(Bm,{className:"size-4"})," It will rebuild your embeddings for the entire vault")))),zu.default.createElement("div",{className:"flex gap-2 justify-end w-full"},zu.default.createElement(ke,{variant:"ghost",onClick:e},"Apply Later"),zu.default.createElement(ke,{variant:"default",onClick:t},"Apply Now")))}var sse=class extends Zzt.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,Xzt.createRoot)(e);let r=()=>{Ywt(),this.close()},n=()=>{this.close()};this.root.render(zu.default.createElement(ayn,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};var ss=B(X());function Qzt(){let t=Bo(),[e,r]=(0,ss.useState)(null),[n,o]=(0,ss.useState)(!1),i=zee(),[a,s]=(0,ss.useState)(t.plusLicenseKey);return(0,ss.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),ss.default.createElement("section",{className:"flex flex-col gap-4 bg-secondary p-4 rounded-lg"},ss.default.createElement("div",{className:"text-xl font-bold flex items-center gap-2 justify-between"},ss.default.createElement("span",null,"Copilot Plus (beta)"),i&&ss.default.createElement(py,{variant:"outline",className:"text-success"},"Active")),ss.default.createElement("div",{className:"text-sm text-muted flex flex-col gap-2"},ss.default.createElement("div",null,"Copilot Plus takes your Obsidian experience to the next level with cutting-edge AI capabilities. This premium tier unlocks advanced features, including chat context, PDF and image support, web search integration, exclusive chat and embedding models, and much more."),ss.default.createElement("div",null,"Currently in beta, Copilot Plus is evolving fast, with new features and improvements rolling out regularly. Join now to secure the lowest price and get early access!")),ss.default.createElement("div",{className:"flex items-center gap-2"},ss.default.createElement(AS,{className:"w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),ss.default.createElement(ke,{disabled:n,onClick:async()=>{xt("plusLicenseKey",a),o(!0);let u=await Hee();o(!1),u?(r(null),new sse(app).open()):r("Invalid license key")},className:"min-w-20"},n?ss.default.createElement(td,{className:"h-4 w-4 animate-spin"}):"Apply"),ss.default.createElement(ke,{variant:"secondary",onClick:()=>DN(iE.SETTINGS)},"Join Now ",ss.default.createElement(uM,{className:"size-4"}))),ss.default.createElement("div",{className:"text-error"},e))}var uyn={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus (beta)"},e2t=()=>{let{modalContainer:t}=TS(),e=Bo(),[r,n]=(0,Fe.useState)(!1),[o,i]=(0,Fe.useState)(!1),[a,s]=(0,Fe.useState)(e.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),u=async f=>{f!==e.embeddingModelKey&&new oq(app,async()=>{xt("embeddingModelKey",f),await va.getInstance().indexVaultToVectorStore(!0)}).open()},l=()=>{i(!0);try{let f=a||"{$date}_{$time}__{$topic}",m=["{$date}","{$time}","{$topic}"].filter(x=>!f.includes(x));if(m.length>0){new iq.Notice(`Error: Missing required variables: ${m.join(", ")}`,4e3);return}let h=/[\\/:*?"<>|]/,v=f.replace(/\{\$date}/g,"").replace(/\{\$time}/g,"").replace(/\{\$topic}/g,"");if(h.test(v)){new iq.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:g}=_l(new Date),w=f.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",g.split("_")[0]).replace("{$time}",g.split("_")[1]);xt("defaultConversationNoteName",f),s(f),new iq.Notice(`Format applied successfully! Example: ${w}`,4e3)}catch(f){new iq.Notice(`Error applying format: ${f.message}`,4e3)}finally{i(!1)}},c=!!e.activeModels.find(f=>f.enabled&&Kr(f)===e.defaultModelKey),d=e.activeModels.filter(f=>f.enabled).map(f=>({label:qIe(f),value:Kr(f)}));return Fe.default.createElement("div",{className:"space-y-4"},Fe.default.createElement(Qzt,null),Fe.default.createElement("section",null,Fe.default.createElement("div",{className:"text-xl font-bold mb-3"},"General"),Fe.default.createElement("div",{className:"space-y-4"},Fe.default.createElement("div",{className:"space-y-4"},Fe.default.createElement(Yn,{type:"custom",title:"API Keys",description:Fe.default.createElement("div",{className:"flex items-center gap-1.5"},Fe.default.createElement("span",{className:"leading-none"},"Configure API keys for different AI providers"),Fe.default.createElement(qu,{delayDuration:0},Fe.default.createElement(qr,null,Fe.default.createElement(Ur,{asChild:!0},Fe.default.createElement(ms,{className:"size-4"})),Fe.default.createElement(Lr,{className:"max-w-96 flex flex-col gap-2 py-4"},Fe.default.createElement("div",{className:"text-sm font-medium text-accent"},"API key required for chat and QA features"),Fe.default.createElement("div",{className:"text-xs text-muted"},"To enable chat and QA functionality, please provide an API key from your selected provider.")))))},Fe.default.createElement(ke,{onClick:()=>n(!0),variant:"secondary",className:"flex items-center gap-2 w-full sm:w-auto justify-center sm:justify-start"},"Set Keys",Fe.default.createElement(Cz,{className:"h-4 w-4"}))),Fe.default.createElement(Yzt,{open:r,onOpenChange:n,settings:e,updateSetting:xt,modalContainer:t})),Fe.default.createElement(Yn,{type:"select",title:"Default Chat Model",description:"Select the Chat model to use",value:c?e.defaultModelKey:"Select Model",onChange:f=>{let p=e.activeModels.find(v=>v.enabled&&Kr(v)===f);if(!p)return;let{hasApiKey:m,errorNotice:h}=u9(p,e);if(!m&&h){new iq.Notice(h);return}xt("defaultModelKey",f)},options:c?d:[{label:"Select Model",value:"Select Model"},...d],placeholder:"Model"}),Fe.default.createElement(Yn,{type:"select",title:"Embedding Model",description:Fe.default.createElement("div",{className:"space-y-2"},Fe.default.createElement("div",{className:"flex items-center gap-1.5"},Fe.default.createElement("span",{className:"leading-none font-medium text-accent"},"Core Feature: Powers Semantic Search & QA"),Fe.default.createElement(qu,{delayDuration:0},Fe.default.createElement(qr,null,Fe.default.createElement(Ur,{asChild:!0},Fe.default.createElement(ms,{className:"size-4"})),Fe.default.createElement(Lr,{className:"max-w-96 flex flex-col gap-2"},Fe.default.createElement("div",{className:"text-sm text-muted pt-2"},"This model converts text into vector representations, essential for semantic search and QA functionality. Changing the embedding model will:"),Fe.default.createElement("ul",{className:"text-sm text-muted pl-4"},Fe.default.createElement("li",null,"Require rebuilding your vault's vector index"),Fe.default.createElement("li",null,"Affect semantic search quality"),Fe.default.createElement("li",null,"Impact QA feature performance"))))))),value:e.embeddingModelKey,onChange:u,options:e.activeEmbeddingModels.map(f=>({label:qIe(f),value:Kr(f)})),placeholder:"Model"}),Fe.default.createElement(Yn,{type:"select",title:"Default Mode",description:Fe.default.createElement("div",{className:"flex items-center gap-1.5"},Fe.default.createElement("span",{className:"leading-none"},"Select the default chat mode"),Fe.default.createElement(qu,{delayDuration:0},Fe.default.createElement(qr,null,Fe.default.createElement(Ur,{asChild:!0},Fe.default.createElement(ms,{className:"size-4"})),Fe.default.createElement(Lr,{className:"max-w-96 flex flex-col gap-2"},Fe.default.createElement("ul",{className:"text-sm text-muted pl-4"},Fe.default.createElement("li",null,Fe.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",Fe.default.createElement("i",null,"Free to use with your own API key.")),Fe.default.createElement("li",null,Fe.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",Fe.default.createElement("i",null,"Free to use with your own API key.")),Fe.default.createElement("li",null,Fe.default.createElement("strong",null,"Copilot Plus:")," Covers all features of the 2 free modes, plus advanced paid features including chat context menu, advanced search, AI agents, and more. Check out"," ",Fe.default.createElement("a",{href:zOe(iE.MODE_SELECT_TOOLTIP),target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:text-accent-hover"},"obsidiancopilot.com")," ","for more details.")))))),value:e.defaultChainType,onChange:f=>xt("defaultChainType",f),options:Object.entries(uyn).map(([f,p])=>({label:p,value:f}))}),Fe.default.createElement(Yn,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:e.defaultOpenArea,onChange:f=>xt("defaultOpenArea",f),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),Fe.default.createElement(Yn,{type:"text",title:"Default Conversation Folder Name",description:"The default folder name where chat conversations will be saved. Default is 'copilot-conversations'",value:e.defaultSaveFolder,onChange:f=>xt("defaultSaveFolder",f),placeholder:"copilot-conversations"}),Fe.default.createElement(Yn,{type:"text",title:"Custom Prompts Folder Name",description:"The default folder name where custom prompts will be saved. Default is 'copilot-custom-prompts'",value:e.customPromptsFolder,onChange:f=>xt("customPromptsFolder",f),placeholder:"copilot-custom-prompts"}),Fe.default.createElement(Yn,{type:"text",title:"Default Conversation Tag",description:"The default tag to be used when saving a conversation. Default is 'ai-conversations'",value:e.defaultConversationTag,onChange:f=>xt("defaultConversationTag",f),placeholder:"ai-conversations"}),Fe.default.createElement(Yn,{type:"custom",title:"Conversation Filename Template",description:Fe.default.createElement("div",{className:"flex items-start gap-1.5 "},Fe.default.createElement("span",{className:"leading-none"},"Customize the format of saved conversation note names."),Fe.default.createElement(qu,{delayDuration:0},Fe.default.createElement(qr,null,Fe.default.createElement(Ur,{asChild:!0},Fe.default.createElement(ms,{className:"size-4"})),Fe.default.createElement(Lr,{className:"max-w-96 flex flex-col gap-2 py-4"},Fe.default.createElement("div",{className:"text-sm font-medium text-accent"},"Note: All the following variables must be included in the template."),Fe.default.createElement("div",null,Fe.default.createElement("div",{className:"text-sm font-medium text-muted"},"Available variables:"),Fe.default.createElement("ul",{className:"text-sm text-muted pl-4"},Fe.default.createElement("li",null,Fe.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),Fe.default.createElement("li",null,Fe.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),Fe.default.createElement("li",null,Fe.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),Fe.default.createElement("i",{className:"text-sm text-muted mt-2"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]"))))))},Fe.default.createElement("div",{className:"flex items-center gap-1.5 w-[320px]"},Fe.default.createElement(Yo,{type:"text",className:`transition-all duration-200 flex-grow min-w-[80px] ${o?"w-[80px]":"w-[120px]"}`,placeholder:"{$date}_{$time}__{$topic}",value:a,onChange:f=>s(f.target.value),disabled:o}),Fe.default.createElement(ke,{onClick:()=>l(),disabled:o,variant:"secondary"},o?Fe.default.createElement(Fe.default.Fragment,null,Fe.default.createElement(td,{className:"mr-2 h-4 w-4 animate-spin"}),"Apply"):"Apply"))),Fe.default.createElement(Yn,{type:"switch",title:"Autosave Chat",description:"Automatically save the chat when starting a new one or when the plugin reloads",checked:e.autosaveChat,onCheckedChange:f=>xt("autosaveChat",f)}),Fe.default.createElement(Yn,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:e.showSuggestedPrompts,onCheckedChange:f=>xt("showSuggestedPrompts",f)}),Fe.default.createElement(Yn,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:e.showRelevantNotes,onCheckedChange:f=>xt("showRelevantNotes",f)}))))};var oa=B(X());var Oe=B(X());var i6=require("obsidian");var li=B(X());var tt=B(X(),1),xje=B(fs(),1);var Aa=B(X(),1);var sje=B(_t(),1),lyn="DismissableLayer",aje="dismissableLayer.update",cyn="dismissableLayer.pointerDownOutside",dyn="dismissableLayer.focusOutside",t2t,n2t=Aa.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),uje=Aa.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Aa.useContext(n2t),[c,d]=Aa.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Aa.useState({}),m=ri(e,E=>d(E)),h=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(v),_=c?h.indexOf(c):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,x=_>=g,C=myn(E=>{let A=E.target,M=[...l.branches].some(R=>R.contains(A));!x||M||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=hyn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return wS(E=>{_===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Aa.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(t2t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),r2t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=t2t)}},[c,f,r,l]),Aa.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),r2t())},[c,l]),Aa.useEffect(()=>{let E=()=>p({});return document.addEventListener(aje,E),()=>document.removeEventListener(aje,E)},[]),(0,sje.jsx)(Hn.div,{...u,ref:m,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:Xo(t.onFocusCapture,P.onFocusCapture),onBlurCapture:Xo(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Xo(t.onPointerDownCapture,C.onPointerDownCapture)})});uje.displayName=lyn;var fyn="DismissableLayerBranch",pyn=Aa.forwardRef((t,e)=>{let r=Aa.useContext(n2t),n=Aa.useRef(null),o=ri(e,n);return Aa.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,sje.jsx)(Hn.div,{...t,ref:o})});pyn.displayName=fyn;function myn(t,e=globalThis?.document){let r=rr(t),n=Aa.useRef(!1),o=Aa.useRef(()=>{});return Aa.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){o2t(cyn,r,c,{discrete:!0})};var u=l;let c={originalEvent:s};s.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=l,e.addEventListener("click",o.current,{once:!0})):l()}else e.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",i),e.removeEventListener("click",o.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function hyn(t,e=globalThis?.document){let r=rr(t),n=Aa.useRef(!1);return Aa.useEffect(()=>{let o=i=>{i.target&&!n.current&&o2t(dyn,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function r2t(){let t=new CustomEvent(aje);document.dispatchEvent(t)}function o2t(t,e,r,{discrete:n}){let o=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&o.addEventListener(t,e,{once:!0}),n?Pqt(o,i):o.dispatchEvent(i)}var Wh=B(X(),1);var l2t=B(_t(),1),lje="focusScope.autoFocusOnMount",cje="focusScope.autoFocusOnUnmount",i2t={bubbles:!1,cancelable:!0},gyn="FocusScope",dje=Wh.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Wh.useState(null),l=rr(o),c=rr(i),d=Wh.useRef(null),f=ri(e,h=>u(h)),p=Wh.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Wh.useEffect(()=>{if(n){let _=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:KA(d.current,{select:!0})},w=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||KA(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&KA(s)};var h=_,v=w,g=x;document.addEventListener("focusin",_),document.addEventListener("focusout",w);let C=new MutationObserver(x);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),C.disconnect()}}},[n,s,p.paused]),Wh.useEffect(()=>{if(s){s2t.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(lje,i2t);s.addEventListener(lje,l),s.dispatchEvent(g),g.defaultPrevented||(yyn(Syn(c2t(s)),{select:!0}),document.activeElement===h&&KA(s))}return()=>{s.removeEventListener(lje,l),setTimeout(()=>{let g=new CustomEvent(cje,i2t);s.addEventListener(cje,c),s.dispatchEvent(g),g.defaultPrevented||KA(h??document.body,{select:!0}),s.removeEventListener(cje,c),s2t.remove(p)},0)}}},[s,l,c,p]);let m=Wh.useCallback(h=>{if(!r&&!n||p.paused)return;let v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(v&&g){let _=h.currentTarget,[w,x]=byn(_);w&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&KA(w,{select:!0})):h.shiftKey&&g===w&&(h.preventDefault(),r&&KA(x,{select:!0})):g===_&&h.preventDefault()}},[r,n,p.paused]);return(0,l2t.jsx)(Hn.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});dje.displayName=gyn;function yyn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(KA(n,{select:e}),document.activeElement!==r)return}function byn(t){let e=c2t(t),r=a2t(e,t),n=a2t(e.reverse(),t);return[r,n]}function c2t(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{let o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function a2t(t,e){for(let r of t)if(!_yn(r,{upTo:e}))return r}function _yn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function vyn(t){return t instanceof HTMLInputElement&&"select"in t}function KA(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&vyn(t)&&e&&t.select()}}var s2t=wyn();function wyn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=u2t(t,e),t.unshift(e)},remove(e){t=u2t(t,e),t[0]?.resume()}}}function u2t(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Syn(t){return t.filter(e=>e.tagName!=="A")}var hm=B(X(),1);var d2t=B(X(),1);var fje=B(_t(),1),xyn="Arrow",f2t=d2t.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,fje.jsx)(Hn.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,fje.jsx)("polygon",{points:"0,0 30,0 15,10"})})});f2t.displayName=xyn;var p2t=f2t;var RO=B(X(),1),m2t=B(_t(),1);function h2t(t,e=[]){let r=[];function n(i,a){let s=RO.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,v=RO.useMemo(()=>m,Object.values(m));return(0,m2t.jsx)(h.Provider,{value:v,children:p})}function c(d,f){let p=f?.[t][u]||s,m=RO.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>RO.createContext(a));return function(s){let u=s?.[t]||i;return RO.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Oyn(o,...e)]}function Oyn(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return RO.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var JA=B(_t(),1);var pje="Popper",[g2t,mje]=h2t(pje),[Eyn,y2t]=g2t(pje),b2t=t=>{let{__scopePopper:e,children:r}=t,[n,o]=hm.useState(null);return(0,JA.jsx)(Eyn,{scope:e,anchor:n,onAnchorChange:o,children:r})};b2t.displayName=pje;var _2t="PopperAnchor",v2t=hm.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=y2t(_2t,r),a=hm.useRef(null),s=ri(e,a);return hm.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,JA.jsx)(Hn.div,{...o,ref:s})});v2t.displayName=_2t;var hje="PopperContent",[Pyn,Tyn]=g2t(hje),w2t=hm.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,v=y2t(hje,r),[g,_]=hm.useState(null),w=ri(e,oe=>_(oe)),[x,C]=hm.useState(null),P=kh(x),E=P?.width??0,A=P?.height??0,M=n+(i!=="center"?"-"+i:""),R=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],L=N.length>0,k={padding:R,boundary:N.filter(Iyn),altBoundary:L},{refs:F,floatingStyles:$,placement:U,isPositioned:J,middlewareData:V}=gA({strategy:"fixed",placement:M,whileElementsMounted:(...oe)=>SO(...oe,{animationFrame:p==="always"}),elements:{reference:v.anchor},middleware:[yA({mainAxis:o+A,alignmentAxis:a}),u&&bA({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?_A():void 0,...k}),u&&vA({...k}),wA({...k,apply:({elements:oe,rects:Te,availableWidth:bt,availableHeight:xe})=>{let{width:Z,height:te}=Te.reference,Ee=oe.floating.style;Ee.setProperty("--radix-popper-available-width",`${bt}px`),Ee.setProperty("--radix-popper-available-height",`${xe}px`),Ee.setProperty("--radix-popper-anchor-width",`${Z}px`),Ee.setProperty("--radix-popper-anchor-height",`${te}px`)}}),x&&xA({element:x,padding:s}),Myn({arrowWidth:E,arrowHeight:A}),f&&SA({strategy:"referenceHidden",...k})]}),[j,z]=C2t(U),W=rr(m);Qr(()=>{J&&W?.()},[J,W]);let K=V.arrow?.x,re=V.arrow?.y,De=V.arrow?.centerOffset!==0,[Y,Q]=hm.useState();return Qr(()=>{g&&Q(window.getComputedStyle(g).zIndex)},[g]),(0,JA.jsx)("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:J?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,JA.jsx)(Pyn,{scope:r,placedSide:j,onArrowChange:C,arrowX:K,arrowY:re,shouldHideArrow:De,children:(0,JA.jsx)(Hn.div,{"data-side":j,"data-align":z,...h,ref:w,style:{...h.style,animation:J?void 0:"none"}})})})});w2t.displayName=hje;var S2t="PopperArrow",Ayn={top:"bottom",right:"left",bottom:"top",left:"right"},x2t=hm.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Tyn(S2t,n),a=Ayn[i.placedSide];return(0,JA.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,JA.jsx)(p2t,{...o,ref:r,style:{...o.style,display:"block"}})})});x2t.displayName=S2t;function Iyn(t){return t!==null}var Myn=t=>({name:"transformOrigin",options:t,fn(e){let{placement:r,rects:n,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,s=a?0:t.arrowWidth,u=a?0:t.arrowHeight,[l,c]=C2t(r),d={start:"0%",center:"50%",end:"100%"}[c],f=(o.arrow?.x??0)+s/2,p=(o.arrow?.y??0)+u/2,m="",h="";return l==="bottom"?(m=a?d:`${f}px`,h=`${-u}px`):l==="top"?(m=a?d:`${f}px`,h=`${n.floating.height+u}px`):l==="right"?(m=`${-u}px`,h=a?d:`${p}px`):l==="left"&&(m=`${n.floating.width+u}px`,h=a?d:`${p}px`),{data:{x:m,y:h}}}});function C2t(t){let[e,r="center"]=t.split("-");return[e,r]}var O2t=b2t,E2t=v2t,P2t=w2t,T2t=x2t;var use=B(X(),1),A2t=B(fs(),1);var I2t=B(_t(),1),jyn="Portal",gje=use.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=use.useState(!1);Qr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?A2t.default.createPortal((0,I2t.jsx)(Hn.div,{...n,ref:e}),a):null});gje.displayName=jyn;var M2t=B(X(),1);var R2t=B(_t(),1),Dyn="VisuallyHidden",yje=M2t.forwardRef((t,e)=>(0,R2t.jsx)(Hn.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));yje.displayName=Dyn;var Wt=B(_t(),1),Nyn=[" ","Enter","ArrowUp","ArrowDown"],Lyn=[" ","Enter"],o6="Select",[cse,dse,Fyn]=ose(o6),[aq,Oei]=Ho(o6,[Fyn,mje]),fse=mje(),[kyn,GA]=aq(o6),[Byn,$yn]=aq(o6),j2t=t=>{let{__scopeSelect:e,children:r,open:n,defaultOpen:o,onOpenChange:i,value:a,defaultValue:s,onValueChange:u,dir:l,name:c,autoComplete:d,disabled:f,required:p,form:m}=t,h=fse(e),[v,g]=tt.useState(null),[_,w]=tt.useState(null),[x,C]=tt.useState(!1),P=pA(l),[E=!1,A]=cl({prop:n,defaultProp:o,onChange:i}),[M,R]=cl({prop:a,defaultProp:s,onChange:u}),N=tt.useRef(null),L=v?m||!!v.closest("form"):!0,[k,F]=tt.useState(new Set),$=Array.from(k).map(U=>U.props.value).join(";");return(0,Wt.jsx)(O2t,{...h,children:(0,Wt.jsxs)(kyn,{required:p,scope:e,trigger:v,onTriggerChange:g,valueNode:_,onValueNodeChange:w,valueNodeHasChildren:x,onValueNodeHasChildrenChange:C,contentId:za(),value:M,onValueChange:R,open:E,onOpenChange:A,dir:P,triggerPointerDownPosRef:N,disabled:f,children:[(0,Wt.jsx)(cse.Provider,{scope:e,children:(0,Wt.jsx)(Byn,{scope:t.__scopeSelect,onNativeOptionAdd:tt.useCallback(U=>{F(J=>new Set(J).add(U))},[]),onNativeOptionRemove:tt.useCallback(U=>{F(J=>{let V=new Set(J);return V.delete(U),V})},[]),children:r})}),L?(0,Wt.jsxs)(o4t,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:M,onChange:U=>R(U.target.value),disabled:f,form:m,children:[M===void 0?(0,Wt.jsx)("option",{value:""}):null,Array.from(k)]},$):null]})})};j2t.displayName=o6;var D2t="SelectTrigger",N2t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=fse(r),a=GA(D2t,r),s=a.disabled||n,u=ri(e,a.onTriggerChange),l=dse(r),c=tt.useRef("touch"),[d,f,p]=i4t(h=>{let v=l().filter(w=>!w.disabled),g=v.find(w=>w.value===a.value),_=a4t(v,h,g);_!==void 0&&a.onValueChange(_.value)}),m=h=>{s||(a.onOpenChange(!0),p()),h&&(a.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return(0,Wt.jsx)(E2t,{asChild:!0,...i,children:(0,Wt.jsx)(Hn.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":n4t(a.value)?"":void 0,...o,ref:u,onClick:Xo(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:Xo(o.onPointerDown,h=>{c.current=h.pointerType;let v=h.target;v.hasPointerCapture(h.pointerId)&&v.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(m(h),h.preventDefault())}),onKeyDown:Xo(o.onKeyDown,h=>{let v=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(v&&h.key===" ")&&Nyn.includes(h.key)&&(m(),h.preventDefault())})})})});N2t.displayName=D2t;var L2t="SelectValue",F2t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=GA(L2t,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=ri(e,u.onValueNodeChange);return Qr(()=>{l(c)},[l,c]),(0,Wt.jsx)(Hn.span,{...s,ref:d,style:{pointerEvents:"none"},children:n4t(u.value)?(0,Wt.jsx)(Wt.Fragment,{children:a}):i})});F2t.displayName=L2t;var qyn="SelectIcon",k2t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,Wt.jsx)(Hn.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});k2t.displayName=qyn;var Uyn="SelectPortal",B2t=t=>(0,Wt.jsx)(gje,{asChild:!0,...t});B2t.displayName=Uyn;var eD="SelectContent",$2t=tt.forwardRef((t,e)=>{let r=GA(eD,t.__scopeSelect),[n,o]=tt.useState();if(Qr(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?xje.createPortal((0,Wt.jsx)(q2t,{scope:t.__scopeSelect,children:(0,Wt.jsx)(cse.Slot,{scope:t.__scopeSelect,children:(0,Wt.jsx)("div",{children:t.children})})}),i):null}return(0,Wt.jsx)(U2t,{...t,ref:e})});$2t.displayName=eD;var by=10,[q2t,YA]=aq(eD),zyn="SelectContentImpl",U2t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:v,...g}=t,_=GA(eD,r),[w,x]=tt.useState(null),[C,P]=tt.useState(null),E=ri(e,oe=>x(oe)),[A,M]=tt.useState(null),[R,N]=tt.useState(null),L=dse(r),[k,F]=tt.useState(!1),$=tt.useRef(!1);tt.useEffect(()=>{if(w)return PA(w)},[w]),mA();let U=tt.useCallback(oe=>{let[Te,...bt]=L().map(te=>te.ref.current),[xe]=bt.slice(-1),Z=document.activeElement;for(let te of oe)if(te===Z||(te?.scrollIntoView({block:"nearest"}),te===Te&&C&&(C.scrollTop=0),te===xe&&C&&(C.scrollTop=C.scrollHeight),te?.focus(),document.activeElement!==Z))return},[L,C]),J=tt.useCallback(()=>U([A,w]),[U,A,w]);tt.useEffect(()=>{k&&J()},[k,J]);let{onOpenChange:V,triggerPointerDownPosRef:j}=_;tt.useEffect(()=>{if(w){let oe={x:0,y:0},Te=xe=>{oe={x:Math.abs(Math.round(xe.pageX)-(j.current?.x??0)),y:Math.abs(Math.round(xe.pageY)-(j.current?.y??0))}},bt=xe=>{oe.x<=10&&oe.y<=10?xe.preventDefault():w.contains(xe.target)||V(!1),document.removeEventListener("pointermove",Te),j.current=null};return j.current!==null&&(document.addEventListener("pointermove",Te),document.addEventListener("pointerup",bt,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Te),document.removeEventListener("pointerup",bt,{capture:!0})}}},[w,V,j]),tt.useEffect(()=>{let oe=()=>V(!1);return window.addEventListener("blur",oe),window.addEventListener("resize",oe),()=>{window.removeEventListener("blur",oe),window.removeEventListener("resize",oe)}},[V]);let[z,W]=i4t(oe=>{let Te=L().filter(Z=>!Z.disabled),bt=Te.find(Z=>Z.ref.current===document.activeElement),xe=a4t(Te,oe,bt);xe&&setTimeout(()=>xe.ref.current.focus())}),K=tt.useCallback((oe,Te,bt)=>{let xe=!$.current&&!bt;(_.value!==void 0&&_.value===Te||xe)&&(M(oe),xe&&($.current=!0))},[_.value]),re=tt.useCallback(()=>w?.focus(),[w]),De=tt.useCallback((oe,Te,bt)=>{let xe=!$.current&&!bt;(_.value!==void 0&&_.value===Te||xe)&&N(oe)},[_.value]),Y=n==="popper"?bje:z2t,Q=Y===bje?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:v}:{};return(0,Wt.jsx)(q2t,{scope:r,content:w,viewport:C,onViewportChange:P,itemRefCallback:K,selectedItem:A,onItemLeave:re,itemTextRefCallback:De,focusSelectedItem:J,selectedItemText:R,position:n,isPositioned:k,searchRef:z,children:(0,Wt.jsx)(r6,{as:Uy,allowPinchZoom:!0,children:(0,Wt.jsx)(dje,{asChild:!0,trapped:_.open,onMountAutoFocus:oe=>{oe.preventDefault()},onUnmountAutoFocus:Xo(o,oe=>{_.trigger?.focus({preventScroll:!0}),oe.preventDefault()}),children:(0,Wt.jsx)(uje,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:oe=>oe.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:(0,Wt.jsx)(Y,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:oe=>oe.preventDefault(),...g,...Q,onPlaced:()=>F(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:Xo(g.onKeyDown,oe=>{let Te=oe.ctrlKey||oe.altKey||oe.metaKey;if(oe.key==="Tab"&&oe.preventDefault(),!Te&&oe.key.length===1&&W(oe.key),["ArrowUp","ArrowDown","Home","End"].includes(oe.key)){let xe=L().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);if(["ArrowUp","End"].includes(oe.key)&&(xe=xe.slice().reverse()),["ArrowUp","ArrowDown"].includes(oe.key)){let Z=oe.target,te=xe.indexOf(Z);xe=xe.slice(te+1)}setTimeout(()=>U(xe)),oe.preventDefault()}})})})})})})});U2t.displayName=zyn;var Hyn="SelectItemAlignedPosition",z2t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=GA(eD,r),a=YA(eD,r),[s,u]=tt.useState(null),[l,c]=tt.useState(null),d=ri(e,E=>c(E)),f=dse(r),p=tt.useRef(!1),m=tt.useRef(!0),{viewport:h,selectedItem:v,selectedItemText:g,focusSelectedItem:_}=a,w=tt.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&v&&g){let E=i.trigger.getBoundingClientRect(),A=l.getBoundingClientRect(),M=i.valueNode.getBoundingClientRect(),R=g.getBoundingClientRect();if(i.dir!=="rtl"){let Z=R.left-A.left,te=M.left-Z,Ee=E.left-te,Le=E.width+Ee,Ze=Math.max(Le,A.width),Ot=window.innerWidth-by,Yt=rq(te,[by,Math.max(by,Ot-Ze)]);s.style.minWidth=Le+"px",s.style.left=Yt+"px"}else{let Z=A.right-R.right,te=window.innerWidth-M.right-Z,Ee=window.innerWidth-E.right-te,Le=E.width+Ee,Ze=Math.max(Le,A.width),Ot=window.innerWidth-by,Yt=rq(te,[by,Math.max(by,Ot-Ze)]);s.style.minWidth=Le+"px",s.style.right=Yt+"px"}let N=f(),L=window.innerHeight-by*2,k=h.scrollHeight,F=window.getComputedStyle(l),$=parseInt(F.borderTopWidth,10),U=parseInt(F.paddingTop,10),J=parseInt(F.borderBottomWidth,10),V=parseInt(F.paddingBottom,10),j=$+U+k+V+J,z=Math.min(v.offsetHeight*5,j),W=window.getComputedStyle(h),K=parseInt(W.paddingTop,10),re=parseInt(W.paddingBottom,10),De=E.top+E.height/2-by,Y=L-De,Q=v.offsetHeight/2,oe=v.offsetTop+Q,Te=$+U+oe,bt=j-Te;if(Te<=De){let Z=N.length>0&&v===N[N.length-1].ref.current;s.style.bottom="0px";let te=l.clientHeight-h.offsetTop-h.offsetHeight,Ee=Math.max(Y,Q+(Z?re:0)+te+J),Le=Te+Ee;s.style.height=Le+"px"}else{let Z=N.length>0&&v===N[0].ref.current;s.style.top="0px";let Ee=Math.max(De,$+h.offsetTop+(Z?K:0)+Q)+bt;s.style.height=Ee+"px",h.scrollTop=Te-De+h.offsetTop}s.style.margin=`${by}px 0`,s.style.minHeight=z+"px",s.style.maxHeight=L+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,v,g,i.dir,n]);Qr(()=>w(),[w]);let[x,C]=tt.useState();Qr(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]);let P=tt.useCallback(E=>{E&&m.current===!0&&(w(),_?.(),m.current=!1)},[w,_]);return(0,Wt.jsx)(Wyn,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:P,children:(0,Wt.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:(0,Wt.jsx)(Hn.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});z2t.displayName=Hyn;var Vyn="SelectPopperPosition",bje=tt.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=by,...i}=t,a=fse(r);return(0,Wt.jsx)(P2t,{...a,...i,ref:e,align:n,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});bje.displayName=Vyn;var[Wyn,Cje]=aq(eD,{}),_je="SelectViewport",H2t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=YA(_je,r),a=Cje(_je,r),s=ri(e,i.onViewportChange),u=tt.useRef(0);return(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),(0,Wt.jsx)(cse.Slot,{scope:r,children:(0,Wt.jsx)(Hn.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Xo(o.onScroll,l=>{let c=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=a;if(f?.current&&d){let p=Math.abs(u.current-c.scrollTop);if(p>0){let m=window.innerHeight-by*2,h=parseFloat(d.style.minHeight),v=parseFloat(d.style.height),g=Math.max(h,v);if(g<m){let _=g+p,w=Math.min(m,_),x=_-w;d.style.height=w+"px",d.style.bottom==="0px"&&(c.scrollTop=x>0?x:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});H2t.displayName=_je;var V2t="SelectGroup",[Kyn,Jyn]=aq(V2t),Gyn=tt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=za();return(0,Wt.jsx)(Kyn,{scope:r,id:o,children:(0,Wt.jsx)(Hn.div,{role:"group","aria-labelledby":o,...n,ref:e})})});Gyn.displayName=V2t;var W2t="SelectLabel",K2t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Jyn(W2t,r);return(0,Wt.jsx)(Hn.div,{id:o.id,...n,ref:e})});K2t.displayName=W2t;var lse="SelectItem",[Yyn,J2t]=aq(lse),G2t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=GA(lse,r),u=YA(lse,r),l=s.value===n,[c,d]=tt.useState(i??""),[f,p]=tt.useState(!1),m=ri(e,_=>u.itemRefCallback?.(_,n,o)),h=za(),v=tt.useRef("touch"),g=()=>{o||(s.onValueChange(n),s.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,Wt.jsx)(Yyn,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:tt.useCallback(_=>{d(w=>w||(_?.textContent??"").trim())},[]),children:(0,Wt.jsx)(cse.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,Wt.jsx)(Hn.div,{role:"option","aria-labelledby":h,"data-highlighted":f?"":void 0,"aria-selected":l&&f,"data-state":l?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:m,onFocus:Xo(a.onFocus,()=>p(!0)),onBlur:Xo(a.onBlur,()=>p(!1)),onClick:Xo(a.onClick,()=>{v.current!=="mouse"&&g()}),onPointerUp:Xo(a.onPointerUp,()=>{v.current==="mouse"&&g()}),onPointerDown:Xo(a.onPointerDown,_=>{v.current=_.pointerType}),onPointerMove:Xo(a.onPointerMove,_=>{v.current=_.pointerType,o?u.onItemLeave?.():v.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Xo(a.onPointerLeave,_=>{_.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Xo(a.onKeyDown,_=>{u.searchRef?.current!==""&&_.key===" "||(Lyn.includes(_.key)&&g(),_.key===" "&&_.preventDefault())})})})})});G2t.displayName=lse;var n6="SelectItemText",Y2t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=GA(n6,r),s=YA(n6,r),u=J2t(n6,r),l=$yn(n6,r),[c,d]=tt.useState(null),f=ri(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,m=tt.useMemo(()=>(0,Wt.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:v}=l;return Qr(()=>(h(m),()=>v(m)),[h,v,m]),(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsx)(Hn.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?xje.createPortal(i.children,a.valueNode):null]})});Y2t.displayName=n6;var Z2t="SelectItemIndicator",X2t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return J2t(Z2t,r).isSelected?(0,Wt.jsx)(Hn.span,{"aria-hidden":!0,...n,ref:e}):null});X2t.displayName=Z2t;var vje="SelectScrollUpButton",Q2t=tt.forwardRef((t,e)=>{let r=YA(vje,t.__scopeSelect),n=Cje(vje,t.__scopeSelect),[o,i]=tt.useState(!1),a=ri(e,n.onScrollButtonChange);return Qr(()=>{if(r.viewport&&r.isPositioned){let u=function(){let c=l.scrollTop>0;i(c)};var s=u;let l=r.viewport;return u(),l.addEventListener("scroll",u),()=>l.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),o?(0,Wt.jsx)(t4t,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});Q2t.displayName=vje;var wje="SelectScrollDownButton",e4t=tt.forwardRef((t,e)=>{let r=YA(wje,t.__scopeSelect),n=Cje(wje,t.__scopeSelect),[o,i]=tt.useState(!1),a=ri(e,n.onScrollButtonChange);return Qr(()=>{if(r.viewport&&r.isPositioned){let u=function(){let c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;i(d)};var s=u;let l=r.viewport;return u(),l.addEventListener("scroll",u),()=>l.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),o?(0,Wt.jsx)(t4t,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});e4t.displayName=wje;var t4t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=YA("SelectScrollButton",r),a=tt.useRef(null),s=dse(r),u=tt.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return tt.useEffect(()=>()=>u(),[u]),Qr(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,Wt.jsx)(Hn.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:Xo(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:Xo(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:Xo(o.onPointerLeave,()=>{u()})})}),Zyn="SelectSeparator",r4t=tt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,Wt.jsx)(Hn.div,{"aria-hidden":!0,...n,ref:e})});r4t.displayName=Zyn;var Sje="SelectArrow",Xyn=tt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=fse(r),i=GA(Sje,r),a=YA(Sje,r);return i.open&&a.position==="popper"?(0,Wt.jsx)(T2t,{...o,...n,ref:e}):null});Xyn.displayName=Sje;function n4t(t){return t===""||t===void 0}var o4t=tt.forwardRef((t,e)=>{let{value:r,...n}=t,o=tt.useRef(null),i=ri(e,o),a=V$(r);return tt.useEffect(()=>{let s=o.current,u=window.HTMLSelectElement.prototype,c=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==r&&c){let d=new Event("change",{bubbles:!0});c.call(s,r),s.dispatchEvent(d)}},[a,r]),(0,Wt.jsx)(yje,{asChild:!0,children:(0,Wt.jsx)("select",{...n,ref:i,defaultValue:r})})});o4t.displayName="BubbleSelect";function i4t(t){let e=rr(t),r=tt.useRef(""),n=tt.useRef(0),o=tt.useCallback(a=>{let s=r.current+a;e(s),function u(l){r.current=l,window.clearTimeout(n.current),l!==""&&(n.current=window.setTimeout(()=>u(""),1e3))}(s)},[e]),i=tt.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return tt.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function a4t(t,e,r){let o=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=r?t.indexOf(r):-1,a=Qyn(t,Math.max(i,0));o.length===1&&(a=a.filter(l=>l!==r));let u=a.find(l=>l.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==r?u:void 0}function Qyn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var s4t=j2t,Oje=N2t,u4t=F2t,l4t=k2t,c4t=B2t,Eje=$2t,d4t=H2t;var Pje=K2t,Tje=G2t,f4t=Y2t,p4t=X2t,Aje=Q2t,Ije=e4t,Mje=r4t;var m4t=s4t;var h4t=u4t,Rje=li.forwardRef(({className:t,children:e,...r},n)=>li.createElement(Oje,{ref:n,className:Ce("border-solid !bg-dropdown !shadow-sm transition-colors","focus-visible:shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"," hover:data-[state=closed]:!bg-interactive-accent hover:data-[state=closed]:!text-on-accent","flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-border px-3 py-1 text-sm ring-offset-ring placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r},e,li.createElement(l4t,{asChild:!0},li.createElement(ps,{className:"h-4 w-4"}))));Rje.displayName=Oje.displayName;var g4t=li.forwardRef(({className:t,...e},r)=>li.createElement(Aje,{ref:r,className:Ce("flex cursor-default items-center justify-center py-1",t),...e},li.createElement(sM,{className:"h-4 w-4"})));g4t.displayName=Aje.displayName;var y4t=li.forwardRef(({className:t,...e},r)=>li.createElement(Ije,{ref:r,className:Ce("flex cursor-default items-center justify-center py-1",t),...e},li.createElement(ps,{className:"h-4 w-4"})));y4t.displayName=Ije.displayName;var jje=li.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>li.createElement(c4t,{container:n},li.createElement(Eje,{ref:i,className:Ce("relative z-modal max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-primary text-normal shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...o},li.createElement(g4t,null),li.createElement(d4t,{className:Ce("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]")},e),li.createElement(y4t,null))));jje.displayName=Eje.displayName;var tbn=li.forwardRef(({className:t,...e},r)=>li.createElement(Pje,{ref:r,className:Ce("px-2 py-1.5 text-sm font-semibold",t),...e}));tbn.displayName=Pje.displayName;var Dje=li.forwardRef(({className:t,children:e,...r},n)=>li.createElement(Tje,{ref:n,className:Ce("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-interactive-accent focus:text-on-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r},li.createElement("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center"},li.createElement(p4t,null,li.createElement(yg,{className:"h-4 w-4"}))),li.createElement(f4t,null,e)));Dje.displayName=Tje.displayName;var rbn=li.forwardRef(({className:t,...e},r)=>li.createElement(Mje,{ref:r,className:Ce("-mx-1 my-1 h-px bg-primary-alt",t),...e}));rbn.displayName=Mje.displayName;var sq=B(X());var hl=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>sq.default.createElement("div",{className:"space-y-2"},sq.default.createElement(fp,{className:r?"text-error":""},t," ",e&&sq.default.createElement("span",{className:"text-error"},"*")),i,r&&sq.default.createElement("p",{className:"text-xs text-error"},o),n&&sq.default.createElement("p",{className:"text-sm text-muted"},n));var Nje=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=TS(),a=de(),s=o?"openai":"openai",[u,l]=(0,Oe.useState)(null),[c,d]=(0,Oe.useState)(!1),[f,p]=(0,Oe.useState)(!1),[m,h]=(0,Oe.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1}),v=(j,z)=>{h(W=>({...W,[j]:z}))},g=()=>{h({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},_=()=>{let j=!0,z={...m};return z.name=!C.name,C.name||(j=!1),C.provider==="azure openai"&&(z.instanceName=!C.azureOpenAIApiInstanceName,z.apiVersion=!C.azureOpenAIApiVersion,o?(z.embeddingDeploymentName=!C.azureOpenAIApiEmbeddingDeploymentName,C.azureOpenAIApiEmbeddingDeploymentName||(j=!1)):(z.deploymentName=!C.azureOpenAIApiDeploymentName,C.azureOpenAIApiDeploymentName||(j=!1)),(!C.azureOpenAIApiInstanceName||!C.azureOpenAIApiVersion)&&(j=!1)),h(z),j},w=j=>a[My[j]]||"",x=(j=s)=>{let z={name:"",provider:j,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:w(j),isEmbeddingModel:o,capabilities:[]};return o?z:{...z,stream:!0}},[C,P]=(0,Oe.useState)(x()),E=j=>({...j,name:j.name?.trim(),baseUrl:j.baseUrl?.trim(),apiKey:j.apiKey?.trim(),openAIOrgId:j.openAIOrgId?.trim(),azureOpenAIApiInstanceName:j.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:j.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:j.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:j.azureOpenAIApiVersion?.trim()}),[A,M]=(0,Oe.useState)(nx(s)),R=()=>!!(C.name&&C.provider),N=()=>f||!R(),L=()=>{if(!_()){new i6.Notice("Please fill in all required fields");return}let j=E(C);r(j),e(!1),P(x()),g()},k=j=>{M(nx(j)),P({...C,provider:j,apiKey:w(j),...j==="openai"?{openAIOrgId:a.openAIOrgId}:{},...j==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{}})},F=j=>{j||(P(x()),g(),d(!1)),e(j)},$=async()=>{if(!_()){new i6.Notice("Please fill in all required fields");return}p(!0);try{let j=E(C);await n(j),new i6.Notice("Model verification successful!")}catch(j){console.error(j);let z=Pi(j);new i6.Notice("Model verification failed: "+z)}finally{p(!1)}},U=()=>{let z=(()=>{switch(C.provider){case"openai":return Oe.default.createElement(hl,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},Oe.default.createElement(Yo,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:C.openAIOrgId||"",onChange:W=>P({...C,openAIOrgId:W.target.value})}));case"azure openai":return Oe.default.createElement(Oe.default.Fragment,null,Oe.default.createElement(hl,{label:"Instance Name",required:!0,error:m.instanceName,errorMessage:"Instance name is required"},Oe.default.createElement(Yo,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:C.azureOpenAIApiInstanceName||"",onChange:W=>{P({...C,azureOpenAIApiInstanceName:W.target.value}),v("instanceName",!1)}})),o?Oe.default.createElement(hl,{label:"Embedding Deployment Name",required:!0,error:m.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},Oe.default.createElement(Yo,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:C.azureOpenAIApiEmbeddingDeploymentName||"",onChange:W=>{P({...C,azureOpenAIApiEmbeddingDeploymentName:W.target.value}),v("embeddingDeploymentName",!1)}})):Oe.default.createElement(hl,{label:"Deployment Name",required:!0,error:m.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},Oe.default.createElement(Yo,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:C.azureOpenAIApiDeploymentName||"",onChange:W=>{P({...C,azureOpenAIApiDeploymentName:W.target.value}),v("deploymentName",!1)}})),Oe.default.createElement(hl,{label:"API Version",required:!0,error:m.apiVersion,errorMessage:"API version is required"},Oe.default.createElement(Yo,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:C.azureOpenAIApiVersion||"",onChange:W=>{P({...C,azureOpenAIApiVersion:W.target.value}),v("apiVersion",!1)}})));default:return null}})();return z?Oe.default.createElement(CV,{open:c,onOpenChange:d,className:"space-y-2 border rounded-lg pt-4"},Oe.default.createElement("div",{className:"flex items-center justify-between"},Oe.default.createElement(fp,null,"Additional ",Ef(C.provider)," Settings"),Oe.default.createElement(OV,{asChild:!0},Oe.default.createElement(ke,{variant:"ghost",size:"sm",className:"w-9 p-0"},Oe.default.createElement(ps,{className:"h-4 w-4"}),Oe.default.createElement("span",{className:"sr-only"},"Toggle")))),Oe.default.createElement(EV,{className:"space-y-4 max-h-[200px] overflow-y-auto pl-0.5 pr-2 pb-0.5"},z)):null},J=()=>{if(C.provider!=="azure openai")return A.host;let j=C.azureOpenAIApiInstanceName||"[instance]",z=o?C.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":C.azureOpenAIApiDeploymentName||"[deployment]",W=C.azureOpenAIApiVersion||"[api-version]";return`https://${j}.openai.azure.com/openai/deployments/${z}/${o?"embeddings":"chat/completions"}?api-version=${W}`},V=Object.entries(aE).map(([j,z])=>({id:j,label:j.charAt(0).toUpperCase()+j.slice(1),description:z}));return Oe.default.createElement(HA,{open:t,onOpenChange:F},Oe.default.createElement(EO,{className:"sm:max-w-[425px]",container:i,ref:j=>l(j)},Oe.default.createElement(PO,null,Oe.default.createElement(TO,null,"Add Custom ",o?"Embedding":"Chat"," Model"),Oe.default.createElement(AO,null,"Add a new model to your collection.")),Oe.default.createElement("div",{className:"space-y-3"},Oe.default.createElement(hl,{label:"Model Name",required:!0,error:m.name,errorMessage:"Model name is required"},Oe.default.createElement(Yo,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:C.name,onChange:j=>{P({...C,name:j.target.value}),v("name",!1)}})),Oe.default.createElement(hl,{label:Oe.default.createElement("div",{className:"flex items-center gap-1.5"},Oe.default.createElement("span",{className:"leading-none"},"Display Name"),Oe.default.createElement(qu,{delayDuration:0},Oe.default.createElement(qr,null,Oe.default.createElement(Ur,{asChild:!0},Oe.default.createElement(ms,{className:"size-4"})),Oe.default.createElement(Lr,{align:"start",className:"max-w-96",side:"bottom"},Oe.default.createElement("div",{className:"text-sm text-muted flex flex-col gap-0.5"},Oe.default.createElement("div",{className:"text-[12px] font-bold"},"Suggested format:"),Oe.default.createElement("div",{className:"text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Oe.default.createElement("div",{className:"text-[12px]"},"Example:",Oe.default.createElement("li",null,"Direct-Paid:Ds-r1"),Oe.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Oe.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Oe.default.createElement(Yo,{type:"text",placeholder:"Custom display name (optional)",value:C.displayName||"",onChange:j=>{P({...C,displayName:j.target.value})}})),Oe.default.createElement(hl,{label:"Provider"},Oe.default.createElement(m4t,{value:C.provider,onValueChange:k},Oe.default.createElement(Rje,null,Oe.default.createElement(h4t,{placeholder:"Select provider"})),Oe.default.createElement(jje,{container:u},Object.values(o?Bce(oE,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):Bce(qI,["COPILOT_PLUS"])).map(j=>Oe.default.createElement(Dje,{key:j,value:j},Ef(j)))))),Oe.default.createElement(hl,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Oe.default.createElement(Yo,{type:"text",placeholder:J()||"https://api.example.com/v1",value:C.baseUrl||"",onChange:j=>P({...C,baseUrl:j.target.value})})),Oe.default.createElement(hl,{label:"API Key"},Oe.default.createElement(AS,{placeholder:`Enter ${A.label} API Key`,value:C.apiKey||"",onChange:j=>P({...C,apiKey:j})}),A.keyManagementURL&&Oe.default.createElement("p",{className:"text-xs text-muted"},Oe.default.createElement("a",{href:A.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",A.label," API Key"))),Oe.default.createElement(hl,{label:Oe.default.createElement("div",{className:"flex items-center gap-1.5"},Oe.default.createElement("span",{className:"leading-none"},"Model Capabilities"),Oe.default.createElement(qu,{delayDuration:0},Oe.default.createElement(qr,null,Oe.default.createElement(Ur,{asChild:!0},Oe.default.createElement(ms,{className:"size-4"})),Oe.default.createElement(Lr,{align:"start",className:"max-w-96",side:"bottom"},Oe.default.createElement("div",{className:"text-sm text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Oe.default.createElement("div",{className:"flex gap-4 items-center"},V.map(({id:j,label:z,description:W})=>Oe.default.createElement("div",{key:j,className:"flex items-center gap-2"},Oe.default.createElement(lf,{id:j,checked:C.capabilities?.includes(j),onCheckedChange:K=>{let re=C.capabilities||[];P({...C,capabilities:K?[...re,j]:re.filter(De=>De!==j)})}}),Oe.default.createElement(fp,{htmlFor:j,className:"text-sm"},Oe.default.createElement(qu,{delayDuration:0},Oe.default.createElement(qr,null,Oe.default.createElement(Ur,{asChild:!0},Oe.default.createElement("span",null,z)),Oe.default.createElement(Lr,{side:"bottom"},W)))))))),U()),Oe.default.createElement("div",{className:"flex justify-end gap-4 items-center"},Oe.default.createElement("div",{className:"flex items-center gap-2"},Oe.default.createElement(lf,{id:"enable-cors",checked:C.enableCors||!1,onCheckedChange:j=>P({...C,enableCors:j})}),Oe.default.createElement(fp,{htmlFor:"enable-cors",className:"text-sm"},Oe.default.createElement("div",{className:"flex items-center gap-1.5"},Oe.default.createElement("span",null,"Enable CORS"),Oe.default.createElement(qu,{delayDuration:0},Oe.default.createElement(qr,null,Oe.default.createElement(Ur,{asChild:!0},Oe.default.createElement(ms,{className:"size-4"})),Oe.default.createElement(Lr,{align:"start",className:"max-w-96",side:"bottom"},Oe.default.createElement("div",{className:"text-sm text-muted"},"Only check this option when prompted that CORS is needed"))))))),Oe.default.createElement("div",{className:"flex gap-2"},Oe.default.createElement(ke,{variant:"secondary",onClick:L,disabled:N()},"Add Model"),Oe.default.createElement(ke,{variant:"secondary",onClick:$,disabled:N()},f?Oe.default.createElement(Oe.default.Fragment,null,Oe.default.createElement(td,{className:"mr-2 h-4 w-4 animate-spin"}),"Verify"):"Verify")))))};var Ke=B(X());var nbn={reasoning:{icon:Sx,color:"text-model-capabilities-blue",tooltip:aE.reasoning},vision:{icon:wx,color:"text-model-capabilities-green",tooltip:aE.vision},websearch:{icon:cM,color:"text-model-capabilities-blue",tooltip:aE.websearch}},obn=["reasoning","vision","websearch"],ibn=t=>Ke.default.createElement(qu,{delayDuration:0},Ke.default.createElement("div",{className:"grid grid-cols-3 gap-1 w-16 mx-auto"},obn.map(e=>{let r=nbn[e];if(!r)return Ke.default.createElement("div",{key:e,className:"w-4"});let n=r.icon;return t.capabilities?.includes(e)?Ke.default.createElement(qr,{key:e},Ke.default.createElement(Ur,{asChild:!0},Ke.default.createElement("div",{className:"flex items-center justify-center"},Ke.default.createElement(n,{className:`h-4 w-4 ${r.color}`}))),Ke.default.createElement(Lr,{side:"bottom"},r.tooltip)):Ke.default.createElement("div",{key:e,className:"flex items-center justify-center"},Ke.default.createElement("div",{className:"w-4 h-4"}))}))),abn=({model:t,onEdit:e,onDelete:r,onUpdateModel:n,id:o})=>{let[i,a]=Ke.default.useState(!1),{attributes:s,listeners:u,setNodeRef:l,transform:c,transition:d,isDragging:f}=XV({id:o,disabled:t.core}),p={transform:hy.Transform.toString(c),transition:d};return Ke.default.createElement(jV,{ref:l,style:p,className:Ce("mb-2",f&&["opacity-90","shadow-lg","border-2","border-accent/50","relative","z-[9999]","bg-background","rounded-lg","transform-gpu"],!t.core&&"touch-none")},Ke.default.createElement(DV,{className:"p-3"},Ke.default.createElement("div",{className:"flex items-center justify-between"},!t.core&&Ke.default.createElement("div",{className:"mr-2 touch-none cursor-grab active:cursor-grabbing",...s,...u},Ke.default.createElement(DE,{className:"h-4 w-4 text-muted-foreground"})),Ke.default.createElement("div",{className:"flex-1 cursor-pointer",onClick:()=>a(!i)},Ke.default.createElement("div",{className:"flex items-center gap-2"},Ke.default.createElement("div",{className:"w-3 h-3 flex items-center justify-center"},i?Ke.default.createElement(ps,{className:"h-3 w-3 stroke-[7]"}):Ke.default.createElement(_x,{className:"h-3 w-3 stroke-[7]"})),Ke.default.createElement("div",null,Ke.default.createElement("div",{className:"flex items-center gap-1"},Ke.default.createElement("span",{className:"font-medium"},t.displayName||t.name),t.capabilities&&t.capabilities.length>0&&Ke.default.createElement(BIe,{capabilities:t.capabilities,iconSize:14})),Ke.default.createElement("div",{className:"flex items-center gap-2"},Ke.default.createElement("span",{className:"text-sm text-muted bg-secondary"},Ef(t.provider,t)))))),Ke.default.createElement("div",{className:"flex items-center gap-2"},e&&Ke.default.createElement(ke,{variant:"ghost",size:"icon",onClick:m=>{m.stopPropagation(),e()}},Ke.default.createElement(jN,{className:"h-4 w-4"})),r&&!t.core&&Ke.default.createElement(ke,{variant:"ghost",size:"icon",onClick:m=>{m.stopPropagation(),r()}},Ke.default.createElement(_g,{className:"h-4 w-4"}))))),Ke.default.createElement("div",{className:Ce("transition-all duration-300 ease-in-out",i?"max-h-20 opacity-100":"max-h-0 opacity-0 overflow-hidden")},Ke.default.createElement(NV,{className:"p-3 pt-0"},Ke.default.createElement("div",{className:"flex justify-around"},!t.isEmbeddingModel&&Ke.default.createElement("div",{className:"flex items-center gap-2"},Ke.default.createElement("span",{className:"text-sm"},"Enabled"),Ke.default.createElement(lf,{checked:t.enabled,onCheckedChange:m=>n({...t,enabled:m})})),Ke.default.createElement("div",{className:"flex items-center gap-2"},Ke.default.createElement("span",{className:"text-sm"},"CORS"),Ke.default.createElement(lf,{checked:t.enableCors,onCheckedChange:m=>n({...t,enableCors:m})}))))))},sbn=({model:t,onEdit:e,onDelete:r,onUpdateModel:n,isEmbeddingModel:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=XV({id:Kr(t),disabled:t.core}),d={transform:hy.Transform.toString(u),transition:l};return Ke.default.createElement($j,{ref:s,style:d,className:Ce("hover:bg-interactive-accent/10 transition-colors duration-200",c&&"shadow-lg bg-background/90 backdrop-blur-sm relative z-[100] cursor-grabbing border-2 border-accent/50",!c&&"z-auto")},Ke.default.createElement(mp,{className:"w-6 px-2"},!t.core&&Ke.default.createElement(ke,{variant:"ghost",size:"icon",className:"cursor-grab touch-none hover:cursor-grab active:cursor-grabbing p-0 h-6 w-6",...i,...a},Ke.default.createElement(DE,{className:"h-4 w-4 text-muted-foreground hover:text-foreground transition-colors"}))),Ke.default.createElement(mp,{className:"pl-0"},t.displayName||t.name),Ke.default.createElement(mp,null,Ef(t.provider,t)),Ke.default.createElement(mp,{className:"text-center flex justify-center"},ibn(t)),!o&&Ke.default.createElement(mp,{className:"text-center"},Ke.default.createElement(lf,{id:`${Kr(t)}-enabled`,checked:t.enabled,onCheckedChange:f=>n({...t,enabled:f}),className:"mx-auto"})),Ke.default.createElement(mp,{className:"text-center"},Ke.default.createElement(lf,{id:`${Kr(t)}-enableCors`,checked:t.enableCors,onCheckedChange:f=>n({...t,enableCors:f}),className:"mx-auto"})),Ke.default.createElement(mp,{className:"text-center"},Ke.default.createElement("div",{className:"flex justify-center gap-2"},e&&Ke.default.createElement(ke,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"shadow-sm hover:shadow-md transition-shadow"},Ke.default.createElement(jN,{className:"h-4 w-4"})),!t.core&&Ke.default.createElement(ke,{variant:"ghost",size:"icon",onClick:()=>r(Kr(t)),className:"shadow-sm hover:shadow-md transition-shadow"},Ke.default.createElement(_g,{className:"h-4 w-4"})))))},Lje=({models:t,onEdit:e,onDelete:r,onAdd:n,onUpdateModel:o,onReorderModels:i,title:a})=>{let s=!!(t.length>0&&t[0].isEmbeddingModel),u=Hae(X$(UA),X$(qA,{coordinateGetter:Yae})),l=t.findIndex(p=>!p.core),c=p=>m=>{let{transform:h,active:v,activeNodeRect:g,over:_}=m;if(!v||!g)return h;let w=t.findIndex(A=>Kr(A)===v.id),x=t.filter(A=>!A.core).length,C=g.height,P=(l-w)*C,E=(l+x-1-w)*C;if(p&&_){let A=t.findIndex(R=>Kr(R)===_.id);if(t[A].core||A<l)return{...h,x:0,y:w*C}}return{...h,x:0,y:Math.min(Math.max(P,h.y),E)}},d=p=>{let{active:m,over:h}=p;if(h&&m.id!==h.id){let v=t.findIndex(x=>Kr(x)===m.id),g=t.findIndex(x=>Kr(x)===h.id),_=t[g];if(g<l||_.core)return;let w=Q$(t,v,g);i?.(w)}},f=()=>Ke.default.createElement("div",{className:"md:hidden relative"},Ke.default.createElement(GV,{sensors:u,collisionDetection:KV,onDragEnd:d,modifiers:[c(!0)]},Ke.default.createElement(ZV,{items:t.map(p=>Kr(p)),strategy:YV},Ke.default.createElement("div",{className:"space-y-2 relative"},t.map(p=>Ke.default.createElement(abn,{key:Kr(p),id:Kr(p),model:p,onEdit:e?()=>e(p):void 0,onDelete:()=>r(Kr(p)),onUpdateModel:o}))))));return Ke.default.createElement("div",{className:"mb-4"},Ke.default.createElement("div",{className:"hidden md:block"},Ke.default.createElement(GV,{sensors:u,collisionDetection:KV,onDragEnd:d,modifiers:[c(!1)]},Ke.default.createElement("div",{className:"relative overflow-hidden"},Ke.default.createElement(FV,null,Ke.default.createElement(kV,null,Ke.default.createElement($j,null,Ke.default.createElement(pp,{className:"w-6 px-2"}),Ke.default.createElement(pp,{className:"pl-0"},"Model"),Ke.default.createElement(pp,null,"Provider"),Ke.default.createElement(pp,{className:"text-center"},"Capabilities"),!s&&Ke.default.createElement(pp,{className:"text-center"},"Enable"),Ke.default.createElement(pp,{className:"text-center"},"CORS"),Ke.default.createElement(pp,{className:"w-[100px] text-center"},"Actions"))),Ke.default.createElement(BV,{className:"relative"},Ke.default.createElement(ZV,{items:t.map(p=>Kr(p)),strategy:YV},t.map(p=>Ke.default.createElement(sbn,{key:Kr(p),model:p,onEdit:e?()=>e(p):void 0,onDelete:r,onUpdateModel:o,isEmbeddingModel:s})))))))),f(),Ke.default.createElement("div",{className:"mt-4 flex justify-end"},Ke.default.createElement(ke,{onClick:n,variant:"secondary",className:"flex items-center gap-2"},Ke.default.createElement(xx,{className:"h-4 w-4"}),"Add Custom Model")))};var Ct=B(X());var b4t=({open:t,onOpenChange:e,model:r,onUpdate:n})=>{let{modalContainer:o}=TS(),[i,a]=(0,Ct.useState)(r),[s,u]=(0,Ct.useState)(r),[l,c]=(0,Ct.useState)({}),d=de(),f=_=>d[My[_]]||"";(0,Ct.useEffect)(()=>{a(r),u(r),r?.provider&&c(nx(r.provider))},[r]);let p=(0,Ct.useMemo)(()=>a9((_,w)=>{_&&n(_,w)},500),[n]),m=(0,Ct.useCallback)((_,w)=>{a(x=>{if(!x)return null;let C={...x,[_]:w};return p(s,C),C})},[s,p]);if(!i)return null;let h=()=>{if(!i||!i.provider||i.provider!=="azure-openai")return l.host||"https://api.example.com/v1";let _=i.azureOpenAIApiInstanceName||"[instance]",w=i.isEmbeddingModel?i.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":i.azureOpenAIApiDeploymentName||"[deployment]",x=i.azureOpenAIApiVersion||"[api-version]",C=i.isEmbeddingModel?"embeddings":"chat/completions";return`https://${_}.openai.azure.com/openai/deployments/${w}/${C}?api-version=${x}`},v=Object.entries(aE).map(([_,w])=>({id:_,label:_.charAt(0).toUpperCase()+_.slice(1),description:w})),g=i.apiKey||f(i.provider);return Ct.default.createElement(HA,{open:t,onOpenChange:e},Ct.default.createElement(EO,{className:"sm:max-w-[425px]",container:o},Ct.default.createElement(PO,null,Ct.default.createElement(TO,null,"Model Settings - ",i.name),Ct.default.createElement(AO,null,"Customize model parameters.")),Ct.default.createElement("div",{className:"space-y-3"},Ct.default.createElement(hl,{label:"Model Name",required:!0},Ct.default.createElement(Yo,{type:"text",disabled:i.core,value:i.name,onChange:_=>m("name",_.target.value),placeholder:"Enter model name"})),Ct.default.createElement(hl,{label:Ct.default.createElement("div",{className:"flex items-center gap-1.5"},Ct.default.createElement("span",{className:"leading-none"},"Display Name"),Ct.default.createElement(qu,{delayDuration:0},Ct.default.createElement(qr,null,Ct.default.createElement(Ur,{asChild:!0},Ct.default.createElement(ms,{className:"size-4"})),Ct.default.createElement(Lr,{align:"start",className:"max-w-96",side:"bottom"},Ct.default.createElement("div",{className:"text-sm text-muted flex flex-col gap-0.5"},Ct.default.createElement("div",{className:"text-[12px] font-bold"},"Suggested format:"),Ct.default.createElement("div",{className:"text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Ct.default.createElement("div",{className:"text-[12px]"},"Example:",Ct.default.createElement("li",null,"Direct-Paid:Ds-r1"),Ct.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Ct.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Ct.default.createElement(Yo,{type:"text",placeholder:"Custom display name (optional)",value:i.displayName||"",onChange:_=>m("displayName",_.target.value)})),Ct.default.createElement(hl,{label:"Provider"},Ct.default.createElement(Yo,{type:"text",value:Ef(i.provider),disabled:!0,className:"bg-muted"})),Ct.default.createElement(hl,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Ct.default.createElement(Yo,{type:"text",placeholder:h(),value:i.baseUrl||"",onChange:_=>m("baseUrl",_.target.value)})),Ct.default.createElement(hl,{label:"API Key"},Ct.default.createElement(AS,{placeholder:`Enter ${l.label||"Provider"} API Key`,value:g,onChange:_=>m("apiKey",_)}),l.keyManagementURL&&Ct.default.createElement("p",{className:"text-xs text-muted"},Ct.default.createElement("a",{href:l.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",l.label," API Key"))),Ct.default.createElement(hl,{label:Ct.default.createElement("div",{className:"flex items-center gap-1.5"},Ct.default.createElement("span",{className:"leading-none"},"Model Capabilities"),Ct.default.createElement(qu,{delayDuration:0},Ct.default.createElement(qr,null,Ct.default.createElement(Ur,{asChild:!0},Ct.default.createElement(ms,{className:"size-4"})),Ct.default.createElement(Lr,{align:"start",className:"max-w-96",side:"bottom"},Ct.default.createElement("div",{className:"text-sm text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Ct.default.createElement("div",{className:"flex gap-4 items-center"},v.map(({id:_,label:w,description:x})=>Ct.default.createElement("div",{key:_,className:"flex items-center gap-2"},Ct.default.createElement(lf,{id:_,checked:i.capabilities?.includes(_),onCheckedChange:C=>{let P=i.capabilities||[],E=C?[...P,_]:P.filter(A=>A!==_);m("capabilities",E)}}),Ct.default.createElement(fp,{htmlFor:_,className:"text-sm"},Ct.default.createElement(qu,{delayDuration:0},Ct.default.createElement(qr,null,Ct.default.createElement(Ur,{asChild:!0},Ct.default.createElement("span",null,w)),Ct.default.createElement(Lr,{side:"bottom"},x)))))))))))};var _4t=require("obsidian"),v4t=()=>{let t=Bo(),[e,r]=(0,oa.useState)(null),[n,o]=(0,oa.useState)(!1),[i,a]=(0,oa.useState)(!1),s=m=>{let[h,v]=m.split("|"),g=t.activeModels.filter(w=>!(w.name===h&&w.provider===v)),_=t.defaultModelKey;if(m===t.defaultModelKey){let w=g.find(x=>x.enabled);_=w?`${w.name}|${w.provider}`:""}rE({activeModels:g,defaultModelKey:_})},u=(m,h)=>{let v=t.activeModels.findIndex(g=>g.name===m.name&&g.provider===m.provider);if(v!==-1){let g=[...t.activeModels];g[v]=h,xt("activeModels",g)}else new _4t.Notice("Could not find model to update"),nt("Could not find model to update:",m)},l=m=>{let h=t.activeModels.map(v=>v.name===m.name&&v.provider===m.provider?m:v);xt("activeModels",h)},c=m=>{xt("activeModels",m)},d=m=>{let[h,v]=m.split("|"),g=t.activeEmbeddingModels.filter(_=>!(_.name===h&&_.provider===v));xt("activeEmbeddingModels",g)},f=m=>{let h=t.activeEmbeddingModels.map(v=>v.name===m.name&&v.provider===m.provider?m:v);xt("activeEmbeddingModels",h)},p=m=>{xt("activeEmbeddingModels",m)};return oa.default.createElement("div",{className:"space-y-4"},oa.default.createElement("section",null,oa.default.createElement("div",{className:"text-xl font-bold mb-3"},"Chat Models"),oa.default.createElement(Lje,{models:t.activeModels,onEdit:r,onDelete:s,onAdd:()=>o(!0),onUpdateModel:l,onReorderModels:c,title:"Chat Model"}),oa.default.createElement(b4t,{open:!!e,onOpenChange:m=>!m&&r(null),model:e,onUpdate:u}),oa.default.createElement(Nje,{open:n,onOpenChange:o,onAdd:m=>{let h=[...t.activeModels,m];xt("activeModels",h)},ping:m=>of.getInstance().ping(m)}),oa.default.createElement("div",{className:"space-y-4"},oa.default.createElement(Yn,{type:"slider",title:"Temperature",description:"Default is 0.1. Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.",value:t.temperature,onChange:m=>xt("temperature",m),min:0,max:2,step:.05}),oa.default.createElement(Yn,{type:"slider",title:"Token limit",description:oa.default.createElement(oa.default.Fragment,null,oa.default.createElement("p",null,"The maximum number of ",oa.default.createElement("em",null,"output tokens")," to generate. Default is 1000."),oa.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model.")),value:t.maxTokens,onChange:m=>xt("maxTokens",m),min:0,max:16e3,step:100}),oa.default.createElement(Yn,{type:"slider",title:"Conversation turns in context",description:"The number of previous conversation turns to include in the context. Default is 15 turns, i.e. 30 messages.",value:t.contextTurns,onChange:m=>xt("contextTurns",m),min:1,max:50,step:1}))),oa.default.createElement("section",null,oa.default.createElement("div",{className:"text-xl font-bold mb-3"},"Embedding Models"),oa.default.createElement(Lje,{models:t.activeEmbeddingModels,onDelete:d,onAdd:()=>a(!0),onUpdateModel:f,onReorderModels:p,title:"Embedding Model"}),oa.default.createElement(Nje,{open:i,onOpenChange:a,onAdd:m=>{let h=[...t.activeEmbeddingModels,m];xt("activeEmbeddingModels",h)},isEmbeddingModel:!0,ping:m=>ws.getInstance().ping(m)})))};var T4t=require("obsidian");var on=B(X()),A4t=B(km());var w4t=require("obsidian"),pse=class extends w4t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)dU(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};var S4t=require("obsidian");var mse=class extends S4t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=kee(this.app);return this.app.vault.getAllLoadedFiles().forEach(o=>{o.parent?.path&&o.parent.path!=="/"&&!n.some(a=>o.parent.path===a||o.parent.path.startsWith(a+"/"))&&r.add(o.parent.path)}),Array.from(r)}getItemText(r){return r}onChooseItem(r,n){this.onChooseFolder(r)}};var x4t=require("obsidian"),Kh=B(X()),C4t=B(km());function ubn({onConfirm:t,onCancel:e}){let[r,n]=(0,Kh.useState)(""),[o,i]=(0,Kh.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return Kh.default.createElement("div",{className:"flex flex-col gap-4"},Kh.default.createElement("div",{className:"flex flex-col gap-2"},Kh.default.createElement(Yo,{placeholder:"Enter the extension (e.g. txt, excalidraw.md)",value:r,onChange:u=>{n(u.target.value),i(null)},onKeyDown:u=>{u.key==="Enter"&&a(r)}}),o&&Kh.default.createElement("p",{className:"text-error text-sm"},o)),Kh.default.createElement("div",{className:"flex justify-end gap-2"},Kh.default.createElement(ke,{variant:"secondary",onClick:e},"Cancel"),Kh.default.createElement(ke,{variant:"default",onClick:()=>a(r)},"Confirm")))}var hse=class extends x4t.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,C4t.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Kh.default.createElement(ubn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var O4t=require("obsidian"),_y=B(X()),E4t=B(km());function lbn({onConfirm:t,onCancel:e}){let[r,n]=(0,_y.useState)("");return _y.default.createElement("div",{className:"flex flex-col gap-4"},_y.default.createElement("div",{className:"flex flex-col gap-4"},_y.default.createElement("div",null,"Comma separated list of paths, tags, note titles or file extension e.g. folder1, folder1/folder2, #tag1, #tag2, [[note1]], [[note2]], *.jpg, *.excallidraw.md"),_y.default.createElement(Yo,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),_y.default.createElement("div",{className:"flex justify-end gap-2"},_y.default.createElement(ke,{variant:"secondary",onClick:e},"Cancel"),_y.default.createElement(ke,{variant:"default",onClick:()=>t(r)},"Confirm")))}var gse=class extends O4t.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,E4t.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(_y.default.createElement(lbn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var uq=B(X());var yse=B(X()),cbn=2;function dbn(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+cbn<t.current?.scrollWidth)??!1}function fbn(t){switch(t){case 2:return"line-clamp-2";case 3:return"line-clamp-3";default:return""}}var P4t=({children:t,className:e,lineClamp:r,tooltipContent:n,...o})=>{let i=(0,yse.useRef)(null),[a,s]=(0,yse.useState)(!1);return uq.default.createElement(qu,{delayDuration:0},uq.default.createElement(qr,{open:a,onOpenChange:l=>{s(l&&dbn(i,r))}},uq.default.createElement(Ur,{asChild:!0},uq.default.createElement("div",{...o,ref:i,className:Ce("max-w-full text-normal",(!r||r<=1)&&"truncate",r&&fbn(r),e),"data-testid":"truncatedText"},t)),uq.default.createElement(Lr,{className:"max-w-64 text-wrap break-words text-body-normal"},n??t)))};function bse({title:t,patterns:e,onRemove:r}){return on.default.createElement("div",{className:"grid grid-cols-4 gap-2"},on.default.createElement("div",{className:"font-bold"},t),on.default.createElement("ul",{className:"list-disc list-inside pl-0 m-0 col-span-3 flex flex-col gap-1"},e.map(n=>on.default.createElement("li",{key:n,className:"flex gap-2 hover:bg-dropdown-hover pl-2 pr-1 rounded-md"},on.default.createElement(P4t,{className:"flex-1"},n),on.default.createElement(ke,{variant:"ghost2",size:"fit",onClick:()=>r(n)},on.default.createElement(Nf,{className:"size-4"}))))))}function pbn({value:t,onUpdate:e,container:r}){let[n,o]=(0,on.useState)(t),i=mT(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=j3(i),c=f=>{let p=Wwt({tagPatterns:f.tagPatterns??a,extensionPatterns:f.extensionPatterns??s,folderPatterns:f.folderPatterns??u,notePatterns:f.notePatterns??l});o(p),e(p)},d=a.length>0||s.length>0||u.length>0||l.length>0;return on.default.createElement("div",{className:"flex flex-col gap-4 mt-2"},on.default.createElement("div",{className:"flex flex-col gap-2 p-4 border border-border border-solid rounded-md max-h-[400px] overflow-y-auto"},!d&&on.default.createElement("div",{className:"text-center text-sm text-muted-foreground"},"No patterns specified"),a.length>0&&on.default.createElement(bse,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(m=>m!==f);c({tagPatterns:p})}}),s.length>0&&on.default.createElement(bse,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(m=>m!==f);c({extensionPatterns:p})}}),u.length>0&&on.default.createElement(bse,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(m=>m!==f);c({folderPatterns:p})}}),l.length>0&&on.default.createElement(bse,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(m=>m!==f);c({notePatterns:p})}})),on.default.createElement("div",{className:"flex justify-end gap-2"},on.default.createElement(M$,null,on.default.createElement(R$,{asChild:!0},on.default.createElement(ke,{variant:"secondary"},"Add...")),on.default.createElement(OS,{align:"start",container:r},on.default.createElement(os,{onSelect:()=>{new pse(app,f=>{let p=`#${f}`;a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},on.default.createElement("div",{className:"flex items-center gap-2"},on.default.createElement(Iz,{className:"size-4"}),"Tag")),on.default.createElement(os,{onSelect:()=>{new mse(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},on.default.createElement("div",{className:"flex items-center gap-2"},on.default.createElement(wz,{className:"size-4"}),"Folder")),on.default.createElement(os,{onSelect:()=>{new MA({app,onNoteSelect:f=>{let p=`[[${f.basename}]]`;l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},on.default.createElement("div",{className:"flex items-center gap-2"},on.default.createElement(lM,{className:"size-4"}),"Note")),on.default.createElement(os,{onSelect:()=>{new hse(app,f=>{let p=`*.${f}`;s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},on.default.createElement("div",{className:"flex items-center gap-2"},on.default.createElement(vz,{className:"size-4"}),"Extension")),on.default.createElement(os,{onSelect:()=>{new gse(app,f=>{let p=mT(f),{tagPatterns:m,extensionPatterns:h,folderPatterns:v,notePatterns:g}=j3(p);c({tagPatterns:[...a,...m],extensionPatterns:[...s,...h],folderPatterns:[...u,...v],notePatterns:[...l,...g]})}).open()}},on.default.createElement("div",{className:"flex items-center gap-2"},on.default.createElement(dM,{className:"size-4"}),"Custom"))))))}var a6=class extends T4t.Modal{constructor(r,n,o,i){super(r);this.onUpdate=n;this.value=o;this.setTitle(i)}onOpen(){let{contentEl:r}=this;this.root=(0,A4t.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(on.default.createElement(pbn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};var Cr=B(X()),I4t=()=>{let t=Bo(),e=r=>{let n=parseInt(r);n!==t.numPartitions&&new oq(app,async()=>{xt("numPartitions",n),await va.getInstance().indexVaultToVectorStore(!0)}).open()};return Cr.default.createElement("div",{className:"space-y-4"},Cr.default.createElement("section",null,Cr.default.createElement("div",{className:"space-y-4"},Cr.default.createElement(Yn,{type:"select",title:"Auto-Index Strategy",description:Cr.default.createElement("div",{className:"flex items-center gap-1.5"},Cr.default.createElement("span",{className:"leading-none"},"Decide when you want the vault to be indexed."),Cr.default.createElement(qu,{delayDuration:0},Cr.default.createElement(qr,null,Cr.default.createElement(Ur,{asChild:!0},Cr.default.createElement(ms,{className:"size-4"})),Cr.default.createElement(Lr,null,Cr.default.createElement("div",{className:"space-y-2 py-2"},Cr.default.createElement("div",{className:"space-y-1"},Cr.default.createElement("div",{className:"text-muted text-sm"},"Choose when to index your vault:"),Cr.default.createElement("ul",{className:"space-y-1 pl-2 list-disc text-sm"},Cr.default.createElement("li",null,Cr.default.createElement("div",{className:"flex items-center gap-1"},Cr.default.createElement("strong",{className:"inline-block whitespace-nowrap"},"NEVER:"),Cr.default.createElement("span",null,"Manual indexing via command or refresh only"))),Cr.default.createElement("li",null,Cr.default.createElement("div",{className:"flex items-center gap-1"},Cr.default.createElement("strong",{className:"inline-block whitespace-nowrap"},"ON STARTUP:"),Cr.default.createElement("span",null,"Index updates when plugin loads or reloads"))),Cr.default.createElement("li",null,Cr.default.createElement("div",{className:"flex items-center gap-1"},Cr.default.createElement("strong",{className:"inline-block whitespace-nowrap"},"ON MODE SWITCH:"),Cr.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),Cr.default.createElement("p",{className:"text-callout-warning text-sm"},"Warning: Cost implications for large vaults with paid models")))))),value:t.indexVaultToVectorStore,onChange:r=>{xt("indexVaultToVectorStore",r)},options:O$e.map(r=>({label:r,value:r})),placeholder:"Strategy"}),Cr.default.createElement(Yn,{type:"slider",title:"Max Sources",description:"Copilot goes through your vault to find relevant blocks and passes the top N blocks to the LLM. Default for N is 3. Increase if you want more sources included in the answer generation step.",min:1,max:128,step:1,value:t.maxSourceChunks,onChange:r=>xt("maxSourceChunks",r)}),Cr.default.createElement(Yn,{type:"slider",title:"Requests per Minute",description:"Default is 90. Decrease if you are rate limited by your embedding provider.",min:10,max:300,step:10,value:t.embeddingRequestsPerMin,onChange:r=>xt("embeddingRequestsPerMin",r)}),Cr.default.createElement(Yn,{type:"slider",title:"Embedding Batch Size",description:"Default is 16. Increase if you are rate limited by your embedding provider.",min:1,max:128,step:1,value:t.embeddingBatchSize,onChange:r=>xt("embeddingBatchSize",r)}),Cr.default.createElement(Yn,{type:"select",title:"Number of Partitions",description:"Number of partitions for Copilot index. Default is 1. Increase if you have issues indexing large vaults. Warning: Changes require clearing and rebuilding the index!",value:t.numPartitions.toString(),onChange:e,options:["1","2","3","4","5","6","7","8","12","16","20","24","28","32","36","40"].map(r=>({label:r,value:r}))}),Cr.default.createElement(Yn,{type:"custom",title:"Exclusions",description:Cr.default.createElement(Cr.default.Fragment,null,Cr.default.createElement("p",null,"Exclude folders, tags, note titles or file extensions from being indexed. Previously indexed files will remain until a force re-index is performed."))},Cr.default.createElement(ke,{variant:"secondary",onClick:()=>new a6(app,r=>xt("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),Cr.default.createElement(Yn,{type:"custom",title:"Inclusions",description:Cr.default.createElement("p",null,"Index only the specified paths, tags, or note titles. Exclusions take precedence over inclusions. Previously indexed files will remain until a force re-index is performed.")},Cr.default.createElement(ke,{variant:"secondary",onClick:()=>new a6(app,r=>xt("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),Cr.default.createElement(Yn,{type:"switch",title:"Enable Obsidian Sync for Copilot index",description:"If enabled, the index will be stored in the .obsidian folder and synced with Obsidian Sync by default. If disabled, it will be stored in .copilot-index folder at vault root.",checked:t.enableIndexSync,onCheckedChange:r=>xt("enableIndexSync",r)}),Cr.default.createElement(Yn,{type:"switch",title:"Disable index loading on mobile",description:"When enabled, Copilot index won't be loaded on mobile devices to save resources. Only chat mode will be available. Any existing index from desktop sync will be preserved. Uncheck to enable QA modes on mobile.",checked:t.disableIndexOnMobile,onCheckedChange:r=>xt("disableIndexOnMobile",r)}))))};var R4t=["basic","model","QA","command","advanced"],mbn={basic:Vn.default.createElement(pz,{className:"w-5 h-5"}),model:Vn.default.createElement(mz,{className:"w-5 h-5"}),QA:Vn.default.createElement(hz,{className:"w-5 h-5"}),command:Vn.default.createElement(zy,{className:"w-5 h-5"}),advanced:Vn.default.createElement(dM,{className:"w-5 h-5"})},hbn={basic:()=>Vn.default.createElement(e2t,null),model:()=>Vn.default.createElement(v4t,null),QA:()=>Vn.default.createElement(I4t,null),command:()=>Vn.default.createElement(DUt,null),advanced:()=>Vn.default.createElement(Gzt,null)},M4t=R4t.map(t=>({id:t,icon:mbn[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),gbn=({plugin:t})=>{let{selectedTab:e,setSelectedTab:r}=TS();return Vn.default.createElement("div",{className:"flex flex-col"},Vn.default.createElement("div",{className:"inline-flex rounded-lg"},M4t.map((n,o)=>Vn.default.createElement(vqt,{key:n.id,tab:n,isSelected:e===n.id,onClick:()=>r(n.id),isFirst:o===0,isLast:o===M4t.length-1}))),Vn.default.createElement("div",{className:"w-[100%] border border-solid"}),Vn.default.createElement("div",null,R4t.map(n=>{let o=hbn[n];return Vn.default.createElement(wqt,{key:n,id:n,isSelected:e===n},Vn.default.createElement(o,null))})))},ybn=({plugin:t})=>{let[e,r]=Vn.default.useState(0),{latestVersion:n,hasUpdate:o}=Iae(t.manifest.version),i=async()=>{new jae(app,async()=>{l$e(),r(s=>s+1)}).open()};return Vn.default.createElement(xqt,null,Vn.default.createElement("div",null,Vn.default.createElement("div",{className:"flex flex-col gap-2"},Vn.default.createElement("h1",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2"},Vn.default.createElement("div",{className:"flex items-center gap-2"},Vn.default.createElement("span",null,"Copilot Settings"),Vn.default.createElement("div",{className:"flex items-center gap-1"},Vn.default.createElement("span",{className:"text-xs text-muted"},"v",t.manifest.version),n&&Vn.default.createElement(Vn.default.Fragment,null,o?Vn.default.createElement("a",{href:"obsidian://show-plugin?id=copilot",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-accent hover:underline"},"(Update to v",n,")"):Vn.default.createElement("span",{className:"text-xs text-normal"}," (up to date)")))),Vn.default.createElement("div",{className:"self-end sm:self-auto"},Vn.default.createElement(ke,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),Vn.default.createElement(gbn,{key:e,plugin:t})))},j4t=ybn;var _se=class extends s6.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(wl)[0]?.view&&de().autosaveChat&&await this.plugin.autosaveCurrentChat();let r=this.plugin.app;await r.plugins.disablePlugin("copilot"),await r.plugins.enablePlugin("copilot"),r.setting.openTabById("copilot").display(),new s6.Notice("Plugin reloaded successfully.")}catch(e){new s6.Notice("Failed to reload the plugin. Please reload manually."),console.error("Error reloading plugin:",e)}}display(){let{containerEl:e}=this;e.empty(),e.style.userSelect="text";let r=e.createDiv("div");(0,D4t.createRoot)(r).render(Fje.default.createElement(j1e.Provider,{value:e},Fje.default.createElement(j4t,{plugin:this.plugin})))}};var N4t=B(Lee()),vse=class t{constructor(){this.cacheDir=".copilot/pdf-cache"}static getInstance(){return t.instance||(t.instance=new t),t.instance}async ensureCacheDir(){await app.vault.adapter.exists(this.cacheDir)||(ar("Creating PDF cache directory:",this.cacheDir),await app.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){let r=`${e.path}:${e.stat.size}:${e.stat.mtime}`,n=(0,N4t.MD5)(r).toString();return ar("Generated cache key for PDF:",{path:e.path,key:n}),n}getCachePath(e){return`${this.cacheDir}/${e}.json`}async get(e){try{let r=this.getCacheKey(e),n=this.getCachePath(r);if(await app.vault.adapter.exists(n)){ar("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return ar("Cache miss for PDF:",e.path),null}catch(r){return nt("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);ar("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){nt("Error writing to PDF cache:",n)}}async clear(){try{if(await app.vault.adapter.exists(this.cacheDir)){let e=await app.vault.adapter.list(this.cacheDir);ar("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){nt("Error clearing PDF cache:",e)}}};var L4t=require("obsidian");var Sse,F4t,wse=class{constructor(e){this.vault=e;ODe(this,Sse)}async load(e){let r=await this.vault.read(e),{nodes:n=[],edges:o=[]}=JSON.parse(r),i=await Promise.all(n.map(async u=>{if(u.type==="file"&&u.file){let l=this.vault.getAbstractFileByPath(u.file),c=l instanceof L4t.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];EDe(this,Sse,F4t).call(this,i,a);let s=Object.fromEntries(i.map(u=>[u.id,u]));return{nodes:i,edges:a,byId:s}}buildPrompt(e){let r=new Map,n=e.nodes.filter(s=>s.type==="group");for(let s of n){let u=e.nodes.filter(l=>{if(l.id===s.id)return!1;let c=l.x+l.width/2,d=l.y+l.height/2;return c>=s.x&&d>=s.y&&c<=s.x+s.width&&d<=s.y+s.height});r.set(s.label||s.id,u)}let o=`This canvas contains the following elements:
`,i=s=>{switch(s.type){case"file":return`- File: ${s.file}
Content:
${s.content}
`;case"text":return`- Text: "${s.text}"
`;case"link":return`- Link: ${s.url}
`;default:return""}};n.forEach(s=>{let u=s.label||s.id,l=r.get(u)||[];o+=`Group "${u}" contains:
`,l.forEach(c=>{o+=i(c)}),o+=`
`});let a=e.nodes.filter(s=>s.type==="group"?!1:!Array.from(r.values()).flat().some(u=>u.id===s.id));return a.length>0&&(o+=`Elements outside of groups:
`,a.forEach(s=>{o+=i(s)})),o+=`
When describing this canvas, please:
`,o+=`- Use the actual titles/names of elements instead of their IDs
`,o+=`- Pay attention to the content and relationships between elements
`,o+=`- Describe files by their names, links by their URLs, and text nodes by their content
`,o}};Sse=new WeakSet,F4t=function(e,r){let n=e.filter(o=>o.type==="group");for(let o of n)for(let i of e){if(i.id===o.id)continue;let a=i.x+i.width/2,s=i.y+i.height/2;a>=o.x&&s>=o.y&&a<=o.x+o.width&&s<=o.y+o.height&&r.push({id:crypto.randomUUID(),fromNode:o.id,toNode:i.id,label:"contains"})}};var kje=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},xse=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=vse.getInstance()}async parseFile(e,r){try{ar("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return ar("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);ar("Calling pdf4llm API for:",e.path);let i=await this.brevilabsClient.pdf4llm(o);return await this.pdfCache.set(e,i),i.response}catch(n){return nt(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){ar("Clearing PDF cache"),await this.pdfCache.clear()}},Bje=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{ar("Parsing Canvas file:",e.path);let n=new wse(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return nt(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},Cse=class{constructor(e,r){this.parsers=new Map;this.registerParser(new kje),this.registerParser(new xse(e)),this.registerParser(new Bje)}registerParser(e){for(let r of e.supportedExtensions)this.parsers.set(r,e)}async parseFile(e,r){let n=this.parsers.get(e.extension);if(!n)throw new Error(`No parser found for file type: ${e.extension}`);return await n.parseFile(e,r)}supportsExtension(e){return this.parsers.has(e)}async clearPDFCache(){let e=this.parsers.get("pdf");e instanceof xse&&await e.clearCache()}};var jO=require("obsidian");var Ose=class extends jO.Plugin{constructor(){super(...arguments);this.userMessageHistory=[];this.handleContextMenu=(r,n)=>{yqt(r,n,this)}}async onload(){await this.loadSettings(),this.settingsUnsubscriber=bl(async(r,n)=>{n.enableEncryption?await this.saveData(await K$e(n)):await this.saveData(n),UIe(this,r,n)}),this.addSettingTab(new _se(this.app,this)),this.sharedState=new dqt,this.vectorStoreManager=va.getInstance(),this.brevilabsClient=Ss.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),Hee(),this.chainManager=new yO(this.app,this.vectorStoreManager),this.fileParserManager=new Cse(this.brevilabsClient,this.app.vault),this.registerView(wl,r=>new FA(r,this)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",r=>{this.activateView()}),UIe(this,void 0,de()),gj.initTools(this.app.vault),this.registerEvent(this.app.workspace.on("editor-menu",(r,n)=>{n.getSelection().trim()&&this.handleContextMenu(r,n)})),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{if(r&&r.view instanceof jO.MarkdownView&&r.view.file){let o=this.app.workspace.getLeavesOfType(wl).find(i=>i.view instanceof FA)?.view;if(o){let i=new CustomEvent(ix.ACTIVE_LEAF_CHANGE);o.eventTarget.dispatchEvent(i)}}}))}async onunload(){this.vectorStoreManager&&this.vectorStoreManager.onunload(),this.settingsUnsubscriber?.(),console.log("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(de().autosaveChat){let r=this.app.workspace.getLeavesOfType(wl)[0]?.view;r&&r.sharedState.chatHistory.length>0&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(wl).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(wl).find(l=>l.view instanceof FA)?.view;if(u&&(!i||a)){let l=new CustomEvent(n,{detail:{selectedText:a,eventSubtype:o}});u.eventTarget.dispatchEvent(l)}},0)}processSelection(r,n,o){this.processText(r,n,o)}emitChatIsVisible(){let r=this.app.workspace.getLeavesOfType(wl).find(n=>n.view instanceof FA)?.view;if(r){let n=new CustomEvent(ix.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===wl&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(jO.MarkdownView);return{getSelection:()=>{let n=r?.editor?.getSelection();if(n)return n;let o=this.app.workspace.getActiveFile();return o?this.app.vault.cachedRead(o):""},replaceSelection:r?.editor?.replaceSelection.bind(r.editor)||(()=>{})}}processCustomPrompt(r,n){let o=this.getCurrentEditorOrDummy();this.processText(o,r,n,!1)}toggleView(){this.app.workspace.getLeavesOfType(wl).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(wl);r.length===0?de().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:wl,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:wl,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(wl)}async loadSettings(){let r=await this.loadData(),n=c$e(r);rE(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=Kr(i),s=o.get(a);s?o.set(a,{...i,isBuiltIn:s.isBuiltIn||i.isBuiltIn}):o.set(a,i)}),Array.from(o.values())}async loadCopilotChatHistory(){let r=await this.getChatHistoryFiles();if(r.length===0){new jO.Notice("No chat history found.");return}new Rae(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(de().defaultSaveFolder);return r instanceof jO.TFolder?(await this.app.vault.getMarkdownFiles()).filter(o=>o.path.startsWith(r.path)):[]}async loadChatHistory(r){let n=await this.app.vault.read(r),o=LDt(n);this.sharedState.clearChatHistory(),o.forEach(a=>this.sharedState.addMessage(a)),await Y8(o,this.chainManager.memoryManager);let i=this.app.workspace.getLeavesOfType(wl)[0];i?i.view.updateView():this.activateView()}async customSearchDB(r,n,o){return(await new VT({minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o}).getOramaChunks(r,n)).map(s=>({content:s.pageContent,metadata:s.metadata}))}};
/*! Bundled license information:
@langchain/core/dist/utils/fast-json-patch/src/helpers.js:
(*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2022 Joachim Wester
* MIT licensed
*)
@langchain/core/dist/utils/fast-json-patch/src/duplex.js:
(*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2013-2021 Joachim Wester
* MIT license
*)
mustache/mustache.mjs:
(*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*)
react/cjs/react.production.min.js:
(**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
moment/moment.js:
(*! moment.js *)
(*! version : 2.29.4 *)
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
(*! license : MIT *)
(*! momentjs.com *)
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
scheduler/cjs/scheduler.production.min.js:
(**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react-dom/cjs/react-dom.production.min.js:
(**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react/cjs/react-jsx-runtime.production.min.js:
(**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
tslib/tslib.es6.js:
(*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** *)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
@langchain/core/dist/utils/js-sha1/hash.js:
(*
* [js-sha1]{@link https://github.com/emn178/js-sha1}
*
* @version 0.6.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*)
crypto-js/ripemd160.js:
(** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*)
crypto-js/mode-ctr-gladman.js:
(** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*)
lucide-react/dist/esm/shared/src/utils.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/defaultAttributes.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/Icon.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/createLucideIcon.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/arrow-big-up.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/arrow-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/bot.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/check.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-down.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/chevron-up.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-help.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle-stop.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/circle.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/cog.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/command.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/copy.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/corner-down-left.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/cpu.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/database.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/download.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/ellipsis-vertical.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/ellipsis.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/external-link.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/eye-off.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/eye.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-input.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-output.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file-text.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/file.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/folder.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/globe.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/grip-vertical.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/image.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/info.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/key.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/library-big.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/lightbulb.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/loader-circle.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/message-circle-plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pen-line.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pencil-line.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/pencil.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/plus.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/refresh-ccw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/refresh-cw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/rotate-cw.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/sparkles.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/square-arrow-out-up-right.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/square-pen.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/tag.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/text-cursor-input.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/trash-2.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/triangle-alert.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/user.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/wrench.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/icons/x.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
lucide-react/dist/esm/lucide-react.js:
(**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
@google/generative-ai/dist/index.mjs:
(**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*)
@google/generative-ai/dist/index.mjs:
(**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*)
*/
/* nosourcemap */